diff --git a/app/src/organisms/Devices/ProtocolRun/ProtocolRunHeader.tsx b/app/src/organisms/Devices/ProtocolRun/ProtocolRunHeader.tsx index b808844c62c..7e897afaa6d 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 = @@ -824,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)) @@ -903,7 +912,8 @@ function ActionButton(props: ActionButtonProps): JSX.Element { spin={ isProtocolAnalyzing || runStatus === RUN_STATUS_STOP_REQUESTED || - isResetRunLoading + isResetRunLoading || + isClosingCurrentRun } /> ) : null}