From 7e94c3c04866950986edbd8e892d0527cef2d717 Mon Sep 17 00:00:00 2001 From: Brian Whitney Date: Wed, 18 Dec 2024 12:27:14 -0800 Subject: [PATCH] seperate table --- .../Modal/CopyFileManifest/index.tsx | 44 +++++++++++++++---- 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/packages/core/components/Modal/CopyFileManifest/index.tsx b/packages/core/components/Modal/CopyFileManifest/index.tsx index bd29c960..3d998acc 100644 --- a/packages/core/components/Modal/CopyFileManifest/index.tsx +++ b/packages/core/components/Modal/CopyFileManifest/index.tsx @@ -49,18 +49,31 @@ export default function CopyFileManifest({ onDismiss }: ModalProps) { fetchDetails(); }, [fileSelection, fileService]); + // Handler for moving files to NAS cache const onMove = () => { dispatch(interaction.actions.copyFiles(fileDetails)); onDismiss(); }; - const body = ( -
-

- Files copied to the local NAS cache (VAST) are stored with a 180-day lease, after - which they revert to cloud-only. To renew the lease, simply reselect the files and - confirm the copy. -

+ // Separate files by "Should Be in Local Cache" + const filesInLocalCache = fileDetails.filter((file) => + file.annotations.some( + (annotation) => + annotation.name === "Should Be in Local Cache" && annotation.values[0] === true + ) + ); + + const filesNotInLocalCache = fileDetails.filter((file) => + file.annotations.some( + (annotation) => + annotation.name === "Should Be in Local Cache" && annotation.values[0] === false + ) + ); + + // Reusable function to render a table for files + const renderTable = (files: FileDetail[], title: string) => ( +
+

{title}

@@ -70,7 +83,7 @@ export default function CopyFileManifest({ onDismiss }: ModalProps) { - {fileDetails.map((file) => ( + {files.map((file) => ( @@ -79,6 +92,21 @@ export default function CopyFileManifest({ onDismiss }: ModalProps) {
{clipFileName(file.name)} {filesize(file.size || 0)}
+
+ ); + + const body = ( +
+

+ Files copied to the local NAS cache (VAST) are stored with a 180-day lease, after + which they revert to cloud-only. To renew the lease, simply reselect the files and + confirm the copy. +

+ {renderTable( + filesInLocalCache, + "Files that are already in Local Cache (VAST) to renew lease for" + )} + {renderTable(filesNotInLocalCache, "Files to Download to Local Cache (VAST)")}
{isLoading ? "Calculating..." : totalSize || "0 B"}