@@ -39,16 +39,13 @@ import {
3939 ChipProps as MChipProps ,
4040 FadeProps as MFadeProps ,
4141} from "@mui/material" ;
42- import React , { ReactNode } from "react" ;
42+ import React , { ComponentProps , ReactNode } from "react" ;
4343import {
4444 ANVIL_CMG_CATEGORY_KEY ,
4545 ANVIL_CMG_CATEGORY_LABEL ,
4646 DATASET_RESPONSE ,
4747} from "../../../../../site-config/anvil-cmg/category" ;
48- import {
49- ROUTE_EXPORT_TO_TERRA ,
50- ROUTE_MANIFEST_DOWNLOAD ,
51- } from "../../../../../site-config/anvil-cmg/dev/export/constants" ;
48+ import { ROUTES } from "../../../../../site-config/anvil-cmg/dev/export/routes" ;
5249import {
5350 AggregatedBioSampleResponse ,
5451 AggregatedDatasetResponse ,
@@ -452,7 +449,7 @@ export const buildDatasetExportMethodManifestDownload = (
452449 buttonLabel : "Request File Manifest" ,
453450 description :
454451 "Request a file manifest suitable for downloading this dataset to your HPC cluster or local machine." ,
455- route : `${ datasetPath } ${ ROUTE_MANIFEST_DOWNLOAD } ` ,
452+ route : `${ datasetPath } ${ ROUTES . MANIFEST_DOWNLOAD } ` ,
456453 title : "Download a File Manifest with Metadata" ,
457454 } ;
458455} ;
@@ -486,7 +483,7 @@ export const buildDatasetExportMethodTerra = (
486483 buttonLabel : "Analyze in Terra" ,
487484 description :
488485 "Terra is a biomedical research platform to analyze data using workflows, Jupyter Notebooks, RStudio, and Galaxy." ,
489- route : `${ datasetPath } ${ ROUTE_EXPORT_TO_TERRA } ` ,
486+ route : `${ datasetPath } ${ ROUTES . TERRA } ` ,
490487 title : "Export Dataset Data and Metadata to Terra Workspace" ,
491488 } ;
492489} ;
@@ -744,7 +741,7 @@ export const buildExportMethodManifestDownload = (
744741 buttonLabel : "Request File Manifest" ,
745742 description :
746743 "Request a file manifest for the current query containing the full list of selected files and the metadata for each file." ,
747- route : ROUTE_MANIFEST_DOWNLOAD ,
744+ route : ROUTES . MANIFEST_DOWNLOAD ,
748745 title : "Download a File Manifest with Metadata for the Selected Data" ,
749746 } ;
750747} ;
@@ -764,7 +761,7 @@ export const buildExportMethodTerra = (
764761 buttonLabel : "Analyze in Terra" ,
765762 description :
766763 "Terra is a biomedical research platform to analyze data using workflows, Jupyter Notebooks, RStudio, and Galaxy." ,
767- route : ROUTE_EXPORT_TO_TERRA ,
764+ route : ROUTES . TERRA ,
768765 title : "Export Study Data and Metadata to Terra Workspace" ,
769766 } ;
770767} ;
@@ -793,6 +790,77 @@ export const buildExportSelectedDataSummary = (
793790 } ;
794791} ;
795792
793+ /**
794+ * Build props for ExportToPlatform component.
795+ * @param props - Props to pass to the ExportToPlatform component.
796+ * @returns model to be used as props for the ExportToPlatform component.
797+ */
798+ export const buildExportToPlatform = (
799+ props : Pick <
800+ ComponentProps < typeof C . ExportToPlatform > ,
801+ "buttonLabel" | "description" | "successTitle" | "title"
802+ >
803+ ) : ( (
804+ _ : unknown ,
805+ viewContext : ViewContext < unknown >
806+ ) => ComponentProps < typeof C . ExportToPlatform > ) => {
807+ return ( _ : unknown , viewContext : ViewContext < unknown > ) => {
808+ const {
809+ exploreState : { filterState } ,
810+ fileManifestState,
811+ } = viewContext ;
812+ return {
813+ ...props ,
814+ fileManifestState,
815+ fileSummaryFacetName : ANVIL_CMG_CATEGORY_KEY . FILE_FILE_FORMAT ,
816+ filters : filterState ,
817+ formFacet : getFormFacets ( fileManifestState ) ,
818+ speciesFacetName : ANVIL_CMG_CATEGORY_KEY . DONOR_ORGANISM_TYPE ,
819+ } ;
820+ } ;
821+ } ;
822+
823+ /**
824+ * Build props for ExportToPlatform BackPageHero component.
825+ * @param title - Title of the export method.
826+ * @returns model to be used as props for the BackPageHero component.
827+ */
828+ export const buildExportToPlatformHero = (
829+ title : string
830+ ) : ( (
831+ _ : unknown ,
832+ viewContext : ViewContext < unknown >
833+ ) => React . ComponentProps < typeof C . BackPageHero > ) => {
834+ return ( _ , viewContext ) => {
835+ const {
836+ exploreState : { tabValue } ,
837+ } = viewContext ;
838+ return getExportMethodHero ( tabValue , title ) ;
839+ } ;
840+ } ;
841+
842+ /**
843+ * Build props for ExportMethod component for display of the export to [platform] metadata section.
844+ * @param props - Props to pass to the ExportMethod component.
845+ * @returns model to be used as props for the ExportMethod component.
846+ */
847+ export const buildExportToPlatformMethod = (
848+ props : Pick <
849+ ComponentProps < typeof ExportMethod > ,
850+ "buttonLabel" | "description" | "route" | "title"
851+ >
852+ ) : ( (
853+ _ : unknown ,
854+ viewContext : ViewContext < unknown >
855+ ) => ComponentProps < typeof ExportMethod > ) => {
856+ return ( _ : unknown , viewContext : ViewContext < unknown > ) => {
857+ return {
858+ ...props ,
859+ ...getExportMethodAccessibility ( viewContext ) ,
860+ } ;
861+ } ;
862+ } ;
863+
796864/**
797865 * Build props for ExportToTerra component.
798866 * @param _ - Unused.
0 commit comments