From 32953c10fb2812b2f786266230ad25f501d610b3 Mon Sep 17 00:00:00 2001 From: cosa65 Date: Fri, 15 Dec 2023 10:25:59 -0300 Subject: [PATCH 1/3] Add custom message for cell metadata upload not ready Signed-off-by: cosa65 --- src/components/data-management/LaunchAnalysisButton.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/data-management/LaunchAnalysisButton.jsx b/src/components/data-management/LaunchAnalysisButton.jsx index 2ad57a81eb..f9751d6f66 100644 --- a/src/components/data-management/LaunchAnalysisButton.jsx +++ b/src/components/data-management/LaunchAnalysisButton.jsx @@ -164,9 +164,12 @@ const LaunchAnalysisButton = () => { } if (!canLaunchAnalysis()) { + const message = !cellLevelMetadataIsReady + ? 'Ensure that the cell level metadata file is uploaded correctly' + : 'Ensure that all samples are uploaded successfully and all relevant metadata is inserted.'; return ( {/* disabled button inside tooltip causes tooltip to not function */} {/* https://github.com/react-component/tooltip/issues/18#issuecomment-140078802 */} From 76e9cb3e26e3ca834e02b691b8616352ac7803de Mon Sep 17 00:00:00 2001 From: cosa65 Date: Fri, 15 Dec 2023 12:38:41 -0300 Subject: [PATCH 2/3] Add icon when there is an error Signed-off-by: cosa65 --- .../data-management/LaunchAnalysisButton.jsx | 73 ++++++++++++++----- 1 file changed, 54 insertions(+), 19 deletions(-) diff --git a/src/components/data-management/LaunchAnalysisButton.jsx b/src/components/data-management/LaunchAnalysisButton.jsx index 6b52b03f0f..9243109187 100644 --- a/src/components/data-management/LaunchAnalysisButton.jsx +++ b/src/components/data-management/LaunchAnalysisButton.jsx @@ -1,7 +1,7 @@ import React, { useState, useCallback, useEffect } from 'react'; import { useSelector, useDispatch } from 'react-redux'; import { - Button, Tooltip, Popconfirm, + Button, Tooltip, Popconfirm, Typography, Space, } from 'antd'; import _ from 'lodash'; @@ -12,25 +12,9 @@ import integrationTestConstants from 'utils/integrationTestConstants'; import { useAppRouter } from 'utils/AppRouteProvider'; import calculatePipelinesRerunStatus from 'utils/data-management/calculatePipelinesRerunStatus'; +import { WarningOutlined } from '@ant-design/icons'; -const LaunchButtonTemplate = (props) => { - const { - // eslint-disable-next-line react/prop-types - onClick, disabled, text, loading, - } = props; - - return ( - - ); -}; +const { Text } = Typography; const LaunchAnalysisButton = () => { const dispatch = useDispatch(); @@ -127,6 +111,57 @@ const LaunchAnalysisButton = () => { activeExperiment.cellLevelMetadata?.uploadStatus, ]); + const getAllExperimentSampleFiles = useCallback(() => ( + activeExperiment.sampleIds.flatMap((sampleId) => Object.values(samples[sampleId].files)) + ), [samples, activeExperiment?.sampleIds]); + + const getAnyFileUploadFailed = useCallback(() => { + const nonErrorStatuses = [UploadStatus.UPLOADED, UploadStatus.UPLOADING]; + + const cellLevelUploadError = !_.isNil(activeExperiment.cellLevelMetadata) + && !nonErrorStatuses.includes(activeExperiment.cellLevelMetadata.uploadStatus); + + const sampleFileUploadError = getAllExperimentSampleFiles() + .some((sampleFile) => !nonErrorStatuses.includes(sampleFile.upload.status)); + + return cellLevelUploadError || sampleFileUploadError; + }, [ + samples, + activeExperiment?.sampleIds, + activeExperiment.cellLevelMetadata, + ]); + + const LaunchButtonTemplate = (props) => { + const { + // eslint-disable-next-line react/prop-types + onClick, disabled, text, loading, + } = props; + + return ( + + ); + }; + const renderLaunchButton = () => { let buttonText; From df32e2a56a5fa2965dc9b51f35cbedfb1cc6de4b Mon Sep 17 00:00:00 2001 From: cosa65 Date: Fri, 15 Dec 2023 16:05:23 -0300 Subject: [PATCH 3/3] Add handling of samples for experiment still loading Signed-off-by: cosa65 --- src/components/data-management/LaunchAnalysisButton.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/data-management/LaunchAnalysisButton.jsx b/src/components/data-management/LaunchAnalysisButton.jsx index 9243109187..1afaeb93db 100644 --- a/src/components/data-management/LaunchAnalysisButton.jsx +++ b/src/components/data-management/LaunchAnalysisButton.jsx @@ -112,7 +112,7 @@ const LaunchAnalysisButton = () => { ]); const getAllExperimentSampleFiles = useCallback(() => ( - activeExperiment.sampleIds.flatMap((sampleId) => Object.values(samples[sampleId].files)) + activeExperiment.sampleIds.flatMap((sampleId) => Object.values(samples[sampleId]?.files ?? {})) ), [samples, activeExperiment?.sampleIds]); const getAnyFileUploadFailed = useCallback(() => {