From bd84617e054740fbc477f710b4b32a8ffee6b986 Mon Sep 17 00:00:00 2001 From: Adam Taylor Date: Fri, 8 Nov 2024 15:26:00 +0000 Subject: [PATCH 1/4] Add Terra manifest to Download options --- .../src/components/FileTable.tsx | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/packages/data-portal-explore/src/components/FileTable.tsx b/packages/data-portal-explore/src/components/FileTable.tsx index f3a61726..36aa3d80 100644 --- a/packages/data-portal-explore/src/components/FileTable.tsx +++ b/packages/data-portal-explore/src/components/FileTable.tsx @@ -104,6 +104,28 @@ function generateGen3ManifestFile(files: Entity[]): string | undefined { return data.length > 0 ? JSON.stringify(data, null, 2) : undefined; } +function generateTerraManifestFile(files: Entity[]): string | undefined { + const columns = [ + 'entity:drs_id', + 'drs_uri', + 'filename', + ]; + const data = _(files) + .filter((f) => !!f.viewers?.cds) + .map((f) => [ + f.viewers?.cds?.drs_id, // Assuming drs_id is a property in viewers.cds + f.viewers?.cds?.drs_uri, + f.name // Use `name` property for the filename + ]) + .value(); + + if (data.length > 0) { + return [columns, ...data].map((row) => row.join('\t')).join('\n'); // Join with tabs for TSV format + } else { + return undefined; + } +} + const FilenameWithAccessIcon: React.FunctionComponent<{ file: Entity; @@ -244,6 +266,28 @@ const gen3ManifestInstructions = (gen3manifestFile: string | undefined) => { ); }; +const terra3ManifestInstructions = (terra3manifestFile: string | undefined) => { + if (!terra3manifestFile) return null; + + return ( +
+

+

+ Access files in Terra:{' '} + You can add these files to Terra using the following manifest file. +

+

+ +

+
+ ); +}; + const CDSInstructions: React.FunctionComponent<{ files: Entity[] }> = ({ files }) => { const dbgapFiles = files.filter( (f) => f.downloadSource === DownloadSourceCategory.dbgap @@ -254,6 +298,7 @@ const CDSInstructions: React.FunctionComponent<{ files: Entity[] }> = ({ files } const manifestFile = generateCdsManifestFile(files); const gen3manifestFile = generateGen3ManifestFile(files); + const terra3manifestFile = generateTerraManifestFile(files); return (
@@ -292,6 +337,7 @@ const CDSInstructions: React.FunctionComponent<{ files: Entity[] }> = ({ files } {/* CDS and Gen3 manifest instructions */} {cdsManifestInstructions(manifestFile)} + {terra3ManifestInstructions(terra3manifestFile)} {gen3ManifestInstructions(gen3manifestFile)}
); From 1442ae26d6c31b6c8dc2489733f3f952731aca3e Mon Sep 17 00:00:00 2001 From: Adam Taylor Date: Fri, 8 Nov 2024 15:26:20 +0000 Subject: [PATCH 2/4] Add brief terra instructions --- packages/data-portal-explore/src/components/FileTable.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/data-portal-explore/src/components/FileTable.tsx b/packages/data-portal-explore/src/components/FileTable.tsx index 36aa3d80..c56cc306 100644 --- a/packages/data-portal-explore/src/components/FileTable.tsx +++ b/packages/data-portal-explore/src/components/FileTable.tsx @@ -274,7 +274,11 @@ const terra3ManifestInstructions = (terra3manifestFile: string | undefined) => {

Access files in Terra:{' '} - You can add these files to Terra using the following manifest file. + First link your Terra account to NCI CRDC Framework Services from your{' '} + + Terra profile External Identities + page.{' '} + You can then add these files to Terra using the following manifest file.