From db53b475ccf6b77d20c0a0ad2523e2e04ad8d10e Mon Sep 17 00:00:00 2001 From: Jarvis Raymond Date: Thu, 22 Feb 2024 13:50:47 -0600 Subject: [PATCH] feat(downloadVariableMetadataButton): reverted login button changes to ActionButtons per discussion with stakeholders --- .../ActionButtons/ActionButtons.tsx | 156 +++++++----------- 1 file changed, 59 insertions(+), 97 deletions(-) diff --git a/src/Discovery/DiscoveryDetails/DataDownloadList/ActionButtons/ActionButtons.tsx b/src/Discovery/DiscoveryDetails/DataDownloadList/ActionButtons/ActionButtons.tsx index 6efc115a66..3d278c5f97 100644 --- a/src/Discovery/DiscoveryDetails/DataDownloadList/ActionButtons/ActionButtons.tsx +++ b/src/Discovery/DiscoveryDetails/DataDownloadList/ActionButtons/ActionButtons.tsx @@ -1,5 +1,7 @@ import React, { useEffect, useState } from 'react'; -import { Col, Row, Button, Popover } from 'antd'; +import { + Col, Row, Button, Popover, +} from 'antd'; import { useHistory, useLocation } from 'react-router-dom'; import { DiscoveryConfig } from '../../../DiscoveryConfig'; import { DiscoveryResource } from '../../../Discovery'; @@ -34,28 +36,26 @@ const ActionButtons = ({ const history = useHistory(); const location = useLocation(); - const studyMetadataFieldNameReference: string | undefined = - discoveryConfig?.features.exportToWorkspace.studyMetadataFieldName; - const manifestFieldName: string | undefined = - discoveryConfig?.features.exportToWorkspace.manifestFieldName; + const studyMetadataFieldNameReference: string | undefined = discoveryConfig?.features.exportToWorkspace.studyMetadataFieldName; + const manifestFieldName: string | undefined = discoveryConfig?.features.exportToWorkspace.manifestFieldName; const showDownloadStudyLevelMetadataButton = Boolean( - discoveryConfig?.features.exportToWorkspace.enableDownloadStudyMetadata && - studyMetadataFieldNameReference && - resourceInfo?.[studyMetadataFieldNameReference] + discoveryConfig?.features.exportToWorkspace.enableDownloadStudyMetadata + && studyMetadataFieldNameReference + && resourceInfo?.[studyMetadataFieldNameReference], ); const showDownloadFileManifestButtons = Boolean( - discoveryConfig?.features.exportToWorkspace.enableDownloadManifest + discoveryConfig?.features.exportToWorkspace.enableDownloadManifest, ); const showDownloadAllFilesButtons = Boolean( - discoveryConfig?.features.exportToWorkspace.enableDownloadZip + discoveryConfig?.features.exportToWorkspace.enableDownloadZip, ); const verifyExternalLoginsNeeded = Boolean( - discoveryConfig?.features.exportToWorkspace.verifyExternalLogins + discoveryConfig?.features.exportToWorkspace.verifyExternalLogins, ); const showDownloadVariableMetadataButton = Boolean( - discoveryConfig.features.exportToWorkspace.variableMetadataFieldName && - discoveryConfig.features.exportToWorkspace.enableDownloadVariableMetadata + discoveryConfig.features.exportToWorkspace.variableMetadataFieldName + && discoveryConfig.features.exportToWorkspace.enableDownloadVariableMetadata, ); const [dataDictionaryInfo, setDataDictionaryInfo] = useState({ noVariableLevelMetadata: true, @@ -67,18 +67,17 @@ const ActionButtons = ({ discoveryConfig, resourceInfo, showDownloadVariableMetadataButton, - setDataDictionaryInfo + setDataDictionaryInfo, ); }, [resourceInfo]); - const ConditionalPopover = ({ children }) => - noData ? ( - - {children} - - ) : ( - children - ); + const ConditionalPopover = ({ children }) => (noData ? ( + + {children} + + ) : ( + children + )); return (
@@ -89,77 +88,42 @@ const ActionButtons = ({ {showDownloadVariableMetadataButton && ( - {isUserLoggedIn && !healLoginNeeded && ( - - )} - {!dataDictionaryInfo.noVariableLevelMetadata && - (!isUserLoggedIn || healLoginNeeded) && ( - + )} {showDownloadStudyLevelMetadataButton && ( - {isUserLoggedIn && !healLoginNeeded && ( - - - - )} - {(!isUserLoggedIn || healLoginNeeded) && ( + - )} + )} {showDownloadFileManifestButtons && ( @@ -173,7 +137,7 @@ const ActionButtons = ({ HandleDownloadManifestClick( discoveryConfig, [resourceInfo], - healLoginNeeded + healLoginNeeded, ); }} > @@ -189,7 +153,7 @@ const ActionButtons = ({ HandleRedirectToLoginClick( resourceInfo, discoveryConfig, - 'manifest' + 'manifest', ); }} > @@ -207,18 +171,16 @@ const ActionButtons = ({ className='discovery-action-bar-button' disabled={Boolean(noData || downloadStatus.inProgress)} loading={downloadStatus.inProgress === 'DownloadAllFiles'} - onClick={() => - DownloadAllFiles( - resourceInfo, - downloadStatus, - setDownloadStatus, - history, - location, - healLoginNeeded, - verifyExternalLoginsNeeded, - manifestFieldName - ) - } + onClick={() => DownloadAllFiles( + resourceInfo, + downloadStatus, + setDownloadStatus, + history, + location, + healLoginNeeded, + verifyExternalLoginsNeeded, + manifestFieldName, + )} > Download All Files @@ -232,7 +194,7 @@ const ActionButtons = ({ HandleRedirectToLoginClick( resourceInfo, discoveryConfig, - 'download' + 'download', ); }} >