diff --git a/explorer/app/components/Detail/components/Export/common/entities.ts b/explorer/app/components/Detail/components/Export/common/entities.ts deleted file mode 100644 index 1541f6544..000000000 --- a/explorer/app/components/Detail/components/Export/common/entities.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { SelectCategory } from "@clevercanary/data-explorer-ui/lib/common/entities"; - -/** - * Set of possible values for the export filter key. - */ -export enum ExportFilterKey { - ENTITY_ID = "ENTITY_ID", - FILE_FORMAT = "FILE_FORMAT", - GENUS_SPECIES = "GENUS_SPECIES", -} - -/** - * Filter model of export select category. - */ -export interface ExportSelectCategory extends Omit { - values: string[]; -} - -/** - * Map of export filter key to export select category. - */ -export type ExportFilterKeyExportCategory = Map< - ExportFilterKey, - ExportSelectCategory ->; diff --git a/explorer/app/components/Detail/components/Export/common/utils.ts b/explorer/app/components/Detail/components/Export/common/utils.ts deleted file mode 100644 index b7384ae83..000000000 --- a/explorer/app/components/Detail/components/Export/common/utils.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Filters } from "@clevercanary/data-explorer-ui/lib/common/entities"; -import { ExportFilterKeyExportCategory } from "./entities"; - -/** - * Returns initially selected export filters for the given entity. - * @param filterKeyValue - Export filters. - * @returns selected export filters. - */ -export function initExportEntityFilters( - filterKeyValue: ExportFilterKeyExportCategory -): Filters { - const filters: Filters = []; - for (const [, { key, values }] of filterKeyValue) { - filters.push({ categoryKey: key, value: values }); - } - return filters; -} diff --git a/explorer/app/components/Detail/components/Export/components/ExportEntityToTerraForm/exportEntityToTerraForm.tsx b/explorer/app/components/Detail/components/Export/components/ExportEntityToTerraForm/exportEntityToTerraForm.tsx deleted file mode 100644 index a7e5d05c3..000000000 --- a/explorer/app/components/Detail/components/Export/components/ExportEntityToTerraForm/exportEntityToTerraForm.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { Filters } from "@clevercanary/data-explorer-ui/lib/common/entities"; -import { useFileManifestState } from "@clevercanary/data-explorer-ui/lib/hooks/useFileManifestState"; -import React, { useEffect, useState } from "react"; -import { ExportFilterKeyExportCategory } from "../../common/entities"; - -export interface ExportEntityToTerraFormProps { - entityFilters?: Filters; // Initial filters for the entity. - filterKeyValue: ExportFilterKeyExportCategory; -} - -export const ExportEntityToTerraForm = ({ - entityFilters, -}: ExportEntityToTerraFormProps): JSX.Element => { - const { updateFilters } = useFileManifestState(); - const [filters] = useState(entityFilters || []); - - // Set export filters with the entity id, and any selected filter categories. - useEffect(() => { - updateFilters(filters); - }, [filters, updateFilters]); - - return <>{/* Export entity form */}; -}; diff --git a/explorer/app/components/Export/components/BatchCorrectionWarning/batchCorrectionWarning.tsx b/explorer/app/components/Export/components/BatchCorrectionWarning/batchCorrectionWarning.tsx new file mode 100644 index 000000000..4c794e3c9 --- /dev/null +++ b/explorer/app/components/Export/components/BatchCorrectionWarning/batchCorrectionWarning.tsx @@ -0,0 +1,19 @@ +import { TagWarning } from "@clevercanary/data-explorer-ui/lib/components/common/Tag/tag.styles"; +import { + Link, + LinkProps, +} from "@clevercanary/data-explorer-ui/lib/components/Links/components/Link/link"; +import React from "react"; + +export const BatchCorrectionWarning = ({ + label, + url, +}: LinkProps): JSX.Element => { + return ( +

+ Please note Data normalization and batch + correction may differ between projects and processing methods. For details + see . +

+ ); +}; diff --git a/explorer/app/components/index.tsx b/explorer/app/components/index.tsx index d11593106..ba8914ad6 100644 --- a/explorer/app/components/index.tsx +++ b/explorer/app/components/index.tsx @@ -1,4 +1,5 @@ export { Alert } from "@clevercanary/data-explorer-ui/lib/components/common/Alert/alert"; +export { FluidAlert } from "@clevercanary/data-explorer-ui/lib/components/common/Alert/alert.styles"; export { ButtonGroup } from "@clevercanary/data-explorer-ui/lib/components/common/ButtonGroup/buttonGroup"; export { ContentCopyIconSmall, @@ -24,12 +25,13 @@ export { TagWarning } from "@clevercanary/data-explorer-ui/lib/components/common export { DetailViewTable } from "@clevercanary/data-explorer-ui/lib/components/Detail/components/DetailViewTable/detailViewTable"; export { DownloadCurlCommandForm } from "@clevercanary/data-explorer-ui/lib/components/Export/components/DownloadCurlCommand/components/DownloadCurlCommandForm/downloadCurlCommandForm"; export { DownloadCurlCommand } from "@clevercanary/data-explorer-ui/lib/components/Export/components/DownloadCurlCommand/downloadCurlCommand"; -export { ExportEntityToTerra } from "@clevercanary/data-explorer-ui/lib/components/Export/components/ExportEntityToTerra/exportEntityToTerra"; export { ExportMethod } from "@clevercanary/data-explorer-ui/lib/components/Export/components/ExportMethod/exportMethod"; export { ExportSelectedData } from "@clevercanary/data-explorer-ui/lib/components/Export/components/ExportSelectedData/exportSelectedData"; export { ExportCurrentQuery } from "@clevercanary/data-explorer-ui/lib/components/Export/components/ExportSummary/components/ExportCurrentQuery/exportCurrentQuery"; export { ExportSelectedDataSummary } from "@clevercanary/data-explorer-ui/lib/components/Export/components/ExportSummary/components/ExportSelectedDataSummary/exportSelectedDataSummary"; export { ExportSummary } from "@clevercanary/data-explorer-ui/lib/components/Export/components/ExportSummary/exportSummary"; +export { ExportToTerraForm } from "@clevercanary/data-explorer-ui/lib/components/Export/components/ExportToTerra/components/ExportToTerraForm/exportToTerraForm"; +export { ExportToTerra } from "@clevercanary/data-explorer-ui/lib/components/Export/components/ExportToTerra/exportToTerra"; export { AzulFileDownload } from "@clevercanary/data-explorer-ui/lib/components/Index/components/AzulFileDownload/azulFileDownload"; export { Cell } from "@clevercanary/data-explorer-ui/lib/components/Index/components/Cell/cell"; export { Summaries } from "@clevercanary/data-explorer-ui/lib/components/Index/components/Hero/components/Summaries/summaries"; @@ -54,7 +56,6 @@ export { MdxMarkdown } from "./common/MDXMarkdown/mdxMarkdown"; export { ConsentCodeList } from "./Detail/components/ConsentCodeList/consentCodeList"; export { ConsentTooltip } from "./Detail/components/ConsentTooltip/consentTooltip"; export { ConsortiumOverview } from "./Detail/components/Consortium/ConsortiumOverview/consortiumOverview"; -export { ExportEntityToTerraForm } from "./Detail/components/Export/components/ExportEntityToTerraForm/exportEntityToTerraForm"; export { FileLocationArchivePreview } from "./Detail/components/GeneratedMatricesTables/components/FileLocationArchivePreview/fileLocationArchivePreview"; export { FileLocationCopy } from "./Detail/components/GeneratedMatricesTables/components/FileLocationCopy/fileLocationCopy"; export { FileLocationDownload } from "./Detail/components/GeneratedMatricesTables/components/FileLocationDownload/fileLocationDownload"; diff --git a/explorer/app/content/anvil-cmg/index.tsx b/explorer/app/content/anvil-cmg/index.tsx index ae3e246f4..429322c6d 100644 --- a/explorer/app/content/anvil-cmg/index.tsx +++ b/explorer/app/content/anvil-cmg/index.tsx @@ -1,6 +1,6 @@ export { RenderComponent } from "@clevercanary/data-explorer-ui/lib/components/ComponentCreator/components/RenderComponent/renderComponent"; export { Section } from "../../components/common/MDXMarkdown/components/Section/mdxSection.styles"; -export { default as ExportToTerra } from "../common/exportToTerra.mdx"; +export { default as ExportToTerraStart } from "../common/exportToTerraStart.mdx"; export { default as ExportToTerraSuccess } from "../common/exportToTerraSuccess.mdx"; export { default as DataReleasePolicy } from "./dataReleasePolicy.mdx"; export { default as LoginTermsOfService } from "./loginTermsOfService.mdx"; diff --git a/explorer/app/content/common/exportToTerra.mdx b/explorer/app/content/common/exportToTerraStart.mdx similarity index 100% rename from explorer/app/content/common/exportToTerra.mdx rename to explorer/app/content/common/exportToTerraStart.mdx diff --git a/explorer/app/content/hca-dcp/downloadEntityCurlCommandStart.mdx b/explorer/app/content/hca-dcp/downloadCurlCommandStart.mdx similarity index 100% rename from explorer/app/content/hca-dcp/downloadEntityCurlCommandStart.mdx rename to explorer/app/content/hca-dcp/downloadCurlCommandStart.mdx diff --git a/explorer/app/content/hca-dcp/downloadCurlCommandSuccess.mdx b/explorer/app/content/hca-dcp/downloadCurlCommandSuccess.mdx new file mode 100644 index 000000000..b1c4960c6 --- /dev/null +++ b/explorer/app/content/hca-dcp/downloadCurlCommandSuccess.mdx @@ -0,0 +1,12 @@ +import { BatchCorrectionWarning } from "../../components/Export/components/BatchCorrectionWarning/batchCorrectionWarning"; + +### Your curl Command is Ready + +Execute the curl command below in your terminal to download the selected data. + + diff --git a/explorer/app/content/hca-dcp/downloadEntityCurlCommandSuccess.mdx b/explorer/app/content/hca-dcp/downloadEntityCurlCommandSuccess.mdx deleted file mode 100644 index b0b82c333..000000000 --- a/explorer/app/content/hca-dcp/downloadEntityCurlCommandSuccess.mdx +++ /dev/null @@ -1,13 +0,0 @@ -import { Link, TagWarning } from "../../components/index"; - -### Your curl Command is Ready - -Execute the curl command below in your terminal to download the selected data. - -Please note Data normalization and batch correction may -differ between projects and processing methods. For details see -. diff --git a/explorer/app/content/hca-dcp/exportToTerraStart.mdx b/explorer/app/content/hca-dcp/exportToTerraStart.mdx new file mode 100644 index 000000000..fa2862fe4 --- /dev/null +++ b/explorer/app/content/hca-dcp/exportToTerraStart.mdx @@ -0,0 +1,10 @@ +import { BatchCorrectionWarning } from "../../components/Export/components/BatchCorrectionWarning/batchCorrectionWarning"; + +### Export To Terra + + diff --git a/explorer/app/content/hca-dcp/exportToTerraSuccessWithWarning.mdx b/explorer/app/content/hca-dcp/exportToTerraSuccessWithWarning.mdx new file mode 100644 index 000000000..dfac9cbd4 --- /dev/null +++ b/explorer/app/content/hca-dcp/exportToTerraSuccessWithWarning.mdx @@ -0,0 +1,12 @@ +import { BatchCorrectionWarning } from "../../components/Export/components/BatchCorrectionWarning/batchCorrectionWarning"; + +### Your Terra Workspace Link is Ready + +Your Terra Workspace has been opened in a new browser tab. The workspace URL is referenced below. + + diff --git a/explorer/app/content/hca-dcp/index.tsx b/explorer/app/content/hca-dcp/index.tsx index b102534d2..9eb1141d7 100644 --- a/explorer/app/content/hca-dcp/index.tsx +++ b/explorer/app/content/hca-dcp/index.tsx @@ -3,12 +3,14 @@ export { Section, SectionActions, } from "../../components/common/MDXMarkdown/components/Section/mdxSection.styles"; -export { default as ExportToTerra } from "../common/exportToTerra.mdx"; +export { default as ExportToTerra } from "../common/exportToTerraStart.mdx"; export { default as ExportToTerraSuccess } from "../common/exportToTerraSuccess.mdx"; export { default as BatchCorrectionWarning } from "./batchCorrectionWarning.mdx"; export { default as ContributorGeneratedMatrices } from "./contributorGeneratedMatrices.mdx"; export { default as DataReleasePolicy } from "./dataReleasePolicy.mdx"; export { default as DCPGeneratedMatrices } from "./dcpGeneratedMatrices.mdx"; -export { default as DownloadEntityCurlCommandStart } from "./downloadEntityCurlCommandStart.mdx"; -export { default as DownloadEntityCurlCommandSuccess } from "./downloadEntityCurlCommandSuccess.mdx"; +export { default as DownloadCurlCommandStart } from "./downloadCurlCommandStart.mdx"; +export { default as DownloadCurlCommandSuccess } from "./downloadCurlCommandSuccess.mdx"; +export { default as ExportToTerraStart } from "./exportToTerraStart.mdx"; +export { default as ExportToTerraSuccessWithWarning } from "./exportToTerraSuccessWithWarning.mdx"; export { default as MatrixQuestionnaire } from "./matrixQuestionnaire.mdx"; diff --git a/explorer/app/hooks/azul/useExportEntityToTerraResponseURL.ts b/explorer/app/hooks/azul/useExportEntityToTerraResponseURL.ts deleted file mode 100644 index 37ab2f09e..000000000 --- a/explorer/app/hooks/azul/useExportEntityToTerraResponseURL.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { buildExportToTerraUrl } from "@clevercanary/data-explorer-ui/lib/components/Export/common/utils"; -import { useConfig } from "@clevercanary/data-explorer-ui/lib/hooks/useConfig"; -import { FileLocation } from "@clevercanary/data-explorer-ui/lib/hooks/useRequestFileLocation"; - -/** - * Returns the export to Terra response URL for the given request file location. - * @param requestParams - Export to terra request params. - * @param fileLocation - Request file location. - * @returns export to Terra request and response URLs. - */ -export const useExportEntityToTerraResponseURL = ( - requestParams: URLSearchParams, - fileLocation?: FileLocation -): string | undefined => { - const { config } = useConfig(); - const { exportToTerraUrl } = config; - const { location } = fileLocation || {}; - - if (!exportToTerraUrl || !location) { - return; - } - - // Build export to terra response URL - return buildExportToTerraUrl(exportToTerraUrl, requestParams, location); -}; diff --git a/explorer/app/hooks/azul/useFileManifestRequestParams.ts b/explorer/app/hooks/azul/useFileManifestRequestParams.ts deleted file mode 100644 index efbcb26e1..000000000 --- a/explorer/app/hooks/azul/useFileManifestRequestParams.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { - AZUL_PARAM, - ManifestDownloadFormat, -} from "@clevercanary/data-explorer-ui/lib/apis/azul/common/entities"; -import { transformFilters } from "@clevercanary/data-explorer-ui/lib/apis/azul/common/filterTransformer"; -import { useConfig } from "@clevercanary/data-explorer-ui/lib/hooks/useConfig"; -import { useFileManifestState } from "@clevercanary/data-explorer-ui/lib/hooks/useFileManifestState"; - -/** - * Returns the download file manifest request parameters for the given manifest format and filters. - * @param manifestFormat - Manifest format. - * @returns download file manifest request parameters. - */ -export const useFileManifestRequestParams = ( - manifestFormat: ManifestDownloadFormat -): URLSearchParams => { - const { filters } = useFileManifestState(); - const { config } = useConfig(); - const { dataSource } = config; - const { defaultDetailParams } = dataSource; - const { catalog } = defaultDetailParams || {}; - - // Build request params. - return new URLSearchParams({ - [AZUL_PARAM.CATALOG]: catalog, - format: manifestFormat, - [AZUL_PARAM.FILTERS]: transformFilters(filters), - }); -}; diff --git a/explorer/app/hooks/azul/useFileManifestRequestURL.ts b/explorer/app/hooks/azul/useFileManifestRequestURL.ts deleted file mode 100644 index 9bc043ab8..000000000 --- a/explorer/app/hooks/azul/useFileManifestRequestURL.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { useConfig } from "@clevercanary/data-explorer-ui/lib/hooks/useConfig"; - -/** - * Returns file manifest URL for the integrations end point and given request params. - * @param requestParams - Request params. - * @returns file manifest URL. - */ -export const useFileManifestRequestURL = ( - requestParams: URLSearchParams -): string => { - const { config } = useConfig(); - const { dataSource } = config; - const { url } = dataSource; - - // Build file manifest URL - return `${url}fetch/manifest/files?${requestParams.toString()}`; -}; diff --git a/explorer/app/viewModelBuilders/azul/anvil-cmg/common/viewModelBuilders.ts b/explorer/app/viewModelBuilders/azul/anvil-cmg/common/viewModelBuilders.ts index af250111e..d6587d899 100644 --- a/explorer/app/viewModelBuilders/azul/anvil-cmg/common/viewModelBuilders.ts +++ b/explorer/app/viewModelBuilders/azul/anvil-cmg/common/viewModelBuilders.ts @@ -1,7 +1,13 @@ import { LABEL } from "@clevercanary/data-explorer-ui/lib/apis/azul/common/entities"; import { CallToAction } from "@clevercanary/data-explorer-ui/lib/components/common/Button/components/CallToActionButton/callToActionButton"; import { ANCHOR_TARGET } from "@clevercanary/data-explorer-ui/lib/components/Links/common/entities"; +import { ViewContext } from "@clevercanary/data-explorer-ui/lib/config/entities"; +import { FILE_MANIFEST_TYPE } from "@clevercanary/data-explorer-ui/lib/hooks/useFileManifest/common/entities"; import React from "react"; +import { + FORM_FACETS, + ROUTE_EXPORT_TO_TERRA, +} from "../../../../../site-config/anvil-cmg/dev/export/constants"; import { URL_DATASETS } from "../../../../../site-config/anvil/dev/config"; import { AggregatedBioSampleResponse, @@ -60,17 +66,9 @@ import { getReportedEthnicities, } from "../../../../apis/azul/anvil-cmg/common/transformers"; import * as C from "../../../../components"; -import { - ExportFilterKey, - ExportFilterKeyExportCategory, -} from "../../../../components/Detail/components/Export/common/entities"; -import { initExportEntityFilters } from "../../../../components/Detail/components/Export/common/utils"; import { METADATA_KEY } from "../../../../components/Index/common/entities"; import { getPluralizedMetadataLabel } from "../../../../components/Index/common/indexTransformer"; import * as MDX from "../../../../content/anvil-cmg"; -import { useExportEntityToTerraResponseURL } from "../../../../hooks/azul/useExportEntityToTerraResponseURL"; -import { useFileManifestRequestParams } from "../../../../hooks/azul/useFileManifestRequestParams"; -import { useFileManifestRequestURL } from "../../../../hooks/azul/useFileManifestRequestURL"; /** * Build props for activity type Cell component from the given activities response. @@ -212,20 +210,6 @@ export const buildDataModality = ( }; }; -/** - * Build props for TitledText component for the display of the data release policy. - * @returns model to be used as props for the TitledText component. - */ -export const buildDataReleasePolicy = (): React.ComponentProps< - typeof C.TitledText -> => { - return { - text: [ - "Downloaded data is governed by the AnVIL Data Release Policy. For more information please see our Data Use Agreement.", - ], - }; -}; - /** * Build dataset access badge component from the given index/datasets response. * @param response - Response model return from index/datasets API. @@ -336,24 +320,89 @@ export const buildDocumentId = ( }; /** - * Build props for ExportEntityToTerra component from the given datasets response. + * Build props for ExportToTerra component from the given datasets response. * @param datasetsResponse - Response model return from datasets API. - * @returns model to be used as props for the ExportEntityToTerra component. + * @returns model to be used as props for the ExportToTerra component. */ export const buildExportEntityToTerra = ( datasetsResponse: DatasetsResponse -): React.ComponentProps => { - return { - ExportForm: (props) => - C.ExportEntityToTerraForm({ - ...getExportFormProps(datasetsResponse), - ...props, - }), - ExportToTerra: MDX.ExportToTerra, +): React.ComponentProps => { + return { + ExportForm: C.ExportToTerraForm, + ExportToTerraStart: MDX.ExportToTerraStart, ExportToTerraSuccess: MDX.ExportToTerraSuccess, - useExportParams: useFileManifestRequestParams, - useExportRequestURL: useFileManifestRequestURL, - useExportResponseURL: useExportEntityToTerraResponseURL, + entity: ["entryId", datasetsResponse.entryId], + fileManifestType: FILE_MANIFEST_TYPE.ENITY_EXPORT_TO_TERRA, + formFacets: FORM_FACETS, + }; +}; + +/** + * Build props for export Hero component. + * @param _ - Unused. + * @param viewContext - View context. + * @returns model to be used as props for the Hero component. + */ +export function buildExportHero( + _: Record, + viewContext: ViewContext +): React.ComponentProps { + const { exploreState } = viewContext; + const { tabValue } = exploreState || {}; + return { + breadcrumbs: [ + { path: `/${tabValue}`, text: "Explore" }, + { path: "", text: "Export Selected Data" }, + ], + title: "Choose Export Method", + }; +} + +/** + * Build props for export to terra Hero component. + * @param _ - Unused. + * @param viewContext - View context. + * @returns model to be used as props for the Hero component. + */ +export const buildExportMethodHeroTerra = ( + _: Record, + viewContext: ViewContext +): React.ComponentProps => { + const title = "Export to Terra"; + const { + exploreState: { tabValue }, + } = viewContext; + return getExportMethodHero(tabValue, title); +}; + +/** + * Build props for ExportMethod component for display of the export to terra metadata section. + * @returns model to be used as props for the ExportMethod component. + */ +export const buildExportMethodTerra = (): React.ComponentProps< + typeof C.ExportMethod +> => ({ + buttonLabel: "Analyze in Terra", + description: + "Terra is a biomedical research platform to analyze data using workflows, Jupyter Notebooks, RStudio, and Galaxy.", + disabled: false, + route: ROUTE_EXPORT_TO_TERRA, + title: "Export Study Data and Metadata to Terra Workspace", +}); + +/** + * Build props for ExportToTerra component. + * @returns model to be used as props for the ExportToTerra component. + */ +export const buildExportToTerra = (): React.ComponentProps< + typeof C.ExportToTerra +> => { + return { + ExportForm: C.ExportToTerraForm, + ExportToTerraStart: MDX.ExportToTerraStart, + ExportToTerraSuccess: MDX.ExportToTerraSuccess, + fileManifestType: FILE_MANIFEST_TYPE.EXPORT_TO_TERRA, + formFacets: FORM_FACETS, }; }; @@ -585,27 +634,6 @@ export const buildReportedEthnicities = ( }; }; -export const buildExportToCurlCommand = (): React.ComponentProps< - typeof C.ExportMethod -> => ({ - buttonLabel: "Request curl Command", - description: "Obtain a curl command for downloading the selected data.", - disabled: false, - route: "/export", - title: "Download Study Data and Metadata (Curl Command)", -}); - -export const buildExportToTerraMetadata = (): React.ComponentProps< - typeof C.ExportMethod -> => ({ - buttonLabel: "Analyze in Terra", - description: - "Terra is a biomedical research platform to analyze data using workflows, Jupyter Notebooks, RStudio, and Galaxy.", - disabled: false, - route: "/export/export-to-terra", - title: "Export Study Data and Metadata to Terra Workspace", -}); - /** * Returns the callToAction prop for the Hero component from the given datasets API. * @param datasetEntity - Response model return from datasets API. @@ -626,57 +654,21 @@ function getDatasetCallToAction( } /** - * Returns dataset file formats from the datasets API response. - * @param datasetsResponse - Response model return from datasets API. - * @returns dataset file formats. - */ -export function getDatasetFileFormats( - datasetsResponse: DatasetsResponse -): string[] { - const fileFormats = datasetsResponse.files - // TODO revisit mapping multiple file formats here to prevent an array of arrays - .map((file) => file.file_format) - .sort(); - return [...new Set(fileFormats)]; -} - -/** - * Returns the export filter key value pairs. - * The key-value pairs facilitate the functionality of an export filter form by enabling various - * options, such as selecting and choosing from a range of available categories such as file formats. - * @param datasetsResponse - Response model return from datasets API. - * @returns export filter key value pairs. + * Returns breadcrumbs and title for export method Hero component. + * @param explorePath - Explore path. + * @param title - Export method title. + * @returns model to be used as props for the Hero component. */ -export function getExportFilterKeySelectCategory( - datasetsResponse: DatasetsResponse -): ExportFilterKeyExportCategory { - // Build the available export filter key value pairs. - const filterKeyValue: ExportFilterKeyExportCategory = new Map(); - filterKeyValue.set(ExportFilterKey.ENTITY_ID, { - key: "entryId", - label: "Dataset", - values: [getDatasetId(datasetsResponse)], - }); - // TODO re-enable file format when form is completed - // filterKeyValue.set(ExportFilterKey.FILE_FORMAT, { - // key: "fileFormat", - // label: "File Type", - // values: getDatasetFileFormats(datasetsResponse), - // }); - return filterKeyValue; -} - -/** - * Returns props for ExportEntityToTerraForm component from the given datasets response. - * @param datasetsResponse - Response model return from datasets API. - * @returns model to be used as props for the ExportEntityToTerraForm component. - */ -export function getExportFormProps( - datasetsResponse: DatasetsResponse -): React.ComponentProps { - const filterKeyValue = getExportFilterKeySelectCategory(datasetsResponse); +function getExportMethodHero( + explorePath: string, + title: string +): React.ComponentProps { return { - entityFilters: initExportEntityFilters(filterKeyValue), - filterKeyValue, + breadcrumbs: [ + { path: `/${explorePath}`, text: "Explore" }, + { path: "/export", text: "Export Selected Data" }, + { path: "", text: title }, + ], + title: title, }; } diff --git a/explorer/app/viewModelBuilders/azul/anvil/common/viewModelBuilders.ts b/explorer/app/viewModelBuilders/azul/anvil/common/viewModelBuilders.ts index bca0c5893..c0cd8df14 100644 --- a/explorer/app/viewModelBuilders/azul/anvil/common/viewModelBuilders.ts +++ b/explorer/app/viewModelBuilders/azul/anvil/common/viewModelBuilders.ts @@ -173,20 +173,6 @@ export const buildDataModality = ( }; }; -/** - * Build props for TitledText component for the display of the data release policy. - * @returns model to be used as props for the TitledText component. - */ -export const buildDataReleasePolicy = (): React.ComponentProps< - typeof C.TitledText -> => { - return { - text: [ - "Downloaded data is governed by the AnVIL Data Release Policy. For more information please see our Data Use Agreement.", - ], - }; -}; - /** * Build dataset name Cell component from the given index/datasets response. * @param response - Response model return from index/datasets API. @@ -416,24 +402,3 @@ export const buildReportedEthnicities = ( values: getAggregatedReportedEthnicities(response), }; }; - -export const buildExportToCurlCommand = (): React.ComponentProps< - typeof C.ExportMethod -> => ({ - buttonLabel: "Request curl Command", - description: "Obtain a curl command for downloading the selected data.", - disabled: false, - route: "/export", - title: "Download Study Data and Metadata (Curl Command)", -}); - -export const buildExportToTerraMetadata = (): React.ComponentProps< - typeof C.ExportMethod -> => ({ - buttonLabel: "Analyze in Terra", - description: - "Terra is a biomedical research platform to analyze data using workflows, Jupyter Notebooks, RStudio, and Galaxy.", - disabled: false, - route: "/export/export-to-terra", - title: "Export Study Data and Metadata to Terra Workspace", -}); diff --git a/explorer/app/viewModelBuilders/azul/hca-dcp/common/viewModelBuilders.ts b/explorer/app/viewModelBuilders/azul/hca-dcp/common/viewModelBuilders.ts index 16744e1dd..7f9251e1a 100644 --- a/explorer/app/viewModelBuilders/azul/hca-dcp/common/viewModelBuilders.ts +++ b/explorer/app/viewModelBuilders/azul/hca-dcp/common/viewModelBuilders.ts @@ -13,7 +13,7 @@ import { getConfig } from "@clevercanary/data-explorer-ui/lib/config/config"; import { ViewContext } from "@clevercanary/data-explorer-ui/lib/config/entities"; import { FileFacet, - FILE_MANIFEST_ACTION, + FILE_MANIFEST_TYPE, } from "@clevercanary/data-explorer-ui/lib/hooks/useFileManifest/common/entities"; import { TEXT_BODY_400, @@ -28,7 +28,11 @@ import { HCA_DCP_CATEGORY_LABEL, } from "../../../../../site-config/hca-dcp/category"; import { PROJECTS_URL } from "../../../../../site-config/hca-dcp/dev/config"; -import { FORM_FACETS } from "../../../../../site-config/hca-dcp/dev/export/constants"; +import { + FORM_FACETS, + ROUTE_BULK_DOWNLOAD, + ROUTE_EXPORT_TO_TERRA, +} from "../../../../../site-config/hca-dcp/dev/export/constants"; import { processAggregatedOrArrayValue, processEntityArrayValue, @@ -44,17 +48,9 @@ import { SummaryResponse, } from "../../../../apis/azul/hca-dcp/common/responses"; import * as C from "../../../../components"; -import { - ExportFilterKey, - ExportFilterKeyExportCategory, -} from "../../../../components/Detail/components/Export/common/entities"; -import { initExportEntityFilters } from "../../../../components/Detail/components/Export/common/utils"; import { METADATA_KEY } from "../../../../components/Index/common/entities"; import { getPluralizedMetadataLabel } from "../../../../components/Index/common/indexTransformer"; import * as MDX from "../../../../content/hca-dcp"; -import { useExportEntityToTerraResponseURL } from "../../../../hooks/azul/useExportEntityToTerraResponseURL"; -import { useFileManifestRequestParams } from "../../../../hooks/azul/useFileManifestRequestParams"; -import { useFileManifestRequestURL } from "../../../../hooks/azul/useFileManifestRequestURL"; import { humanFileSize } from "../../../../utils/fileSize"; import { mapAccessions } from "./accessionMapper/accessionMapper"; import { Accession } from "./accessionMapper/entities"; @@ -161,7 +157,7 @@ export const buildAnalysisPortals = ( * @returns model to be used as props for the alert component. */ export const buildBatchCorrectionWarning = (): React.ComponentProps< - typeof C.Alert + typeof C.FluidAlert > => { return { children: MDX.RenderComponent({ Component: MDX.BatchCorrectionWarning }), @@ -374,6 +370,22 @@ export const buildDonorDisease = ( }; }; +/** + * Build props for DownloadCurlCommand component. + * @returns model to be used as props for the DownloadCurlCommand component. + */ +export const buildDownloadCurlCommand = (): React.ComponentProps< + typeof C.DownloadCurlCommand +> => { + return { + DownloadCurlForm: C.DownloadCurlCommandForm, + DownloadCurlStart: MDX.DownloadCurlCommandStart, + DownloadCurlSuccess: MDX.DownloadCurlCommandSuccess, + fileManifestType: FILE_MANIFEST_TYPE.BULK_DOWNLOAD, + formFacets: FORM_FACETS, + }; +}; + /** * Build props for DownloadCurlCommand component from the given projects response. * @param projectsResponse - Response model return from projects API. @@ -384,13 +396,13 @@ export const buildDownloadEntityCurlCommand = ( ): React.ComponentProps => { return { DownloadCurlForm: C.DownloadCurlCommandForm, - DownloadCurlStart: MDX.DownloadEntityCurlCommandStart, - DownloadCurlSuccess: MDX.DownloadEntityCurlCommandSuccess, + DownloadCurlStart: MDX.DownloadCurlCommandStart, + DownloadCurlSuccess: MDX.DownloadCurlCommandSuccess, entity: [ "projectId", processEntityValue(projectsResponse.projects, "projectId"), ], - fileManifestAction: FILE_MANIFEST_ACTION.ENTITY_BULK_DOWNLOAD, + fileManifestType: FILE_MANIFEST_TYPE.ENTITY_BULK_DOWNLOAD, formFacets: FORM_FACETS, }; }; @@ -435,24 +447,23 @@ export const buildExportCurrentQuery = (): React.ComponentProps< }; /** - * Build props for ExportEntityToTerra component from the given projects response. + * Build props for ExportToTerra component from the given projects response. * @param projectsResponse - Response model return from projects API. - * @returns model to be used as props for the ExportEntityToTerra component. + * @returns model to be used as props for the ExportToTerra component. */ export const buildExportEntityToTerra = ( projectsResponse: ProjectsResponse -): React.ComponentProps => { +): React.ComponentProps => { return { - ExportForm: (props) => - C.ExportEntityToTerraForm({ - ...getExportFormProps(projectsResponse), - ...props, - }), - ExportToTerra: MDX.ExportToTerra, + ExportForm: C.ExportToTerraForm, + ExportToTerraStart: MDX.ExportToTerra, ExportToTerraSuccess: MDX.ExportToTerraSuccess, - useExportParams: useFileManifestRequestParams, - useExportRequestURL: useFileManifestRequestURL, - useExportResponseURL: useExportEntityToTerraResponseURL, + entity: [ + "projectId", + processEntityValue(projectsResponse.projects, "projectId"), + ], + fileManifestType: FILE_MANIFEST_TYPE.ENITY_EXPORT_TO_TERRA, + formFacets: FORM_FACETS, }; }; @@ -478,49 +489,99 @@ export function buildExportHero( } /** - * Build props for ExportSelectedDataSummary component. - * @returns model to be used as props for the ExportSelectedDataSummary component. - */ -export const buildExportSelectedDataSummary = (): React.ComponentProps< - typeof C.ExportSelectedDataSummary -> => { - return { - getExportSelectedDataSummary: ( - filesFacets: FileFacet[], - summary?: SummaryResponse - ) => getExportSelectedDataSummary(filesFacets, summary), - }; -}; - -/** - * Build props for ExportMethod component for display of the download to curl command metadata section. + * Build props for ExportMethod component for display of the download to curl command section. * @returns model to be used as props for the ExportMethod component. */ -export const buildExportToCurlCommand = (): React.ComponentProps< +export const buildExportMethodBulkDownload = (): React.ComponentProps< typeof C.ExportMethod > => ({ buttonLabel: "Request curl Command", description: "Obtain a curl command for downloading the selected data.", disabled: false, - route: "/export/get-curl-command", + route: ROUTE_BULK_DOWNLOAD, title: "Download Study Data and Metadata (Curl Command)", }); /** - * Build props for ExportMethod component for display of the export to terra metadata section. + * Build props for download curl command Hero component. + * @param _ - Unused. + * @param viewContext - View context. + * @returns model to be used as props for the Hero component. + */ +export const buildExportMethodHeroCurlCommand = ( + _: Record, + viewContext: ViewContext +): React.ComponentProps => { + const title = 'Download Selected Data Using "curl"'; + const { + exploreState: { tabValue }, + } = viewContext; + return getExportMethodHero(tabValue, title); +}; + +/** + * Build props for export to terra Hero component. + * @param _ - Unused. + * @param viewContext - View context. + * @returns model to be used as props for the Hero component. + */ +export const buildExportMethodHeroTerra = ( + _: Record, + viewContext: ViewContext +): React.ComponentProps => { + const title = "Export to Terra"; + const { + exploreState: { tabValue }, + } = viewContext; + return getExportMethodHero(tabValue, title); +}; + +/** + * Build props for ExportMethod component for display of the export to terra section. * @returns model to be used as props for the ExportMethod component. */ -export const buildExportToTerraMetadata = (): React.ComponentProps< +export const buildExportMethodTerra = (): React.ComponentProps< typeof C.ExportMethod > => ({ buttonLabel: "Analyze in Terra", description: "Terra is a biomedical research platform to analyze data using workflows, Jupyter Notebooks, RStudio, and Galaxy.", disabled: false, - route: "/export/export-to-terra", + route: ROUTE_EXPORT_TO_TERRA, title: "Export Study Data and Metadata to Terra Workspace", }); +/** + * Build props for ExportSelectedDataSummary component. + * @returns model to be used as props for the ExportSelectedDataSummary component. + */ +export const buildExportSelectedDataSummary = (): React.ComponentProps< + typeof C.ExportSelectedDataSummary +> => { + return { + getExportSelectedDataSummary: ( + filesFacets: FileFacet[], + summary?: SummaryResponse + ) => getExportSelectedDataSummary(filesFacets, summary), + }; +}; + +/** + * Build props for ExportToTerra component. + * @returns model to be used as props for the ExportToTerra component. + */ +export const buildExportToTerra = (): React.ComponentProps< + typeof C.ExportToTerra +> => { + return { + ExportForm: C.ExportToTerraForm, + ExportToTerraStart: MDX.ExportToTerraStart, + ExportToTerraSuccess: MDX.ExportToTerraSuccessWithWarning, + fileManifestType: FILE_MANIFEST_TYPE.EXPORT_TO_TERRA, + formFacets: FORM_FACETS, + }; +}; + /** * Build props for the KeyValuePairs component for displaying project file counts from the given projects response. * @param projectsResponse - Response model return from projects API. @@ -1051,54 +1112,6 @@ export function getExportCurrentProjectQuery( ]; } -/** - * Returns the export filter key value pairs. - * The key-value pairs facilitate the functionality of an export filter form by enabling various - * options, such as selecting and choosing from a range of available categories such as genus species and file formats. - * @param projectsResponse - Response model return from projects API. - * @returns export filter key value pairs. - */ -export function getExportFilterKeySelectCategory( - projectsResponse: ProjectsResponse -): ExportFilterKeyExportCategory { - // Build the available export filter key value pairs. - const filterKeyValue: ExportFilterKeyExportCategory = new Map(); - filterKeyValue.set(ExportFilterKey.ENTITY_ID, { - key: "projectId", - label: "Project", - values: [processEntityValue(projectsResponse.projects, "projectId")], - }); - filterKeyValue.set(ExportFilterKey.GENUS_SPECIES, { - key: HCA_DCP_CATEGORY_KEY.GENUS_SPECIES, - label: "Species", - values: processAggregatedOrArrayValue( - projectsResponse.donorOrganisms, - HCA_DCP_CATEGORY_KEY.GENUS_SPECIES - ), - }); - filterKeyValue.set(ExportFilterKey.FILE_FORMAT, { - key: HCA_DCP_CATEGORY_KEY.FILE_FORMAT, - label: "File Type", - values: getProjectFileFormats(projectsResponse), - }); - return filterKeyValue; -} - -/** - * Returns props for ExportEntityToTerraForm component from the given projects response. - * @param projectsResponse - Response model return from projects API. - * @returns model to be used as props for the ExportEntityToTerraForm component. - */ -export function getExportFormProps( - projectsResponse: ProjectsResponse -): React.ComponentProps { - const filterKeyValue = getExportFilterKeySelectCategory(projectsResponse); - return { - entityFilters: initExportEntityFilters(filterKeyValue), - filterKeyValue, - }; -} - /** * Returns the key value pairs for the file counts component. * @param projectsResponse - Response model return from projects API. @@ -1120,6 +1133,26 @@ function getFileCountsKeyValuePairs( return keyValuePairs; } +/** + * Returns breadcrumbs and title for export method Hero component. + * @param explorePath - Explore path. + * @param title - Export method title. + * @returns model to be used as props for the Hero component. + */ +function getExportMethodHero( + explorePath: string, + title: string +): React.ComponentProps { + return { + breadcrumbs: [ + { path: `/${explorePath}`, text: "Explore" }, + { path: "/export", text: "Export Selected Data" }, + { path: "", text: title }, + ], + title: title, + }; +} + /** * Returns generated matrices actions column def. * @returns actions column def. diff --git a/explorer/package-lock.json b/explorer/package-lock.json index 4a1fbebf0..14cf0b5a8 100644 --- a/explorer/package-lock.json +++ b/explorer/package-lock.json @@ -8,7 +8,7 @@ "name": "explorer", "version": "0.1.0", "dependencies": { - "@clevercanary/data-explorer-ui": "0.31.0", + "@clevercanary/data-explorer-ui": "0.32.0", "@emotion/react": "11.11.1", "@emotion/styled": "11.11.0", "@mdx-js/loader": "^2.3.0", @@ -2119,9 +2119,9 @@ "dev": true }, "node_modules/@clevercanary/data-explorer-ui": { - "version": "0.31.0", - "resolved": "https://registry.npmjs.org/@clevercanary/data-explorer-ui/-/data-explorer-ui-0.31.0.tgz", - "integrity": "sha512-UU838fcSaKCWljd8pGKyP2HYCp3YeDSRRGAsWS+sCmucqdrcTdjeOuNlRP8Tbt8xYGDuO2r1qcbJmf+0CtrzQw==", + "version": "0.32.0", + "resolved": "https://registry.npmjs.org/@clevercanary/data-explorer-ui/-/data-explorer-ui-0.32.0.tgz", + "integrity": "sha512-NLA1VBpKmqrN+Noqd75T4B2g4/c2sdPyzlr9I84UZ2zT4iegpOrdJGrqYlSUPbapm8IqKaa0mHvRdrP6pWoHAw==", "peerDependencies": { "@emotion/react": "11.11.1", "@emotion/styled": "11.11.0", @@ -25187,9 +25187,9 @@ "dev": true }, "@clevercanary/data-explorer-ui": { - "version": "0.31.0", - "resolved": "https://registry.npmjs.org/@clevercanary/data-explorer-ui/-/data-explorer-ui-0.31.0.tgz", - "integrity": "sha512-UU838fcSaKCWljd8pGKyP2HYCp3YeDSRRGAsWS+sCmucqdrcTdjeOuNlRP8Tbt8xYGDuO2r1qcbJmf+0CtrzQw==", + "version": "0.32.0", + "resolved": "https://registry.npmjs.org/@clevercanary/data-explorer-ui/-/data-explorer-ui-0.32.0.tgz", + "integrity": "sha512-NLA1VBpKmqrN+Noqd75T4B2g4/c2sdPyzlr9I84UZ2zT4iegpOrdJGrqYlSUPbapm8IqKaa0mHvRdrP6pWoHAw==", "requires": {} }, "@colors/colors": { diff --git a/explorer/package.json b/explorer/package.json index 6092ffdf9..73a26f1d9 100644 --- a/explorer/package.json +++ b/explorer/package.json @@ -33,7 +33,7 @@ "test:anvil-catalog": "playwright test -c playwright_anvil-catalog.config.ts" }, "dependencies": { - "@clevercanary/data-explorer-ui": "0.31.0", + "@clevercanary/data-explorer-ui": "0.32.0", "@emotion/react": "11.11.1", "@emotion/styled": "11.11.0", "@mdx-js/loader": "^2.3.0", diff --git a/explorer/pages/export/export-to-terra.tsx b/explorer/pages/export/export-to-terra.tsx index f5fd3636a..2dac531de 100644 --- a/explorer/pages/export/export-to-terra.tsx +++ b/explorer/pages/export/export-to-terra.tsx @@ -1,12 +1,12 @@ -import { ExportToTerraView } from "@clevercanary/data-explorer-ui/lib/views/ExportToTerraView/exportToTerraView"; +import { ExportMethodView } from "@clevercanary/data-explorer-ui/lib/views/ExportMethodView/exportMethodView"; import React from "react"; /** - * Export page. - * @returns Element rendered as export page. + * Export method page. + * @returns export method view component. */ -const ExportToTerraPage = (): JSX.Element => { - return ; +const ExportMethodPage = (): JSX.Element => { + return ; }; -export default ExportToTerraPage; +export default ExportMethodPage; diff --git a/explorer/pages/export/get-curl-command.tsx b/explorer/pages/export/get-curl-command.tsx index 3b0bfcf8a..b083e872d 100644 --- a/explorer/pages/export/get-curl-command.tsx +++ b/explorer/pages/export/get-curl-command.tsx @@ -1,32 +1,12 @@ -import { DownloadCurlCommandForm } from "@clevercanary/data-explorer-ui/lib/components/Export/components/DownloadCurlCommand/components/DownloadCurlCommandForm/downloadCurlCommandForm"; -import { DownloadCurlCommand } from "@clevercanary/data-explorer-ui/lib/components/Export/components/DownloadCurlCommand/downloadCurlCommand"; -import { FILE_MANIFEST_ACTION } from "@clevercanary/data-explorer-ui/lib/hooks/useFileManifest/common/entities"; import { ExportMethodView } from "@clevercanary/data-explorer-ui/lib/views/ExportMethodView/exportMethodView"; import React from "react"; -import * as MDX from "../../app/content/hca-dcp"; -import { FORM_FACETS } from "../../site-config/hca-dcp/dev/export/constants"; - -const TITLE = 'Download Selected Data Using "curl"'; /** * Download curl command page. * @returns download curl command view component. */ const GetCurlCommandPage = (): JSX.Element => { - return ( - - } - title={TITLE} - /> - ); + return ; }; export default GetCurlCommandPage; diff --git a/explorer/site-config/anvil-cmg/dev/detail/dataset/exportMainColumn.ts b/explorer/site-config/anvil-cmg/dev/detail/dataset/exportMainColumn.ts index e9e922e8b..841a65308 100644 --- a/explorer/site-config/anvil-cmg/dev/detail/dataset/exportMainColumn.ts +++ b/explorer/site-config/anvil-cmg/dev/detail/dataset/exportMainColumn.ts @@ -5,7 +5,7 @@ import * as V from "../../../../../app/viewModelBuilders/azul/anvil-cmg/common/v export const mainColumn: ComponentConfig[] = [ { - component: C.ExportEntityToTerra, + component: C.ExportToTerra, viewBuilder: V.buildExportEntityToTerra, - } as ComponentConfig, + } as ComponentConfig, ]; diff --git a/explorer/site-config/anvil-cmg/dev/export/constants.ts b/explorer/site-config/anvil-cmg/dev/export/constants.ts new file mode 100644 index 000000000..7a46afe61 --- /dev/null +++ b/explorer/site-config/anvil-cmg/dev/export/constants.ts @@ -0,0 +1,3 @@ +export const FORM_FACETS = []; + +export const ROUTE_EXPORT_TO_TERRA = "/export/export-to-terra"; diff --git a/explorer/site-config/anvil-cmg/dev/export/export.ts b/explorer/site-config/anvil-cmg/dev/export/export.ts index 128659a18..6b55e3c1c 100644 --- a/explorer/site-config/anvil-cmg/dev/export/export.ts +++ b/explorer/site-config/anvil-cmg/dev/export/export.ts @@ -1,41 +1,67 @@ import { - BackPageConfig, ComponentConfig, + ExportConfig, } from "@clevercanary/data-explorer-ui/lib/config/entities"; -import * as C from "app/components"; -import * as T from "../../../../app/viewModelBuilders/azul/anvil/common/viewModelBuilders"; +import * as C from "../../../../app/components"; +import * as MDX from "../../../../app/content/anvil-cmg"; +import * as V from "../../../../app/viewModelBuilders/azul/anvil-cmg/common/viewModelBuilders"; +import { ROUTE_EXPORT_TO_TERRA } from "./constants"; -export const exportConfig: BackPageConfig = { - detailOverviews: [], +export const exportConfig: ExportConfig = { + exportMethods: [ + { + mainColumn: [ + { + component: C.ExportToTerra, + viewBuilder: V.buildExportToTerra, + } as ComponentConfig, + ], + route: ROUTE_EXPORT_TO_TERRA, + top: [ + { + component: C.BackPageHero, + viewBuilder: V.buildExportMethodHeroTerra, + } as ComponentConfig, + ], + }, + ], staticLoad: true, //TODO is this correct? tabs: [ { label: "Choose Export Method", mainColumn: [ { - component: C.ExportMethod, - viewBuilder: T.buildExportToTerraMetadata, - } as ComponentConfig, + children: [ + { + component: C.ExportMethod, + viewBuilder: V.buildExportMethodTerra, + } as ComponentConfig, + ], + component: C.ExportSelectedData, + } as ComponentConfig, ], route: "/export", sideColumn: [ { - component: C.TitledText, - viewBuilder: T.buildDataReleasePolicy, - } as ComponentConfig, + children: [ + { + children: [ + { + component: MDX.DataReleasePolicy, + } as ComponentConfig, + ], + component: MDX.Section, + } as ComponentConfig, + ], + component: C.FluidPaper, + } as ComponentConfig, ], }, ], top: [ { component: C.BackPageHero, - props: { - breadcrumbs: [ - { path: "/datasets", text: "Datasets" }, - { path: "/export", text: "Export" }, - ], - title: "Choose Export Method", - }, + viewBuilder: V.buildExportHero, } as ComponentConfig, ], }; diff --git a/explorer/site-config/anvil/dev/config.ts b/explorer/site-config/anvil/dev/config.ts index 8385190a0..902abc139 100644 --- a/explorer/site-config/anvil/dev/config.ts +++ b/explorer/site-config/anvil/dev/config.ts @@ -5,7 +5,6 @@ import { CATALOG_DEFAULT } from "../../../app/apis/azul/anvil/common/constants"; import { authenticationConfig } from "./authentication/authentication"; import { ANVIL_CATEGORY_KEY, ANVIL_CATEGORY_LABEL } from "./category"; import { socials } from "./constants"; -import { exportConfig } from "./export/export"; import { activitiesEntityConfig } from "./index/activitiesEntityConfig"; import { biosamplesEntityConfig } from "./index/biosamplesEntityConfig"; import { datasetsEntityConfig } from "./index/datasetsEntityConfig"; @@ -93,8 +92,6 @@ const config: SiteConfig = { filesEntityConfig, ], explorerTitle: "Anvil Data Explorer", - export: exportConfig, - exportToTerraUrl: "https://app.terra.bio", layout: { footer: { logos: [ diff --git a/explorer/site-config/anvil/dev/export/export.ts b/explorer/site-config/anvil/dev/export/export.ts deleted file mode 100644 index d1defe4a5..000000000 --- a/explorer/site-config/anvil/dev/export/export.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { - BackPageConfig, - ComponentConfig, -} from "@clevercanary/data-explorer-ui/lib/config/entities"; -import * as C from "app/components"; -import * as T from "../../../../app/viewModelBuilders/azul/anvil/common/viewModelBuilders"; - -export const exportConfig: BackPageConfig = { - detailOverviews: [], - staticLoad: true, - tabs: [ - { - label: "Choose Export Method", - mainColumn: [ - { - component: C.ExportMethod, - viewBuilder: T.buildExportToCurlCommand, - } as ComponentConfig, - { - component: C.ExportMethod, - viewBuilder: T.buildExportToTerraMetadata, - } as ComponentConfig, - ], - route: "/export", - sideColumn: [ - { - component: C.TitledText, - viewBuilder: T.buildDataReleasePolicy, - } as ComponentConfig, - ], - }, - ], - top: [ - { - component: C.BackPageHero, - props: { - breadcrumbs: [ - { path: "/datasets", text: "Datasets" }, - { path: "/export", text: "Export" }, - ], - title: "Choose Export Method", - }, - } as ComponentConfig, - ], -}; diff --git a/explorer/site-config/hca-dcp/dev/detail/project/exportMainColumn.ts b/explorer/site-config/hca-dcp/dev/detail/project/exportMainColumn.ts index 3bdb02391..2d7146c26 100644 --- a/explorer/site-config/hca-dcp/dev/detail/project/exportMainColumn.ts +++ b/explorer/site-config/hca-dcp/dev/detail/project/exportMainColumn.ts @@ -5,11 +5,11 @@ import * as V from "../../../../../app/viewModelBuilders/azul/hca-dcp/common/vie export const mainColumn: ComponentConfig[] = [ { - component: C.Alert, + component: C.FluidAlert, viewBuilder: V.buildBatchCorrectionWarning, - } as ComponentConfig, + } as ComponentConfig, { - component: C.ExportEntityToTerra, + component: C.ExportToTerra, viewBuilder: V.buildExportEntityToTerra, - } as ComponentConfig, + } as ComponentConfig, ]; diff --git a/explorer/site-config/hca-dcp/dev/detail/project/matricesMainColumn.ts b/explorer/site-config/hca-dcp/dev/detail/project/matricesMainColumn.ts index 444290c95..507dd6c7d 100644 --- a/explorer/site-config/hca-dcp/dev/detail/project/matricesMainColumn.ts +++ b/explorer/site-config/hca-dcp/dev/detail/project/matricesMainColumn.ts @@ -6,9 +6,9 @@ import * as V from "../../../../../app/viewModelBuilders/azul/hca-dcp/common/vie export const mainColumn: ComponentConfig[] = [ { - component: C.Alert, + component: C.FluidAlert, viewBuilder: V.buildBatchCorrectionWarning, - } as ComponentConfig, + } as ComponentConfig, { children: [ { diff --git a/explorer/site-config/hca-dcp/dev/export/constants.ts b/explorer/site-config/hca-dcp/dev/export/constants.ts index e5a9c560c..3e2c0182a 100644 --- a/explorer/site-config/hca-dcp/dev/export/constants.ts +++ b/explorer/site-config/hca-dcp/dev/export/constants.ts @@ -7,3 +7,6 @@ export const FORM_FACETS = [ label: "File Type", }, ]; + +export const ROUTE_BULK_DOWNLOAD = "/export/get-curl-command"; +export const ROUTE_EXPORT_TO_TERRA = "/export/export-to-terra"; diff --git a/explorer/site-config/hca-dcp/dev/export/export.ts b/explorer/site-config/hca-dcp/dev/export/export.ts index 9476815eb..2708b0883 100644 --- a/explorer/site-config/hca-dcp/dev/export/export.ts +++ b/explorer/site-config/hca-dcp/dev/export/export.ts @@ -1,13 +1,45 @@ import { - BackPageConfig, ComponentConfig, + ExportConfig, } from "@clevercanary/data-explorer-ui/lib/config/entities"; import * as C from "app/components"; import * as MDX from "../../../../app/content/hca-dcp"; import * as V from "../../../../app/viewModelBuilders/azul/hca-dcp/common/viewModelBuilders"; +import { ROUTE_BULK_DOWNLOAD, ROUTE_EXPORT_TO_TERRA } from "./constants"; -export const exportConfig: BackPageConfig = { - detailOverviews: [], +export const exportConfig: ExportConfig = { + exportMethods: [ + { + mainColumn: [ + { + component: C.DownloadCurlCommand, + viewBuilder: V.buildDownloadCurlCommand, + } as ComponentConfig, + ], + route: ROUTE_BULK_DOWNLOAD, + top: [ + { + component: C.BackPageHero, + viewBuilder: V.buildExportMethodHeroCurlCommand, + } as ComponentConfig, + ], + }, + { + mainColumn: [ + { + component: C.ExportToTerra, + viewBuilder: V.buildExportToTerra, + } as ComponentConfig, + ], + route: ROUTE_EXPORT_TO_TERRA, + top: [ + { + component: C.BackPageHero, + viewBuilder: V.buildExportMethodHeroTerra, + } as ComponentConfig, + ], + }, + ], staticLoad: true, tabs: [ { @@ -17,11 +49,11 @@ export const exportConfig: BackPageConfig = { children: [ { component: C.ExportMethod, - viewBuilder: V.buildExportToCurlCommand, + viewBuilder: V.buildExportMethodBulkDownload, } as ComponentConfig, { component: C.ExportMethod, - viewBuilder: V.buildExportToTerraMetadata, + viewBuilder: V.buildExportMethodTerra, } as ComponentConfig, ], component: C.ExportSelectedData, diff --git a/explorer/site-config/lungmap/dev/export/exportConfig.ts b/explorer/site-config/lungmap/dev/export/exportConfig.ts index abb309b6f..1de3189e1 100644 --- a/explorer/site-config/lungmap/dev/export/exportConfig.ts +++ b/explorer/site-config/lungmap/dev/export/exportConfig.ts @@ -1,12 +1,12 @@ import { - BackPageConfig, ComponentConfig, + ExportConfig, } from "@clevercanary/data-explorer-ui/lib/config/entities"; import * as C from "../../../../app/components"; import * as MDX from "../../../../app/content/lungmap"; import { exportConfig as hcaExportConfig } from "../../../hca-dcp/dev/export/export"; -export const exportConfig: BackPageConfig = { +export const exportConfig: ExportConfig = { ...hcaExportConfig, tabs: [ {