From 3230f2d3a446f4d519db7686571205bdc758b924 Mon Sep 17 00:00:00 2001 From: Shlok Amin Date: Thu, 19 Sep 2024 12:06:02 -0400 Subject: [PATCH 1/2] fix(app): disable run again button when old run is being dismissed closes RQA-3202 --- app/src/organisms/Devices/ProtocolRun/ProtocolRunHeader.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/src/organisms/Devices/ProtocolRun/ProtocolRunHeader.tsx b/app/src/organisms/Devices/ProtocolRun/ProtocolRunHeader.tsx index b808844c62c..0f26dd4fd9e 100644 --- a/app/src/organisms/Devices/ProtocolRun/ProtocolRunHeader.tsx +++ b/app/src/organisms/Devices/ProtocolRun/ProtocolRunHeader.tsx @@ -507,6 +507,7 @@ export function ProtocolRunHeader({ isFixtureMismatch={isFixtureMismatch} isResetRunLoadingRef={isResetRunLoadingRef} missingSetupSteps={missingSetupSteps} + isClosingCurrentRun={isClosingCurrentRun} /> @@ -668,6 +669,7 @@ interface ActionButtonProps { isFixtureMismatch: boolean isResetRunLoadingRef: React.MutableRefObject missingSetupSteps: string[] + isClosingCurrentRun: boolean } // TODO(jh, 04-22-2024): Refactor switch cases into separate factories to increase readability and testability. @@ -681,6 +683,7 @@ function ActionButton(props: ActionButtonProps): JSX.Element { isFixtureMismatch, isResetRunLoadingRef, missingSetupSteps, + isClosingCurrentRun, } = props const navigate = useNavigate() const { t } = useTranslation(['run_details', 'shared']) @@ -737,6 +740,7 @@ function ActionButton(props: ActionButtonProps): JSX.Element { isPlayRunActionLoading || isPauseRunActionLoading || isResetRunLoading || + isClosingCurrentRun || isOtherRunCurrent || isProtocolAnalyzing || isFixtureMismatch || @@ -814,6 +818,8 @@ function ActionButton(props: ActionButtonProps): JSX.Element { START_RUN_STATUSES.includes(runStatus) ) { disableReason = t('close_door') + } else if (isClosingCurrentRun) { + disableReason = t('shared:robot_is_busy') } const shouldShowHSConfirm = From 87f2bc150920049be86c6e9127d037e4a2a1cee0 Mon Sep 17 00:00:00 2001 From: Shlok Amin Date: Thu, 19 Sep 2024 12:19:39 -0400 Subject: [PATCH 2/2] show spinner and change button text --- app/src/organisms/Devices/ProtocolRun/ProtocolRunHeader.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/organisms/Devices/ProtocolRun/ProtocolRunHeader.tsx b/app/src/organisms/Devices/ProtocolRun/ProtocolRunHeader.tsx index 0f26dd4fd9e..7e897afaa6d 100644 --- a/app/src/organisms/Devices/ProtocolRun/ProtocolRunHeader.tsx +++ b/app/src/organisms/Devices/ProtocolRun/ProtocolRunHeader.tsx @@ -830,6 +830,9 @@ function ActionButton(props: ActionButtonProps): JSX.Element { if (isProtocolAnalyzing) { buttonIconName = 'ot-spinner' buttonText = t('analyzing_on_robot') + } else if (isClosingCurrentRun) { + buttonIconName = 'ot-spinner' + buttonText = t('canceling_run') } else if ( runStatus === RUN_STATUS_RUNNING || (runStatus != null && RECOVERY_STATUSES.includes(runStatus)) @@ -909,7 +912,8 @@ function ActionButton(props: ActionButtonProps): JSX.Element { spin={ isProtocolAnalyzing || runStatus === RUN_STATUS_STOP_REQUESTED || - isResetRunLoading + isResetRunLoading || + isClosingCurrentRun } /> ) : null}