Skip to content

Commit

Permalink
fix(app): update protocol setup action needed status for missing pipe…
Browse files Browse the repository at this point in the history
…ttes and modules (#14573)

renders action needed in protocol setup step when pipette is missing (or
mismatched) or module is missing for both OT-2 and Flex

closes RQA-2406, RQA-2407
  • Loading branch information
brenthagen authored Mar 1, 2024
1 parent be51dfc commit e3ed21d
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 5 deletions.
34 changes: 29 additions & 5 deletions app/src/organisms/Devices/ProtocolRun/ProtocolRunSetup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { FLEX_ROBOT_TYPE, OT2_ROBOT_TYPE } from '@opentrons/shared-data'
import { Line } from '../../../atoms/structure'
import { StyledText } from '../../../atoms/text'
import { InfoMessage } from '../../../molecules/InfoMessage'
import { INCOMPATIBLE, INEXACT_MATCH } from '../../../redux/pipettes'
import {
getIsFixtureMismatch,
getRequiredDeckConfig,
Expand All @@ -33,6 +34,7 @@ import {
useRobot,
useRunCalibrationStatus,
useRunHasStarted,
useRunPipetteInfoByMount,
useStoredProtocolAnalysis,
useUnmatchedModulesForProtocol,
} from '../hooks'
Expand Down Expand Up @@ -93,6 +95,20 @@ export function ProtocolRunSetup({
robotType,
protocolAnalysis
)
const runPipetteInfoByMount = useRunPipetteInfoByMount(runId)

const isMissingPipette =
(runPipetteInfoByMount.left != null &&
runPipetteInfoByMount.left.requestedPipetteMatch === INCOMPATIBLE) ||
(runPipetteInfoByMount.right != null &&
runPipetteInfoByMount.right.requestedPipetteMatch === INCOMPATIBLE) ||
// for Flex, require exact match
(isFlex &&
runPipetteInfoByMount.left != null &&
runPipetteInfoByMount.left.requestedPipetteMatch === INEXACT_MATCH) ||
(isFlex &&
runPipetteInfoByMount.right != null &&
runPipetteInfoByMount.right.requestedPipetteMatch === INEXACT_MATCH)

const isFixtureMismatch = getIsFixtureMismatch(deckConfigCompatibility)

Expand Down Expand Up @@ -297,6 +313,7 @@ export function ProtocolRunSetup({
isFlex,
isMissingModule,
isFixtureMismatch,
isMissingPipette,
}}
/>
}
Expand Down Expand Up @@ -329,6 +346,7 @@ interface StepRightElementProps {
isFlex: boolean
isMissingModule: boolean
isFixtureMismatch: boolean
isMissingPipette: boolean
}
function StepRightElement(props: StepRightElementProps): JSX.Element | null {
const {
Expand All @@ -339,14 +357,14 @@ function StepRightElement(props: StepRightElementProps): JSX.Element | null {
isFlex,
isMissingModule,
isFixtureMismatch,
isMissingPipette,
} = props
const { t } = useTranslation('protocol_setup')
const isActionNeeded = isMissingModule || isFixtureMismatch

if (
!runHasStarted &&
(stepKey === ROBOT_CALIBRATION_STEP_KEY ||
(stepKey === MODULE_SETUP_KEY && isFlex))
(stepKey === ROBOT_CALIBRATION_STEP_KEY || stepKey === MODULE_SETUP_KEY)
) {
const moduleAndDeckStatus = isActionNeeded
? { complete: false }
Expand All @@ -361,12 +379,18 @@ function StepRightElement(props: StepRightElementProps): JSX.Element | null {
stepKey === ROBOT_CALIBRATION_STEP_KEY &&
!calibrationStatusRobot.complete
) {
statusText = t('calibration_needed')
statusText = isMissingPipette
? t('action_needed')
: t('calibration_needed')
} else if (stepKey === MODULE_SETUP_KEY && !calibrationStatus?.complete) {
statusText = isActionNeeded ? t('action_needed') : t('calibration_needed')
}

return (
// do not render calibration ready status icon for OT-2 module setup
return isFlex ||
!(
stepKey === MODULE_SETUP_KEY && statusText === t('calibration_ready')
) ? (
<Flex flexDirection={DIRECTION_ROW} alignItems={ALIGN_CENTER}>
<Icon
size="1rem"
Expand All @@ -385,7 +409,7 @@ function StepRightElement(props: StepRightElementProps): JSX.Element | null {
{statusText}
</StyledText>
</Flex>
)
) : null
} else if (stepKey === LPC_KEY) {
return <LearnAboutLPC />
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import {
useRobot,
useRunCalibrationStatus,
useRunHasStarted,
useRunPipetteInfoByMount,
useStoredProtocolAnalysis,
useUnmatchedModulesForProtocol,
} from '../../hooks'
Expand Down Expand Up @@ -118,6 +119,9 @@ const mockGetIsFixtureMismatch = getIsFixtureMismatch as jest.MockedFunction<
const mockUseNotifyRunQuery = useNotifyRunQuery as jest.MockedFunction<
typeof useNotifyRunQuery
>
const mockUseRunPipetteInfoByMount = useRunPipetteInfoByMount as jest.MockedFunction<
typeof useRunPipetteInfoByMount
>

const ROBOT_NAME = 'otie'
const RUN_ID = '1'
Expand Down Expand Up @@ -190,6 +194,9 @@ describe('ProtocolRunSetup', () => {
.mockReturnValue({ missingModuleIds: [], remainingAttachedModules: [] })
when(mockGetIsFixtureMismatch).mockReturnValue(false)
mockUseNotifyRunQuery.mockReturnValue({} as any)
when(mockUseRunPipetteInfoByMount)
.calledWith(RUN_ID)
.mockReturnValue({ left: null, right: null })
})
afterEach(() => {
resetAllWhenMocks()
Expand Down

0 comments on commit e3ed21d

Please sign in to comment.