Skip to content

Commit d86dcbd

Browse files
frano-mFran McDade
and
Fran McDade
authored
fix: update batch correction warning message for all downloads (#3993) (#4008)
Co-authored-by: Fran McDade <[email protected]>
1 parent 6e9d194 commit d86dcbd

File tree

10 files changed

+174
-4
lines changed

10 files changed

+174
-4
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<TagWarning>Please note</TagWarning> Data normalization and batch correction may
2+
differ between projects and processing methods.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { DownloadBatchCorrectionWarning } from "./index";
2+
3+
### Your curl Command is Ready
4+
5+
Execute the curl command below in your terminal to download the selected data.
6+
7+
<DownloadBatchCorrectionWarning />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { DownloadBatchCorrectionWarning } from "./index";
2+
3+
### Select File Types
4+
5+
Select the files types to be imported into your Terra workspace.
6+
7+
<DownloadBatchCorrectionWarning />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { DownloadBatchCorrectionWarning } from "./index";
2+
3+
### Your Terra Workspace Link is Ready
4+
5+
<DownloadBatchCorrectionWarning />

explorer/app/components/common/MDXContent/lungmap/index.tsx

+5
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,8 @@ export { Section } from "../../MDXMarkdown/components/Section/mdxSection.styles"
22
export { default as ContributorGeneratedMatrices } from "../hca-dcp/contributorGeneratedMatrices.mdx";
33
export { default as BatchCorrectionWarning } from "./batchCorrectionWarning.mdx";
44
export { default as DataReleasePolicy } from "./dataReleasePolicy.mdx";
5+
export { default as DownloadBatchCorrectionWarning } from "./downloadBatchCorrectionWarning.mdx";
6+
export { default as DownloadCurlCommandSuccess } from "./downloadCurlCommandSuccess.mdx";
7+
export { default as ExportToTerraStart } from "./exportToTerraStart.mdx";
8+
export { default as ExportToTerraSuccessWithWarning } from "./exportToTerraSuccessWithWarning.mdx";
9+
export { default as ManifestDownloadSuccess } from "./manifestDownloadSuccess.mdx";
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { DownloadBatchCorrectionWarning } from "./index";
2+
3+
### Your File Manifest is Ready
4+
5+
<DownloadBatchCorrectionWarning />
6+
7+
This link expires in 7 days.

explorer/app/viewModelBuilders/azul/lungmap/common/viewModelBuilders.ts

+72
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { ViewContext } from "@databiosphere/findable-ui/lib/config/entities";
12
import { ColumnDef } from "@tanstack/react-table";
23
import React from "react";
34
import {
@@ -6,11 +7,17 @@ import {
67
} from "../../../../../site-config/hca-dcp/category";
78
import { ProjectsResponse } from "../../../../apis/azul/hca-dcp/common/responses";
89
import * as C from "../../../../components";
10+
import * as MDX from "../../../../components/common/MDXContent/lungmap";
11+
import { Unused } from "../../../common/entities";
912
import {
1013
groupProjectMatrixViewsBySpecies,
1114
projectMatrixMapper,
1215
} from "../../hca-dcp/common/projectMatrixMapper/projectMatrixMapper";
1316
import {
17+
buildDownloadCurlCommand as buildHCADownloadCurlCommand,
18+
buildDownloadEntityCurlCommand as buildHCADownloadEntityCurlCommand,
19+
buildExportToTerra as buildHCAExportToTerra,
20+
buildManifestDownload as buildHCAManifestDownload,
1421
getGeneratedMatricesActionsColumnDef,
1522
getGeneratedMatricesAnatomicalEntityColumnDef,
1623
getGeneratedMatricesContentDescriptionColumnDef,
@@ -71,6 +78,71 @@ function buildContributorGeneratedMatricesTableColumns<T>(): ColumnDef<T>[] {
7178
];
7279
}
7380

81+
/**
82+
* Build props for DownloadCurlCommand component.
83+
* @param _ - Unused.
84+
* @param viewContext - View context.
85+
* @returns model to be used as props for the DownloadCurlCommand component.
86+
*/
87+
export const buildDownloadCurlCommand = (
88+
_: Unused,
89+
viewContext?: ViewContext
90+
): React.ComponentProps<typeof C.DownloadCurlCommand> => {
91+
return {
92+
...buildHCADownloadCurlCommand(_, viewContext as ViewContext),
93+
DownloadCurlSuccess: MDX.DownloadCurlCommandSuccess,
94+
};
95+
};
96+
97+
/**
98+
* Build props for DownloadCurlCommand component from the given projects response.
99+
* @param projectsResponse - Response model return from projects API.
100+
* @param viewContext - View context.
101+
* @returns model to be used as props for the DownloadCurlCommand component.
102+
*/
103+
export const buildDownloadEntityCurlCommand = (
104+
projectsResponse: ProjectsResponse,
105+
viewContext: ViewContext
106+
): React.ComponentProps<typeof C.DownloadCurlCommand> => {
107+
return {
108+
...buildHCADownloadEntityCurlCommand(projectsResponse, viewContext),
109+
DownloadCurlSuccess: MDX.DownloadCurlCommandSuccess,
110+
};
111+
};
112+
113+
/**
114+
* Build props for ExportToTerra component.
115+
* @param _ - Unused.
116+
* @param viewContext - View context.
117+
* @returns model to be used as props for the ExportToTerra component.
118+
*/
119+
export const buildExportToTerra = (
120+
_: Unused,
121+
viewContext?: ViewContext
122+
): React.ComponentProps<typeof C.ExportToTerra> => {
123+
return {
124+
...buildHCAExportToTerra(_, viewContext as ViewContext),
125+
ExportToTerraStart: MDX.ExportToTerraStart,
126+
ExportToTerraSuccess: MDX.ExportToTerraSuccessWithWarning,
127+
};
128+
};
129+
130+
/**
131+
* Build props for ManifestDownload component.
132+
* @param _ - Unused.
133+
* @param viewContext - View context.
134+
* @returns model to be used as props for the ManifestDownload component.
135+
*/
136+
export const buildManifestDownload = (
137+
_: Unused,
138+
viewContext?: ViewContext
139+
): React.ComponentProps<typeof C.ManifestDownload> => {
140+
return {
141+
...buildHCAManifestDownload(_, viewContext as ViewContext),
142+
ManifestDownloadSuccess: MDX.ManifestDownloadSuccess,
143+
};
144+
};
145+
74146
/**
75147
* Returns grid props for the Grid component.
76148
* Views render as follows:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { ComponentConfig } from "@databiosphere/findable-ui/lib/config/entities";
2+
import { ProjectsResponse } from "../../../../../app/apis/azul/hca-dcp/common/responses";
3+
import * as C from "../../../../../app/components";
4+
import * as V from "../../../../../app/viewModelBuilders/azul/lungmap/common/viewModelBuilders";
5+
6+
export const mainColumn: ComponentConfig[] = [
7+
{
8+
component: C.DownloadCurlCommand,
9+
viewBuilder: V.buildDownloadEntityCurlCommand,
10+
} as ComponentConfig<typeof C.DownloadCurlCommand, ProjectsResponse>,
11+
];

explorer/site-config/lungmap/dev/export/exportConfig.ts

+56-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
1-
import { ExportConfig } from "@databiosphere/findable-ui/lib/config/entities";
1+
import {
2+
ComponentConfig,
3+
ExportConfig,
4+
ExportMethodConfig,
5+
} from "@databiosphere/findable-ui/lib/config/entities";
6+
import * as V from "../../../../app/viewModelBuilders/azul/lungmap/common/viewModelBuilders";
7+
import {
8+
ROUTE_BULK_DOWNLOAD,
9+
ROUTE_EXPORT_TO_TERRA,
10+
ROUTE_MANIFEST_DOWNLOAD,
11+
} from "../../../hca-dcp/dev/export/constants";
212
import { exportConfig as hcaExportConfig } from "../../../hca-dcp/dev/export/export";
313
import { getExportCurrentQueryAndDataSummary } from "../../../hca-dcp/dev/export/sideColumn";
414
import { getExportDataReleasePolicy } from "./sideColumn";
515

616
export const exportConfig: ExportConfig = {
7-
...hcaExportConfig,
17+
...getExportConfig(hcaExportConfig),
818
tabs: [
919
{
1020
...hcaExportConfig.tabs[0],
@@ -15,3 +25,47 @@ export const exportConfig: ExportConfig = {
1525
},
1626
],
1727
};
28+
29+
/**
30+
* Returns the export config.
31+
* @param exportConfig - Export config.
32+
* @returns export config.
33+
*/
34+
function getExportConfig(exportConfig: ExportConfig): ExportConfig {
35+
// Clone export config.
36+
const cloneExportConfig = { ...exportConfig };
37+
// Update export methods.
38+
cloneExportConfig.exportMethods = getExportMethods(exportConfig);
39+
return cloneExportConfig;
40+
}
41+
42+
/**
43+
* Returns the export methods.
44+
* @param exportConfig - Export config.
45+
* @returns export methods.
46+
*/
47+
function getExportMethods(exportConfig: ExportConfig): ExportMethodConfig[] {
48+
return [...exportConfig.exportMethods].map((exportMethod) => {
49+
const cloneExportMethod = { ...exportMethod };
50+
const mainColumn = cloneExportMethod.mainColumn as ComponentConfig[];
51+
// Clone main column.
52+
const cloneMainColumn = [...mainColumn];
53+
// Clone first component of main column.
54+
const cloneFirstComponent = { ...cloneMainColumn[0] };
55+
// Update the export method view builders for each download type.
56+
if (cloneExportMethod.route === ROUTE_BULK_DOWNLOAD) {
57+
// Update view builder for bulk download.
58+
cloneFirstComponent.viewBuilder = V.buildDownloadCurlCommand;
59+
}
60+
if (cloneExportMethod.route === ROUTE_MANIFEST_DOWNLOAD) {
61+
// Update view builder for manifest download.
62+
cloneFirstComponent.viewBuilder = V.buildManifestDownload;
63+
}
64+
if (cloneExportMethod.route === ROUTE_EXPORT_TO_TERRA) {
65+
// Update view builder for export to Terra.
66+
cloneFirstComponent.viewBuilder = V.buildExportToTerra;
67+
}
68+
cloneExportMethod.mainColumn = [cloneFirstComponent];
69+
return cloneExportMethod;
70+
});
71+
}

explorer/site-config/lungmap/dev/index/projectsEntityConfig.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { EntityConfig } from "@databiosphere/findable-ui/lib/config/entities";
22
import { mainColumn as hcaMetadataMainColumn } from "../../../hca-dcp/dev/detail/project/metadataMainColumn";
33
import { sideColumn as hcaOverviewSideColumn } from "../../../hca-dcp/dev/detail/project/overviewSideColumn";
4-
import { mainColumn as hcaProjectFilesMainColumn } from "../../../hca-dcp/dev/detail/project/projectFilesMainColumn";
54
import { projectsEntityConfig as hcaProjectsEntity } from "../../../hca-dcp/dev/index/projectsEntityConfig";
65
import { mainColumn as exportMainColumn } from "../detail/project/exportMainColumn";
76
import { sideColumn as exportSideColumn } from "../detail/project/exportSideColumn";
87
import { getOverviewMainColumn } from "../detail/project/mainColumn";
98
import { mainColumn as matricesMainColumn } from "../detail/project/matricesMainColumn";
109
import { sideColumn as metadataSideColumn } from "../detail/project/metadataSideColumn";
10+
import { mainColumn as projectFilesMainColumn } from "../detail/project/projectFilesMainColumn";
1111
import { sideColumn as projectFilesSideColumn } from "../detail/project/projectFilesSideColumn";
1212

1313
/**
@@ -37,7 +37,7 @@ export const projectsEntityConfig: EntityConfig = {
3737
},
3838
{
3939
label: "Download",
40-
mainColumn: hcaProjectFilesMainColumn,
40+
mainColumn: projectFilesMainColumn,
4141
route: "get-curl-command",
4242
sideColumn: projectFilesSideColumn,
4343
},

0 commit comments

Comments
 (0)