Skip to content

Commit 1fab2f9

Browse files
frano-mclaude
andauthored
Add total file size to export selected data summary (#4739)
* feat: add total file size to export selected data summary (#4738) * fix: rename fileSize to totalFileSize for consistency (#4738) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Fran McDade <18710366+frano-m@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 451482d commit 1fab2f9

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

app/viewModelBuilders/azul/anvil-cmg/common/summaryMapper/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export const DEFAULT_SUMMARY: FileSummary = {
66
donorCount: 0,
77
fileCount: 0,
88
fileFormats: [LABEL.UNSPECIFIED],
9+
totalFileSize: 0,
910
};
1011

1112
/**
@@ -17,4 +18,5 @@ export const SUMMARY_DISPLAY_TEXT: Record<SUMMARY, string> = {
1718
[SUMMARY.FILE_COUNT]: "Files",
1819
[SUMMARY.FILE_FORMATS]: "File Formats",
1920
[SUMMARY.ORGANISM_TYPE]: "Organism Type",
21+
[SUMMARY.TOTAL_FILE_SIZE]: "Total File Size",
2022
};

app/viewModelBuilders/azul/anvil-cmg/common/summaryMapper/entities.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export interface FileSummary {
66
donorCount: number;
77
fileCount: number;
88
fileFormats: string[];
9+
totalFileSize: number;
910
}
1011

1112
/**
@@ -17,4 +18,5 @@ export const enum SUMMARY {
1718
FILE_COUNT = "FILE_COUNT",
1819
FILE_FORMATS = "FILE_FORMATS",
1920
ORGANISM_TYPE = "ORGANISM_TYPE",
21+
TOTAL_FILE_SIZE = "TOTAL_FILE_SIZE",
2022
}

app/viewModelBuilders/azul/anvil-cmg/common/summaryMapper/summaryMapper.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
Term,
88
} from "@databiosphere/findable-ui/lib/hooks/useFileManifest/common/entities";
99
import { formatCountSize } from "@databiosphere/findable-ui/lib/utils/formatCountSize";
10+
import { formatFileSize } from "@databiosphere/findable-ui/lib/utils/formatFileSize";
1011
import { ANVIL_CMG_CATEGORY_KEY } from "../../../../../../site-config/anvil-cmg/category";
1112
import { SummaryResponse } from "../../../../../apis/azul/anvil-cmg/common/responses";
1213
import { METADATA_KEY } from "../../../../../components/Index/common/entities";
@@ -44,6 +45,7 @@ export function bindFileSummaryResponse(
4445
donorCount: summaryResponse.donorCount,
4546
fileCount: summaryResponse.fileCount,
4647
fileFormats: bindFileFormatSummaryResponse(summaryResponse),
48+
totalFileSize: summaryResponse.totalFileSize,
4749
};
4850
}
4951

@@ -63,6 +65,7 @@ export function mapExportSummary(
6365
const donorCount = fileSummary.donorCount;
6466
const fileCount = fileSummary.fileCount;
6567
const fileFormats = fileSummary.fileFormats;
68+
const totalFileSize = fileSummary.totalFileSize;
6669
const organismType = listSelectedTermsOfFacet(
6770
filesFacets,
6871
ANVIL_CMG_CATEGORY_KEY.DONOR_ORGANISM_TYPE
@@ -89,6 +92,10 @@ export function mapExportSummary(
8992
values: fileFormats,
9093
})
9194
); // Formats
95+
summaryBySummaryKey.set(
96+
SUMMARY.TOTAL_FILE_SIZE,
97+
formatFileSize(totalFileSize)
98+
); // Total file Size
9299
return summaryBySummaryKey;
93100
}
94101

0 commit comments

Comments
 (0)