Skip to content
Merged
6 changes: 4 additions & 2 deletions app/src/assets/localization/en/labware_position_check.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"clear_deck_all_lw_leave_modules": "Clear all deck slots of labware, leaving modules in place",
"cli_ssh": "Command Line Interface (SSH)",
"close_and_apply_offset_data": "Close and apply labware offset data",
"complete": "Complete",
"confirm": "Confirm",
"confirm_detached": "Confirm removal",
"confirm_go_back_without_saving": "Are you sure you want to go back to the the labware list without saving?",
Expand All @@ -42,7 +43,6 @@
"confirm_position_and_return_tip": "Confirm position, return tip to Slot {{next_slot}} and home",
"confirm_removal": "Confirm removal",
"continue": "Continue",
"custom": "Custom",
"default": "Default",
"default_labware_offset": "Default Labware Offset",
"default_location_offset_added": "Default location offset added",
Expand All @@ -54,7 +54,7 @@
"exit": "Exit",
"exit_screen_confirm_exit": "Exit and discard all labware offsets",
"exit_screen_go_back": "Go back to labware position check",
"exit_screen_subtitle": "If you exit now, all labware offsets will be discarded. This cannot be undone.",
"exit_screen_subtitle": "If you exit now, only the labware offsets you've confirmed will be applied to this run.",
"exit_screen_title": "Exit before completing Labware Position Check?",
"failed_to_save_final_position": "Failed to save final position",
"get_labware_offset_data": "Get Labware Offset Data",
Expand Down Expand Up @@ -110,6 +110,7 @@
"location_header": "Location",
"lpc_complete": "Labware Position Check complete",
"lpc_complete_summary_screen_heading": "Labware Position Check Complete",
"manual": "Manual",
"modify_hardcoded_offsets_in_protocol": "Hardcoded offsets must be changed in your Python protocol",
"module_display_location_text": "{{moduleName}} in Deck Slot {{slot}}",
"module_in_slot": "{{module}} in {{slot}}",
Expand Down Expand Up @@ -162,6 +163,7 @@
"secondary_pipette_tipracks_section": "Check tip racks with {{secondary_mount}} Pipette",
"see_how_offsets_work": "See how labware offsets work",
"select_labware_to_view_data": "Select a labware to view its stored offset data.",
"skip": "Skip",
"slot": "Slot {{slotName}}",
"slot_applied_location_offset_updated": "{{slot}} applied location offset updated",
"slot_in_module_applied_location_offset_updated": "{{slot}} in {{module}} applied location offset updated",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@
return t('add_missing_labware_offsets')
} else if (offsetsConfirmed) {
return t('offsets_already_applied')
} else if (lpcDisabledReason != null) {
return lpcDisabledReason

Check warning on line 74 in app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabwarePositionCheck/FlexSetupLPC/LPCSetupFlexBtns.tsx

View check run for this annotation

Codecov / codecov/patch

app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabwarePositionCheck/FlexSetupLPC/LPCSetupFlexBtns.tsx#L73-L74

Added lines #L73 - L74 were not covered by tests
} else if (!anyOffsetsToLpc) {
return t('no_offsets_found')
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
Tooltip,
TYPOGRAPHY,
useHoverTooltip,
Icon,
} from '@opentrons/components'
import { useProtocolQuery } from '@opentrons/react-api-client'

Expand Down Expand Up @@ -80,7 +81,7 @@
placement: TOOLTIP_LEFT,
})

const { launchLPC, lpcProps, showLPC } = useLPCFlows({
const { launchLPC, lpcProps, showLPC, isLaunchingLPC } = useLPCFlows({

Check warning on line 84 in app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabwarePositionCheck/OT2SetupLPC/index.tsx

View check run for this annotation

Codecov / codecov/patch

app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabwarePositionCheck/OT2SetupLPC/index.tsx#L84

Added line #L84 was not covered by tests
runId,
robotType,
protocolName,
Expand Down Expand Up @@ -142,9 +143,19 @@
onClick={launchLPC}
id="LabwareSetup_checkLabwarePositionsButton"
{...runLPCTargetProps}
disabled={lpcDisabledReason !== null}
disabled={lpcDisabledReason !== null || isLaunchingLPC}

Check warning on line 146 in app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabwarePositionCheck/OT2SetupLPC/index.tsx

View check run for this annotation

Codecov / codecov/patch

app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabwarePositionCheck/OT2SetupLPC/index.tsx#L146

Added line #L146 was not covered by tests
>
{t('run_labware_position_check')}
<Flex alignItems={ALIGN_CENTER}>
{isLaunchingLPC && (
<Icon
size="1rem"
spin
name="ot-spinner"
marginRight={SPACING.spacing8}

Check warning on line 154 in app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabwarePositionCheck/OT2SetupLPC/index.tsx

View check run for this annotation

Codecov / codecov/patch

app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabwarePositionCheck/OT2SetupLPC/index.tsx#L148-L154

Added lines #L148 - L154 were not covered by tests
/>
)}
{t('run_labware_position_check')}
</Flex>

Check warning on line 158 in app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabwarePositionCheck/OT2SetupLPC/index.tsx

View check run for this annotation

Codecov / codecov/patch

app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabwarePositionCheck/OT2SetupLPC/index.tsx#L157-L158

Added lines #L157 - L158 were not covered by tests
</PrimaryButton>
{lpcDisabledReason !== null ? (
<Tooltip tooltipProps={runLPCTooltipProps}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

const buildColTwoText = (): string => {
if (isHardcoded || lsExistingOffset?.vector != null) {
return t('custom')
return t('manual')

Check warning on line 38 in app/src/organisms/LabwareOffsetsTable/AccordionDetail.tsx

View check run for this annotation

Codecov / codecov/patch

app/src/organisms/LabwareOffsetsTable/AccordionDetail.tsx#L38

Added line #L38 was not covered by tests
} else if (defaultExistingOffset?.vector != null) {
return t('default')
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export interface LegacySupportLPCFlowsProps extends LPCFlowsProps {

export interface LPCFlowsProps {
onCloseClick: () => void
isClosing: boolean
runId: string
robotType: RobotType
deckConfig: DeckConfiguration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,10 @@
const {
createLabwareDefinition,
} = useCreateMaintenanceRunLabwareDefinitionMutation()
const { deleteMaintenanceRun } = useDeleteMaintenanceRunMutation()
const {
deleteMaintenanceRun,
isLoading: isClosing,
} = useDeleteMaintenanceRunMutation()

Check warning on line 125 in app/src/organisms/LabwarePositionCheck/LPCFlows/useLPCFlows.ts

View check run for this annotation

Codecov / codecov/patch

app/src/organisms/LabwarePositionCheck/LPCFlows/useLPCFlows.ts#L122-L125

Added lines #L122 - L125 were not covered by tests

// After the maintenance run is created, add labware defs to the maintenance run.
useEffect(() => {
Expand Down Expand Up @@ -192,6 +195,7 @@
showLPC,
lpcProps: {
onCloseClick: handleCloseLPC,
isClosing,

Check warning on line 198 in app/src/organisms/LabwarePositionCheck/LPCFlows/useLPCFlows.ts

View check run for this annotation

Codecov / codecov/patch

app/src/organisms/LabwarePositionCheck/LPCFlows/useLPCFlows.ts#L198

Added line #L198 was not covered by tests
runId,
robotType,
deckConfig,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
{...props}
existingOffsets={props.ot2Offsets}
mostRecentAnalysis={props.analysis}
isDeletingMaintenanceRun={props.isClosing}

Check warning on line 20 in app/src/organisms/LabwarePositionCheck/LPCWizardContainer.tsx

View check run for this annotation

Codecov / codecov/patch

app/src/organisms/LabwarePositionCheck/LPCWizardContainer.tsx#L20

Added line #L20 was not covered by tests
/>
)
default: {
Expand Down
36 changes: 32 additions & 4 deletions app/src/organisms/LegacyLabwarePositionCheck/CheckItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,17 @@
import { getDisplayLocation } from './utils/getDisplayLocation'

import type { Dispatch } from 'react'
import type { LabwareOffset } from '@opentrons/api-client'
import type {
LabwareOffset,
LegacyLabwareOffsetLocation,
} from '@opentrons/api-client'
import type {
CompletedProtocolAnalysis,
CreateCommand,
LabwareLocation,
MoveLabwareCreateCommand,
RobotType,
Coordinates,
} from '@opentrons/shared-data'
import type { useChainRunCommands } from '/app/resources/runs'
import type {
Expand All @@ -55,6 +59,13 @@
proceed: () => void
chainRunCommands: ReturnType<typeof useChainRunCommands>['chainRunCommands']
setFatalError: (errorMessage: string) => void
isApplyingOffsets: boolean
calculateAndApplyOffset: (
initialPosition: Coordinates | null,
finalPosition: Coordinates | null,
labwareId: string,
location: LegacyLabwareOffsetLocation
) => Promise<void>
registerPosition: Dispatch<RegisterPositionAction>
workingOffsets: WorkingOffset[]
existingOffsets: LabwareOffset[]
Expand All @@ -63,6 +74,7 @@
robotType: RobotType
shouldUseMetalProbe: boolean
}

export const CheckItem = (props: CheckItemProps): JSX.Element | null => {
const {
labwareId,
Expand All @@ -80,7 +92,9 @@
existingOffsets,
setFatalError,
robotType,
isApplyingOffsets,

Check warning on line 95 in app/src/organisms/LegacyLabwarePositionCheck/CheckItem.tsx

View check run for this annotation

Codecov / codecov/patch

app/src/organisms/LegacyLabwarePositionCheck/CheckItem.tsx#L95

Added line #L95 was not covered by tests
shouldUseMetalProbe,
calculateAndApplyOffset,

Check warning on line 97 in app/src/organisms/LegacyLabwarePositionCheck/CheckItem.tsx

View check run for this annotation

Codecov / codecov/patch

app/src/organisms/LegacyLabwarePositionCheck/CheckItem.tsx#L97

Added line #L97 was not covered by tests
} = props
const { t, i18n } = useTranslation(['labware_position_check', 'shared'])
const isOnDevice = useSelector(getIsOnDevice)
Expand Down Expand Up @@ -355,7 +369,7 @@
},
]

const handleConfirmPosition = (): void => {
const handleConfirmPositionAndApply = (): void => {

Check warning on line 372 in app/src/organisms/LegacyLabwarePositionCheck/CheckItem.tsx

View check run for this annotation

Codecov / codecov/patch

app/src/organisms/LegacyLabwarePositionCheck/CheckItem.tsx#L372

Added line #L372 was not covered by tests
const heaterShakerPrepCommands: CreateCommand[] =
moduleId != null &&
moduleType != null &&
Expand Down Expand Up @@ -403,17 +417,29 @@
location,
position,
})
proceed()
return calculateAndApplyOffset(
initialPosition ?? null,
position,
labwareId,
location
)

Check warning on line 425 in app/src/organisms/LegacyLabwarePositionCheck/CheckItem.tsx

View check run for this annotation

Codecov / codecov/patch

app/src/organisms/LegacyLabwarePositionCheck/CheckItem.tsx#L420-L425

Added lines #L420 - L425 were not covered by tests
} else {
setFatalError('CheckItem failed to save final position with message')
return Promise.reject(
new Error('CheckItem failed to save final position with message')
)

Check warning on line 430 in app/src/organisms/LegacyLabwarePositionCheck/CheckItem.tsx

View check run for this annotation

Codecov / codecov/patch

app/src/organisms/LegacyLabwarePositionCheck/CheckItem.tsx#L428-L430

Added lines #L428 - L430 were not covered by tests
}
})
.then(() => {
proceed()
})

Check warning on line 435 in app/src/organisms/LegacyLabwarePositionCheck/CheckItem.tsx

View check run for this annotation

Codecov / codecov/patch

app/src/organisms/LegacyLabwarePositionCheck/CheckItem.tsx#L433-L435

Added lines #L433 - L435 were not covered by tests
.catch((e: Error) => {
setFatalError(
`CheckItem failed to move from final position with message: ${e.message}`
)
})
}

const handleGoBack = (): void => {
chainRunCommands(
[
Expand Down Expand Up @@ -479,7 +505,8 @@
}
labwareDef={labwareDef}
pipetteName={pipetteName}
handleConfirmPosition={handleConfirmPosition}
handleConfirmPositionAndApply={handleConfirmPositionAndApply}
isApplyingOffsets={isApplyingOffsets}

Check warning on line 509 in app/src/organisms/LegacyLabwarePositionCheck/CheckItem.tsx

View check run for this annotation

Codecov / codecov/patch

app/src/organisms/LegacyLabwarePositionCheck/CheckItem.tsx#L508-L509

Added lines #L508 - L509 were not covered by tests
handleGoBack={handleGoBack}
handleJog={handleJog}
initialPosition={initialPosition}
Expand All @@ -506,6 +533,7 @@
labwareDef={labwareDef}
confirmPlacement={handleConfirmPlacement}
robotType={robotType}
onSkip={proceed}

Check warning on line 536 in app/src/organisms/LegacyLabwarePositionCheck/CheckItem.tsx

View check run for this annotation

Codecov / codecov/patch

app/src/organisms/LegacyLabwarePositionCheck/CheckItem.tsx#L536

Added line #L536 was not covered by tests
/>
)}
</Flex>
Expand Down
31 changes: 25 additions & 6 deletions app/src/organisms/LegacyLabwarePositionCheck/JogToWell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
COLORS,
DIRECTION_COLUMN,
Flex,
Icon,
JUSTIFY_CENTER,
JUSTIFY_SPACE_BETWEEN,
LabwareRender,
Expand Down Expand Up @@ -53,7 +54,8 @@
'https://support.opentrons.com/s/article/How-Labware-Offsets-work-on-the-OT-2'

interface JogToWellProps {
handleConfirmPosition: () => void
handleConfirmPositionAndApply: () => void
isApplyingOffsets: boolean
handleGoBack: () => void
handleJog: Jog
pipetteName: PipetteName
Expand All @@ -71,7 +73,8 @@
body,
pipetteName,
labwareDef,
handleConfirmPosition,
handleConfirmPositionAndApply,
isApplyingOffsets,

Check warning on line 77 in app/src/organisms/LegacyLabwarePositionCheck/JogToWell.tsx

View check run for this annotation

Codecov / codecov/patch

app/src/organisms/LegacyLabwarePositionCheck/JogToWell.tsx#L76-L77

Added lines #L76 - L77 were not covered by tests
handleGoBack,
handleJog,
initialPosition,
Expand Down Expand Up @@ -198,7 +201,7 @@
/>
<SmallButton
buttonText={t('shared:confirm_position')}
onClick={handleConfirmPosition}
onClick={handleConfirmPositionAndApply}

Check warning on line 204 in app/src/organisms/LegacyLabwarePositionCheck/JogToWell.tsx

View check run for this annotation

Codecov / codecov/patch

app/src/organisms/LegacyLabwarePositionCheck/JogToWell.tsx#L204

Added line #L204 was not covered by tests
/>
</Flex>
{showFullJogControls
Expand Down Expand Up @@ -259,11 +262,27 @@
>
<NeedHelpLink href={LPC_HELP_LINK_URL} />
<Flex gridGap={SPACING.spacing8}>
<SecondaryButton onClick={handleGoBack}>
<SecondaryButton
onClick={handleGoBack}
disabled={isApplyingOffsets}

Check warning on line 267 in app/src/organisms/LegacyLabwarePositionCheck/JogToWell.tsx

View check run for this annotation

Codecov / codecov/patch

app/src/organisms/LegacyLabwarePositionCheck/JogToWell.tsx#L265-L267

Added lines #L265 - L267 were not covered by tests
>
{t('shared:go_back')}
</SecondaryButton>
<PrimaryButton onClick={handleConfirmPosition}>
{t('shared:confirm_position')}
<PrimaryButton
onClick={handleConfirmPositionAndApply}
disabled={isApplyingOffsets}

Check warning on line 273 in app/src/organisms/LegacyLabwarePositionCheck/JogToWell.tsx

View check run for this annotation

Codecov / codecov/patch

app/src/organisms/LegacyLabwarePositionCheck/JogToWell.tsx#L271-L273

Added lines #L271 - L273 were not covered by tests
>
<Flex>
{isApplyingOffsets ? (
<Icon
size="1rem"
spin
name="ot-spinner"
marginRight={SPACING.spacing8}

Check warning on line 281 in app/src/organisms/LegacyLabwarePositionCheck/JogToWell.tsx

View check run for this annotation

Codecov / codecov/patch

app/src/organisms/LegacyLabwarePositionCheck/JogToWell.tsx#L275-L281

Added lines #L275 - L281 were not covered by tests
/>
) : null}
{t('shared:confirm_position')}
</Flex>

Check warning on line 285 in app/src/organisms/LegacyLabwarePositionCheck/JogToWell.tsx

View check run for this annotation

Codecov / codecov/patch

app/src/organisms/LegacyLabwarePositionCheck/JogToWell.tsx#L283-L285

Added lines #L283 - L285 were not covered by tests
</PrimaryButton>
</Flex>
</Flex>
Expand Down
Loading
Loading