@@ -126,29 +126,52 @@ export const buildActivityType = (
126
126
} ;
127
127
128
128
/**
129
- * Build props for list view access warning Alert component.
129
+ * Build props for dataset-related export warning Alert component.
130
130
* @param _ - Unused.
131
131
* @param viewContext - View context.
132
132
* @returns model to be used as props for the Alert component.
133
133
*/
134
- export const buildAlertEntityListWarning = (
134
+ export const buildAlertDatasetExportWarning = (
135
135
_ : 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." ;
138
141
return {
139
142
...ALERT_PROPS . STANDARD_WARNING ,
140
143
component : C . FluidPaper ,
141
- entityName : viewContext . entityConfig . label ,
144
+ content ,
142
145
} ;
143
146
} ;
144
147
145
148
/**
146
- * Build props for entity related export warning Alert component.
149
+ * Build props for entity related download manifest warning Alert component.
147
150
* @param _ - Unused.
148
151
* @param viewContext - View context.
149
152
* @returns model to be used as props for the Alert component.
150
153
*/
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 = (
152
175
_ : Unused ,
153
176
viewContext : ViewContext < Unused >
154
177
) : React . ComponentProps < typeof MDX . Alert > => {
@@ -168,41 +191,38 @@ export const buildAlertExportEntityWarning = (
168
191
} ;
169
192
170
193
/**
171
- * Build props for export warning Alert component.
194
+ * Build props for list view access warning Alert component.
172
195
* @param _ - Unused.
173
196
* @param viewContext - View context.
174
197
* @returns model to be used as props for the Alert component.
175
198
*/
176
- export const buildAlertExportWarning = (
199
+ export const buildAlertEntityListWarning = (
177
200
_ : Unused ,
178
201
viewContext : ViewContext < unknown >
179
- ) : React . ComponentProps < typeof MDX . AlertExportWarning > => {
180
- const isAuthenticated = isUserAuthenticated ( viewContext ) ;
202
+ ) : React . ComponentProps < typeof MDX . AlertEntityListWarning > => {
181
203
return {
182
204
...ALERT_PROPS . STANDARD_WARNING ,
183
205
component : C . FluidPaper ,
184
- content : isAuthenticated ? null : MDX . AlertExportWarningContent ( { } ) ,
185
- size : isAuthenticated ? SIZE . MEDIUM : SIZE . LARGE ,
206
+ entityName : viewContext . entityConfig . label ,
186
207
} ;
187
208
} ;
188
209
189
210
/**
190
- * Build props for entity related download manifest warning Alert component.
211
+ * Build props for export warning Alert component.
191
212
* @param _ - Unused.
192
213
* @param viewContext - View context.
193
214
* @returns model to be used as props for the Alert component.
194
215
*/
195
- export const buildAlertManifestDownloadEntityWarning = (
216
+ export const buildAlertExportWarning = (
196
217
_ : 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 ) ;
202
221
return {
203
222
...ALERT_PROPS . STANDARD_WARNING ,
204
223
component : C . FluidPaper ,
205
- content,
224
+ content : isAuthenticated ? null : MDX . AlertExportWarningContent ( { } ) ,
225
+ size : isAuthenticated ? SIZE . MEDIUM : SIZE . LARGE ,
206
226
} ;
207
227
} ;
208
228
@@ -351,6 +371,121 @@ export const buildDatasetDetails = (
351
371
} ;
352
372
} ;
353
373
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
+
354
489
/**
355
490
* Build props for BackPageHero component from the given datasets response.
356
491
* @param datasetsResponse - Response model return from datasets API.
@@ -380,6 +515,16 @@ export const buildDatasetIds = (
380
515
} ;
381
516
} ;
382
517
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
+
383
528
/**
384
529
* Build dataset title Link component from the given datasets response.
385
530
* @param datasetsResponse - Response model return from datasets API.
@@ -931,18 +1076,26 @@ function getDatasetCallToAction(
931
1076
const isReady = isResponseReady ( datasetsResponse ) ;
932
1077
const isAccessGranted = isDatasetAccessible ( datasetsResponse ) ;
933
1078
const registeredIdentifier = getDatasetRegisteredIdentifier ( datasetsResponse ) ;
934
- if (
935
- ! isReady ||
936
- isAccessGranted ||
937
- registeredIdentifier === LABEL . UNSPECIFIED
938
- ) {
1079
+ if ( ! isReady ) {
939
1080
return ;
940
1081
}
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.
946
1099
}
947
1100
948
1101
/**
@@ -1309,12 +1462,14 @@ export const renderWhenUnAuthenticated = (
1309
1462
} ;
1310
1463
1311
1464
/**
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).
1313
1467
* @param datasetsResponse - Response model return from datasets API.
1314
1468
* @param viewContext - View context.
1315
1469
* @returns model to be used as props for the ConditionalComponent component.
1470
+ * @deprecated
1316
1471
*/
1317
- export const renderExportEntity = (
1472
+ export const renderDatasetTerraExport = (
1318
1473
datasetsResponse : DatasetsResponse ,
1319
1474
viewContext : ViewContext < DatasetsResponse >
1320
1475
) : React . ComponentProps < typeof C . ConditionalComponent > => {
@@ -1329,32 +1484,34 @@ export const renderExportEntity = (
1329
1484
} ;
1330
1485
1331
1486
/**
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).
1333
1489
* @param datasetsResponse - Response model return from datasets API.
1334
1490
* @param viewContext - View context.
1335
1491
* @returns model to be used as props for the ConditionalComponent component.
1492
+ * @deprecated
1336
1493
*/
1337
- export const renderExportEntityWarning = (
1494
+ export const renderDatasetTerraExportWarning = (
1338
1495
datasetsResponse : DatasetsResponse ,
1339
1496
viewContext : ViewContext < DatasetsResponse >
1340
1497
) : React . ComponentProps < typeof C . ConditionalComponent > => {
1341
1498
const {
1342
1499
exploreState : { featureFlagState } ,
1343
1500
} = viewContext ;
1344
1501
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 ) ) ,
1349
1505
} ;
1350
1506
} ;
1351
1507
1352
1508
/**
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.
1354
1511
* @param datasetsResponse - Response model return from datasets API.
1355
1512
* @returns model to be used as props for the ConditionalComponent component.
1356
1513
*/
1357
- export const renderManifestDownloadEntity = (
1514
+ export const renderDatasetExport = (
1358
1515
datasetsResponse : DatasetsResponse
1359
1516
) : React . ComponentProps < typeof C . ConditionalComponent > => {
1360
1517
return {
@@ -1363,11 +1520,12 @@ export const renderManifestDownloadEntity = (
1363
1520
} ;
1364
1521
1365
1522
/**
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.
1367
1525
* @param datasetsResponse - Response model return from datasets API.
1368
1526
* @returns model to be used as props for the ConditionalComponent component.
1369
1527
*/
1370
- export const renderManifestDownloadEntityWarning = (
1528
+ export const renderDatasetExportWarning = (
1371
1529
datasetsResponse : DatasetsResponse
1372
1530
) : React . ComponentProps < typeof C . ConditionalComponent > => {
1373
1531
return {
0 commit comments