@@ -126,29 +126,52 @@ export const buildActivityType = (
126126} ;
127127
128128/**
129- * Build props for list view access warning Alert component.
129+ * Build props for dataset-related export warning Alert component.
130130 * @param _ - Unused.
131131 * @param viewContext - View context.
132132 * @returns model to be used as props for the Alert component.
133133 */
134- export const buildAlertEntityListWarning = (
134+ export const buildAlertDatasetExportWarning = (
135135 _ : Unused ,
136- viewContext : ViewContext < unknown >
137- ) : React . ComponentProps < typeof MDX . AlertEntityListWarning > => {
136+ viewContext : ViewContext < Unused >
137+ ) : React . ComponentProps < typeof MDX . Alert > => {
138+ const content = isUserAuthenticated ( viewContext )
139+ ? "To export this dataset, please request access."
140+ : "To export this dataset, please sign in and, if necessary, request access." ;
138141 return {
139142 ...ALERT_PROPS . STANDARD_WARNING ,
140143 component : C . FluidPaper ,
141- entityName : viewContext . entityConfig . label ,
144+ content ,
142145 } ;
143146} ;
144147
145148/**
146- * Build props for entity related export warning Alert component.
149+ * Build props for entity related download manifest warning Alert component.
147150 * @param _ - Unused.
148151 * @param viewContext - View context.
149152 * @returns model to be used as props for the Alert component.
150153 */
151- export const buildAlertExportEntityWarning = (
154+ export const buildAlertDatasetManifestDownloadWarning = (
155+ _ : Unused ,
156+ viewContext : ViewContext < Unused >
157+ ) : React . ComponentProps < typeof MDX . Alert > => {
158+ const content = isUserAuthenticated ( viewContext )
159+ ? "To download this dataset manifest, please request access."
160+ : "To download this dataset manifest, please sign in and, if necessary, request access." ;
161+ return {
162+ ...ALERT_PROPS . STANDARD_WARNING ,
163+ component : C . FluidPaper ,
164+ content,
165+ } ;
166+ } ;
167+
168+ /**
169+ * Build props for dataset-related export warning Alert component.
170+ * @param _ - Unused.
171+ * @param viewContext - View context.
172+ * @returns model to be used as props for the Alert component.
173+ */
174+ export const buildAlertDatasetTerraExportWarning = (
152175 _ : Unused ,
153176 viewContext : ViewContext < Unused >
154177) : React . ComponentProps < typeof MDX . Alert > => {
@@ -168,41 +191,38 @@ export const buildAlertExportEntityWarning = (
168191} ;
169192
170193/**
171- * Build props for export warning Alert component.
194+ * Build props for list view access warning Alert component.
172195 * @param _ - Unused.
173196 * @param viewContext - View context.
174197 * @returns model to be used as props for the Alert component.
175198 */
176- export const buildAlertExportWarning = (
199+ export const buildAlertEntityListWarning = (
177200 _ : Unused ,
178201 viewContext : ViewContext < unknown >
179- ) : React . ComponentProps < typeof MDX . AlertExportWarning > => {
180- const isAuthenticated = isUserAuthenticated ( viewContext ) ;
202+ ) : React . ComponentProps < typeof MDX . AlertEntityListWarning > => {
181203 return {
182204 ...ALERT_PROPS . STANDARD_WARNING ,
183205 component : C . FluidPaper ,
184- content : isAuthenticated ? null : MDX . AlertExportWarningContent ( { } ) ,
185- size : isAuthenticated ? SIZE . MEDIUM : SIZE . LARGE ,
206+ entityName : viewContext . entityConfig . label ,
186207 } ;
187208} ;
188209
189210/**
190- * Build props for entity related download manifest warning Alert component.
211+ * Build props for export warning Alert component.
191212 * @param _ - Unused.
192213 * @param viewContext - View context.
193214 * @returns model to be used as props for the Alert component.
194215 */
195- export const buildAlertManifestDownloadEntityWarning = (
216+ export const buildAlertExportWarning = (
196217 _ : Unused ,
197- viewContext : ViewContext < Unused >
198- ) : React . ComponentProps < typeof MDX . Alert > => {
199- const content = isUserAuthenticated ( viewContext )
200- ? "To download this dataset manifest, please request access."
201- : "To download this dataset manifest, please sign in and, if necessary, request access." ;
218+ viewContext : ViewContext < unknown >
219+ ) : React . ComponentProps < typeof MDX . AlertExportWarning > => {
220+ const isAuthenticated = isUserAuthenticated ( viewContext ) ;
202221 return {
203222 ...ALERT_PROPS . STANDARD_WARNING ,
204223 component : C . FluidPaper ,
205- content,
224+ content : isAuthenticated ? null : MDX . AlertExportWarningContent ( { } ) ,
225+ size : isAuthenticated ? SIZE . MEDIUM : SIZE . LARGE ,
206226 } ;
207227} ;
208228
@@ -351,6 +371,121 @@ export const buildDatasetDetails = (
351371 } ;
352372} ;
353373
374+ /**
375+ * Build base breadcrumbs for dataset export. Includes link to all datasets and
376+ * the selected dataset.
377+ * @param datasetsResponse - Response model return from datasets API.
378+ * @returns array of breadcrumbs to be used by dataset export and dataset export method pages.
379+ */
380+ export function buildDatasetExportBreadcrumbs (
381+ datasetsResponse : DatasetsResponse
382+ ) : Breadcrumb [ ] {
383+ const datasetPath = buildDatasetPath ( datasetsResponse ) ;
384+ const datasetTitle = getDatasetTitle ( datasetsResponse ) ;
385+ return [
386+ { path : URL_DATASETS , text : "Datasets" } ,
387+ { path : datasetPath , text : datasetTitle } ,
388+ ] ;
389+ }
390+
391+ /**
392+ * Build props for dataset export BackPageHero component.
393+ * @param datasetsResponse - Response model return from datasets API.
394+ * @returns model to be used as props for the BackPageHero component.
395+ */
396+ export function buildDatasetExportHero (
397+ datasetsResponse : DatasetsResponse
398+ ) : React . ComponentProps < typeof C . BackPageHero > {
399+ return {
400+ breadcrumbs : [
401+ ...buildDatasetExportBreadcrumbs ( datasetsResponse ) ,
402+ { path : "" , text : "Choose Export Method" } ,
403+ ] ,
404+ title : getDatasetTitle ( datasetsResponse ) ,
405+ } ;
406+ }
407+
408+ /**
409+ * Returns breadcrumbs and title for dataset export method Hero component.
410+ * @param datasetsResponse - Response model return from datasets API.
411+ * @param title - Short export method description (e.g. Request File Manifest).
412+ * @returns model to be used as props for the Hero component.
413+ */
414+ function getDatasetExportMethodHero (
415+ datasetsResponse : DatasetsResponse ,
416+ title : string
417+ ) : React . ComponentProps < typeof C . BackPageHero > {
418+ const datasetPath = buildDatasetPath ( datasetsResponse ) ;
419+ return {
420+ breadcrumbs : [
421+ ...buildDatasetExportBreadcrumbs ( datasetsResponse ) ,
422+ { path : `${ datasetPath } /export` , text : "Choose Export Method" } ,
423+ { path : "" , text : title } ,
424+ ] ,
425+ title : getDatasetTitle ( datasetsResponse ) ,
426+ } ;
427+ }
428+
429+ /**
430+ * Build props for dataset manifest download BackPageHero component.
431+ * @param datasetsResponse - Response model return from datasets API.
432+ * @returns model to be used as props for the BackPageHero component.
433+ */
434+ export const buildDatasetExportMethodHeroManifestDownload = (
435+ datasetsResponse : DatasetsResponse
436+ ) : React . ComponentProps < typeof C . BackPageHero > => {
437+ const title = "File Manifest" ;
438+ return getDatasetExportMethodHero ( datasetsResponse , title ) ;
439+ } ;
440+
441+ /**
442+ * Build props for dataset manifest download BackPageHero component.
443+ * @param datasetsResponse - Response model return from datasets API.
444+ * @returns model to be used as props for the BackPageHero component.
445+ */
446+ export const buildDatasetExportMethodHeroTerraExport = (
447+ datasetsResponse : DatasetsResponse
448+ ) : React . ComponentProps < typeof C . BackPageHero > => {
449+ const title = "Analyze in Terra" ;
450+ return getDatasetExportMethodHero ( datasetsResponse , title ) ;
451+ } ;
452+
453+ /**
454+ * Build props for ExportMethod component for display of the dataset manifest download section.
455+ * @param datasetsResponse - Response model return from datasets API.
456+ * @returns model to be used as props for the dataset file manifest export method component.
457+ */
458+ export const buildDatasetExportMethodManifestDownload = (
459+ datasetsResponse : DatasetsResponse
460+ ) : React . ComponentProps < typeof C . ExportMethod > => {
461+ const datasetPath = buildDatasetPath ( datasetsResponse ) ;
462+ return {
463+ buttonLabel : "Request File Manifest" ,
464+ description :
465+ "Request a file manifest suitable for downloading this dataset to your HPC cluster or local machine." ,
466+ route : `${ datasetPath } ${ ROUTE_MANIFEST_DOWNLOAD } ` ,
467+ title : "Download a File Manifest with Metadata" ,
468+ } ;
469+ } ;
470+
471+ /**
472+ * Build props for ExportMethod component for display of the export to terra metadata section.
473+ * @param datasetsResponse - Response model return from datasets API.
474+ * @returns model to be used as props for the dataset Terra export method component.
475+ */
476+ export const buildDatasetExportMethodTerra = (
477+ datasetsResponse : DatasetsResponse
478+ ) : React . ComponentProps < typeof ExportMethod > => {
479+ const datasetPath = buildDatasetPath ( datasetsResponse ) ;
480+ return {
481+ buttonLabel : "Analyze in Terra" ,
482+ description :
483+ "Terra is a biomedical research platform to analyze data using workflows, Jupyter Notebooks, RStudio, and Galaxy." ,
484+ route : `${ datasetPath } ${ ROUTE_EXPORT_TO_TERRA } ` ,
485+ title : "Export Dataset Data and Metadata to Terra Workspace" ,
486+ } ;
487+ } ;
488+
354489/**
355490 * Build props for BackPageHero component from the given datasets response.
356491 * @param datasetsResponse - Response model return from datasets API.
@@ -380,6 +515,16 @@ export const buildDatasetIds = (
380515 } ;
381516} ;
382517
518+ /**
519+ * Build path to dataset from the given datasets response.
520+ * @param datasetsResponse - Response model return from datasets API.
521+ * @returns path to the dataset.
522+ */
523+ export function buildDatasetPath ( datasetsResponse : DatasetsResponse ) : string {
524+ const datasetId = getDatasetEntryId ( datasetsResponse ) ;
525+ return `${ URL_DATASETS } /${ datasetId } ` ;
526+ }
527+
383528/**
384529 * Build dataset title Link component from the given datasets response.
385530 * @param datasetsResponse - Response model return from datasets API.
@@ -931,18 +1076,26 @@ function getDatasetCallToAction(
9311076 const isReady = isResponseReady ( datasetsResponse ) ;
9321077 const isAccessGranted = isDatasetAccessible ( datasetsResponse ) ;
9331078 const registeredIdentifier = getDatasetRegisteredIdentifier ( datasetsResponse ) ;
934- if (
935- ! isReady ||
936- isAccessGranted ||
937- registeredIdentifier === LABEL . UNSPECIFIED
938- ) {
1079+ if ( ! isReady ) {
9391080 return ;
9401081 }
941- return {
942- label : "Request Access" ,
943- target : ANCHOR_TARGET . BLANK ,
944- url : `https://dbgap.ncbi.nlm.nih.gov/aa/wga.cgi?adddataset=${ registeredIdentifier } ` ,
945- } ;
1082+ // Display export button if user is authorized to access the dataset.
1083+ if ( isAccessGranted ) {
1084+ return {
1085+ label : "Export" ,
1086+ target : ANCHOR_TARGET . SELF ,
1087+ url : `/datasets/${ getDatasetEntryId ( datasetsResponse ) } /export` ,
1088+ } ;
1089+ }
1090+ // Display request access button if user is not authorized to access the dataset.
1091+ if ( registeredIdentifier === LABEL . UNSPECIFIED ) {
1092+ return {
1093+ label : "Request Access" ,
1094+ target : ANCHOR_TARGET . BLANK ,
1095+ url : `https://dbgap.ncbi.nlm.nih.gov/aa/wga.cgi?adddataset=${ registeredIdentifier } ` ,
1096+ } ;
1097+ }
1098+ // Otherwise, display nothing.
9461099}
9471100
9481101/**
@@ -1309,12 +1462,14 @@ export const renderWhenUnAuthenticated = (
13091462} ;
13101463
13111464/**
1312- * Renders entity related export when the given datasests response is accessible.
1465+ * Renders dataset export to Terra component when the given datasests response is accessible. Note,
1466+ * this can be removed once the verbatim feature flag is removed (use renderDatasetExport instead).
13131467 * @param datasetsResponse - Response model return from datasets API.
13141468 * @param viewContext - View context.
13151469 * @returns model to be used as props for the ConditionalComponent component.
1470+ * @deprecated
13161471 */
1317- export const renderExportEntity = (
1472+ export const renderDatasetTerraExport = (
13181473 datasetsResponse : DatasetsResponse ,
13191474 viewContext : ViewContext < DatasetsResponse >
13201475) : React . ComponentProps < typeof C . ConditionalComponent > => {
@@ -1329,32 +1484,34 @@ export const renderExportEntity = (
13291484} ;
13301485
13311486/**
1332- * Renders entity related export warning when the given datasests response is not accessible.
1487+ * Renders dataset export to Terra warning component when the given datasests response is accessible. Note,
1488+ * this can be removed once the verbatim feature flag is removed (use renderDatasetExportWarning instead).
13331489 * @param datasetsResponse - Response model return from datasets API.
13341490 * @param viewContext - View context.
13351491 * @returns model to be used as props for the ConditionalComponent component.
1492+ * @deprecated
13361493 */
1337- export const renderExportEntityWarning = (
1494+ export const renderDatasetTerraExportWarning = (
13381495 datasetsResponse : DatasetsResponse ,
13391496 viewContext : ViewContext < DatasetsResponse >
13401497) : React . ComponentProps < typeof C . ConditionalComponent > => {
13411498 const {
13421499 exploreState : { featureFlagState } ,
13431500 } = viewContext ;
13441501 return {
1345- isIn : ! (
1346- isDatasetAccessible ( datasetsResponse ) &&
1347- Boolean ( featureFlagState ?. includes ( FEATURE_FLAGS . VERBATIM ) )
1348- ) ,
1502+ isIn :
1503+ ! isDatasetAccessible ( datasetsResponse ) ||
1504+ Boolean ( ! featureFlagState ?. includes ( FEATURE_FLAGS . VERBATIM ) ) ,
13491505 } ;
13501506} ;
13511507
13521508/**
1353- * Renders entity related download manifest when the given datasests response is accessible.
1509+ * Renders dataset export-related components (either the choose export method component,
1510+ * or specific export components) when the given dataset is accessble.
13541511 * @param datasetsResponse - Response model return from datasets API.
13551512 * @returns model to be used as props for the ConditionalComponent component.
13561513 */
1357- export const renderManifestDownloadEntity = (
1514+ export const renderDatasetExport = (
13581515 datasetsResponse : DatasetsResponse
13591516) : React . ComponentProps < typeof C . ConditionalComponent > => {
13601517 return {
@@ -1363,11 +1520,12 @@ export const renderManifestDownloadEntity = (
13631520} ;
13641521
13651522/**
1366- * Renders entity related download manifest warning when the given datasests response is not accessible.
1523+ * Renders dataset export-related warning components (either the choose export method component,
1524+ * or specific export components) when the given dataset is not accessible.
13671525 * @param datasetsResponse - Response model return from datasets API.
13681526 * @returns model to be used as props for the ConditionalComponent component.
13691527 */
1370- export const renderManifestDownloadEntityWarning = (
1528+ export const renderDatasetExportWarning = (
13711529 datasetsResponse : DatasetsResponse
13721530) : React . ComponentProps < typeof C . ConditionalComponent > => {
13731531 return {
0 commit comments