Skip to content

Commit

Permalink
Redirect to robot dashboard after cancelling quick transfer from desktop
Browse files Browse the repository at this point in the history
  • Loading branch information
smb2268 committed Aug 15, 2024
1 parent c994dd8 commit 9715946
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 7 deletions.
38 changes: 31 additions & 7 deletions app/src/organisms/Devices/ProtocolRun/ProtocolRunHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ export function ProtocolRunHeader({
displayName,
protocolKey,
isProtocolAnalyzing,
isQuickTransfer,
} = useProtocolDetailsForRun(runId)
const { reportRecoveredRunResult } = useRecoveryAnalytics()

Expand Down Expand Up @@ -287,12 +288,13 @@ export function ProtocolRunHeader({
...robotAnalyticsData,
},
})

// Close the run if no tips are attached after running tip check at least once.
// This marks the robot as "not busy" as soon as a run is cancelled if drop tip CTAs are unnecessary.
if (initialPipettesWithTipsCount === 0) {
closeCurrentRun()
}
closeCurrentRun({
onSuccess: () => {
if (isQuickTransfer) {
navigate(`/devices/${robotName}`)
}
},
})
}
}, [runStatus, isRunCurrent, runId])

Expand Down Expand Up @@ -340,7 +342,13 @@ export function ProtocolRunHeader({
name: ANALYTICS_PROTOCOL_RUN_ACTION.FINISH,
properties: robotAnalyticsData ?? undefined,
})
closeCurrentRun()
closeCurrentRun({
onSuccess: () => {
if (isQuickTransfer) {
navigate(`/devices/${robotName}`)
}
},
})
}

return (
Expand Down Expand Up @@ -440,6 +448,22 @@ export function ProtocolRunHeader({
isRunCurrent={isRunCurrent}
/>
) : null}
{mostRecentRunId === runId && showDropTipBanner && areTipsAttached ? (
<ProtocolDropTipBanner
onLaunchWizardClick={toggleDTWiz}
onCloseClick={() => {
resetTipStatus()
setShowDropTipBanner(false)
closeCurrentRun({
onSuccess: () => {
if (isQuickTransfer) {
navigate(`/devices/${robotName}`)
}
},
})
}}
/>
) : null}
{showDTModal ? (
<ProtocolDropTipModal
onSkip={onDTModalSkip}
Expand Down
2 changes: 2 additions & 0 deletions app/src/organisms/Devices/hooks/useProtocolDetailsForRun.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export interface ProtocolDetails {
protocolKey: string | null
isProtocolAnalyzing?: boolean
robotType: RobotType
isQuickTransfer: boolean
}

export function useProtocolDetailsForRun(
Expand Down Expand Up @@ -67,5 +68,6 @@ export function useProtocolDetailsForRun(
(mostRecentAnalysis?.status === 'completed'
? mostRecentAnalysis?.robotType ?? FLEX_ROBOT_TYPE
: FLEX_ROBOT_TYPE),
isQuickTransfer: protocolRecord?.data.protocolKind === 'quick-transfer',
}
}

0 comments on commit 9715946

Please sign in to comment.