Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(app): disable run again button when old run is being dismissed #16300

Merged
merged 2 commits into from
Sep 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion app/src/organisms/Devices/ProtocolRun/ProtocolRunHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@ export function ProtocolRunHeader({
isFixtureMismatch={isFixtureMismatch}
isResetRunLoadingRef={isResetRunLoadingRef}
missingSetupSteps={missingSetupSteps}
isClosingCurrentRun={isClosingCurrentRun}
/>
</Flex>
</Box>
Expand Down Expand Up @@ -668,6 +669,7 @@ interface ActionButtonProps {
isFixtureMismatch: boolean
isResetRunLoadingRef: React.MutableRefObject<boolean>
missingSetupSteps: string[]
isClosingCurrentRun: boolean
}

// TODO(jh, 04-22-2024): Refactor switch cases into separate factories to increase readability and testability.
Expand All @@ -681,6 +683,7 @@ function ActionButton(props: ActionButtonProps): JSX.Element {
isFixtureMismatch,
isResetRunLoadingRef,
missingSetupSteps,
isClosingCurrentRun,
} = props
const navigate = useNavigate()
const { t } = useTranslation(['run_details', 'shared'])
Expand Down Expand Up @@ -737,6 +740,7 @@ function ActionButton(props: ActionButtonProps): JSX.Element {
isPlayRunActionLoading ||
isPauseRunActionLoading ||
isResetRunLoading ||
isClosingCurrentRun ||
isOtherRunCurrent ||
isProtocolAnalyzing ||
isFixtureMismatch ||
Expand Down Expand Up @@ -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 =
Expand All @@ -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))
Expand Down Expand Up @@ -903,7 +912,8 @@ function ActionButton(props: ActionButtonProps): JSX.Element {
spin={
isProtocolAnalyzing ||
runStatus === RUN_STATUS_STOP_REQUESTED ||
isResetRunLoading
isResetRunLoading ||
isClosingCurrentRun
}
/>
) : null}
Expand Down
Loading