From b32182407241c8837d9a5ea5cccefb66a642c558 Mon Sep 17 00:00:00 2001 From: Seth Foster Date: Fri, 9 Aug 2024 12:10:11 -0400 Subject: [PATCH] fix(app): fix liquid & modules confirm (#15946) Fixes RQA-2925 for desktop: the liquids entry now will count as complete for the purposes of not popping or being listed in the modal if you have no liquids. It also gets complete decorations if there are no liquids. That required adding that rightElement thing to the empty version of the setup step, and that also is what we would need to do for modules, so also add decorations for modules and fix the completion logic to count the module actually being plugged in again (this was RQA-2928). On the ODD, similar kind of logic but a lot easier to implement because the data is more local; we can default the state to !hasLiquids, and then use the same styling we already had implemented for runtime parameters for the setup step. Also, remove some stylistically out of date text transforms on the setup cards. ## testing and review - [x] Upload a protocol that has no liquids and no modules and no deck fixtures - [x] the liquids and modules tabs should should default to completed, meaning - [x] on desktop, they get complete badges and text (including on the OT-2) - [x] on the ODD, they get rendered green - [x] on desktop and ODD, they don't inhibit starting the run - [x] including that if you haven't confirmed some other step, the steps nag modal doesn't mention liquids - [x] on a protocol that requires modules, if you don't have the modules plugged in you get an action needed badge Closes RQA-2928 Closes RQA-2925 --- .../localization/en/protocol_setup.json | 1 + .../Devices/ProtocolRun/EmptySetupStep.tsx | 24 +++++++---- .../Devices/ProtocolRun/ProtocolRunSetup.tsx | 41 +++++++++++-------- app/src/pages/ProtocolSetup/index.tsx | 21 ++++++---- 4 files changed, 55 insertions(+), 32 deletions(-) diff --git a/app/src/assets/localization/en/protocol_setup.json b/app/src/assets/localization/en/protocol_setup.json index c46a8fee0d3..ad0727639ec 100644 --- a/app/src/assets/localization/en/protocol_setup.json +++ b/app/src/assets/localization/en/protocol_setup.json @@ -74,6 +74,7 @@ "deck_conflict_info": "Update the deck configuration by removing the {{currentFixture}} in location {{cutout}}. Either remove the fixture from the deck configuration or update the protocol.", "deck_conflict": "Deck location conflict", "deck_hardware": "Deck hardware", + "deck_hardware_ready": "Deck hardware ready", "deck_map": "Deck Map", "default_values": "Default values", "example": "Example", diff --git a/app/src/organisms/Devices/ProtocolRun/EmptySetupStep.tsx b/app/src/organisms/Devices/ProtocolRun/EmptySetupStep.tsx index 8a4d5a9c2bc..eeca6dcf81a 100644 --- a/app/src/organisms/Devices/ProtocolRun/EmptySetupStep.tsx +++ b/app/src/organisms/Devices/ProtocolRun/EmptySetupStep.tsx @@ -6,24 +6,30 @@ import { SPACING, LegacyStyledText, TYPOGRAPHY, + DIRECTION_ROW, + JUSTIFY_SPACE_BETWEEN, } from '@opentrons/components' interface EmptySetupStepProps { title: React.ReactNode description: string + rightElement?: React.ReactNode } export function EmptySetupStep(props: EmptySetupStepProps): JSX.Element { - const { title, description } = props + const { title, description, rightElement } = props return ( - - - {title} - - {description} + + + + {title} + + {description} + + {rightElement} ) } diff --git a/app/src/organisms/Devices/ProtocolRun/ProtocolRunSetup.tsx b/app/src/organisms/Devices/ProtocolRun/ProtocolRunSetup.tsx index 7ea1386768d..ad2a02c61f9 100644 --- a/app/src/organisms/Devices/ProtocolRun/ProtocolRunSetup.tsx +++ b/app/src/organisms/Devices/ProtocolRun/ProtocolRunSetup.tsx @@ -163,17 +163,6 @@ export function ProtocolRunSetup({ return true }) - const [ - labwareSetupComplete, - setLabwareSetupComplete, - ] = React.useState(false) - const [liquidSetupComplete, setLiquidSetupComplete] = React.useState( - false - ) - const [lpcComplete, setLpcComplete] = React.useState(false) - - if (robot == null) return null - const liquids = protocolAnalysis?.liquids ?? [] const liquidsInLoadOrder = protocolAnalysis != null @@ -194,6 +183,18 @@ export function ProtocolRunSetup({ ? t('install_modules', { count: modules.length }) : t('no_deck_hardware_specified') + const [ + labwareSetupComplete, + setLabwareSetupComplete, + ] = React.useState(false) + const [liquidSetupComplete, setLiquidSetupComplete] = React.useState( + !hasLiquids + ) + if (!hasLiquids && missingSteps.includes('liquids')) { + setMissingSteps(missingSteps.filter(step => step !== 'liquids')) + } + const [lpcComplete, setLpcComplete] = React.useState(false) + if (robot == null) return null const StepDetailMap: Record< StepKey, { @@ -250,8 +251,14 @@ export function ProtocolRunSetup({ rightElProps: { stepKey: MODULE_SETUP_KEY, complete: - calibrationStatusRobot.complete && calibrationStatusModules.complete, - completeText: isFlex ? t('calibration_ready') : '', + calibrationStatusRobot.complete && + calibrationStatusModules.complete && + !isMissingModule && + !isFixtureMismatch, + completeText: + isFlex && hasModules + ? t('calibration_ready') + : t('deck_hardware_ready'), incompleteText: isFlex ? t('calibration_needed') : t('action_needed'), missingHardware: isMissingModule || isFixtureMismatch, missingHardwareText: t('action_needed'), @@ -372,6 +379,11 @@ export function ProtocolRunSetup({ + } /> ) : ( @@ -481,7 +492,6 @@ function StepRightElement(props: StepRightElementProps): JSX.Element | null { color={COLORS.black90} css={TYPOGRAPHY.pSemiBold} marginRight={SPACING.spacing16} - textTransform={TYPOGRAPHY.textTransformCapitalize} id={`RunSetupCard_${props.stepKey}_missingHardwareText`} whitespace="nowrap" > @@ -503,7 +513,6 @@ function StepRightElement(props: StepRightElementProps): JSX.Element | null { color={COLORS.black90} css={TYPOGRAPHY.pSemiBold} marginRight={SPACING.spacing16} - textTransform={TYPOGRAPHY.textTransformCapitalize} id={`RunSetupCard_${props.stepKey}_incompleteText`} whitespace="nowrap" > diff --git a/app/src/pages/ProtocolSetup/index.tsx b/app/src/pages/ProtocolSetup/index.tsx index e7317a5dc4f..5a50c52c19c 100644 --- a/app/src/pages/ProtocolSetup/index.tsx +++ b/app/src/pages/ProtocolSetup/index.tsx @@ -513,6 +513,8 @@ function PrepareToRun({ areModulesReady && areFixturesReady && !isLocationConflict ? 'ready' : 'not ready' + // Liquids information + const liquidsInProtocol = mostRecentAnalysis?.liquids ?? [] const isReadyToRun = incompleteInstrumentCount === 0 && areModulesReady && areFixturesReady @@ -523,7 +525,11 @@ function PrepareToRun({ if (isReadyToRun) { if ( runStatus === RUN_STATUS_IDLE && - !(labwareConfirmed && offsetsConfirmed && liquidsConfirmed) + !( + labwareConfirmed && + offsetsConfirmed && + (liquidsConfirmed || liquidsInProtocol.length === 0) + ) ) { confirmStepsComplete() } else if (runStatus === RUN_STATUS_IDLE && isHeaterShakerInProtocol) { @@ -654,9 +660,6 @@ function PrepareToRun({ runRecord?.data?.labwareOffsets ?? [] ) - // Liquids information - const liquidsInProtocol = mostRecentAnalysis?.liquids ?? [] - const { data: doorStatus } = useDoorQuery({ refetchInterval: FETCH_DURATION_MS, }) @@ -757,7 +760,7 @@ function PrepareToRun({ detail={modulesDetail} subDetail={modulesSubDetail} status={modulesStatus} - disabled={ + interactionDisabled={ protocolModulesInfo.length === 0 && !protocolHasFixtures } /> @@ -799,7 +802,11 @@ function PrepareToRun({ setSetupScreen('liquids') }} title={i18n.format(t('liquids'), 'capitalize')} - status={liquidsConfirmed ? 'ready' : 'general'} + status={ + liquidsConfirmed || liquidsInProtocol.length === 0 + ? 'ready' + : 'general' + } detail={ liquidsInProtocol.length > 0 ? t('initial_liquids_num', { @@ -807,7 +814,7 @@ function PrepareToRun({ }) : t('liquids_not_in_setup') } - disabled={liquidsInProtocol.length === 0} + interactionDisabled={liquidsInProtocol.length === 0} /> ) : (