Skip to content

Commit 6293e07

Browse files
authored
fix(app): disable run again button when old run is being dismissed (#16300)
closes RQA-3202
1 parent a7dea54 commit 6293e07

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

app/src/organisms/Devices/ProtocolRun/ProtocolRunHeader.tsx

+11-1
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,7 @@ export function ProtocolRunHeader({
507507
isFixtureMismatch={isFixtureMismatch}
508508
isResetRunLoadingRef={isResetRunLoadingRef}
509509
missingSetupSteps={missingSetupSteps}
510+
isClosingCurrentRun={isClosingCurrentRun}
510511
/>
511512
</Flex>
512513
</Box>
@@ -668,6 +669,7 @@ interface ActionButtonProps {
668669
isFixtureMismatch: boolean
669670
isResetRunLoadingRef: React.MutableRefObject<boolean>
670671
missingSetupSteps: string[]
672+
isClosingCurrentRun: boolean
671673
}
672674

673675
// 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 {
681683
isFixtureMismatch,
682684
isResetRunLoadingRef,
683685
missingSetupSteps,
686+
isClosingCurrentRun,
684687
} = props
685688
const navigate = useNavigate()
686689
const { t } = useTranslation(['run_details', 'shared'])
@@ -737,6 +740,7 @@ function ActionButton(props: ActionButtonProps): JSX.Element {
737740
isPlayRunActionLoading ||
738741
isPauseRunActionLoading ||
739742
isResetRunLoading ||
743+
isClosingCurrentRun ||
740744
isOtherRunCurrent ||
741745
isProtocolAnalyzing ||
742746
isFixtureMismatch ||
@@ -814,6 +818,8 @@ function ActionButton(props: ActionButtonProps): JSX.Element {
814818
START_RUN_STATUSES.includes(runStatus)
815819
) {
816820
disableReason = t('close_door')
821+
} else if (isClosingCurrentRun) {
822+
disableReason = t('shared:robot_is_busy')
817823
}
818824

819825
const shouldShowHSConfirm =
@@ -824,6 +830,9 @@ function ActionButton(props: ActionButtonProps): JSX.Element {
824830
if (isProtocolAnalyzing) {
825831
buttonIconName = 'ot-spinner'
826832
buttonText = t('analyzing_on_robot')
833+
} else if (isClosingCurrentRun) {
834+
buttonIconName = 'ot-spinner'
835+
buttonText = t('canceling_run')
827836
} else if (
828837
runStatus === RUN_STATUS_RUNNING ||
829838
(runStatus != null && RECOVERY_STATUSES.includes(runStatus))
@@ -903,7 +912,8 @@ function ActionButton(props: ActionButtonProps): JSX.Element {
903912
spin={
904913
isProtocolAnalyzing ||
905914
runStatus === RUN_STATUS_STOP_REQUESTED ||
906-
isResetRunLoading
915+
isResetRunLoading ||
916+
isClosingCurrentRun
907917
}
908918
/>
909919
) : null}

0 commit comments

Comments
 (0)