-) => {
- return renderWithProviders(
- ,
- {
- i18nInstance: i18n,
- }
- )[0]
-}
-
-describe('DeprecatedLabwarePositionCheckStepDetail', () => {
- let props: React.ComponentProps<
- typeof DeprecatedLabwarePositionCheckStepDetail
- >
- beforeEach(() => {
- props = {
- selectedStep: mockLabwarePositionCheckStepTipRack,
- jog: jest
- .fn()
- .mockImplementation((_axis, _direction, _step, onSuccess) => {
- onSuccess(mockJoggedToPosition)
- }) as any,
- runId: MOCK_RUN_ID,
- savePositionCommandData: {
- [mockLabwarePositionCheckStepTipRack.labwareId]: ['commandId1'],
- },
- }
- when(mockDeprecatedStepDetailText)
- .calledWith(
- partialComponentPropsMatcher({
- selectedStep: mockLabwarePositionCheckStepTipRack,
- })
- )
- .mockReturnValue(Mock Step Detail Text
)
- when(mockUseLabwareOffsetForLabware)
- .calledWith(MOCK_RUN_ID, mockLabwarePositionCheckStepTipRack.labwareId)
- .mockReturnValue(null)
- when(mockUseCommandQuery)
- .calledWith(MOCK_RUN_ID, 'commandId1')
- .mockReturnValue({
- data: {
- data: {
- commandType: 'savePosition',
- result: {
- position: mockStartingPosition,
- },
- },
- },
- } as any)
- when(mockUseProtocolDetailsForRun)
- .calledWith(MOCK_RUN_ID)
- .mockReturnValue({
- protocolData: {
- labware: [
- {
- id: mockLabwarePositionCheckStepTipRack.labwareId,
- slot: '1',
- displayName: 'someDislpayName',
- definitionUri: LABWARE_DEF_URI,
- loadName: 'someLoadName',
- },
- ],
- labwareDefinitions: {
- [LABWARE_DEF_URI]: LABWARE_DEF,
- },
- pipettes: [
- {
- id: PRIMARY_PIPETTE_ID,
- pipetteName: PRIMARY_PIPETTE_NAME,
- mount: 'left',
- },
- ],
- },
- } as any)
-
- when(mockGetPipetteNameSpecs)
- .calledWith(PRIMARY_PIPETTE_NAME as any)
- .mockReturnValue({ channels: 1 } as any)
-
- mockGetIsTiprack.mockReturnValue(false)
-
- mockJogControls.mockReturnValue()
-
- when(mockRobotWorkSpace)
- .mockReturnValue(
- mockRobotWorkSpace not being called with the correct props
- )
- .calledWith(anyProps())
- .mockImplementation(({ children }) => (
-
- ))
-
- when(mockPipetteRender)
- .mockReturnValue()
- .calledWith(
- partialComponentPropsMatcher({
- labwareDef: LABWARE_DEF,
- })
- )
- .mockReturnValue(mock pipette render
)
- when(mockOffsetVector)
- .mockReturnValue(
- mockOffsetVector not being called with the correct props
- )
- .calledWith(anyProps())
- .mockImplementation(props => (
- {`x${props.x},y${props.y},z${props.z}`}
- ))
- })
- afterEach(() => {
- resetAllWhenMocks()
- jest.restoreAllMocks()
- })
- it('renders StepDetailText component', () => {
- const { getByText } = render(props)
- getByText('Mock Step Detail Text')
- })
- it('renders the level with labware image', () => {
- render(props)
- screen.getByAltText('level with labware')
- })
- it('renders null if protocol data is null', () => {
- mockUseProtocolDetailsForRun.mockReturnValue({ protocolData: null } as any)
- const { container } = render(props)
- expect(container.firstChild).toBeNull()
- })
- it('renders the level with tip image', () => {
- mockGetIsTiprack.mockReturnValue(true)
-
- when(mockUseProtocolDetailsForRun)
- .calledWith(MOCK_RUN_ID)
- .mockReturnValue({
- protocolData: {
- labware: [
- {
- id: mockLabwarePositionCheckStepTipRack.labwareId,
- slot: '1',
- displayName: 'someDislpayName',
- definitionUri: LABWARE_DEF_URI,
- loadName: 'someLoadName',
- },
- ],
- labwareDefinitions: {
- [TIPRACK_DEF_URI]: LABWARE_DEF,
- },
- pipettes: [
- {
- id: PRIMARY_PIPETTE_ID,
- pipetteName: PRIMARY_PIPETTE_NAME,
- mount: 'left',
- },
- ],
- },
- } as any)
- render(props)
- screen.getByAltText('level with tip')
- })
- it('renders a pipette', () => {
- when(mockPipetteRender)
- .calledWith(
- componentPropsMatcher({
- labwareDef: LABWARE_DEF,
- pipetteName: PRIMARY_PIPETTE_NAME,
- })
- )
- .mockReturnValue(mock pipette render
)
- const { getByText } = render(props)
- getByText('mock pipette render')
- })
- describe('when pipette is multi channel', () => {
- it('renders labware with stroke, and highlighted labels outside', () => {
- when(mockGetPipetteNameSpecs)
- .calledWith(PRIMARY_PIPETTE_NAME as any)
- .mockReturnValue({ channels: 8 } as any)
-
- when(mockLabwareRender)
- .mockReturnValue(
- mock labware render not being called with the right props
- )
- .calledWith(
- partialComponentPropsMatcher({
- definition: LABWARE_DEF,
- wellStroke: { A1: C_BLUE, A2: C_BLUE },
- wellLabelOption: WELL_LABEL_OPTIONS.SHOW_LABEL_OUTSIDE,
- highlightedWellLabels: { wells: ['A1', 'A2'] },
- })
- )
- .mockReturnValue(
-
- mock labware with stroke and highlighted well labels outside
-
- )
-
- const { getByText } = render(props)
- getByText('mock labware with stroke and highlighted well labels outside')
- })
- })
- describe('when pipette is single channel', () => {
- it('renders labware with stroke, and highlighted labels outside', () => {
- when(mockGetPipetteNameSpecs)
- .calledWith(PRIMARY_PIPETTE_NAME as any)
- .mockReturnValue({ channels: 1 } as any)
-
- when(mockLabwareRender)
- .mockReturnValue(
- mock labware render not being called with the right props
- )
- .calledWith(
- partialComponentPropsMatcher({
- definition: LABWARE_DEF,
- wellStroke: { A1: C_BLUE },
- wellLabelOption: WELL_LABEL_OPTIONS.SHOW_LABEL_OUTSIDE,
- highlightedWellLabels: { wells: ['A1'] },
- })
- )
- .mockReturnValue(
-
- mock labware with stroke and highlighted well labels outside
-
- )
-
- const { getByText } = render(props)
- getByText('mock labware with stroke and highlighted well labels outside')
- })
- })
- describe('jog controls', () => {
- it('renders correct text when jog controls are hidden', () => {
- const { getByText, getByRole } = render(props)
- getByText('Need to make an adjustment?')
- getByRole('button', { name: 'Reveal jog controls' })
- expect(screen.queryByText('Mock Jog Controls')).toBeNull()
- })
- it('renders correct text when jog controls are revealed', () => {
- mockJogControls.mockReturnValue(Mock Jog Controls
)
- const { getByText, getByRole } = render(props)
- getByText('Need to make an adjustment?')
- const revealJogControls = getByRole('button', {
- name: 'Reveal jog controls',
- })
- fireEvent.click(revealJogControls)
- getByText('Mock Jog Controls')
- })
- it('renders identity offset and updates correctly after jog', () => {
- mockJogControls.mockImplementation(props => (
-
- ))
- const { getByText, getByRole } = render(props)
- const revealJogControls = getByRole('button', {
- name: 'Reveal jog controls',
- })
- getByText('x0,y0,z0')
- fireEvent.click(revealJogControls)
- const jogButton = getByRole('button', {
- name: 'MOCK JOG BUTTON',
- })
- fireEvent.click(jogButton)
- getByText('x1,y1,z1')
- })
- it('renders existing offset and updates correctly after jog', () => {
- mockJogControls.mockImplementation(props => (
-
- ))
- when(mockUseLabwareOffsetForLabware)
- .calledWith(MOCK_RUN_ID, mockLabwarePositionCheckStepTipRack.labwareId)
- .mockReturnValue({
- id: 'fake_offset_id',
- vector: { x: 4, y: 5, z: 6 },
- createdAt: 'fakeTimestamp',
- location: { slotName: '1' },
- definitionUri: 'fakeUri',
- })
- const { getByText, getByRole } = render(props)
- const revealJogControls = getByRole('button', {
- name: 'Reveal jog controls',
- })
- getByText('x4,y5,z6')
- fireEvent.click(revealJogControls)
- const jogButton = getByRole('button', {
- name: 'MOCK JOG BUTTON',
- })
- fireEvent.click(jogButton)
- getByText('x5,y6,z7')
- })
- })
-})
diff --git a/app/src/organisms/LabwarePositionCheck/DeprecatedComponents/__tests__/DeprecatedLabwarePositionCheckStepDetailModal.test.tsx b/app/src/organisms/LabwarePositionCheck/DeprecatedComponents/__tests__/DeprecatedLabwarePositionCheckStepDetailModal.test.tsx
deleted file mode 100644
index 336944cd67c..00000000000
--- a/app/src/organisms/LabwarePositionCheck/DeprecatedComponents/__tests__/DeprecatedLabwarePositionCheckStepDetailModal.test.tsx
+++ /dev/null
@@ -1,61 +0,0 @@
-import * as React from 'react'
-import { fireEvent } from '@testing-library/react'
-import { renderWithProviders } from '@opentrons/components'
-import { i18n } from '../../../../i18n'
-import { DeprecatedLabwarePositionCheckStepDetailModal } from '../DeprecatedLabwarePositionCheckStepDetailModal'
-
-const render = (
- props: React.ComponentProps<
- typeof DeprecatedLabwarePositionCheckStepDetailModal
- >
-) => {
- return renderWithProviders(
- ,
- {
- i18nInstance: i18n,
- }
- )[0]
-}
-
-describe('DeprecatedLabwarePositionCheckStepDetailModal', () => {
- let props: React.ComponentProps<
- typeof DeprecatedLabwarePositionCheckStepDetailModal
- >
- beforeEach(() => {
- props = { onCloseClick: jest.fn() }
- })
-
- it('should render the correct header', () => {
- const { getByRole } = render(props)
- expect(
- getByRole('heading', {
- name: 'How to tell if the pipette is centered and level',
- })
- ).toBeTruthy()
- })
- it('should render the correct body and image texts', () => {
- const { getByText } = render(props)
- getByText(
- 'To ensure that the nozzle is centered, check from a second side of your OT-2.'
- )
- getByText(
- 'To ensure the nozzle or tip is level with the top of the labware, position yourself at eye-level and/or slide a sheet of paper between the nozzle and tip.'
- )
- getByText('Viewed from front, it appears centered...')
- getByText('...but viewed from side, it requires adjustment')
- getByText('Nozzle is not centered')
- getByText('Viewed from standing height, it appears level...')
- getByText('... but viewed from eye-level, it requires adjustment')
- getByText('Nozzle is not level')
- getByText(
- 'If you’re having trouble, slide 1 sheet of printer paper between the nozzle and the tip. A single piece of paper should barely pass between them.'
- )
- })
- it('should call onCloseClick when the close button is pressed', () => {
- const { getByRole } = render(props)
- expect(props.onCloseClick).not.toHaveBeenCalled()
- const closeButton = getByRole('button', { name: 'close' })
- fireEvent.click(closeButton)
- expect(props.onCloseClick).toHaveBeenCalled()
- })
-})
diff --git a/app/src/organisms/LabwarePositionCheck/DeprecatedComponents/__tests__/DeprecatedRobotMotionLoadingModal.test.tsx b/app/src/organisms/LabwarePositionCheck/DeprecatedComponents/__tests__/DeprecatedRobotMotionLoadingModal.test.tsx
deleted file mode 100644
index 6aa88157c87..00000000000
--- a/app/src/organisms/LabwarePositionCheck/DeprecatedComponents/__tests__/DeprecatedRobotMotionLoadingModal.test.tsx
+++ /dev/null
@@ -1,36 +0,0 @@
-import * as React from 'react'
-import { when } from 'jest-when'
-import { DeprecatedRobotMotionLoadingModal } from '../DeprecatedRobotMotionLoadingModal'
-import { i18n } from '../../../../i18n'
-import {
- partialComponentPropsMatcher,
- renderWithProviders,
-} from '@opentrons/components'
-
-jest.mock('../DeprecatedRobotMotionLoadingModal')
-
-const mockDeprecatedRobotMotionLoadingModal = DeprecatedRobotMotionLoadingModal as jest.MockedFunction<
- typeof DeprecatedRobotMotionLoadingModal
->
-
-const mockTitle = 'Moving to Slot 7'
-
-const render = () => {
- return renderWithProviders(
- ,
- {
- i18nInstance: i18n,
- }
- )[0]
-}
-
-describe('Deprecated Robot in Motion Modal', () => {
- it('should render robot in motion modal WITH title', () => {
- when(mockDeprecatedRobotMotionLoadingModal)
- .calledWith(partialComponentPropsMatcher({ title: mockTitle }))
- .mockReturnValue(mock {mockTitle}
)
-
- const { getByText } = render()
- getByText('mock Moving to Slot 7')
- })
-})
diff --git a/app/src/organisms/LabwarePositionCheck/DeprecatedComponents/__tests__/DeprecatedSectionList.test.tsx b/app/src/organisms/LabwarePositionCheck/DeprecatedComponents/__tests__/DeprecatedSectionList.test.tsx
deleted file mode 100644
index 3c0c8f26d88..00000000000
--- a/app/src/organisms/LabwarePositionCheck/DeprecatedComponents/__tests__/DeprecatedSectionList.test.tsx
+++ /dev/null
@@ -1,94 +0,0 @@
-import { renderWithProviders } from '@opentrons/components'
-import * as React from 'react'
-import { i18n } from '../../../../i18n'
-import { DeprecatedSectionList } from '../DeprecatedSectionList'
-import { DeprecatedSection } from '../types'
-
-const MOCK_SECTIONS_1_PIPETTE_2_STEPS = [
- 'PRIMARY_PIPETTE_TIPRACKS',
- 'RETURN_TIP',
-] as DeprecatedSection[]
-const MOCK_SECTIONS_2_PIPETTES_3_STEPS = [
- 'PRIMARY_PIPETTE_TIPRACKS',
- 'SECONDARY_PIPETTE_TIPRACKS',
- 'RETURN_TIP',
-] as DeprecatedSection[]
-const MOCK_SECTIONS_2_PIPETTES_4_STEPS = [
- 'PRIMARY_PIPETTE_TIPRACKS',
- 'SECONDARY_PIPETTE_TIPRACKS',
- 'CHECK_REMAINING_LABWARE_WITH_PRIMARY_PIPETTE',
- 'RETURN_TIP',
-] as DeprecatedSection[]
-
-const render = (props: React.ComponentProps) => {
- return renderWithProviders(, {
- i18nInstance: i18n,
- })[0]
-}
-
-describe('DeprecatedSectionList', () => {
- let props: React.ComponentProps
-
- beforeEach(() => {
- props = {
- sections: MOCK_SECTIONS_1_PIPETTE_2_STEPS,
- currentSection: 'PRIMARY_PIPETTE_TIPRACKS',
- primaryPipetteMount: 'left',
- secondaryPipetteMount: '',
- }
- })
- it('renders a 2 step Nav with 1 pipette', () => {
- const { getByText } = render(props)
- expect(getByText('1')).toHaveStyle('backgroundColor: C_SELECTED_DARK')
- getByText('Check tip racks with Left Pipette and pick up a tip')
- expect(getByText('2')).toHaveStyle('backgroundColor: C_DISABLED')
- getByText('Return tip')
- })
- it('renders a 3 step Nav with 2 pipettes', () => {
- props = {
- sections: MOCK_SECTIONS_2_PIPETTES_3_STEPS,
- currentSection: 'PRIMARY_PIPETTE_TIPRACKS',
- primaryPipetteMount: 'left',
- secondaryPipetteMount: 'right',
- }
- const { getByText } = render(props)
- expect(getByText('1')).toHaveStyle('backgroundColor: C_SELECTED_DARK')
- getByText('Check tip racks with Right Pipette')
- expect(getByText('2')).toHaveStyle('backgroundColor: C_DISABLED')
- getByText('Check tip racks with Left Pipette and pick up a tip')
- expect(getByText('3')).toHaveStyle('backgroundColor: C_DISABLED')
- getByText('Return tip')
- })
- it('renders a 4 step Nav with 2 pipettes', () => {
- props = {
- sections: MOCK_SECTIONS_2_PIPETTES_4_STEPS,
- currentSection: 'PRIMARY_PIPETTE_TIPRACKS',
- primaryPipetteMount: 'left',
- secondaryPipetteMount: 'right',
- }
- const { getByText } = render(props)
- expect(getByText('1')).toHaveStyle('backgroundColor: C_SELECTED_DARK')
- getByText('Check tip racks with Right Pipette')
- expect(getByText('2')).toHaveStyle('backgroundColor: C_DISABLED')
- getByText('Check tip racks with Left Pipette and pick up a tip')
- expect(getByText('3')).toHaveStyle('backgroundColor: C_DISABLED')
- getByText('Check remaining labware with Left Pipette and tip')
- expect(getByText('4')).toHaveStyle('backgroundColor: C_DISABLED')
- getByText('Return tip')
- })
- it('renders a 3 step Nav with 2 pipettes and on the second step', () => {
- props = {
- sections: MOCK_SECTIONS_2_PIPETTES_3_STEPS,
- currentSection: 'SECONDARY_PIPETTE_TIPRACKS',
- primaryPipetteMount: 'left',
- secondaryPipetteMount: 'right',
- completedSections: ['PRIMARY_PIPETTE_TIPRACKS'],
- }
- const { getByText } = render(props)
- getByText('Check tip racks with Right Pipette')
- expect(getByText('2')).toHaveStyle('backgroundColor: C_SELECTED_DARK')
- getByText('Check tip racks with Left Pipette and pick up a tip')
- expect(getByText('3')).toHaveStyle('backgroundColor: C_DISABLED')
- getByText('Return tip')
- })
-})
diff --git a/app/src/organisms/LabwarePositionCheck/DeprecatedComponents/__tests__/DeprecatedStepDetailText.test.tsx b/app/src/organisms/LabwarePositionCheck/DeprecatedComponents/__tests__/DeprecatedStepDetailText.test.tsx
deleted file mode 100644
index fda1e762791..00000000000
--- a/app/src/organisms/LabwarePositionCheck/DeprecatedComponents/__tests__/DeprecatedStepDetailText.test.tsx
+++ /dev/null
@@ -1,307 +0,0 @@
-import * as React from 'react'
-import { resetAllWhenMocks, when } from 'jest-when'
-import { fireEvent, screen } from '@testing-library/react'
-import withSinglechannelProtocol from '@opentrons/shared-data/protocol/fixtures/4/testModulesProtocol.json'
-import withMultiChannelProtocol from '@opentrons/shared-data/protocol/fixtures/4/pipetteMultiChannelProtocolV4.json'
-import {
- nestedTextMatcher,
- componentPropsMatcher,
- renderWithProviders,
-} from '@opentrons/components'
-import { i18n } from '../../../../i18n'
-import { useProtocolDetailsForRun } from '../../../Devices/hooks'
-import { DeprecatedLabwarePositionCheckStepDetailModal } from '../DeprecatedLabwarePositionCheckStepDetailModal'
-import { DeprecatedStepDetailText } from '../DeprecatedStepDetailText'
-
-jest.mock('../DeprecatedLabwarePositionCheckStepDetailModal')
-jest.mock('../../../Devices/hooks')
-
-const mockUseProtocolDetailsForRun = useProtocolDetailsForRun as jest.MockedFunction<
- typeof useProtocolDetailsForRun
->
-const mockDeprecatedLabwarePositionCheckStepDetailModal = DeprecatedLabwarePositionCheckStepDetailModal as jest.MockedFunction<
- typeof DeprecatedLabwarePositionCheckStepDetailModal
->
-const PICKUP_TIP_LABWARE_ID = 'PICKUP_TIP_LABWARE_ID'
-const PRIMARY_PIPETTE_ID = 'PRIMARY_PIPETTE_ID'
-const MOCK_RUN_ID = 'fakeRunId'
-
-const mockLabwarePositionCheckStepTipRack = {
- labwareId:
- '1d57fc10-67ad-11ea-9f8b-3b50068bd62d:opentrons/opentrons_96_filtertiprack_200ul/1',
- section: '',
- commands: [
- {
- command: 'pickUpTip',
- params: {
- pipette: PRIMARY_PIPETTE_ID,
- labware: PICKUP_TIP_LABWARE_ID,
- },
- },
- ],
-} as any
-
-const mockLabwarePositionCheckStepLabware = {
- labwareId:
- '24274d20-67ad-11ea-9f8b-3b50068bd62d:opentrons/nest_96_wellplate_100ul_pcr_full_skirt/1',
- section: '',
- commands: [
- {
- command: 'pickUpTip',
- params: {
- pipette: PRIMARY_PIPETTE_ID,
- labware: PICKUP_TIP_LABWARE_ID,
- },
- },
- ],
-} as any
-
-const render = (
- props: React.ComponentProps
-) => {
- return renderWithProviders(, {
- i18nInstance: i18n,
- })[0]
-}
-
-describe('DeprecatedStepDetailText', () => {
- let props: React.ComponentProps
- beforeEach(() => {
- props = {
- selectedStep: mockLabwarePositionCheckStepTipRack,
- runId: MOCK_RUN_ID,
- }
-
- when(mockDeprecatedLabwarePositionCheckStepDetailModal)
- .calledWith(
- componentPropsMatcher({
- onCloseClick: expect.anything(),
- })
- )
- .mockImplementation(({ onCloseClick }) => (
-
- mock labware position check step detail modal
-
- ))
- when(mockUseProtocolDetailsForRun)
- .calledWith(MOCK_RUN_ID)
- .mockReturnValue({
- protocolData: {
- ...withSinglechannelProtocol,
- labware: [
- {
- id: 'trashId',
- slot: '12',
- displayName: 'Trash',
- definitionUri: 'opentrons/opentrons_1_trash_1100ml_fixed/1',
- loadName: 'opentrons_1_trash_1100ml_fixed',
- },
- {
- id:
- '1d57fc10-67ad-11ea-9f8b-3b50068bd62d:opentrons/opentrons_96_filtertiprack_200ul/1',
- slot: '2',
- displayName: 'Opentrons 96 Filter Tip Rack 200 µL',
- definitionUri: 'opentrons/opentrons_96_filtertiprack_200ul/1',
- loadName: 'opentrons_96_filtertiprack_200ul',
- },
- {
- id:
- '24274d20-67ad-11ea-9f8b-3b50068bd62d:opentrons/nest_96_wellplate_100ul_pcr_full_skirt/1',
- slot: '1d57adf0-67ad-11ea-9f8b-3b50068bd62d:magneticModuleType',
- displayName: 'NEST 96 Well Plate 100 µL PCR Full Skirt',
- definitionUri:
- 'opentrons/nest_96_wellplate_100ul_pcr_full_skirt/1',
- loadName: 'nest_96_wellplate_100ul_pcr_full_skirt',
- },
- {
- id:
- '269518d0-67ad-11ea-9f8b-3b50068bd62d:opentrons/opentrons_24_aluminumblock_nest_1.5ml_screwcap/1',
- slot:
- '1d57d500-67ad-11ea-9f8b-3b50068bd62d:temperatureModuleType',
- displayName:
- 'Opentrons 24 Well Aluminum Block with NEST 1.5 mL Screwcap',
- definitionUri:
- 'opentrons/opentrons_24_aluminumblock_nest_1.5ml_screwcap/1',
- loadName: 'opentrons_24_aluminumblock_nest_1.5ml_screwcap',
- },
- ],
- },
- } as any)
- })
-
- afterEach(() => {
- resetAllWhenMocks()
- jest.restoreAllMocks()
- })
-
- it('opens up the LPC help modal when clicked', () => {
- const { getByText } = render(props)
-
- expect(
- screen.queryByText('mock labware position check step detail modal')
- ).toBeNull()
- const helpLink = getByText('See how to tell if the pipette is centered')
- fireEvent.click(helpLink)
- getByText('mock labware position check step detail modal')
- })
- it('closes the LPC help modal when closed', () => {
- const { getByText } = render(props)
-
- const helpLink = getByText('See how to tell if the pipette is centered')
- fireEvent.click(helpLink)
- const mockModal = getByText('mock labware position check step detail modal')
- fireEvent.click(mockModal)
- expect(
- screen.queryByText('mock labware position check step detail modal')
- ).toBeNull()
- })
- it('renders the 1 tip with tiprack text: labware_step_detail_tiprack', () => {
- props = { ...props, pipetteChannels: 1 }
- const { getByText } = render(props)
- getByText('See how to tell if the pipette is centered')
- getByText(
- nestedTextMatcher(
- 'The pipette nozzle should be centered above A1 in Opentrons 96 Filter Tip Rack 200 µL and level with the top of the tip.'
- )
- )
- })
- it('renders the 1 tip with labware text: labware_step_detail_labware', () => {
- props = {
- selectedStep: mockLabwarePositionCheckStepLabware,
- pipetteChannels: 1,
- runId: MOCK_RUN_ID,
- }
- const { getByText } = render(props)
- getByText('See how to tell if the pipette is centered')
- getByText(
- nestedTextMatcher(
- 'The tip should be centered above A1 in NEST 96 Well Plate 100 µL PCR Full Skirt and level with the top of the labware.'
- )
- )
- })
- it('renders the 8 tips with tiprack text: labware_step_detail_tiprack_plural', () => {
- props = { ...props, pipetteChannels: 8 }
- when(mockUseProtocolDetailsForRun)
- .calledWith(MOCK_RUN_ID)
- .mockReturnValue({
- protocolData: {
- ...withMultiChannelProtocol,
- labware: [
- {
- id: 'trashId',
- slot: '12',
- displayName: 'Trash',
- definitionUri: 'opentrons/opentrons_1_trash_1100ml_fixed/1',
- loadName: 'opentrons_1_trash_1100ml_fixed',
- },
- {
- id:
- '1d57fc10-67ad-11ea-9f8b-3b50068bd62d:opentrons/opentrons_96_filtertiprack_200ul/1',
- slot: '2',
- displayName: 'Opentrons 96 Filter Tip Rack 200 µL',
- definitionUri: 'opentrons/opentrons_96_filtertiprack_200ul/1',
- loadName: 'opentrons_96_filtertiprack_200ul',
- },
- {
- id:
- '24274d20-67ad-11ea-9f8b-3b50068bd62d:opentrons/nest_96_wellplate_100ul_pcr_full_skirt/1',
- slot: '1d57adf0-67ad-11ea-9f8b-3b50068bd62d:magneticModuleType',
- displayName: 'NEST 96 Well Plate 100 µL PCR Full Skirt',
- definitionUri:
- 'opentrons/nest_96_wellplate_100ul_pcr_full_skirt/1',
- loadName: 'nest_96_wellplate_100ul_pcr_full_skirt',
- },
- {
- id:
- '269518d0-67ad-11ea-9f8b-3b50068bd62d:opentrons/opentrons_24_aluminumblock_nest_1.5ml_screwcap/1',
- slot:
- '1d57d500-67ad-11ea-9f8b-3b50068bd62d:temperatureModuleType',
- displayName:
- 'Opentrons 24 Well Aluminum Block with NEST 1.5 mL Screwcap',
- definitionUri:
- 'opentrons/opentrons_24_aluminumblock_nest_1.5ml_screwcap/1',
- loadName: 'opentrons_24_aluminumblock_nest_1.5ml_screwcap',
- },
- ],
- },
- } as any)
-
- const { getByText } = render(props)
- getByText('See how to tell if the pipette is centered')
-
- getByText(
- nestedTextMatcher(
- 'The pipette nozzles should be centered above column 1 in Opentrons 96 Filter Tip Rack 200 µL and level with the top of the tips.'
- )
- )
- })
- it('renders the 8 tips with labware text: labware_step_detail_labware_plural', () => {
- props = {
- selectedStep: mockLabwarePositionCheckStepLabware,
- pipetteChannels: 8,
- runId: MOCK_RUN_ID,
- }
- when(mockUseProtocolDetailsForRun)
- .calledWith(MOCK_RUN_ID)
- .mockReturnValue({
- protocolData: {
- ...withMultiChannelProtocol,
- labware: [
- {
- id: 'trashId',
- slot: '12',
- displayName: 'Trash',
- definitionUri: 'opentrons/opentrons_1_trash_1100ml_fixed/1',
- loadName: 'opentrons_1_trash_1100ml_fixed',
- },
- {
- id:
- '1d57fc10-67ad-11ea-9f8b-3b50068bd62d:opentrons/opentrons_96_filtertiprack_200ul/1',
- slot: '2',
- displayName: 'Opentrons 96 Filter Tip Rack 200 µL',
- definitionUri: 'opentrons/opentrons_96_filtertiprack_200ul/1',
- loadName: 'opentrons_96_filtertiprack_200ul',
- },
- {
- id:
- '24274d20-67ad-11ea-9f8b-3b50068bd62d:opentrons/nest_96_wellplate_100ul_pcr_full_skirt/1',
- slot: '1d57adf0-67ad-11ea-9f8b-3b50068bd62d:magneticModuleType',
- displayName: 'NEST 96 Well Plate 100 µL PCR Full Skirt',
- definitionUri:
- 'opentrons/nest_96_wellplate_100ul_pcr_full_skirt/1',
- loadName: 'nest_96_wellplate_100ul_pcr_full_skirt',
- },
- {
- id:
- '269518d0-67ad-11ea-9f8b-3b50068bd62d:opentrons/opentrons_24_aluminumblock_nest_1.5ml_screwcap/1',
- slot:
- '1d57d500-67ad-11ea-9f8b-3b50068bd62d:temperatureModuleType',
- displayName:
- 'Opentrons 24 Well Aluminum Block with NEST 1.5 mL Screwcap',
- definitionUri:
- 'opentrons/opentrons_24_aluminumblock_nest_1.5ml_screwcap/1',
- loadName: 'opentrons_24_aluminumblock_nest_1.5ml_screwcap',
- },
- ],
- },
- } as any)
-
- const { getByText } = render(props)
- getByText('See how to tell if the pipette is centered')
-
- getByText(
- nestedTextMatcher(
- 'The tips should be centered above column 1 in NEST 96 Well Plate 100 µL PCR Full Skirt and level with the top of the labware.'
- )
- )
- })
- it('returns null if protocolData is null', () => {
- when(mockUseProtocolDetailsForRun)
- .calledWith(MOCK_RUN_ID)
- .mockReturnValue({
- protocolData: null,
- } as any)
- const { container } = render(props)
- expect(container.firstChild).toBeNull()
- })
-})
diff --git a/app/src/organisms/LabwarePositionCheck/DeprecatedComponents/__tests__/DeprecatedSummaryScreen.test.tsx b/app/src/organisms/LabwarePositionCheck/DeprecatedComponents/__tests__/DeprecatedSummaryScreen.test.tsx
deleted file mode 100644
index 920328160a8..00000000000
--- a/app/src/organisms/LabwarePositionCheck/DeprecatedComponents/__tests__/DeprecatedSummaryScreen.test.tsx
+++ /dev/null
@@ -1,162 +0,0 @@
-import * as React from 'react'
-import { when, resetAllWhenMocks } from 'jest-when'
-import { act } from 'react-dom/test-utils'
-import { fireEvent } from '@testing-library/dom'
-import { useTrackEvent } from '../../../../redux/analytics'
-import { renderWithProviders } from '@opentrons/components'
-import { i18n } from '../../../../i18n'
-import { useProtocolDetailsForRun } from '../../../Devices/hooks'
-import { useLPCSuccessToast } from '../../../Devices/hooks/useLPCSuccessToast'
-import { useCurrentRunId } from '../../../ProtocolUpload/hooks'
-import { DeprecatedSectionList } from '../DeprecatedSectionList'
-import { DeprecatedDeckMap } from '../DeprecatedDeckMap'
-import { DeprecatedSummaryScreen } from '../DeprecatedSummaryScreen'
-import { DeprecatedLabwareOffsetsSummary } from '../DeprecatedLabwareOffsetsSummary'
-import { useIntroInfo, useLabwareOffsets } from '../../deprecatedHooks'
-import { DeprecatedSection } from '../types'
-
-jest.mock('../../../../redux/analytics')
-jest.mock('../../../ProtocolUpload/hooks')
-jest.mock('../../../Devices/hooks')
-jest.mock('../../../Devices/hooks/useLPCSuccessToast')
-jest.mock('../DeprecatedSectionList')
-jest.mock('../../deprecatedHooks')
-jest.mock('../DeprecatedDeckMap')
-jest.mock('../DeprecatedLabwareOffsetsSummary')
-
-const mockDeprecatedSectionList = DeprecatedSectionList as jest.MockedFunction<
- typeof DeprecatedSectionList
->
-const mockUseIntroInfo = useIntroInfo as jest.MockedFunction<
- typeof useIntroInfo
->
-const mockUseProtocolDetailsForRun = useProtocolDetailsForRun as jest.MockedFunction<
- typeof useProtocolDetailsForRun
->
-const mockDeprecatedDeckmap = DeprecatedDeckMap as jest.MockedFunction<
- typeof DeprecatedDeckMap
->
-
-const mockDeprecatedLabwareOffsetsSummary = DeprecatedLabwareOffsetsSummary as jest.MockedFunction<
- typeof DeprecatedLabwareOffsetsSummary
->
-const mockUseLabwareOffsets = useLabwareOffsets as jest.MockedFunction<
- typeof useLabwareOffsets
->
-const mockUseLPCSuccessToast = useLPCSuccessToast as jest.MockedFunction<
- typeof useLPCSuccessToast
->
-const mockUseCurrentRunId = useCurrentRunId as jest.MockedFunction<
- typeof useCurrentRunId
->
-const mockUseTrackEvent = useTrackEvent as jest.MockedFunction<
- typeof useTrackEvent
->
-
-const MOCK_DEPRECATED_SECTIONS = [
- 'PRIMARY_PIPETTE_TIPRACKS' as DeprecatedSection,
-]
-const LABWARE_DEF_ID = 'LABWARE_DEF_ID'
-const PRIMARY_PIPETTE_ID = 'PRIMARY_PIPETTE_ID'
-const PRIMARY_PIPETTE_NAME = 'PRIMARY_PIPETTE_NAME'
-const LABWARE_DEF = {
- ordering: [['A1', 'A2']],
-}
-const MOCK_RUN_ID = 'fake_run_id'
-
-const render = (
- props: React.ComponentProps
-) => {
- return renderWithProviders(, {
- i18nInstance: i18n,
- })[0]
-}
-
-let mockTrackEvent: jest.Mock
-describe('DeprecatedSummaryScreen', () => {
- let props: React.ComponentProps
-
- beforeEach(() => {
- props = {
- savePositionCommandData: { someLabwareIf: ['commandId1', 'commandId2'] },
- onCloseClick: jest.fn(),
- }
- mockUseCurrentRunId.mockReturnValue(MOCK_RUN_ID)
- mockDeprecatedSectionList.mockReturnValue(Mock SectionList
)
- mockDeprecatedDeckmap.mockReturnValue(Mock DeckMap
)
- mockDeprecatedLabwareOffsetsSummary.mockReturnValue(
- Mock Labware Offsets Summary
- )
- mockUseLabwareOffsets.mockResolvedValue([])
-
- when(mockUseIntroInfo).calledWith().mockReturnValue({
- primaryPipetteMount: 'left',
- secondaryPipetteMount: '',
- firstTiprackSlot: '2',
- sections: MOCK_DEPRECATED_SECTIONS,
- })
-
- when(mockUseProtocolDetailsForRun)
- .calledWith(MOCK_RUN_ID)
- .mockReturnValue({
- protocolData: {
- labware: [
- {
- id:
- '1d57fc10-67ad-11ea-9f8b-3b50068bd62d:opentrons/opentrons_96_filtertiprack_200ul/1',
- slot: '1',
- displayName: 'someDisplayName',
- definitionId: LABWARE_DEF_ID,
- loadName: 'someLoadName',
- },
- ],
- labwareDefinitions: {
- [LABWARE_DEF_ID]: LABWARE_DEF,
- },
- pipettes: {
- [PRIMARY_PIPETTE_ID]: {
- name: PRIMARY_PIPETTE_NAME,
- mount: 'left',
- },
- },
- },
- } as any)
- when(mockUseLPCSuccessToast)
- .calledWith()
- .mockReturnValue({ setIsShowingLPCSuccessToast: _isShowing => {} })
- mockTrackEvent = jest.fn()
- when(mockUseTrackEvent).calledWith().mockReturnValue(mockTrackEvent)
- })
- afterEach(() => {
- resetAllWhenMocks()
- jest.restoreAllMocks()
- })
- it('renders Summary Screen with all components and header', () => {
- const { getByText } = render(props)
- getByText('Mock SectionList')
- getByText('Mock DeckMap')
- getByText('Mock Labware Offsets Summary')
- getByText('Labware Position Check Complete')
- })
- it('renders apply offset button and clicks it', () => {
- const mockSetIsShowingLPCSuccessToast = jest.fn()
- when(mockUseLPCSuccessToast).calledWith().mockReturnValue({
- setIsShowingLPCSuccessToast: mockSetIsShowingLPCSuccessToast,
- })
- const { getByRole } = render(props)
- expect(props.onCloseClick).not.toHaveBeenCalled()
- expect(mockSetIsShowingLPCSuccessToast).not.toHaveBeenCalled()
- const button = getByRole('button', {
- name: 'Close and apply labware offset data',
- })
- act(() => {
- fireEvent.click(button)
- })
- expect(props.onCloseClick).toHaveBeenCalled()
- expect(mockSetIsShowingLPCSuccessToast).toHaveBeenCalled()
- expect(mockTrackEvent).toHaveBeenCalledWith({
- name: 'applyLabwareOffsetData',
- properties: {},
- })
- })
-})
diff --git a/app/src/organisms/LabwarePositionCheck/DeprecatedComponents/constants.ts b/app/src/organisms/LabwarePositionCheck/DeprecatedComponents/constants.ts
deleted file mode 100644
index 4ea16757b8b..00000000000
--- a/app/src/organisms/LabwarePositionCheck/DeprecatedComponents/constants.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-export const DEPRECATED_SECTIONS = {
- PRIMARY_PIPETTE_TIPRACKS: 'PRIMARY_PIPETTE_TIPRACKS',
- SECONDARY_PIPETTE_TIPRACKS: 'SECONDARY_PIPETTE_TIPRACKS',
- CHECK_REMAINING_LABWARE_WITH_PRIMARY_PIPETTE:
- 'CHECK_REMAINING_LABWARE_WITH_PRIMARY_PIPETTE',
- RETURN_TIP: 'RETURN_TIP',
-} as const
diff --git a/app/src/organisms/LabwarePositionCheck/DeprecatedComponents/styles.css b/app/src/organisms/LabwarePositionCheck/DeprecatedComponents/styles.css
deleted file mode 100644
index b8492ef714c..00000000000
--- a/app/src/organisms/LabwarePositionCheck/DeprecatedComponents/styles.css
+++ /dev/null
@@ -1,23 +0,0 @@
-@import '@opentrons/components';
-
-.deck_map {
- margin: 0 5%;
-}
-
-.modal {
- display: flex;
- align-items: flex-start;
- z-index: 100;
-}
-
-.modal_contents {
- max-width: 85%;
- max-height: 100%;
- overflow-y: auto;
-}
-
-.sticky_alert {
- position: sticky;
- top: 3rem;
- z-index: 100;
-}
diff --git a/app/src/organisms/LabwarePositionCheck/DeprecatedComponents/types.ts b/app/src/organisms/LabwarePositionCheck/DeprecatedComponents/types.ts
deleted file mode 100644
index 240db95819f..00000000000
--- a/app/src/organisms/LabwarePositionCheck/DeprecatedComponents/types.ts
+++ /dev/null
@@ -1,40 +0,0 @@
-import { DEPRECATED_SECTIONS } from './constants'
-import type { LabwareDefinition2 } from '@opentrons/shared-data'
-import type { MoveToWellCreateCommand } from '@opentrons/shared-data/protocol/types/schemaV6/command/gantry'
-import type {
- HeaterShakerCloseLatchCreateCommand,
- HeaterShakerDeactivateShakerCreateCommand,
- TCOpenLidCreateCommand,
-} from '@opentrons/shared-data/protocol/types/schemaV6/command/module'
-import type {
- DropTipCreateCommand,
- PickUpTipCreateCommand,
-} from '@opentrons/shared-data/protocol/types/schemaV6/command/pipetting'
-
-export type DeprecatedSection = keyof typeof DEPRECATED_SECTIONS
-
-export type LabwarePositionCheckCreateCommand =
- | MoveToWellCreateCommand
- | PickUpTipCreateCommand
- | DropTipCreateCommand
- | TCOpenLidCreateCommand
- | HeaterShakerDeactivateShakerCreateCommand
- | HeaterShakerCloseLatchCreateCommand
-// LabwarePositionCheckMovementCommand is used to distinguish commands that have pipette + labware ids
-export type LabwarePositionCheckMovementCommand =
- | MoveToWellCreateCommand
- | PickUpTipCreateCommand
- | DropTipCreateCommand
-export interface DeprecatedLabwarePositionCheckStep {
- labwareId: string
- section: DeprecatedSection
- commands: LabwarePositionCheckCreateCommand[]
-}
-export interface LabwareToOrder {
- definition: LabwareDefinition2
- labwareId: string
- slot: string
-}
-export interface SavePositionCommandData {
- [labwareId: string]: string[]
-}
diff --git a/app/src/organisms/LabwarePositionCheck/LabwarePositionCheckComponent.tsx b/app/src/organisms/LabwarePositionCheck/LabwarePositionCheckComponent.tsx
index b9a88039085..f01253e116b 100644
--- a/app/src/organisms/LabwarePositionCheck/LabwarePositionCheckComponent.tsx
+++ b/app/src/organisms/LabwarePositionCheck/LabwarePositionCheckComponent.tsx
@@ -23,11 +23,7 @@ import {
Coordinates,
FIXED_TRASH_ID,
} from '@opentrons/shared-data'
-import type {
- Axis,
- Sign,
- StepSize,
-} from '../../molecules/DeprecatedJogControls/types'
+import type { Axis, Sign, StepSize } from '../../molecules/JogControls/types'
import type {
CreateRunCommand,
RegisterPositionAction,
diff --git a/app/src/organisms/LabwarePositionCheck/PickUpTip.tsx b/app/src/organisms/LabwarePositionCheck/PickUpTip.tsx
index 814ceaf4342..dcb69116f61 100644
--- a/app/src/organisms/LabwarePositionCheck/PickUpTip.tsx
+++ b/app/src/organisms/LabwarePositionCheck/PickUpTip.tsx
@@ -23,7 +23,7 @@ import { TipConfirmation } from './TipConfirmation'
import { getDisplayLocation } from './utils/getDisplayLocation'
import { chainRunCommands } from './utils/chainRunCommands'
-import type { Jog } from '../../molecules/DeprecatedJogControls/types'
+import type { Jog } from '../../molecules/JogControls/types'
import type {
PickUpTipStep,
RegisterPositionAction,
diff --git a/app/src/organisms/LabwarePositionCheck/constants.ts b/app/src/organisms/LabwarePositionCheck/constants.ts
index e143357be57..1c8072da534 100644
--- a/app/src/organisms/LabwarePositionCheck/constants.ts
+++ b/app/src/organisms/LabwarePositionCheck/constants.ts
@@ -1,11 +1,3 @@
-export const DEPRECATED_SECTIONS = {
- PRIMARY_PIPETTE_TIPRACKS: 'PRIMARY_PIPETTE_TIPRACKS',
- SECONDARY_PIPETTE_TIPRACKS: 'SECONDARY_PIPETTE_TIPRACKS',
- CHECK_REMAINING_LABWARE_WITH_PRIMARY_PIPETTE:
- 'CHECK_REMAINING_LABWARE_WITH_PRIMARY_PIPETTE',
- RETURN_TIP: 'RETURN_TIP',
-} as const
-
export const SECTIONS = {
BEFORE_BEGINNING: 'BEFORE_BEGINNING',
CHECK_TIP_RACKS: 'CHECK_TIP_RACKS',
diff --git a/app/src/organisms/LabwarePositionCheck/deprecatedHooks/__tests__/useIntroInfo.test.tsx b/app/src/organisms/LabwarePositionCheck/deprecatedHooks/__tests__/useIntroInfo.test.tsx
deleted file mode 100644
index 3f8b782ee7d..00000000000
--- a/app/src/organisms/LabwarePositionCheck/deprecatedHooks/__tests__/useIntroInfo.test.tsx
+++ /dev/null
@@ -1,143 +0,0 @@
-import * as React from 'react'
-import { when } from 'jest-when'
-import { Provider } from 'react-redux'
-import { QueryClient, QueryClientProvider } from 'react-query'
-import { createStore, Store } from 'redux'
-import { renderHook } from '@testing-library/react-hooks'
-import { getPipetteNameSpecs, PipetteName } from '@opentrons/shared-data'
-import { getPipetteMount } from '../../../Devices/ProtocolRun/utils/getPipetteMount'
-import { useCurrentRunId } from '../../../ProtocolUpload/hooks'
-import { useProtocolDetailsForRun } from '../../../Devices/hooks/useProtocolDetailsForRun'
-import { useIntroInfo } from '../useIntroInfo'
-import { getLabwareLocation } from '../../../Devices/ProtocolRun/utils/getLabwareLocation'
-import { deprecatedGetLabwarePositionCheckSteps } from '../../deprecatedUtils/deprecatedGetLabwarePositionCheckSteps'
-import type { PickUpTipCreateCommand } from '@opentrons/shared-data/protocol/types/schemaV6/command/pipetting'
-import type { LoadLabwareCreateCommand } from '@opentrons/shared-data/protocol/types/schemaV6/command/setup'
-
-jest.mock('@opentrons/shared-data')
-jest.mock('../../deprecatedUtils/deprecatedGetLabwarePositionCheckSteps')
-jest.mock('../../../Devices/ProtocolRun/utils/getPipetteMount')
-jest.mock('../../../Devices/ProtocolRun/utils/getLabwareLocation')
-jest.mock('../../../Devices/hooks/useProtocolDetailsForRun')
-jest.mock('../../../ProtocolUpload/hooks')
-
-const PRIMARY_PIPETTE_ID = 'PRIMARY_PIPETTE_ID'
-const PRIMARY_PIPETTE_NAME = 'PRIMARY_PIPETTE_NAME' as PipetteName
-const PRIMARY_PIPETTE_NUM_CHANNELS = 8
-const SECONDARY_PIPETTE_ID = 'SECONDARY_PIPETTE_ID'
-const SECONDARY_PIPETTE_NAME = 'SECONDARY_PIPETTE_NAME'
-
-const PICKUP_TIP_LABWARE_ID = 'PICKUP_TIP_LABWARE_ID'
-const PICKUP_TIP_LABWARE_SLOT = '3'
-const PICKUP_TIP_LABWARE_DISPLAY_NAME = 'PICKUP_TIP_LABWARE_DISPLAY_NAME'
-const MOCK_RUN_ID = 'fakeRunId'
-
-const mockUseProtocolDetailsForRun = useProtocolDetailsForRun as jest.MockedFunction<
- typeof useProtocolDetailsForRun
->
-const mockGetPipetteNameSpecs = getPipetteNameSpecs as jest.MockedFunction<
- typeof getPipetteNameSpecs
->
-const mockdeprecatedGetLabwarePositionCheckSteps = deprecatedGetLabwarePositionCheckSteps as jest.MockedFunction<
- typeof deprecatedGetLabwarePositionCheckSteps
->
-const mockGetPipetteMount = getPipetteMount as jest.MockedFunction<
- typeof getPipetteMount
->
-const mockGetLabwareLocation = getLabwareLocation as jest.MockedFunction<
- typeof getLabwareLocation
->
-const mockUseCurrentRunId = useCurrentRunId as jest.MockedFunction<
- typeof useCurrentRunId
->
-
-const store: Store = createStore(jest.fn(), {})
-const queryClient = new QueryClient()
-
-describe('useIntroInfo', () => {
- beforeEach(() => {
- const protocolCommands = [
- {
- commandType: 'loadLabware',
- id: '4abc123',
- params: {
- labwareId: PICKUP_TIP_LABWARE_ID,
- location: {
- slotName: PICKUP_TIP_LABWARE_SLOT,
- },
- },
- } as LoadLabwareCreateCommand,
- ] as any
- mockdeprecatedGetLabwarePositionCheckSteps.mockReturnValue([
- {
- labwareId: PICKUP_TIP_LABWARE_ID,
- section: 'PRIMARY_PIPETTE_TIPRACKS',
- // LPC commands that are generated, different than commands that come from protocol analysis
- commands: [
- {
- commandType: 'pickUpTip',
- params: {
- pipetteId: PRIMARY_PIPETTE_ID,
- labwareId: PICKUP_TIP_LABWARE_ID,
- },
- } as PickUpTipCreateCommand,
- ],
- },
- ])
- mockUseProtocolDetailsForRun.mockReturnValue({
- protocolData: {
- labware: {
- [PICKUP_TIP_LABWARE_ID]: {
- slot: PICKUP_TIP_LABWARE_SLOT,
- displayName: PICKUP_TIP_LABWARE_DISPLAY_NAME,
- },
- },
- pipettes: {
- [PRIMARY_PIPETTE_ID]: {
- name: PRIMARY_PIPETTE_NAME,
- mount: 'left',
- },
- [SECONDARY_PIPETTE_ID]: {
- name: SECONDARY_PIPETTE_NAME,
- mount: 'right',
- },
- },
- commands: protocolCommands,
- },
- } as any)
-
- when(mockGetPipetteNameSpecs)
- .calledWith(PRIMARY_PIPETTE_NAME)
- .mockReturnValue({ channels: PRIMARY_PIPETTE_NUM_CHANNELS } as any)
-
- when(mockGetPipetteMount)
- .calledWith(PRIMARY_PIPETTE_ID, protocolCommands)
- .mockReturnValue('left')
-
- when(mockGetLabwareLocation)
- .calledWith(PICKUP_TIP_LABWARE_ID, protocolCommands)
- .mockReturnValue({ slotName: PICKUP_TIP_LABWARE_SLOT })
-
- when(mockUseCurrentRunId).calledWith().mockReturnValue(MOCK_RUN_ID)
- })
- it('should gather all labware position check intro screen data', () => {
- const wrapper: React.FunctionComponent<{}> = ({ children }) => (
-
-
- {children}
-
-
- )
- const { result } = renderHook(() => useIntroInfo(), {
- wrapper,
- })
- const {
- primaryPipetteMount,
- secondaryPipetteMount,
- firstTiprackSlot,
- } = result.current as any
- expect(primaryPipetteMount).toBe('left')
- expect(secondaryPipetteMount).toBe('right')
- expect(firstTiprackSlot).toBe(PICKUP_TIP_LABWARE_SLOT)
- })
-})
diff --git a/app/src/organisms/LabwarePositionCheck/deprecatedHooks/__tests__/useLabwareOffsetForLabware.test.tsx b/app/src/organisms/LabwarePositionCheck/deprecatedHooks/__tests__/useLabwareOffsetForLabware.test.tsx
deleted file mode 100644
index 6196a9e6264..00000000000
--- a/app/src/organisms/LabwarePositionCheck/deprecatedHooks/__tests__/useLabwareOffsetForLabware.test.tsx
+++ /dev/null
@@ -1,104 +0,0 @@
-import * as React from 'react'
-import { QueryClient, QueryClientProvider } from 'react-query'
-import { createStore, Store } from 'redux'
-import { Provider } from 'react-redux'
-import { when, resetAllWhenMocks } from 'jest-when'
-import { simpleAnalysisFileFixture } from '@opentrons/api-client'
-import { schemaV6Adapter, TEMPERATURE_MODULE_V2 } from '@opentrons/shared-data'
-import { renderHook } from '@testing-library/react-hooks'
-import { useRunQuery } from '@opentrons/react-api-client'
-import { useProtocolDetailsForRun } from '../../../Devices/hooks'
-import { useLabwareOffsetForLabware } from '../useLabwareOffsetForLabware'
-import type { LabwareOffset } from '@opentrons/api-client'
-import type { CompletedProtocolAnalysis } from '@opentrons/shared-data'
-
-jest.mock('@opentrons/react-api-client')
-jest.mock('../../../Devices/hooks')
-const mockAnalysis: CompletedProtocolAnalysis = {
- ...simpleAnalysisFileFixture,
- status: 'completed',
-} as any
-const mockProtocolDetails = schemaV6Adapter(mockAnalysis)
-const queryClient = new QueryClient()
-const store: Store = createStore(jest.fn(), {})
-const wrapper: React.FunctionComponent<{}> = ({ children }) => (
-
- {children}
-
-)
-
-const mockOffset: LabwareOffset = {
- id: 'fakeOffsetId',
- createdAt: 'fakeTimestamp',
- location: { slotName: '2' },
- definitionUri: 'opentrons/opentrons_96_tiprack_300ul/1',
- vector: { x: 1, y: 2, z: 3 },
-}
-const mockOffsetOnMod: LabwareOffset = {
- id: 'fakeOffsetIdOnMod',
- location: { slotName: '3', moduleModel: TEMPERATURE_MODULE_V2 },
- vector: { x: 4, y: 5, z: 6 },
- createdAt: 'fakeTimestamp',
- definitionUri: 'fakeDefUri',
-}
-const MOCK_RUN_ID = 'MOCK_RUN_ID'
-
-const mockUseRunQuery = useRunQuery as jest.MockedFunction
-const mockUseProtocolDetailsForRun = useProtocolDetailsForRun as jest.MockedFunction<
- typeof useProtocolDetailsForRun
->
-
-describe('useLabwareOffsetForLabware', () => {
- beforeEach(() => {
- when(mockUseRunQuery)
- .calledWith(MOCK_RUN_ID)
- .mockReturnValue({
- data: { data: { labwareOffsets: [mockOffsetOnMod, mockOffset] } },
- } as any)
- when(mockUseProtocolDetailsForRun)
- .calledWith(MOCK_RUN_ID)
- .mockReturnValue({
- protocolData: mockProtocolDetails,
- } as any)
- })
- afterEach(() => {
- resetAllWhenMocks()
- jest.restoreAllMocks()
- })
-
- it('should return current offsets associated with given labwareId in protocol', async () => {
- const { result } = renderHook(
- () => useLabwareOffsetForLabware(MOCK_RUN_ID, 'labware-1'),
- { wrapper }
- )
- expect(result.current).toEqual(mockOffset)
- })
- it('should return no offsets if labware and location do not have offset associated', async () => {
- const { result } = renderHook(
- () => useLabwareOffsetForLabware(MOCK_RUN_ID, 'labware-0'),
- { wrapper }
- )
- expect(result.current).toEqual(null)
- })
- it('should return newest offset if multiple match labware and location of supplied labwareId', async () => {
- const newerTimestamp = '2022-05-10T15:30:02.708775+00:00'
- const olderTimestamp = '2020-05-10T15:30:02.708775+00:00'
- when(mockUseRunQuery)
- .calledWith(MOCK_RUN_ID)
- .mockReturnValue({
- data: {
- data: {
- labwareOffsets: [
- { ...mockOffset, createdAt: olderTimestamp },
- { ...mockOffset, createdAt: newerTimestamp },
- ],
- },
- },
- } as any)
- const { result } = renderHook(
- () => useLabwareOffsetForLabware(MOCK_RUN_ID, 'labware-1'),
- { wrapper }
- )
- expect(result.current?.createdAt).toEqual(newerTimestamp)
- })
-})
diff --git a/app/src/organisms/LabwarePositionCheck/deprecatedHooks/__tests__/useLabwarePositionCheck.test.tsx b/app/src/organisms/LabwarePositionCheck/deprecatedHooks/__tests__/useLabwarePositionCheck.test.tsx
deleted file mode 100644
index ab97751ddf7..00000000000
--- a/app/src/organisms/LabwarePositionCheck/deprecatedHooks/__tests__/useLabwarePositionCheck.test.tsx
+++ /dev/null
@@ -1,391 +0,0 @@
-import * as React from 'react'
-import { QueryClient, QueryClientProvider } from 'react-query'
-import { createStore, Store } from 'redux'
-import { Provider } from 'react-redux'
-import { when, resetAllWhenMocks } from 'jest-when'
-import { renderHook } from '@testing-library/react-hooks'
-import {
- useCreateCommandMutation,
- useCreateLabwareDefinitionMutation,
- useHost,
-} from '@opentrons/react-api-client'
-import { useTrackEvent } from '../../../../redux/analytics'
-import { LARGE_STEP_SIZE_MM } from '../../../../molecules/JogControls'
-import {
- useCurrentRunId,
- useCurrentRunCommands,
-} from '../../../ProtocolUpload/hooks'
-import {
- useAttachedModules,
- useProtocolDetailsForRun,
-} from '../../../Devices/hooks'
-import { getLabwareLocation } from '../../../Devices/ProtocolRun/utils/getLabwareLocation'
-import { getModuleInitialLoadInfo } from '../../../Devices/ProtocolRun/utils/getModuleInitialLoadInfo'
-import { useDeprecatedSteps } from '../useDeprecatedSteps'
-import { useDeprecatedLabwarePositionCheck } from '../useDeprecatedLabwarePositionCheck'
-
-import type { HostConfig } from '@opentrons/api-client'
-import type { DeprecatedLabwarePositionCheckStep } from '../../types'
-
-jest.mock('@opentrons/react-api-client')
-jest.mock('../../../../redux/analytics')
-jest.mock('../../../../redux/modules')
-jest.mock('../../../Devices/hooks')
-jest.mock('../../../ProtocolUpload/hooks')
-jest.mock('../../../Devices/ProtocolRun/utils/getLabwareLocation')
-jest.mock('../../../Devices/ProtocolRun/utils/getModuleInitialLoadInfo')
-jest.mock('../useDeprecatedSteps')
-
-const queryClient = new QueryClient()
-const store: Store = createStore(jest.fn(), {})
-const wrapper: React.FunctionComponent<{}> = ({ children }) => (
-
- {children}
-
-)
-
-const mockUseHost = useHost as jest.MockedFunction
-const mockUseAttachedModules = useAttachedModules as jest.MockedFunction<
- typeof useAttachedModules
->
-const mockUseCurrentRunId = useCurrentRunId as jest.MockedFunction<
- typeof useCurrentRunId
->
-const mockUseSteps = useDeprecatedSteps as jest.MockedFunction<
- typeof useDeprecatedSteps
->
-const mockUseCreateCommandMutation = useCreateCommandMutation as jest.MockedFunction<
- typeof useCreateCommandMutation
->
-const mockUseCreateLabwareDefinitionMutation = useCreateLabwareDefinitionMutation as jest.MockedFunction<
- typeof useCreateLabwareDefinitionMutation
->
-const mockUseCurrentRunCommands = useCurrentRunCommands as jest.MockedFunction<
- typeof useCurrentRunCommands
->
-const mockGetLabwareLocation = getLabwareLocation as jest.MockedFunction<
- typeof getLabwareLocation
->
-const mockUseTrackEvent = useTrackEvent as jest.MockedFunction<
- typeof useTrackEvent
->
-const mockUseProtocolDetailsForRun = useProtocolDetailsForRun as jest.MockedFunction<
- typeof useProtocolDetailsForRun
->
-const mockGetModuleInitialLoadInfo = getModuleInitialLoadInfo as jest.MockedFunction<
- typeof getModuleInitialLoadInfo
->
-let mockTrackEvent: jest.Mock
-describe('useDeprecatedLabwarePositionCheck', () => {
- const MOCK_ROBOT_NAME = 'otie'
- const MOCK_RUN_ID = 'MOCK_RUN_ID'
- const HOST_CONFIG: HostConfig = {
- hostname: 'localhost',
- robotName: MOCK_ROBOT_NAME,
- }
- const MOCK_PIPETTE_ID = 'MOCK_PIPETTE_ID'
- const MOCK_LABWARE_ID = 'MOCK_LABWARE_ID'
- const MOCK_COMMAND_ID = 'MOCK_COMMAND_ID'
- const MOCK_SLOT = '1'
- let mockCreateCommand: jest.Mock
- let mockCreateLabwareDefinition: jest.Mock
- beforeEach(() => {
- when(mockUseHost).calledWith().mockReturnValue(HOST_CONFIG)
- when(mockUseAttachedModules).calledWith().mockReturnValue([])
- when(mockUseCurrentRunId).calledWith().mockReturnValue(MOCK_RUN_ID)
- when(mockUseProtocolDetailsForRun)
- .calledWith(MOCK_RUN_ID)
- .mockReturnValue({ protocolData: null } as any)
- when(mockUseCurrentRunCommands).calledWith().mockReturnValue([])
- when(mockUseSteps)
- .calledWith(MOCK_RUN_ID)
- .mockReturnValue([
- {
- commands: [
- {
- commandType: 'pickUpTip',
- params: {
- pipetteId: MOCK_PIPETTE_ID,
- labwareId: MOCK_LABWARE_ID,
- },
- },
- ],
- labwareId: MOCK_LABWARE_ID,
- section: 'PRIMARY_PIPETTE_TIPRACKS',
- } as DeprecatedLabwarePositionCheckStep,
- ])
- mockCreateCommand = jest.fn(() =>
- Promise.resolve({ data: { id: MOCK_COMMAND_ID } })
- )
- when(mockUseCreateCommandMutation)
- .calledWith()
- .mockReturnValue({ createCommand: mockCreateCommand } as any)
- mockCreateLabwareDefinition = jest.fn()
- when(mockUseCreateLabwareDefinitionMutation)
- .calledWith()
- .mockReturnValue({
- createLabwareOffset: mockCreateLabwareDefinition,
- } as any)
- when(mockGetLabwareLocation)
- .calledWith(MOCK_LABWARE_ID, [])
- .mockReturnValue({ slotName: MOCK_SLOT })
- mockTrackEvent = jest.fn()
- when(mockUseTrackEvent).calledWith().mockReturnValue(mockTrackEvent)
- })
- afterEach(() => {
- resetAllWhenMocks()
- jest.restoreAllMocks()
- })
- describe('beginLPC', () => {
- it('should track a mixpanel event', async () => {
- const { result, waitForNextUpdate } = renderHook(
- () => useDeprecatedLabwarePositionCheck(() => null, {}),
- { wrapper }
- )
- if ('error' in result.current) {
- throw new Error('error should not be present')
- }
- const { beginLPC } = result.current
- beginLPC()
- await waitForNextUpdate()
- expect(mockTrackEvent).toHaveBeenCalledWith({
- name: 'LabwarePositionCheckStarted',
- properties: {},
- })
- })
- it('should stop the heater shaker from shaking and close its labware latch', async () => {
- mockGetModuleInitialLoadInfo.mockReturnValue({
- location: { slotName: 'does not matter' },
- } as any)
- when(mockUseSteps)
- .calledWith(MOCK_RUN_ID)
- .mockReturnValue([
- {
- commands: [
- // this first movement command always gets executed after prep commands get executed
- {
- commandType: 'pickUpTip',
- params: {
- pipetteId: MOCK_PIPETTE_ID,
- labwareId: MOCK_LABWARE_ID,
- },
- },
- {
- commandType: 'heaterShaker/deactivateShaker',
- params: {
- moduleId: 'hs_id',
- },
- },
- {
- commandType: 'heaterShaker/closeLabwareLatch',
- params: {
- moduleId: 'hs_id',
- },
- },
- ],
- labwareId: MOCK_LABWARE_ID,
- section: 'PRIMARY_PIPETTE_TIPRACKS',
- } as DeprecatedLabwarePositionCheckStep,
- ])
- const { result, waitForNextUpdate } = renderHook(
- () => useDeprecatedLabwarePositionCheck(() => null, {}),
- { wrapper }
- )
- if ('error' in result.current) {
- throw new Error('error should not be present')
- }
- const { beginLPC } = result.current
- // HS commands should not be called until beginLPC is called
-
- expect(mockCreateCommand).not.toHaveBeenCalledWith({
- runId: MOCK_RUN_ID,
- command: {
- commandType: 'heaterShaker/deactivateShaker',
- params: { moduleId: 'hs_id' },
- },
- })
- expect(mockCreateCommand).not.toHaveBeenCalledWith({
- runId: MOCK_RUN_ID,
- command: {
- commandType: 'heaterShaker/closeLabwareLatch',
- params: { moduleId: 'hs_id' },
- },
- })
-
- beginLPC()
- await waitForNextUpdate()
-
- expect(mockCreateCommand).toHaveBeenCalledWith({
- runId: MOCK_RUN_ID,
- command: {
- commandType: 'heaterShaker/deactivateShaker',
- params: { moduleId: 'hs_id' },
- },
- })
- expect(mockCreateCommand).toHaveBeenCalledWith({
- runId: MOCK_RUN_ID,
- command: {
- commandType: 'heaterShaker/closeLabwareLatch',
- params: { moduleId: 'hs_id' },
- },
- })
- })
- })
- describe('jog', () => {
- it('should NOT queue up a new jog command when a previous jog command has NOT completed', async () => {
- const { result, waitForNextUpdate } = renderHook(
- () => useDeprecatedLabwarePositionCheck(() => null, {}),
- { wrapper }
- )
- if ('error' in result.current) {
- throw new Error('error should not be present')
- }
- const { beginLPC } = result.current
- beginLPC()
- await waitForNextUpdate()
- const [FIRST_JOG_AXIS, FIRST_JOG_DIRECTION, FIRST_JOG_DISTANCE] = [
- 'x' as 'x',
- 1 as 1,
- LARGE_STEP_SIZE_MM,
- ]
- if ('error' in result.current) {
- throw new Error('error should not be present')
- }
- result.current.jog(
- FIRST_JOG_AXIS,
- FIRST_JOG_DIRECTION,
- FIRST_JOG_DISTANCE
- )
- expect(mockCreateCommand).toHaveBeenCalledWith({
- runId: MOCK_RUN_ID,
- command: {
- commandType: 'moveRelative',
- params: {
- pipetteId: 'MOCK_PIPETTE_ID',
- distance: FIRST_JOG_DIRECTION * FIRST_JOG_DISTANCE,
- axis: FIRST_JOG_AXIS,
- },
- },
- waitUntilComplete: true,
- timeout: 10000,
- })
- })
- })
- describe('proceed', () => {
- it('should home the robot after issuing the last LPC command', async () => {
- when(mockUseSteps)
- .calledWith(MOCK_RUN_ID)
- .mockReturnValue([
- {
- commands: [
- {
- commandType: 'pickUpTip',
- params: {
- pipetteId: MOCK_PIPETTE_ID,
- labwareId: MOCK_LABWARE_ID,
- },
- },
- ],
- labwareId: MOCK_LABWARE_ID,
- section: 'PRIMARY_PIPETTE_TIPRACKS',
- } as DeprecatedLabwarePositionCheckStep,
- {
- commands: [
- {
- commandType: 'dropTip',
- params: {
- pipetteId: MOCK_PIPETTE_ID,
- labwareId: MOCK_LABWARE_ID,
- },
- },
- ],
- labwareId: MOCK_LABWARE_ID,
- section: 'RETURN_TIP',
- } as DeprecatedLabwarePositionCheckStep,
- ])
- const { result, waitForNextUpdate } = renderHook(
- () => useDeprecatedLabwarePositionCheck(() => null, {}),
- { wrapper }
- )
- if ('error' in result.current) {
- throw new Error('error should not be present')
- }
- const { beginLPC } = result.current
- beginLPC()
- await waitForNextUpdate()
- mockCreateCommand.mockClear() // clear calls to mockCreateCommand because beginLPC issues a home command
- const { proceed } = result.current
- proceed()
- await waitForNextUpdate()
- expect(mockCreateCommand).toHaveBeenCalledWith({
- runId: MOCK_RUN_ID,
- command: {
- commandType: 'home',
- params: {},
- },
- })
- })
- it('should execute the next command', async () => {
- when(mockUseSteps)
- .calledWith(MOCK_RUN_ID)
- .mockReturnValue([
- {
- commands: [
- {
- commandType: 'pickUpTip',
- params: {
- pipetteId: MOCK_PIPETTE_ID,
- labwareId: MOCK_LABWARE_ID,
- },
- },
- {
- commandType: 'dropTip',
- params: {
- pipetteId: MOCK_PIPETTE_ID,
- labwareId: MOCK_LABWARE_ID,
- },
- },
- ],
- labwareId: MOCK_LABWARE_ID,
- section: 'PRIMARY_PIPETTE_TIPRACKS',
- } as DeprecatedLabwarePositionCheckStep,
- ])
-
- const { result, waitForNextUpdate } = renderHook(
- () => useDeprecatedLabwarePositionCheck(() => null, {}),
- { wrapper }
- )
- if ('error' in result.current) {
- throw new Error('error should not be present')
- }
- const { beginLPC } = result.current
- beginLPC() // beginLPC calls the first command
- await waitForNextUpdate()
- const { proceed } = result.current
- proceed()
- await waitForNextUpdate()
- // this is from the begin LPC call
- expect(mockCreateCommand).toHaveBeenCalledWith({
- runId: MOCK_RUN_ID,
- command: {
- commandType: 'pickUpTip',
- params: {
- pipetteId: MOCK_PIPETTE_ID,
- labwareId: MOCK_LABWARE_ID,
- },
- },
- })
- // drop tip call should get logged
- expect(mockCreateCommand).toHaveBeenCalledWith({
- runId: MOCK_RUN_ID,
- command: {
- commandType: 'dropTip',
- params: expect.objectContaining({
- pipetteId: MOCK_PIPETTE_ID,
- labwareId: MOCK_LABWARE_ID,
- }),
- },
- })
- })
- })
-})
diff --git a/app/src/organisms/LabwarePositionCheck/deprecatedHooks/__tests__/useLoadingText.test.tsx b/app/src/organisms/LabwarePositionCheck/deprecatedHooks/__tests__/useLoadingText.test.tsx
deleted file mode 100644
index b98636f8fa2..00000000000
--- a/app/src/organisms/LabwarePositionCheck/deprecatedHooks/__tests__/useLoadingText.test.tsx
+++ /dev/null
@@ -1,102 +0,0 @@
-import * as React from 'react'
-import { when } from 'jest-when'
-import { renderHook } from '@testing-library/react-hooks'
-import { I18nextProvider } from 'react-i18next'
-import { getLabwareLocation } from '../../../Devices/ProtocolRun/utils/getLabwareLocation'
-import { useProtocolDetailsForRun } from '../../../Devices/hooks'
-import { i18n } from '../../../../i18n'
-import { useTitleText } from '../useDeprecatedLabwarePositionCheck'
-import type { MoveToWellCreateCommand } from '@opentrons/shared-data/protocol/types/schemaV6/command/gantry'
-import type {
- DropTipCreateCommand,
- PickUpTipCreateCommand,
-} from '@opentrons/shared-data/protocol/types/schemaV6/command/pipetting'
-
-jest.mock('../../../Devices/hooks')
-jest.mock('../../../Devices/ProtocolRun/utils/getLabwareLocation')
-
-const mockUseProtocolDetailsForRun = useProtocolDetailsForRun as jest.MockedFunction<
- typeof useProtocolDetailsForRun
->
-const mockGetLabwareLocation = getLabwareLocation as jest.MockedFunction<
- typeof getLabwareLocation
->
-const wrapper: React.FunctionComponent<{}> = ({ children }) => (
- {children}
-)
-
-const mockProtocolData: any = { commands: [] }
-const mockLabwareId = 'mockLabwareId'
-const mockSlotNumber = 'mockSlotNumber'
-const mockRunId = 'mockRunId'
-
-describe('useTitleText', () => {
- beforeEach(() => {
- when(mockUseProtocolDetailsForRun).calledWith(mockRunId).mockReturnValue({
- protocolData: mockProtocolData,
- displayName: 'mock display name',
- protocolKey: 'fakeProtocolKey',
- robotType: 'OT-2 Standard',
- })
- when(mockGetLabwareLocation)
- .calledWith(mockLabwareId, mockProtocolData.commands)
- .mockReturnValue({ slotName: mockSlotNumber })
- })
- it('should return the loading text for a move to well command', () => {
- const command: MoveToWellCreateCommand = {
- commandType: 'moveToWell',
- params: {
- labwareId: mockLabwareId,
- pipetteId: 'p300SingleId',
- wellName: 'A1',
- wellLocation: {
- origin: 'top',
- },
- },
- }
-
- const { result } = renderHook(
- () => useTitleText(true, command, mockRunId),
- {
- wrapper,
- }
- )
- expect(result.current).toBe(`Moving to slot ${mockSlotNumber}`)
- })
- it('should return the loading text for a pick up tip command', () => {
- const command: PickUpTipCreateCommand = {
- commandType: 'pickUpTip',
- params: {
- labwareId: mockLabwareId,
- pipetteId: 'p300SingleId',
- wellName: 'A1',
- },
- }
-
- const { result } = renderHook(
- () => useTitleText(true, command, mockRunId),
- {
- wrapper,
- }
- )
- expect(result.current).toBe(`Picking up tip in slot ${mockSlotNumber}`)
- })
- it('should return the loading text for a drop tip command', () => {
- const command: DropTipCreateCommand = {
- commandType: 'dropTip',
- params: {
- labwareId: mockLabwareId,
- pipetteId: 'p300SingleId',
- wellName: 'A1',
- },
- }
-
- const { result } = renderHook(
- () => useTitleText(true, command, mockRunId),
- {
- wrapper,
- }
- )
- expect(result.current).toBe(`Returning tip in slot ${mockSlotNumber}`)
- })
-})
diff --git a/app/src/organisms/LabwarePositionCheck/deprecatedHooks/index.ts b/app/src/organisms/LabwarePositionCheck/deprecatedHooks/index.ts
deleted file mode 100644
index ed5d5772d01..00000000000
--- a/app/src/organisms/LabwarePositionCheck/deprecatedHooks/index.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-export { useLPCCommands } from './useLPCCommands'
-export { useIntroInfo } from './useIntroInfo'
-export { useLabwareIdsBySection } from './useLabwareIdsBySection'
-export { useSections } from './useSections'
-export { useDeprecatedSteps } from './useDeprecatedSteps'
-export { useDeprecatedLabwarePositionCheck } from './useDeprecatedLabwarePositionCheck'
-export * from './useLabwareOffsets'
diff --git a/app/src/organisms/LabwarePositionCheck/deprecatedHooks/useDeprecatedLabwarePositionCheck.ts b/app/src/organisms/LabwarePositionCheck/deprecatedHooks/useDeprecatedLabwarePositionCheck.ts
deleted file mode 100644
index acf1493a23b..00000000000
--- a/app/src/organisms/LabwarePositionCheck/deprecatedHooks/useDeprecatedLabwarePositionCheck.ts
+++ /dev/null
@@ -1,714 +0,0 @@
-import * as React from 'react'
-import { useTranslation } from 'react-i18next'
-import isEqual from 'lodash/isEqual'
-import { getCommand } from '@opentrons/api-client'
-import {
- Coordinates,
- getLabwareDefIsStandard,
- getLabwareDisplayName,
- IDENTITY_VECTOR,
- LoadedLabware,
-} from '@opentrons/shared-data'
-import {
- useHost,
- useCreateLabwareDefinitionMutation,
- useCreateCommandMutation,
-} from '@opentrons/react-api-client'
-import { useTrackEvent } from '../../../redux/analytics'
-import {
- useCurrentRunId,
- useCurrentRunCommands,
- useCurrentProtocol,
-} from '../../ProtocolUpload/hooks'
-import { useProtocolDetailsForRun } from '../../Devices/hooks'
-import { getLabwareLocation } from '../../Devices/ProtocolRun/utils/getLabwareLocation'
-import { getModuleInitialLoadInfo } from '../../Devices/ProtocolRun/utils/getModuleInitialLoadInfo'
-import { useDeprecatedSteps } from './useDeprecatedSteps'
-import type {
- HostConfig,
- RunCommandSummary,
- VectorOffset,
-} from '@opentrons/api-client'
-import type { LabwareDefinition2 } from '@opentrons/shared-data'
-import type {
- CreateCommand,
- ProtocolFile,
- RunTimeCommand,
-} from '@opentrons/shared-data/protocol/types/schemaV6'
-import type {
- LoadLabwareRunTimeCommand,
- SetupCreateCommand,
- SetupRunTimeCommand,
-} from '@opentrons/shared-data/protocol/types/schemaV6/command/setup'
-import type { DropTipCreateCommand } from '@opentrons/shared-data/protocol/types/schemaV6/command/pipetting'
-import type {
- HeaterShakerCloseLatchCreateCommand,
- HeaterShakerDeactivateShakerCreateCommand,
- TCOpenLidCreateCommand,
-} from '@opentrons/shared-data/protocol/types/schemaV6/command/module'
-import type {
- HomeCreateCommand,
- SavePositionCreateCommand,
-} from '@opentrons/shared-data/protocol/types/schemaV6/command/gantry'
-import type {
- Axis,
- Jog,
- Sign,
- StepSize,
-} from '../../../molecules/DeprecatedJogControls/types'
-import type {
- LabwarePositionCheckCreateCommand,
- LabwarePositionCheckMovementCommand,
- DeprecatedLabwarePositionCheckStep,
- SavePositionCommandData,
-} from '../types'
-
-export type LabwarePositionCheckUtils =
- | {
- currentCommandIndex: number
- currentStep: DeprecatedLabwarePositionCheckStep
- titleText: string
- isLoading: boolean
- showPickUpTipConfirmationModal: boolean
- isComplete: boolean
- beginLPC: () => void
- proceed: () => void
- onUnsuccessfulPickUpTip: () => void
- jog: Jog
- ctaText: string
- }
- | { error: Error }
-
-type LPCPrepCommand =
- | HomeCreateCommand
- | SetupRunTimeCommand
- | TCOpenLidCreateCommand
- | HeaterShakerDeactivateShakerCreateCommand
- | HeaterShakerCloseLatchCreateCommand
-
-const JOG_COMMAND_TIMEOUT = 10000 // 10 seconds
-
-const useLpcCtaText = (
- command: LabwarePositionCheckCreateCommand,
- runId: string | null
-): string => {
- const { protocolData } = useProtocolDetailsForRun(runId)
- const { t } = useTranslation('labware_position_check')
- if (command == null) return ''
- const commands = protocolData?.commands ?? []
- switch (command.commandType) {
- case 'dropTip': {
- const labwareId = command.params.labwareId
- const labwareLocation = getLabwareLocation(labwareId, commands)
- return t('confirm_position_and_return_tip', {
- next_slot:
- labwareLocation !== 'offDeck' && 'slotName' in labwareLocation
- ? labwareLocation.slotName
- : '',
- })
- }
- case 'moveToWell': {
- const labwareId = command.params.labwareId
- const labwareLocation = getLabwareLocation(labwareId, commands)
- let nextSlot = ''
- if (labwareLocation === 'offDeck') {
- nextSlot = 'offDeck'
- } else {
- nextSlot =
- 'slotName' in labwareLocation
- ? labwareLocation.slotName
- : getModuleInitialLoadInfo(labwareLocation.moduleId, commands)
- .location.slotName
- }
- return t('confirm_position_and_move', { next_slot: nextSlot })
- }
- case 'heaterShaker/deactivateShaker':
- case 'heaterShaker/closeLabwareLatch':
- case 'thermocycler/openLid': {
- const moduleId = command.params.moduleId
- const slot = getModuleInitialLoadInfo(moduleId, commands).location
- .slotName
- return t('confirm_position_and_move', {
- next_slot: slot,
- })
- }
- case 'pickUpTip': {
- return t('confirm_position_and_pick_up_tip')
- }
- }
-}
-
-export const useTitleText = (
- loading: boolean,
- command: LabwarePositionCheckMovementCommand,
- runId: string | null,
- labware?: LoadedLabware[],
- labwareDefinitions?: ProtocolFile<{}>['labwareDefinitions']
-): string => {
- const { protocolData } = useProtocolDetailsForRun(runId)
- const { t } = useTranslation('labware_position_check')
-
- if (command == null) {
- return ''
- }
-
- const commands = protocolData?.commands ?? []
-
- const labwareId = command.params.labwareId
- const labwareLocation = getLabwareLocation(labwareId, commands)
- let slot = ''
- if (labwareLocation === 'offDeck') {
- slot = 'offDeck'
- } else {
- slot =
- 'slotName' in labwareLocation
- ? labwareLocation.slotName
- : getModuleInitialLoadInfo(labwareLocation.moduleId, commands).location
- .slotName
- }
-
- if (loading) {
- switch (command.commandType) {
- case 'moveToWell': {
- return t('moving_to_slot_title', {
- slot,
- })
- }
- case 'pickUpTip': {
- return t('picking_up_tip_title', {
- slot,
- })
- }
- case 'dropTip': {
- return t('returning_tip_title', {
- slot,
- })
- }
- }
- } else {
- if (labware == null || labwareDefinitions == null) return ''
-
- // @ts-expect-error: will be an error until we remove the schemaV6Adapter
- const labwareDefId = labware.find(item => item.id === labwareId)
- .definitionUri
- const labwareDisplayName = getLabwareDisplayName(
- labwareDefinitions[labwareDefId]
- )
- return t('check_labware_in_slot_title', {
- labware_display_name: labwareDisplayName,
- slot,
- })
- }
-}
-
-const commandIsComplete = (status: RunCommandSummary['status']): boolean =>
- status === 'succeeded' || status === 'failed'
-
-const createCommandData = (
- command:
- | LabwarePositionCheckMovementCommand
- | LPCPrepCommand
- | SavePositionCreateCommand
-): CreateCommand => {
- if (command.commandType === 'loadLabware') {
- return {
- commandType: command.commandType,
- params: { ...command.params, labwareId: command.result.labwareId },
- }
- }
- return { ...command }
-}
-
-const isLoadCommand = (
- command: RunTimeCommand
-): command is SetupRunTimeCommand => {
- const loadCommands: Array = [
- 'loadLabware',
- 'loadLiquid',
- 'loadModule',
- 'loadPipette',
- ]
- // @ts-expect-error SetupCommand is more specific than Command, but the whole point of this util :)
- return loadCommands.includes(command.commandType)
-}
-
-const isTCOpenCommand = (
- command: CreateCommand
-): command is TCOpenLidCreateCommand =>
- command.commandType === 'thermocycler/openLid'
-
-const isHSCommand = (
- command: CreateCommand
-): command is
- | HeaterShakerDeactivateShakerCreateCommand
- | HeaterShakerCloseLatchCreateCommand =>
- command.commandType === 'heaterShaker/deactivateShaker' ||
- command.commandType === 'heaterShaker/closeLabwareLatch'
-
-const isLoadLabwareCommand = (
- command: RunTimeCommand
-): command is LoadLabwareRunTimeCommand => command.commandType === 'loadLabware'
-
-export function useDeprecatedLabwarePositionCheck(
- addSavePositionCommandData: (commandId: string, labwareId: string) => void,
- savePositionCommandData: SavePositionCommandData
-): LabwarePositionCheckUtils {
- const [currentCommandIndex, setCurrentCommandIndex] = React.useState(
- 0
- )
- const [
- pendingMovementCommandData,
- setPendingMovementCommandData,
- ] = React.useState<{
- commandId: string
- } | null>(null)
- const [isLoading, setIsLoading] = React.useState(false)
- const isJogging = React.useRef(false)
- const [error, setError] = React.useState(null)
- const [
- showPickUpTipConfirmationModal,
- setShowPickUpTipConfirmationModal,
- ] = React.useState(false)
- const [dropTipOffset, setDropTipOffset] = React.useState(
- IDENTITY_VECTOR
- )
- const currentRunId = useCurrentRunId()
- const { protocolData } = useProtocolDetailsForRun(currentRunId)
- const protocolType = useCurrentProtocol()?.data.protocolType
- const { createLabwareDefinition } = useCreateLabwareDefinitionMutation()
- const { createCommand } = useCreateCommandMutation()
- const host = useHost()
- const trackEvent = useTrackEvent()
- const LPCSteps = useDeprecatedSteps(currentRunId)
-
- const LPCCommands = LPCSteps.reduce(
- (commands, currentStep) => {
- return [...commands, ...currentStep.commands]
- },
- []
- )
- // load commands come from the protocol resource
- const loadCommands: SetupRunTimeCommand[] =
- protocolData?.commands.filter(isLoadCommand).map(command => {
- if (command.commandType === 'loadPipette') {
- const commandWithPipetteId = {
- ...command,
- params: {
- ...command.params,
- pipetteId: command.result?.pipetteId,
- },
- }
- return commandWithPipetteId
- }
- return command
- }) ?? []
- // TC open lid commands + HS commands come from the LPC command generator
- const TCOpenCommands = LPCCommands.filter(isTCOpenCommand) ?? []
- const HSCommands = LPCCommands.filter(isHSCommand) ?? []
- const homeCommand: HomeCreateCommand = {
- commandType: 'home',
- params: {},
- }
- // prepCommands will be run when a user starts LPC
- const prepCommands: LPCPrepCommand[] = [
- ...loadCommands,
- ...TCOpenCommands,
- ...HSCommands,
- homeCommand,
- ]
- // LPCMovementCommands will be run during the guided LPC flow
- const LPCMovementCommands: LabwarePositionCheckMovementCommand[] = LPCCommands.filter(
- (
- command: LabwarePositionCheckCreateCommand
- ): command is LabwarePositionCheckMovementCommand =>
- command.commandType !== 'thermocycler/openLid' &&
- command.commandType !== 'heaterShaker/closeLabwareLatch' &&
- command.commandType !== 'heaterShaker/deactivateShaker'
- )
- const currentCommand = LPCMovementCommands[currentCommandIndex]
- const prevCommand = LPCMovementCommands[currentCommandIndex - 1]
-
- const currentStep = LPCSteps.find(step => {
- const matchingCommand = step.commands.find(
- command => prevCommand != null && isEqual(command, prevCommand)
- )
- return matchingCommand
- }) as DeprecatedLabwarePositionCheckStep
-
- const ctaText = useLpcCtaText(currentCommand, currentRunId)
- const robotCommands = useCurrentRunCommands()
- const titleText = useTitleText(
- isLoading,
- prevCommand,
- currentRunId,
- protocolData?.labware,
- protocolData?.labwareDefinitions
- )
- if (
- prevCommand != null &&
- prevCommand.commandType === 'pickUpTip' &&
- !isLoading &&
- !showPickUpTipConfirmationModal
- ) {
- setShowPickUpTipConfirmationModal(true)
- }
- if (error != null) return { error }
- if (currentRunId == null)
- return {
- error: new Error(
- 'No current run id found, cannot perform Labware Position Check without current run.'
- ),
- }
-
- const isComplete = currentCommandIndex === LPCMovementCommands.length
- const failedCommand = robotCommands?.find(
- command => command.status === 'failed'
- )
- if (failedCommand != null && error == null) {
- setError(
- new Error(
- `movement command with type ${failedCommand.commandType} and id ${failedCommand.id} failed on the robot`
- )
- )
- }
- const completedMovementCommand =
- pendingMovementCommandData != null &&
- robotCommands?.find(
- (command: RunCommandSummary) =>
- command.id === pendingMovementCommandData.commandId &&
- command.status != null &&
- commandIsComplete(command.status)
- )
- if (completedMovementCommand && pendingMovementCommandData) {
- // bail if the command failed
- if (completedMovementCommand.status === 'failed') {
- setError(
- new Error(
- `movement command id ${completedMovementCommand.id} failed on the robot`
- )
- )
- }
- setIsLoading(false)
- setPendingMovementCommandData(null)
- }
-
- // (sa 11-18-2021): refactor this function after beta release
- const proceed = (): void => {
- setIsLoading(true)
- setCurrentCommandIndex(currentCommandIndex + 1)
- setShowPickUpTipConfirmationModal(false)
- // before executing the next movement command, save the current position
- const savePositionCommand: CreateCommand = {
- commandType: 'savePosition',
- params: { pipetteId: prevCommand.params.pipetteId },
- }
-
- createCommand({
- runId: currentRunId,
- command: createCommandData(savePositionCommand),
- })
- .then(response => {
- if (prevCommand.commandType === 'moveToWell') {
- const commandId = response.data.id
- addSavePositionCommandData(commandId, prevCommand.params.labwareId)
- }
- // later in the promise chain we may need to incorporate in flight offsets into
- // pickup tip/drop tip commands, so we need to prepare those offset vectors
-
- // if this is the first labware that we are checking, no in flight offsets have been applied
- // return identity offsets and move on, they will no get used
- if (savePositionCommandData[currentCommand.params.labwareId] == null) {
- const positions = Promise.resolve([IDENTITY_VECTOR, IDENTITY_VECTOR])
- return positions
- }
-
- const prevSavePositionCommand = getCommand(
- host as HostConfig,
- currentRunId,
- response.data.id
- )
-
- const initialSavePositionCommandId =
- savePositionCommandData[currentCommand.params.labwareId][0]
- const initialSavePositionCommand = getCommand(
- host as HostConfig,
- currentRunId,
- initialSavePositionCommandId
- )
- const offsetFromPrevSavePositionCommand: Promise = prevSavePositionCommand.then(
- response => {
- return response.data.data.result.position
- }
- )
- const offsetFromInitialSavePositionCommand: Promise = initialSavePositionCommand.then(
- response => {
- return response.data.data.result.position
- }
- )
- const positions = Promise.all([
- offsetFromPrevSavePositionCommand,
- offsetFromInitialSavePositionCommand,
- ])
- return positions
- })
- .then(
- ([
- offsetFromPrevSavePositionCommand,
- offsetFromInitialSavePositionCommand,
- ]) => {
- // if the next command to execute is a pick up tip, we need to make sure
- // we pick up from the offset the user specified
- if (currentCommand.commandType === 'pickUpTip') {
- const {
- x: firstX,
- y: firstY,
- z: firstZ,
- } = offsetFromInitialSavePositionCommand
- const {
- x: secondX,
- y: secondY,
- z: secondZ,
- } = offsetFromPrevSavePositionCommand
- const offset = {
- x: secondX - firstX,
- y: secondY - firstY,
- z: secondZ - firstZ,
- }
-
- // save the offset to be used later by dropTip
- setDropTipOffset(offset)
-
- const wellLocation =
- currentCommand.params.wellLocation != null
- ? {
- ...currentCommand.params.wellLocation,
- offset,
- }
- : { offset }
- currentCommand.params.wellLocation = wellLocation
- } else if (currentCommand.commandType === 'dropTip') {
- // apply in flight offsets to the drop tip command
- const wellLocation =
- currentCommand.params.wellLocation != null
- ? {
- ...currentCommand.params.wellLocation,
- offset: dropTipOffset,
- }
- : { offset: dropTipOffset }
- currentCommand.params.wellLocation = wellLocation
- }
- // execute the movement command
- return createCommand({
- runId: currentRunId,
- command: createCommandData(currentCommand),
- })
- }
- )
- .then(response => {
- setPendingMovementCommandData({
- commandId: response.data.id,
- })
- // if the command is a movement command, save it's location after it completes
- if (currentCommand.commandType === 'moveToWell') {
- const savePositionCommand: SavePositionCreateCommand = {
- commandType: 'savePosition',
- params: { pipetteId: currentCommand.params.pipetteId },
- }
- createCommand({
- runId: currentRunId,
- command: createCommandData(savePositionCommand),
- })
- .then(response => {
- const commandId = response.data.id
- addSavePositionCommandData(
- commandId,
- currentCommand.params.labwareId
- )
- })
- .catch((e: Error) => {
- console.error(`error saving position: ${e.message}`)
- setError(e)
- })
- }
- // if this was the last LPC command, home the robot and log a mixpanel event
- if (currentCommandIndex === LPCMovementCommands.length - 1) {
- const homeCommand: HomeCreateCommand = {
- commandType: 'home',
- params: {},
- }
- createCommand({
- runId: currentRunId,
- command: createCommandData(homeCommand),
- })
- .then(() =>
- trackEvent({
- name: 'LabwarePositionCheckComplete',
- properties: {},
- })
- )
- .catch((e: Error) => {
- console.error(`error homing robot: ${e.message}`)
- setError(e)
- })
- }
- })
- .catch((e: Error) => {
- console.error(`error issuing command to robot: ${e.message}`)
- setError(e)
- })
- }
-
- const beginLPC = (): void => {
- trackEvent({ name: 'LabwarePositionCheckStarted', properties: {} })
- setIsLoading(true)
- // load custom labware definitions that come from python protocols first, so that subsequent load labware commands can reference them
- const customLabwareDefinitions: LabwareDefinition2[] =
- protocolType === 'python' && protocolData != null
- ? protocolData?.commands
- .filter(isLoadLabwareCommand)
- .filter(
- loadLabwareCommand =>
- !getLabwareDefIsStandard(loadLabwareCommand.result.definition)
- )
- .map(loadLabwareCommand => loadLabwareCommand.result.definition)
- : []
-
- // TODO(mc, 2022-03-04): https://github.com/Opentrons/opentrons/issues/9624
- customLabwareDefinitions.forEach(labwareDef => {
- createLabwareDefinition({
- runId: currentRunId,
- data: labwareDef,
- })
- })
-
- // execute prep commands
- prepCommands.forEach(prepCommand => {
- createCommand({
- runId: currentRunId,
- command: createCommandData(prepCommand),
- }).catch((e: Error) => {
- console.error(`error issuing command to robot: ${e.message}`)
- setError(e)
- })
- })
- // issue first movement command
- createCommand({
- runId: currentRunId,
- command: createCommandData(currentCommand),
- })
- .then(response => {
- const commandId = response.data.id
- setPendingMovementCommandData({
- commandId,
- })
- const savePositionCommand: SavePositionCreateCommand = {
- commandType: 'savePosition',
- params: { pipetteId: currentCommand.params.pipetteId },
- }
- createCommand({
- runId: currentRunId,
- command: createCommandData(savePositionCommand),
- }).then(response => {
- const commandId = response.data.id
- addSavePositionCommandData(commandId, currentCommand.params.labwareId)
- })
- setCurrentCommandIndex(currentCommandIndex + 1)
- })
- .catch((e: Error) => {
- console.error(`error issuing command to robot: ${e.message}`)
- setError(e)
- })
- }
-
- const onUnsuccessfulPickUpTip = (): void => {
- setIsLoading(true)
- setShowPickUpTipConfirmationModal(false)
- // drop the tip back where it was before
- const commandType: DropTipCreateCommand['commandType'] = 'dropTip'
- const pipetteId = prevCommand.params.pipetteId
- const labwareId = prevCommand.params.labwareId
- const wellName = prevCommand.params.wellName
- const dropTipCommand: DropTipCreateCommand = {
- commandType,
- params: {
- pipetteId,
- labwareId,
- wellName,
- },
- }
- createCommand({
- runId: currentRunId,
- command: createCommandData(dropTipCommand),
- })
- .then(() => {
- const moveBackToWellCommand =
- // the last command was a pick up tip, the one before that was a move to well
- LPCMovementCommands[currentCommandIndex - 2]
- const moveBackToWell = createCommand({
- runId: currentRunId,
- command: createCommandData(moveBackToWellCommand),
- })
- return moveBackToWell
- })
- .then(response => {
- const commandId = response.data.id
- setPendingMovementCommandData({
- commandId,
- })
- // decrement current command index so that the state resets
- setCurrentCommandIndex(currentCommandIndex - 1)
- })
-
- .catch((e: Error) => {
- console.error(`error issuing drop tip command: ${e.message}`)
- })
- }
-
- const jog = (
- axis: Axis,
- dir: Sign,
- step: StepSize,
- onSuccess?: (position: Coordinates | null) => void
- ): void => {
- // if a jog is currently in flight, return early
- if (isJogging.current) return
- const moveRelCommand: CreateCommand = {
- commandType: 'moveRelative',
- params: {
- pipetteId: prevCommand.params.pipetteId,
- distance: step * dir,
- axis,
- },
- }
- isJogging.current = true
- createCommand({
- runId: currentRunId,
- command: moveRelCommand,
- waitUntilComplete: true,
- timeout: JOG_COMMAND_TIMEOUT,
- })
- .then(data => {
- onSuccess != null && onSuccess(data?.data?.result?.position ?? null)
- isJogging.current = false
- })
- .catch((e: Error) => {
- isJogging.current = false
- setError(e)
- console.error(`error issuing jog command: ${e.message}`)
- })
- }
-
- return {
- currentCommandIndex,
- currentStep,
- beginLPC,
- proceed,
- jog,
- onUnsuccessfulPickUpTip,
- ctaText,
- isComplete,
- titleText,
- isLoading,
- showPickUpTipConfirmationModal,
- }
-}
diff --git a/app/src/organisms/LabwarePositionCheck/deprecatedHooks/useDeprecatedSteps.ts b/app/src/organisms/LabwarePositionCheck/deprecatedHooks/useDeprecatedSteps.ts
deleted file mode 100644
index eb3ec24085d..00000000000
--- a/app/src/organisms/LabwarePositionCheck/deprecatedHooks/useDeprecatedSteps.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-import * as React from 'react'
-import { useProtocolDetailsForRun } from '../../Devices/hooks/useProtocolDetailsForRun'
-import { deprecatedGetLabwarePositionCheckSteps } from '../deprecatedUtils/deprecatedGetLabwarePositionCheckSteps'
-import type { DeprecatedLabwarePositionCheckStep } from '../types'
-
-export function useDeprecatedSteps(
- runId: string | null
-): DeprecatedLabwarePositionCheckStep[] {
- const [LPCSteps, setLPCSteps] = React.useState<
- DeprecatedLabwarePositionCheckStep[]
- >([])
- const { protocolData } = useProtocolDetailsForRun(runId)
- if (protocolData == null) return [] // this state should never be reached
- if (LPCSteps.length === 0) {
- setLPCSteps(deprecatedGetLabwarePositionCheckSteps(protocolData))
- }
- return LPCSteps
-}
diff --git a/app/src/organisms/LabwarePositionCheck/deprecatedHooks/useIntroInfo.ts b/app/src/organisms/LabwarePositionCheck/deprecatedHooks/useIntroInfo.ts
deleted file mode 100644
index 3c5bb323f6f..00000000000
--- a/app/src/organisms/LabwarePositionCheck/deprecatedHooks/useIntroInfo.ts
+++ /dev/null
@@ -1,63 +0,0 @@
-import { getPipetteMount } from '../../Devices/ProtocolRun/utils/getPipetteMount'
-import { getLabwareLocation } from '../../Devices/ProtocolRun/utils/getLabwareLocation'
-import { useProtocolDetailsForRun } from '../../Devices/hooks/useProtocolDetailsForRun'
-import { useCurrentRunId } from '../../ProtocolUpload/hooks'
-import { useDeprecatedSteps } from './useDeprecatedSteps'
-import { useSections } from './useSections'
-import type { PickUpTipCreateCommand } from '@opentrons/shared-data/protocol/types/schemaV6/command/pipetting'
-import type { DeprecatedSection } from '../types'
-
-interface IntroInfo {
- primaryPipetteMount: string
- secondaryPipetteMount: string
- firstTiprackSlot: string
- sections: DeprecatedSection[]
-}
-export function useIntroInfo(): IntroInfo | null {
- const runId = useCurrentRunId()
- const { protocolData } = useProtocolDetailsForRun(runId)
- const steps = useDeprecatedSteps(runId)
- const sections = useSections(runId)
- if (
- protocolData == null ||
- !('pipettes' in protocolData) ||
- !('labware' in protocolData)
- )
- return null // this state should never be reached
-
- // find which tiprack primary pipette will use for check
-
- const pickUpTipStep = steps.find(
- step => step.commands[0].commandType === 'pickUpTip'
- )
- if (pickUpTipStep == null) return null // this state should never be reached
-
- const { pipetteId: primaryPipetteId } = (pickUpTipStep
- .commands[0] as PickUpTipCreateCommand).params
- const primaryPipetteMount = getPipetteMount(
- primaryPipetteId,
- protocolData.commands
- )
- const secondaryPipetteMount =
- primaryPipetteMount === 'right' ? 'left' : 'right'
-
- // find the slot for the first labware that will be checked for button
- const firstTiprackToCheckId = steps[0].labwareId
- const firstTiprackLocation = getLabwareLocation(
- firstTiprackToCheckId,
- protocolData.commands
- )
- if (
- firstTiprackLocation === 'offDeck' ||
- !('slotName' in firstTiprackLocation)
- ) {
- throw new Error('expected tiprack location to be a slot')
- }
-
- return {
- primaryPipetteMount,
- secondaryPipetteMount,
- firstTiprackSlot: firstTiprackLocation.slotName,
- sections,
- }
-}
diff --git a/app/src/organisms/LabwarePositionCheck/deprecatedHooks/useLPCCommands.ts b/app/src/organisms/LabwarePositionCheck/deprecatedHooks/useLPCCommands.ts
deleted file mode 100644
index 36c21939dd6..00000000000
--- a/app/src/organisms/LabwarePositionCheck/deprecatedHooks/useLPCCommands.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-import { LabwarePositionCheckCreateCommand } from '../types'
-import { useDeprecatedSteps } from './useDeprecatedSteps'
-
-export function useLPCCommands(
- runId: string
-): LabwarePositionCheckCreateCommand[] {
- return useDeprecatedSteps(runId).reduce(
- (steps, currentStep) => {
- return [...steps, ...currentStep.commands]
- },
- []
- )
-}
diff --git a/app/src/organisms/LabwarePositionCheck/deprecatedHooks/useLabwareIdsBySection.ts b/app/src/organisms/LabwarePositionCheck/deprecatedHooks/useLabwareIdsBySection.ts
deleted file mode 100644
index b44b15a3852..00000000000
--- a/app/src/organisms/LabwarePositionCheck/deprecatedHooks/useLabwareIdsBySection.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-import type { DeprecatedSection } from '../types'
-import { useDeprecatedSteps } from './useDeprecatedSteps'
-import { useSections } from './useSections'
-
-type LabwareIdsBySection = {
- [section in DeprecatedSection]?: string[]
-}
-export function useLabwareIdsBySection(
- runId: string | null
-): LabwareIdsBySection {
- const steps = useDeprecatedSteps(runId)
- const sections = useSections(runId)
- return sections.reduce(
- (labwareIdsBySection, section) => {
- return {
- ...labwareIdsBySection,
- [section]: steps.reduce(
- (labwareIds, step) =>
- step.section === section
- ? [...labwareIds, step.labwareId]
- : labwareIds,
- []
- ),
- }
- },
- {}
- )
-}
diff --git a/app/src/organisms/LabwarePositionCheck/deprecatedHooks/useLabwareOffsets.ts b/app/src/organisms/LabwarePositionCheck/deprecatedHooks/useLabwareOffsets.ts
deleted file mode 100644
index 985b10fcba1..00000000000
--- a/app/src/organisms/LabwarePositionCheck/deprecatedHooks/useLabwareOffsets.ts
+++ /dev/null
@@ -1,127 +0,0 @@
-import reduce from 'lodash/reduce'
-import { useTranslation, TFunction } from 'react-i18next'
-import {
- getModuleDisplayName,
- getLabwareDisplayName,
- getModuleType,
- LegacySchemaAdapterOutput,
- THERMOCYCLER_MODULE_TYPE,
- getVectorSum,
-} from '@opentrons/shared-data'
-import { getLabwareOffsetLocation } from '../../Devices/ProtocolRun/utils/getLabwareOffsetLocation'
-import { getModuleInitialLoadInfo } from '../../Devices/ProtocolRun/utils/getModuleInitialLoadInfo'
-import { getLabwareLocation } from '../../Devices/ProtocolRun/utils/getLabwareLocation'
-import { getLabwareDefinitionUri } from '../../Devices/ProtocolRun/utils/getLabwareDefinitionUri'
-import { useOffsetDataByLabwareId } from '../../ProtocolUpload/hooks/useOffsetData'
-import type { LabwareOffsetLocation, VectorOffset } from '@opentrons/api-client'
-import type { SavePositionCommandData } from '../types'
-import { getCurrentOffsetForLabwareInLocation } from '../../Devices/ProtocolRun/utils/getCurrentOffsetForLabwareInLocation'
-import { useCurrentRun } from '../../ProtocolUpload/hooks'
-
-const getDisplayLocation = (
- labwareId: string,
- protocolData: LegacySchemaAdapterOutput,
- t: TFunction<'labware_position_check'>
-): string => {
- let location = ''
- const labwareLocation = getLabwareLocation(labwareId, protocolData.commands)
- if (labwareLocation === 'offDeck') return 'Off Deck'
- if ('moduleId' in labwareLocation) {
- if (
- getModuleType(protocolData.modules[labwareLocation.moduleId].model) ===
- THERMOCYCLER_MODULE_TYPE
- ) {
- location = getModuleDisplayName(
- protocolData.modules[labwareLocation.moduleId].model
- )
- } else {
- location = t('module_display_location_text', {
- moduleName: getModuleDisplayName(
- protocolData.modules[labwareLocation.moduleId].model
- ),
- slot: getModuleInitialLoadInfo(
- labwareLocation.moduleId,
- protocolData.commands
- ).location.slotName,
- })
- }
- } else {
- location = t('labware_display_location_text', {
- slot: labwareLocation.slotName,
- })
- }
- return location
-}
-
-export type LabwareOffsets = Array<{
- labwareId: string
- labwareOffsetLocation: LabwareOffsetLocation
- labwareDefinitionUri: string
- displayLocation: string
- displayName: string
- vector: VectorOffset
-}>
-
-export const useLabwareOffsets = (
- savePositionCommandData: SavePositionCommandData,
- protocolData: LegacySchemaAdapterOutput
-): Promise => {
- const { t } = useTranslation('labware_position_check')
- const offsetDataByLabwareId = useOffsetDataByLabwareId(
- savePositionCommandData
- )
- const existingLabwareOffsets = useCurrentRun()?.data?.labwareOffsets ?? []
- return reduce>(
- savePositionCommandData,
- (labwareOffsets, _commandIds, labwareId) => {
- const displayLocation = getDisplayLocation(labwareId, protocolData, t)
- const labwareOffsetLocation = getLabwareOffsetLocation(
- labwareId,
- protocolData.commands,
- protocolData.modules
- )
- // skip if location is offDeck
- if (labwareOffsetLocation == null) return labwareOffsets
- const labwareDefinitionUri = getLabwareDefinitionUri(
- labwareId,
- protocolData.labware,
- protocolData.labwareDefinitions
- )
- // @ts-expect-error: when we remove schemav6Adapter, this logic will be correct
- const definitionUri = protocolData.labware.find(
- item => item.id === labwareId
- ).definitionUri
- const displayName = getLabwareDisplayName(
- protocolData.labwareDefinitions[definitionUri]
- )
- const vectorPromise = offsetDataByLabwareId.then(result => ({
- ...result[labwareId],
- }))
- return labwareOffsets.then(labwareOffsets =>
- vectorPromise.then(vector => {
- const existingOffsetVector = getCurrentOffsetForLabwareInLocation(
- existingLabwareOffsets,
- labwareDefinitionUri,
- labwareOffsetLocation
- )
-
- return [
- ...labwareOffsets,
- {
- labwareId,
- labwareOffsetLocation,
- labwareDefinitionUri,
- displayLocation,
- displayName,
- vector:
- existingOffsetVector != null
- ? getVectorSum(existingOffsetVector.vector, vector)
- : vector,
- },
- ]
- })
- )
- },
- Promise.resolve([])
- )
-}
diff --git a/app/src/organisms/LabwarePositionCheck/deprecatedHooks/useSections.ts b/app/src/organisms/LabwarePositionCheck/deprecatedHooks/useSections.ts
deleted file mode 100644
index 01d0243234c..00000000000
--- a/app/src/organisms/LabwarePositionCheck/deprecatedHooks/useSections.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-import type { DeprecatedSection } from '../types'
-import { useDeprecatedSteps } from './useDeprecatedSteps'
-
-export function useSections(runId: string | null): DeprecatedSection[] {
- const steps = useDeprecatedSteps(runId)
- return steps.reduce(
- (acc, step) => (acc.includes(step.section) ? acc : [...acc, step.section]),
- []
- )
-}
diff --git a/app/src/organisms/LabwarePositionCheck/deprecatedUtils/__tests__/getLatestLabwareOffsetCount.test.ts b/app/src/organisms/LabwarePositionCheck/deprecatedUtils/__tests__/getLatestLabwareOffsetCount.test.ts
deleted file mode 100644
index f0f5d939446..00000000000
--- a/app/src/organisms/LabwarePositionCheck/deprecatedUtils/__tests__/getLatestLabwareOffsetCount.test.ts
+++ /dev/null
@@ -1,187 +0,0 @@
-import { LabwareOffset } from '@opentrons/api-client'
-import { getLatestLabwareOffsetCount } from '../getLatestLabwareOffsetCount'
-describe('getLatestLabwareOffsetCount', () => {
- it('should return 0 when there are no offests', () => {
- const labwareOffsets: LabwareOffset[] = []
-
- expect(getLatestLabwareOffsetCount(labwareOffsets)).toBe(0)
- })
-
- it('should return 1 when there is one offset record', () => {
- const labwareOffsets: LabwareOffset[] = [
- {
- id: 'someID',
- createdAt: '2021-11-29',
- definitionUri: 'some_definitionUri',
- location: { slotName: '1' },
- vector: { x: 1, y: 0, z: 0 },
- },
- ]
- expect(getLatestLabwareOffsetCount(labwareOffsets)).toBe(1)
- })
- it('should return 2 when there are two offset records with different labware', () => {
- const labwareOffsets: LabwareOffset[] = [
- {
- id: 'someID1',
- createdAt: '2021-11-29',
- definitionUri: 'some_definitionUri',
- location: { slotName: '1' },
- vector: { x: 1, y: 0, z: 0 },
- },
- {
- id: 'someID2',
- createdAt: '2021-11-29',
- definitionUri: 'another_definitionUri',
- location: { slotName: '2' },
- vector: { x: 1, y: 2, z: 3 },
- },
- ]
- expect(getLatestLabwareOffsetCount(labwareOffsets)).toBe(2)
- })
- it('should return 1 when there are two offset records with the same labware and slot', () => {
- const labwareOffsets: LabwareOffset[] = [
- {
- id: 'someID1',
- createdAt: '2021-11-29',
- definitionUri: 'some_definitionUri',
- location: { slotName: '1' },
- vector: { x: 1, y: 0, z: 0 },
- },
- {
- id: 'someID2',
- createdAt: '2021-11-30',
- definitionUri: 'some_definitionUri',
- location: { slotName: '1' },
- vector: { x: 1, y: 2, z: 3 },
- },
- ]
- expect(getLatestLabwareOffsetCount(labwareOffsets)).toBe(1)
- })
- it('should return 1 when there are two offset records with the same labware and module location', () => {
- const labwareOffsets: LabwareOffset[] = [
- {
- id: 'someID1',
- createdAt: '2021-11-30',
- definitionUri: 'some_definitionUri',
- location: { slotName: '1', moduleModel: 'temperatureModuleV1' },
- vector: { x: 1, y: 0, z: 0 },
- },
- {
- id: 'someID2',
- createdAt: '2021-11-29',
- definitionUri: 'some_definitionUri',
- location: { slotName: '1', moduleModel: 'temperatureModuleV1' },
- vector: { x: 1, y: 2, z: 3 },
- },
- ]
- expect(getLatestLabwareOffsetCount(labwareOffsets)).toBe(1)
- })
- it('should return 0 when all offsets are identity offsets', () => {
- const labwareOffsets: LabwareOffset[] = [
- {
- id: 'someID1',
- createdAt: '2021-11-29',
- definitionUri: 'some_definitionUri',
- location: { slotName: '2' },
- vector: { x: 0, y: 0, z: 0 },
- },
- {
- id: 'someID2',
- createdAt: '2021-11-29',
- definitionUri: 'some_definitionUri',
- location: { slotName: '3' },
- vector: { x: 0, y: 0, z: 0 },
- },
- ]
- expect(getLatestLabwareOffsetCount(labwareOffsets)).toBe(0)
- })
- it('should not count offsets to the trash', () => {
- const labwareOffsets: LabwareOffset[] = [
- {
- id: 'someID1',
- createdAt: '2021-11-29',
- definitionUri: 'fixedTrash',
- location: { slotName: '12' },
- vector: { x: 0, y: 0, z: 0 },
- },
- {
- id: 'someID2',
- createdAt: '2021-11-29',
- definitionUri: 'some_definitionUri',
- location: { slotName: '1', moduleModel: 'temperatureModuleV1' },
- vector: { x: 1, y: 0, z: 0 },
- },
- ]
- expect(getLatestLabwareOffsetCount(labwareOffsets)).toBe(1)
- })
- it('should return only new offsets when the previous entries were identity offsets', () => {
- const labwareOffsets: LabwareOffset[] = [
- {
- id: 'someId1',
- createdAt: '2021-11-29',
- definitionUri: 'some_definitionUri',
- location: { slotName: '3' },
- vector: { x: 0, y: 0, z: 0 },
- },
- {
- id: 'someId2',
- createdAt: '2021-11-30',
- definitionUri: 'some_definitionUri',
- location: { slotName: '3' },
- vector: { x: 1, y: 0, z: 0 },
- },
- {
- id: 'someId3',
- createdAt: '2021-11-29',
- definitionUri: 'another_definitionUri',
- location: { slotName: '1', moduleModel: 'temperatureModuleV1' },
-
- vector: { x: 0, y: 0, z: 0 },
- },
- {
- id: 'someId4',
- createdAt: '2021-11-30',
- definitionUri: 'another_definitionUri',
- location: { slotName: '1', moduleModel: 'temperatureModuleV1' },
-
- vector: { x: 1, y: 0, z: 0 },
- },
- ]
- expect(getLatestLabwareOffsetCount(labwareOffsets)).toBe(2)
- })
- it('should return only zero offsets when the newest entries are identity offsets', () => {
- const labwareOffsets: LabwareOffset[] = [
- {
- id: 'someId1',
- createdAt: '2021-12-29',
- definitionUri: 'some_definitionUri',
- location: { slotName: '3' },
- vector: { x: 0, y: 0, z: 0 },
- },
- {
- id: 'someId2',
- createdAt: '2021-11-30',
- definitionUri: 'some_definitionUri',
- location: { slotName: '3' },
- vector: { x: 1, y: 0, z: 0 },
- },
- {
- id: 'someId3',
- createdAt: '2021-12-29',
- definitionUri: 'another_definitionUri',
- location: { slotName: '1', moduleModel: 'temperatureModuleV1' },
-
- vector: { x: 0, y: 0, z: 0 },
- },
- {
- id: 'someId4',
- createdAt: '2021-11-30',
- definitionUri: 'another_definitionUri',
- location: { slotName: '1', moduleModel: 'temperatureModuleV1' },
-
- vector: { x: 1, y: 0, z: 0 },
- },
- ]
- expect(getLatestLabwareOffsetCount(labwareOffsets)).toBe(0)
- })
-})
diff --git a/app/src/organisms/LabwarePositionCheck/deprecatedUtils/__tests__/getOnePipettePositionCheckSteps.test.ts b/app/src/organisms/LabwarePositionCheck/deprecatedUtils/__tests__/getOnePipettePositionCheckSteps.test.ts
deleted file mode 100644
index 1973c3fbcbf..00000000000
--- a/app/src/organisms/LabwarePositionCheck/deprecatedUtils/__tests__/getOnePipettePositionCheckSteps.test.ts
+++ /dev/null
@@ -1,314 +0,0 @@
-import _uncastedProtocolMultipleTipracks from '@opentrons/shared-data/protocol/fixtures/6/multipleTipracks.json'
-import _uncastedProtocolWithTC from '@opentrons/shared-data/protocol/fixtures/6/multipleTipracksWithTC.json'
-import { getOnePipettePositionCheckSteps } from '../getOnePipettePositionCheckSteps'
-import { DEPRECATED_SECTIONS } from '../../constants'
-import type { ProtocolAnalysisFile } from '@opentrons/shared-data'
-import type { CreateCommand } from '@opentrons/shared-data/protocol/types/schemaV6'
-import type { DeprecatedLabwarePositionCheckStep } from '../../types'
-
-const protocolMultipleTipracks = (_uncastedProtocolMultipleTipracks as unknown) as ProtocolAnalysisFile
-const protocolWithTC = (_uncastedProtocolWithTC as unknown) as ProtocolAnalysisFile
-
-describe('getOnePipettePositionCheckSteps', () => {
- it('should check all tipracks, pick up a tip at the final tiprack, move to all remaining labware, and drop the tip', () => {
- const primaryPipetteId = 'c235a5a0-0042-11ec-8258-f7ffdf5ad45a' // this is just taken from the protocol fixture
- const labware = [
- {
- id: 'fixedTrash',
- displayName: 'Trash',
- definitionUri: 'opentrons/opentrons_1_trash_1100ml_fixed/1',
- loadName: 'opentrons_1_trash_1100ml_fixed',
- },
- {
- id:
- '50d3ebb0-0042-11ec-8258-f7ffdf5ad45a:opentrons/opentrons_96_tiprack_300ul/1',
- displayName: 'Opentrons 96 Tip Rack 300 µL',
- definitionUri: 'opentrons/opentrons_96_tiprack_300ul/1',
- loadName: 'opentrons_96_tiprack_300ul',
- },
- {
- id:
- '9fbc1db0-0042-11ec-8258-f7ffdf5ad45a:opentrons/nest_12_reservoir_15ml/1',
- displayName: 'NEST 12 Well Reservoir 15 mL',
- definitionUri: 'opentrons/nest_12_reservoir_15ml/1',
- loadName: 'nest_12_reservoir_15ml',
- },
- {
- id: 'e24818a0-0042-11ec-8258-f7ffdf5ad45a',
- displayName: 'Opentrons 96 Tip Rack 300 µL (1)',
- definitionUri: 'opentrons/opentrons_96_tiprack_300ul/1',
- loadName: 'opentrons_96_tiprack_300ul',
- },
- ]
- const labwareDefinitions = protocolMultipleTipracks.labwareDefinitions
- const modules = protocolMultipleTipracks.modules
-
- const tiprackInSlot1Id =
- '50d3ebb0-0042-11ec-8258-f7ffdf5ad45a:opentrons/opentrons_96_tiprack_300ul/1'
- const tiprackInSlot2Id = 'e24818a0-0042-11ec-8258-f7ffdf5ad45a'
- const resevoirId =
- '9fbc1db0-0042-11ec-8258-f7ffdf5ad45a:opentrons/nest_12_reservoir_15ml/1'
-
- const moveToWellFirstTiprack: CreateCommand = {
- commandType: 'moveToWell',
- params: {
- pipetteId: primaryPipetteId,
- labwareId: tiprackInSlot1Id,
- wellName: 'A1',
- wellLocation: {
- origin: 'top',
- },
- },
- }
-
- const moveToWellSecondTiprack: CreateCommand = {
- commandType: 'moveToWell',
- params: {
- pipetteId: primaryPipetteId,
- labwareId: tiprackInSlot2Id,
- wellName: 'A1',
- wellLocation: {
- origin: 'top',
- },
- },
- }
-
- const pickupTipAtLastTiprack: CreateCommand = {
- commandType: 'pickUpTip',
- params: {
- pipetteId: primaryPipetteId,
- labwareId: tiprackInSlot2Id,
- wellName: 'A1',
- },
- }
-
- const moveToWellFirstLabware: CreateCommand = {
- commandType: 'moveToWell',
- params: {
- pipetteId: primaryPipetteId,
- labwareId: resevoirId,
- wellName: 'A1',
- wellLocation: {
- origin: 'top',
- },
- },
- }
-
- const dropTipIntoLastTiprack: CreateCommand = {
- commandType: 'dropTip',
- params: {
- pipetteId: primaryPipetteId,
- labwareId: tiprackInSlot2Id,
- wellName: 'A1',
- },
- }
-
- const allSteps: DeprecatedLabwarePositionCheckStep[] = [
- {
- labwareId: tiprackInSlot1Id,
- section: DEPRECATED_SECTIONS.PRIMARY_PIPETTE_TIPRACKS,
- commands: [moveToWellFirstTiprack],
- },
- {
- labwareId: tiprackInSlot2Id,
- section: DEPRECATED_SECTIONS.PRIMARY_PIPETTE_TIPRACKS,
- commands: [moveToWellSecondTiprack],
- },
- {
- labwareId: tiprackInSlot2Id,
- section: DEPRECATED_SECTIONS.PRIMARY_PIPETTE_TIPRACKS,
- commands: [pickupTipAtLastTiprack],
- },
- {
- labwareId: resevoirId,
- section:
- DEPRECATED_SECTIONS.CHECK_REMAINING_LABWARE_WITH_PRIMARY_PIPETTE,
- commands: [moveToWellFirstLabware],
- },
- {
- labwareId: tiprackInSlot2Id,
- section: DEPRECATED_SECTIONS.RETURN_TIP,
- commands: [dropTipIntoLastTiprack],
- },
- ]
-
- expect(
- getOnePipettePositionCheckSteps({
- primaryPipetteId,
- // @ts-expect-error
- labware,
- labwareDefinitions,
- modules,
- commands: protocolMultipleTipracks.commands,
- })
- ).toEqual(allSteps)
- })
- it('should check tiprack, pick up a tip at the final tiprack, move to all remaining labware (and open TC lid), and drop the tip', () => {
- const primaryPipetteId = 'c235a5a0-0042-11ec-8258-f7ffdf5ad45a' // this is just taken from the protocol fixture
- const labware = [
- {
- id: 'fixedTrash',
- displayName: 'Trash',
- definitionUri: 'opentrons/opentrons_1_trash_1100ml_fixed/1',
- loadName: 'opentrons_1_trash_1100ml_fixed',
- },
- {
- id:
- '50d3ebb0-0042-11ec-8258-f7ffdf5ad45a:opentrons/opentrons_96_tiprack_300ul/1',
- displayName: 'Opentrons 96 Tip Rack 300 µL',
- definitionUri: 'opentrons/opentrons_96_tiprack_300ul/1',
- loadName: 'opentrons_96_tiprack_300ul',
- },
- {
- id:
- '9fbc1db0-0042-11ec-8258-f7ffdf5ad45a:opentrons/nest_12_reservoir_15ml/1',
- displayName: 'NEST 12 Well Reservoir 15 mL',
- definitionUri: 'opentrons/nest_12_reservoir_15ml/1',
- loadName: 'nest_12_reservoir_15ml',
- },
- {
- id: 'e24818a0-0042-11ec-8258-f7ffdf5ad45a',
- displayName: 'Opentrons 96 Tip Rack 300 µL (1)',
- definitionUri: 'opentrons/opentrons_96_tiprack_300ul/1',
- loadName: 'opentrons_96_tiprack_300ul',
- },
- {
- id:
- '1dc0c050-0122-11ec-88a3-f1745cf9b36c:opentrons/nest_96_wellplate_100ul_pcr_full_skirt/1',
- displayName: 'NEST 96 Well Plate 100 µL PCR Full Skirt',
- definitionUri: 'opentrons/nest_96_wellplate_100ul_pcr_full_skirt/1',
- loadName: 'nest_96_wellplate_100ul_pcr_full_skirt',
- },
- ]
- const labwareDefinitions = protocolWithTC.labwareDefinitions
- const modules = protocolWithTC.modules
-
- const TCId = '18f0c1b0-0122-11ec-88a3-f1745cf9b36c:thermocyclerModuleType'
- const tiprackInSlot1Id =
- '50d3ebb0-0042-11ec-8258-f7ffdf5ad45a:opentrons/opentrons_96_tiprack_300ul/1'
- const tiprackInSlot2Id = 'e24818a0-0042-11ec-8258-f7ffdf5ad45a'
- const resevoirId =
- '9fbc1db0-0042-11ec-8258-f7ffdf5ad45a:opentrons/nest_12_reservoir_15ml/1'
- const TCWellPlateId =
- '1dc0c050-0122-11ec-88a3-f1745cf9b36c:opentrons/nest_96_wellplate_100ul_pcr_full_skirt/1'
-
- const moveToWellFirstTiprack: CreateCommand = {
- commandType: 'moveToWell',
- params: {
- pipetteId: primaryPipetteId,
- labwareId: tiprackInSlot1Id,
- wellName: 'A1',
- wellLocation: {
- origin: 'top',
- },
- },
- }
-
- const moveToWellSecondTiprack: CreateCommand = {
- commandType: 'moveToWell',
- params: {
- pipetteId: primaryPipetteId,
- labwareId: tiprackInSlot2Id,
- wellName: 'A1',
- wellLocation: {
- origin: 'top',
- },
- },
- }
-
- const pickupTipAtLastTiprack: CreateCommand = {
- commandType: 'pickUpTip',
- params: {
- pipetteId: primaryPipetteId,
- labwareId: tiprackInSlot2Id,
- wellName: 'A1',
- },
- }
-
- const moveToWellFirstLabware: CreateCommand = {
- commandType: 'moveToWell',
- params: {
- pipetteId: primaryPipetteId,
- labwareId: resevoirId,
- wellName: 'A1',
- wellLocation: {
- origin: 'top',
- },
- },
- }
-
- const openTCLid: CreateCommand = {
- commandType: 'thermocycler/openLid',
- params: {
- moduleId: TCId,
- },
- }
-
- const moveToWellAfterOpeningTCLid: CreateCommand = {
- commandType: 'moveToWell',
- params: {
- pipetteId: primaryPipetteId,
- labwareId: TCWellPlateId,
- wellName: 'A1',
- wellLocation: {
- origin: 'top',
- },
- },
- }
-
- const dropTipIntoLastTiprack: CreateCommand = {
- commandType: 'dropTip',
- params: {
- pipetteId: primaryPipetteId,
- labwareId: tiprackInSlot2Id,
- wellName: 'A1',
- },
- }
-
- const allSteps: DeprecatedLabwarePositionCheckStep[] = [
- {
- labwareId: tiprackInSlot1Id,
- section: DEPRECATED_SECTIONS.PRIMARY_PIPETTE_TIPRACKS,
- commands: [moveToWellFirstTiprack],
- },
- {
- labwareId: tiprackInSlot2Id,
- section: DEPRECATED_SECTIONS.PRIMARY_PIPETTE_TIPRACKS,
- commands: [moveToWellSecondTiprack],
- },
- {
- labwareId: tiprackInSlot2Id,
- section: DEPRECATED_SECTIONS.PRIMARY_PIPETTE_TIPRACKS,
- commands: [pickupTipAtLastTiprack],
- },
- {
- labwareId: resevoirId,
- section:
- DEPRECATED_SECTIONS.CHECK_REMAINING_LABWARE_WITH_PRIMARY_PIPETTE,
- commands: [moveToWellFirstLabware],
- },
- {
- labwareId: TCWellPlateId,
- section:
- DEPRECATED_SECTIONS.CHECK_REMAINING_LABWARE_WITH_PRIMARY_PIPETTE,
- commands: [openTCLid, moveToWellAfterOpeningTCLid],
- },
- {
- labwareId: tiprackInSlot2Id,
- section: DEPRECATED_SECTIONS.RETURN_TIP,
- commands: [dropTipIntoLastTiprack],
- },
- ]
-
- expect(
- getOnePipettePositionCheckSteps({
- primaryPipetteId,
- // @ts-expect-error
- labware,
- labwareDefinitions,
- modules,
- commands: protocolWithTC.commands,
- })
- ).toEqual(allSteps)
- })
-})
diff --git a/app/src/organisms/LabwarePositionCheck/deprecatedUtils/__tests__/getPipetteWorkflow.test.ts b/app/src/organisms/LabwarePositionCheck/deprecatedUtils/__tests__/getPipetteWorkflow.test.ts
deleted file mode 100644
index c42e1da19af..00000000000
--- a/app/src/organisms/LabwarePositionCheck/deprecatedUtils/__tests__/getPipetteWorkflow.test.ts
+++ /dev/null
@@ -1,118 +0,0 @@
-import { PipetteName } from '@opentrons/shared-data'
-import { when, resetAllWhenMocks } from 'jest-when'
-import { getPipetteWorkflow } from '../getPipetteWorkflow'
-import { doesPipetteVisitAllTipracks } from '../../utils/doesPipetteVisitAllTipracks'
-import type { RunTimeCommand } from '@opentrons/shared-data/protocol/types/schemaV6'
-import type { LoadedLabware } from '@opentrons/shared-data'
-
-jest.mock('../../utils/doesPipetteVisitAllTipracks')
-
-const mockDoesPipetteVisitAllTipracks = doesPipetteVisitAllTipracks as jest.MockedFunction<
- typeof doesPipetteVisitAllTipracks
->
-
-describe('getPipetteWorkflow', () => {
- afterEach(() => {
- resetAllWhenMocks()
- })
- it('should return 1 if there is only one pipette', () => {
- const pipetteNames: PipetteName[] = ['p1000_single']
- expect(
- getPipetteWorkflow({
- pipetteNames,
- primaryPipetteId: 'someId',
- labware: [] as LoadedLabware[],
- labwareDefinitions: {},
- commands: [],
- })
- ).toBe(1)
- })
- it('should return 1 if the two pipettes are the same', () => {
- const pipetteNames: PipetteName[] = ['p1000_single', 'p1000_single']
- expect(
- getPipetteWorkflow({
- pipetteNames,
- primaryPipetteId: 'someId',
- labware: [] as LoadedLabware[],
- labwareDefinitions: {},
- commands: [],
- })
- ).toBe(1)
- })
- it('should return 1 if the primary pipette visits all tipracks', () => {
- const pipetteNames: PipetteName[] = ['p1000_single', 'p1000_single_gen2']
- const primaryPipetteId = 'someId'
- const labware: LoadedLabware[] = []
- const labwareDefinitions = {}
- const moveToWellCommand: RunTimeCommand = {
- id: '1',
- commandType: 'moveToWell',
- params: {
- pipetteId: '',
- labwareId: '',
- wellName: '',
- wellLocation: {
- origin: 'top',
- offset: {
- x: 0,
- y: 0,
- z: 0,
- },
- },
- },
- } as any
- const commands: RunTimeCommand[] = [moveToWellCommand]
-
- when(mockDoesPipetteVisitAllTipracks)
- .calledWith(primaryPipetteId, labware, labwareDefinitions, commands)
- .mockReturnValue(true)
-
- expect(
- getPipetteWorkflow({
- pipetteNames,
- primaryPipetteId,
- labware,
- labwareDefinitions,
- commands,
- })
- ).toBe(1)
- })
- it('should return 2 if the primary pipette does NOT visit all tipracks', () => {
- const pipetteNames: PipetteName[] = ['p1000_single', 'p1000_single_gen2']
- const primaryPipetteId = 'someId'
- const labware: LoadedLabware[] = []
- const labwareDefinitions = {}
- const moveToWellCommand: RunTimeCommand = {
- id: '1',
- commandType: 'moveToWell',
- params: {
- pipetteId: '',
- labwareId: '',
- wellName: '',
- wellLocation: {
- origin: 'top',
- offset: {
- x: 0,
- y: 0,
- z: 0,
- },
- },
- },
- } as any
- const commands: RunTimeCommand[] = [moveToWellCommand]
-
- when(mockDoesPipetteVisitAllTipracks)
- .calledWith(primaryPipetteId, labware, labwareDefinitions, commands)
- .mockReturnValue(false)
-
- expect(
- getPipetteWorkflow({
- pipetteNames,
- primaryPipetteId,
- labware,
- labwareDefinitions,
- commands,
- })
- ).toBe(2)
- })
-})
diff --git a/app/src/organisms/LabwarePositionCheck/deprecatedUtils/__tests__/getTwoPipettePositionCheckSteps.test.ts b/app/src/organisms/LabwarePositionCheck/deprecatedUtils/__tests__/getTwoPipettePositionCheckSteps.test.ts
deleted file mode 100644
index c39dd2194bd..00000000000
--- a/app/src/organisms/LabwarePositionCheck/deprecatedUtils/__tests__/getTwoPipettePositionCheckSteps.test.ts
+++ /dev/null
@@ -1,320 +0,0 @@
-import _uncastedProtocolMultipleTipracks from '@opentrons/shared-data/protocol/fixtures/6/multipleTipracks.json'
-import _uncastedProtocolWithTC from '@opentrons/shared-data/protocol/fixtures/6/multipleTipracksWithTC.json'
-import { getTwoPipettePositionCheckSteps } from '../getTwoPipettePositionCheckSteps'
-import { DEPRECATED_SECTIONS } from '../../constants'
-import type { ProtocolAnalysisFile } from '@opentrons/shared-data'
-import type { CreateCommand } from '@opentrons/shared-data/protocol/types/schemaV6'
-import type { DeprecatedLabwarePositionCheckStep } from '../../types'
-
-const protocolMultipleTipracks = (_uncastedProtocolMultipleTipracks as unknown) as ProtocolAnalysisFile
-const protocolWithTC = (_uncastedProtocolWithTC as unknown) as ProtocolAnalysisFile
-
-describe('getTwoPipettePositionCheckSteps', () => {
- it('should move to all tipracks that the secondary pipette uses, move to all tipracks with that the primary pipette uses, pick up a tip at the final tiprack that the primary pipette uses, move to all remaining labware, and drop the tip back in the tiprack that the primary pipette uses', () => {
- const primaryPipetteId = '50d23e00-0042-11ec-8258-f7ffdf5ad45a' // this is just taken from the protocol fixture
- const secondaryPipetteId = 'c235a5a0-0042-11ec-8258-f7ffdf5ad45a'
- const labware = [
- {
- id: 'fixedTrash',
- displayName: 'Trash',
- definitionUri: 'opentrons/opentrons_1_trash_1100ml_fixed/1',
- loadName: 'opentrons_1_trash_1100ml_fixed',
- },
- {
- id:
- '50d3ebb0-0042-11ec-8258-f7ffdf5ad45a:opentrons/opentrons_96_tiprack_300ul/1',
- displayName: 'Opentrons 96 Tip Rack 300 µL',
- definitionUri: 'opentrons/opentrons_96_tiprack_300ul/1',
- loadName: 'opentrons_96_tiprack_300ul',
- },
- {
- id:
- '9fbc1db0-0042-11ec-8258-f7ffdf5ad45a:opentrons/nest_12_reservoir_15ml/1',
- displayName: 'NEST 12 Well Reservoir 15 mL',
- definitionUri: 'opentrons/nest_12_reservoir_15ml/1',
- loadName: 'nest_12_reservoir_15ml',
- },
- {
- id: 'e24818a0-0042-11ec-8258-f7ffdf5ad45a',
- displayName: 'Opentrons 96 Tip Rack 300 µL (1)',
- definitionUri: 'opentrons/opentrons_96_tiprack_300ul/1',
- loadName: 'opentrons_96_tiprack_300ul',
- },
- ]
- const labwareDefinitions = protocolMultipleTipracks.labwareDefinitions
- const modules = protocolMultipleTipracks.modules
- const commands = protocolMultipleTipracks.commands
-
- const tiprackInSlot1Id =
- '50d3ebb0-0042-11ec-8258-f7ffdf5ad45a:opentrons/opentrons_96_tiprack_300ul/1'
- const tiprackInSlot2Id = 'e24818a0-0042-11ec-8258-f7ffdf5ad45a'
- const resevoirId =
- '9fbc1db0-0042-11ec-8258-f7ffdf5ad45a:opentrons/nest_12_reservoir_15ml/1'
-
- const moveToWellSeconaryPipetteSecondTiprack: CreateCommand = {
- commandType: 'moveToWell',
- params: {
- pipetteId: secondaryPipetteId,
- labwareId: tiprackInSlot2Id,
- wellName: 'A1',
- wellLocation: {
- origin: 'top',
- },
- },
- }
-
- const moveToWellPrimaryPipetteFirstTiprack: CreateCommand = {
- commandType: 'moveToWell',
- params: {
- pipetteId: primaryPipetteId,
- labwareId: tiprackInSlot1Id,
- wellName: 'A1',
- wellLocation: {
- origin: 'top',
- },
- },
- }
-
- const pickupTipAtLastTiprackPrimaryPipetteUses: CreateCommand = {
- commandType: 'pickUpTip',
- params: {
- pipetteId: primaryPipetteId,
- labwareId: tiprackInSlot1Id,
- wellName: 'A1',
- },
- }
-
- const moveToWellFirstLabware: CreateCommand = {
- commandType: 'moveToWell',
- params: {
- pipetteId: primaryPipetteId,
- labwareId: resevoirId,
- wellName: 'A1',
- wellLocation: {
- origin: 'top',
- },
- },
- }
-
- const dropTipIntoLastTiprackPrimaryPipetteUses: CreateCommand = {
- commandType: 'dropTip',
- params: {
- pipetteId: primaryPipetteId,
- labwareId: tiprackInSlot1Id,
- wellName: 'A1',
- },
- }
-
- const allSteps: DeprecatedLabwarePositionCheckStep[] = [
- {
- labwareId: tiprackInSlot2Id,
- section: DEPRECATED_SECTIONS.SECONDARY_PIPETTE_TIPRACKS,
- commands: [moveToWellSeconaryPipetteSecondTiprack],
- },
- {
- labwareId: tiprackInSlot1Id,
- section: DEPRECATED_SECTIONS.PRIMARY_PIPETTE_TIPRACKS,
- commands: [moveToWellPrimaryPipetteFirstTiprack],
- },
- {
- labwareId: tiprackInSlot1Id,
- section: DEPRECATED_SECTIONS.PRIMARY_PIPETTE_TIPRACKS,
- commands: [pickupTipAtLastTiprackPrimaryPipetteUses],
- },
- {
- labwareId: resevoirId,
- section:
- DEPRECATED_SECTIONS.CHECK_REMAINING_LABWARE_WITH_PRIMARY_PIPETTE,
- commands: [moveToWellFirstLabware],
- },
- {
- labwareId: tiprackInSlot1Id,
- section: DEPRECATED_SECTIONS.RETURN_TIP,
- commands: [dropTipIntoLastTiprackPrimaryPipetteUses],
- },
- ]
-
- expect(
- getTwoPipettePositionCheckSteps({
- primaryPipetteId,
- secondaryPipetteId,
- // @ts-expect-error
- labware,
- labwareDefinitions,
- modules,
- commands,
- })
- ).toEqual(allSteps)
- })
- it('should move to all tipracks that the secondary pipette uses, move to all tipracks with the primary pipette uses, pick up a tip at the final tiprack that the primary pipette uses, move to all remaining labware (and open TC lid), and drop the tip back in the tiprack that the primary pipette uses', () => {
- const primaryPipetteId = '50d23e00-0042-11ec-8258-f7ffdf5ad45a' // this is just taken from the protocol fixture
- const secondaryPipetteId = 'c235a5a0-0042-11ec-8258-f7ffdf5ad45a'
- const labware = [
- {
- id: 'fixedTrash',
- displayName: 'Trash',
- definitionUri: 'opentrons/opentrons_1_trash_1100ml_fixed/1',
- loadName: 'opentrons_1_trash_1100ml_fixed',
- },
- {
- id:
- '50d3ebb0-0042-11ec-8258-f7ffdf5ad45a:opentrons/opentrons_96_tiprack_300ul/1',
- displayName: 'Opentrons 96 Tip Rack 300 µL',
- definitionUri: 'opentrons/opentrons_96_tiprack_300ul/1',
- loadName: 'opentrons_96_tiprack_300ul',
- },
- {
- id:
- '9fbc1db0-0042-11ec-8258-f7ffdf5ad45a:opentrons/nest_12_reservoir_15ml/1',
- displayName: 'NEST 12 Well Reservoir 15 mL',
- definitionUri: 'opentrons/nest_12_reservoir_15ml/1',
- loadName: 'nest_12_reservoir_15ml',
- },
- {
- id: 'e24818a0-0042-11ec-8258-f7ffdf5ad45a',
- displayName: 'Opentrons 96 Tip Rack 300 µL (1)',
- definitionUri: 'opentrons/opentrons_96_tiprack_300ul/1',
- loadName: 'opentrons_96_tiprack_300ul',
- },
- {
- id:
- '1dc0c050-0122-11ec-88a3-f1745cf9b36c:opentrons/nest_96_wellplate_100ul_pcr_full_skirt/1',
- displayName: 'NEST 96 Well Plate 100 µL PCR Full Skirt',
- definitionUri: 'opentrons/nest_96_wellplate_100ul_pcr_full_skirt/1',
- loadName: 'nest_96_wellplate_100ul_pcr_full_skirt',
- },
- ]
- const labwareDefinitions = protocolWithTC.labwareDefinitions
- const modules = protocolWithTC.modules
- const commands = protocolWithTC.commands
-
- const TCId = '18f0c1b0-0122-11ec-88a3-f1745cf9b36c:thermocyclerModuleType'
- const tiprackInSlot1Id =
- '50d3ebb0-0042-11ec-8258-f7ffdf5ad45a:opentrons/opentrons_96_tiprack_300ul/1'
- const tiprackInSlot2Id = 'e24818a0-0042-11ec-8258-f7ffdf5ad45a'
- const resevoirId =
- '9fbc1db0-0042-11ec-8258-f7ffdf5ad45a:opentrons/nest_12_reservoir_15ml/1'
- const TCWellPlateId =
- '1dc0c050-0122-11ec-88a3-f1745cf9b36c:opentrons/nest_96_wellplate_100ul_pcr_full_skirt/1'
-
- const moveToWellSeconaryPipetteSecondTiprack: CreateCommand = {
- commandType: 'moveToWell',
- params: {
- pipetteId: secondaryPipetteId,
- labwareId: tiprackInSlot2Id,
- wellName: 'A1',
- wellLocation: {
- origin: 'top',
- },
- },
- }
-
- const moveToWellPrimaryPipetteFirstTiprack: CreateCommand = {
- commandType: 'moveToWell',
- params: {
- pipetteId: primaryPipetteId,
- labwareId: tiprackInSlot1Id,
- wellName: 'A1',
- wellLocation: {
- origin: 'top',
- },
- },
- }
-
- const pickupTipAtLastTiprackPrimaryPipetteUses: CreateCommand = {
- commandType: 'pickUpTip',
- params: {
- pipetteId: primaryPipetteId,
- labwareId: tiprackInSlot1Id,
- wellName: 'A1',
- },
- }
-
- const moveToWellFirstLabware: CreateCommand = {
- commandType: 'moveToWell',
- params: {
- pipetteId: primaryPipetteId,
- labwareId: resevoirId,
- wellName: 'A1',
- wellLocation: {
- origin: 'top',
- },
- },
- }
-
- const openTCLidCommand: CreateCommand = {
- commandType: 'thermocycler/openLid',
- params: {
- moduleId: TCId,
- },
- }
-
- const moveToWellAfterOpeningTCLidCommand: CreateCommand = {
- commandType: 'moveToWell',
- params: {
- pipetteId: primaryPipetteId,
- labwareId: TCWellPlateId,
- wellName: 'A1',
- wellLocation: {
- origin: 'top',
- },
- },
- }
-
- const dropTipIntoLastTiprackPrimaryPipetteUses: CreateCommand = {
- commandType: 'dropTip',
- params: {
- pipetteId: primaryPipetteId,
- labwareId: tiprackInSlot1Id,
- wellName: 'A1',
- },
- }
-
- const allSteps: DeprecatedLabwarePositionCheckStep[] = [
- {
- labwareId: tiprackInSlot2Id,
- section: DEPRECATED_SECTIONS.SECONDARY_PIPETTE_TIPRACKS,
- commands: [moveToWellSeconaryPipetteSecondTiprack],
- },
- {
- labwareId: tiprackInSlot1Id,
- section: DEPRECATED_SECTIONS.PRIMARY_PIPETTE_TIPRACKS,
- commands: [moveToWellPrimaryPipetteFirstTiprack],
- },
- {
- labwareId: tiprackInSlot1Id,
- section: DEPRECATED_SECTIONS.PRIMARY_PIPETTE_TIPRACKS,
- commands: [pickupTipAtLastTiprackPrimaryPipetteUses],
- },
- {
- labwareId: resevoirId,
- section:
- DEPRECATED_SECTIONS.CHECK_REMAINING_LABWARE_WITH_PRIMARY_PIPETTE,
- commands: [moveToWellFirstLabware],
- },
- {
- labwareId: TCWellPlateId,
- section:
- DEPRECATED_SECTIONS.CHECK_REMAINING_LABWARE_WITH_PRIMARY_PIPETTE,
- commands: [openTCLidCommand, moveToWellAfterOpeningTCLidCommand],
- },
- {
- labwareId: tiprackInSlot1Id,
- section: DEPRECATED_SECTIONS.RETURN_TIP,
- commands: [dropTipIntoLastTiprackPrimaryPipetteUses],
- },
- ]
-
- expect(
- getTwoPipettePositionCheckSteps({
- primaryPipetteId,
- secondaryPipetteId,
- // @ts-expect-error
- labware,
- labwareDefinitions,
- modules,
- commands,
- })
- ).toEqual(allSteps)
- })
-})
diff --git a/app/src/organisms/LabwarePositionCheck/deprecatedUtils/deprecatedGetLabwarePositionCheckSteps.ts b/app/src/organisms/LabwarePositionCheck/deprecatedUtils/deprecatedGetLabwarePositionCheckSteps.ts
deleted file mode 100644
index 159efb23be8..00000000000
--- a/app/src/organisms/LabwarePositionCheck/deprecatedUtils/deprecatedGetLabwarePositionCheckSteps.ts
+++ /dev/null
@@ -1,79 +0,0 @@
-import { deprecatedGetPrimaryPipetteId } from './deprecatedGetPrimaryPipetteId'
-import { getPipetteWorkflow } from './getPipetteWorkflow'
-import { getOnePipettePositionCheckSteps } from './getOnePipettePositionCheckSteps'
-import { getTwoPipettePositionCheckSteps } from './getTwoPipettePositionCheckSteps'
-import type {
- RunTimeCommand,
- ProtocolAnalysisFile,
-} from '@opentrons/shared-data/protocol/types/schemaV6'
-import type {
- LegacySchemaAdapterOutput,
- LoadedPipette,
-} from '@opentrons/shared-data'
-import type { DeprecatedLabwarePositionCheckStep } from '../types'
-
-export const deprecatedGetLabwarePositionCheckSteps = (
- protocolData: LegacySchemaAdapterOutput
-): DeprecatedLabwarePositionCheckStep[] => {
- if (protocolData != null && 'pipettes' in protocolData) {
- // filter out any pipettes that are not being used in the protocol
- const pipettes: LoadedPipette[] = protocolData.pipettes.filter(pipette =>
- protocolData.commands.some(
- command =>
- command.commandType === 'pickUpTip' &&
- command.params.pipetteId === pipette.id
- )
- )
- const pipetteNames = pipettes.map(({ pipetteName }) => pipetteName)
-
- const labware = protocolData.labware.filter(
- labware =>
- !protocolData.labwareDefinitions[labware.definitionUri]?.parameters
- .isTiprack ||
- (protocolData.labwareDefinitions[labware.definitionUri]?.parameters
- .isTiprack &&
- protocolData.commands.some(
- command =>
- command.commandType === 'pickUpTip' &&
- command.params.labwareId === labware.id
- ))
- )
-
- const modules: ProtocolAnalysisFile['modules'] = protocolData.modules
- const labwareDefinitions = protocolData.labwareDefinitions
- const commands: RunTimeCommand[] = protocolData.commands
- const primaryPipetteId = deprecatedGetPrimaryPipetteId(pipettes, commands)
- const pipetteWorkflow = getPipetteWorkflow({
- pipetteNames,
- primaryPipetteId,
- labware,
- labwareDefinitions,
- commands,
- })
-
- if (pipetteWorkflow === 1) {
- return getOnePipettePositionCheckSteps({
- primaryPipetteId,
- labware,
- labwareDefinitions,
- modules,
- commands,
- })
- } else {
- const secondaryPipetteId = pipettes.find(
- pipette => pipette.id !== primaryPipetteId
- )?.id as string
-
- return getTwoPipettePositionCheckSteps({
- primaryPipetteId,
- secondaryPipetteId,
- labware,
- labwareDefinitions,
- modules,
- commands,
- })
- }
- }
- console.error('expected pipettes to be in protocol data')
- return []
-}
diff --git a/app/src/organisms/LabwarePositionCheck/deprecatedUtils/deprecatedGetPrimaryPipetteId.ts b/app/src/organisms/LabwarePositionCheck/deprecatedUtils/deprecatedGetPrimaryPipetteId.ts
deleted file mode 100644
index 383710f07d4..00000000000
--- a/app/src/organisms/LabwarePositionCheck/deprecatedUtils/deprecatedGetPrimaryPipetteId.ts
+++ /dev/null
@@ -1,74 +0,0 @@
-import { getPipetteNameSpecs } from '@opentrons/shared-data'
-import type { RunTimeCommand } from '@opentrons/shared-data/protocol'
-import type { LoadedPipette } from '@opentrons/shared-data'
-import { LoadPipetteRunTimeCommand } from '@opentrons/shared-data/protocol/types/schemaV6/command/setup'
-
-export const deprecatedGetPrimaryPipetteId = (
- pipettes: LoadedPipette[],
- commands: RunTimeCommand[]
-): string => {
- if (pipettes.length === 1) {
- return pipettes[0].id
- }
-
- const leftPipetteId = commands.find(
- (command: RunTimeCommand): command is LoadPipetteRunTimeCommand =>
- command.commandType === 'loadPipette' && command.params.mount === 'left'
- )?.result?.pipetteId
- const rightPipetteId = commands.find(
- (command: RunTimeCommand): command is LoadPipetteRunTimeCommand =>
- command.commandType === 'loadPipette' && command.params.mount === 'right'
- )?.result?.pipetteId
-
- if (leftPipetteId == null || rightPipetteId == null) {
- throw new Error(
- 'expected to find both left pipette and right pipette but could not'
- )
- }
-
- const leftPipette = pipettes.find(pipette => pipette.id === leftPipetteId)
- const rightPipette = pipettes.find(pipette => pipette.id === rightPipetteId)
-
- const leftPipetteSpecs =
- leftPipette != null ? getPipetteNameSpecs(leftPipette.pipetteName) : null
- const rightPipetteSpecs =
- rightPipette != null ? getPipetteNameSpecs(rightPipette.pipetteName) : null
-
- if (leftPipetteSpecs == null) {
- throw new Error(
- `could not find pipette specs for ${
- leftPipette != null ? leftPipette.pipetteName : 'left pipette'
- }`
- )
- }
- if (rightPipetteSpecs == null) {
- throw new Error(
- `could not find pipette specs for ${
- rightPipette != null ? rightPipette.pipetteName : 'right pipette'
- }`
- )
- }
-
- // prefer pipettes with fewer channels
- if (leftPipetteSpecs.channels !== rightPipetteSpecs.channels) {
- return leftPipetteSpecs.channels < rightPipetteSpecs.channels
- ? leftPipetteId
- : rightPipetteId
- }
- // prefer pipettes with smaller maxVolume
- if (leftPipetteSpecs.maxVolume !== rightPipetteSpecs.maxVolume) {
- return leftPipetteSpecs.maxVolume < rightPipetteSpecs.maxVolume
- ? leftPipetteId
- : rightPipetteId
- }
-
- const leftPipetteGenerationCompare = leftPipetteSpecs.displayCategory.localeCompare(
- rightPipetteSpecs.displayCategory
- )
- // prefer new pipette models
- if (leftPipetteGenerationCompare !== 0) {
- return leftPipetteGenerationCompare > 0 ? leftPipetteId : rightPipetteId
- }
- // if all else is the same, prefer the left pipette
- return leftPipetteId
-}
diff --git a/app/src/organisms/LabwarePositionCheck/deprecatedUtils/deprecatedLabware.ts b/app/src/organisms/LabwarePositionCheck/deprecatedUtils/deprecatedLabware.ts
deleted file mode 100644
index d9a74393e6f..00000000000
--- a/app/src/organisms/LabwarePositionCheck/deprecatedUtils/deprecatedLabware.ts
+++ /dev/null
@@ -1,174 +0,0 @@
-import {
- getIsTiprack,
- getTiprackVolume,
- ProtocolFile,
- LabwareDefinition2,
- getSlotHasMatingSurfaceUnitVector,
- LoadedLabware,
-} from '@opentrons/shared-data'
-import standardDeckDef from '@opentrons/shared-data/deck/definitions/3/ot2_standard.json'
-import type { PickUpTipRunTimeCommand } from '@opentrons/shared-data/protocol/types/schemaV6/command/pipetting'
-import type { RunTimeCommand } from '@opentrons/shared-data/protocol/types/schemaV6'
-import type { LabwareToOrder } from '../types'
-import { getLabwareLocation } from '../../Devices/ProtocolRun/utils/getLabwareLocation'
-import { getModuleInitialLoadInfo } from '../../Devices/ProtocolRun/utils/getModuleInitialLoadInfo'
-
-export const tipRackOrderSort = (
- tiprack1: LabwareToOrder,
- tiprack2: LabwareToOrder
-): -1 | 1 => {
- const tiprack1Volume = getTiprackVolume(tiprack1.definition)
- const tiprack2Volume = getTiprackVolume(tiprack2.definition)
-
- if (tiprack1Volume !== tiprack2Volume) {
- return tiprack1Volume > tiprack2Volume ? -1 : 1
- }
- return orderBySlot(tiprack1, tiprack2)
-}
-
-export const orderBySlot = (
- labware1: LabwareToOrder,
- labware2: LabwareToOrder
-): -1 | 1 => {
- if (labware1.slot < labware2.slot) {
- return -1
- }
- return 1
-}
-
-export const getTiprackIdsInOrder = (
- labware: LoadedLabware[],
- labwareDefinitions: Record,
- commands: RunTimeCommand[]
-): string[] => {
- const unorderedTipracks = labware.reduce(
- (tipracks, currentLabware) => {
- const labwareDef = labwareDefinitions[currentLabware.definitionUri]
- const isTiprack = getIsTiprack(labwareDef)
- if (isTiprack) {
- const labwareLocation = getLabwareLocation(currentLabware.id, commands)
- if (labwareLocation === 'offDeck' || !('slotName' in labwareLocation)) {
- throw new Error('expected tiprack location to be a slot')
- }
-
- return [
- ...tipracks,
- {
- definition: labwareDef,
- labwareId: currentLabware.id,
- slot: labwareLocation.slotName,
- },
- ]
- }
- return [...tipracks]
- },
- []
- )
- const orderedTiprackIds = unorderedTipracks
- .sort(tipRackOrderSort)
- .map(({ labwareId }) => labwareId)
-
- return orderedTiprackIds
-}
-
-export const getAllTipracksIdsThatPipetteUsesInOrder = (
- pipetteId: string,
- commands: RunTimeCommand[],
- labware: LoadedLabware[],
- labwareDefinitions: Record
-): string[] => {
- const pickUpTipCommandsWithPipette: PickUpTipRunTimeCommand[] = commands
- .filter(
- (command): command is PickUpTipRunTimeCommand =>
- command.commandType === 'pickUpTip'
- )
- .filter(command => command.params.pipetteId === pipetteId)
-
- const tipracksVisited = pickUpTipCommandsWithPipette.reduce(
- (visited, command) => {
- const tiprack = command.params.labwareId
- return visited.includes(tiprack) ? visited : [...visited, tiprack]
- },
- []
- )
-
- const orderedTiprackIds = tipracksVisited
- .map(tiprackId => {
- const matchingLabware = labware.find(
- labwareItem => labwareItem.id === tiprackId
- )
- const labwareDefUri = matchingLabware?.definitionUri ?? ''
- const definition = labwareDefinitions[labwareDefUri]
- const tiprackLocation = getLabwareLocation(tiprackId, commands)
- if (tiprackLocation === 'offDeck' || !('slotName' in tiprackLocation)) {
- throw new Error('expected tiprack location to be a slot')
- }
- return {
- labwareId: tiprackId,
- definition,
- slot: tiprackLocation.slotName,
- }
- })
- .sort(tipRackOrderSort)
- .map(({ labwareId }) => labwareId)
-
- return orderedTiprackIds
-}
-
-export const getLabwareIdsInOrder = (
- labware: LoadedLabware[],
- labwareDefinitions: Record,
- modules: ProtocolFile<{}>['modules'],
- commands: RunTimeCommand[]
-): string[] => {
- const unorderedLabware = labware.reduce(
- (unorderedLabware, currentLabware) => {
- const labwareDef = labwareDefinitions[currentLabware.definitionUri]
- const isTiprack = getIsTiprack(labwareDef)
- const labwareLocation = getLabwareLocation(currentLabware.id, commands)
- // skip any labware that is not a tiprack
- if (!isTiprack) {
- if (labwareLocation !== 'offDeck' && 'moduleId' in labwareLocation) {
- return [
- ...unorderedLabware,
- {
- definition: labwareDef,
- labwareId: currentLabware.id,
- slot: getModuleInitialLoadInfo(labwareLocation.moduleId, commands)
- .location.slotName,
- },
- ]
- } else {
- // if we're in a slot where we can't have labware, don't include the definition (i.e. the trash bin)
- if (
- labwareLocation !== 'offDeck' &&
- !getSlotHasMatingSurfaceUnitVector(
- standardDeckDef as any,
- labwareLocation.slotName.toString()
- )
- ) {
- return [...unorderedLabware]
- }
- }
- return [
- ...unorderedLabware,
- {
- definition: labwareDef,
- labwareId: currentLabware.id,
- slot:
- labwareLocation === 'offDeck'
- ? 'offDeck'
- : labwareLocation.slotName,
- },
- ]
- }
- return [...unorderedLabware]
- },
- []
- )
- const orderedLabwareIds = unorderedLabware
- .sort(orderBySlot)
- .map(({ labwareId }) => labwareId)
-
- return orderedLabwareIds
-}
diff --git a/app/src/organisms/LabwarePositionCheck/deprecatedUtils/deprecatedStepCreators.ts b/app/src/organisms/LabwarePositionCheck/deprecatedUtils/deprecatedStepCreators.ts
deleted file mode 100644
index edee4c41d84..00000000000
--- a/app/src/organisms/LabwarePositionCheck/deprecatedUtils/deprecatedStepCreators.ts
+++ /dev/null
@@ -1,181 +0,0 @@
-import {
- getModuleType,
- ProtocolFile,
- RunTimeCommand,
- HEATERSHAKER_MODULE_TYPE,
- THERMOCYCLER_MODULE_TYPE,
- LoadedLabware,
-} from '@opentrons/shared-data'
-import { getLabwareLocation } from '../../Devices/ProtocolRun/utils/getLabwareLocation'
-import type {
- LabwarePositionCheckCreateCommand,
- DeprecatedLabwarePositionCheckStep,
- DeprecatedSection,
-} from '../types'
-import type {
- TCOpenLidCreateCommand,
- HeaterShakerDeactivateShakerCreateCommand,
- HeaterShakerCloseLatchCreateCommand,
-} from '@opentrons/shared-data/protocol/types/schemaV6/command/module'
-import type { MoveToWellCreateCommand } from '@opentrons/shared-data/protocol/types/schemaV6/command/gantry'
-
-const getIsLabwareOnTopOfTC = (
- modules: ProtocolFile<{}>['modules'],
- labwareId: string,
- commands: RunTimeCommand[]
-): boolean => {
- const labwareLocation = getLabwareLocation(labwareId, commands)
- return (
- labwareLocation !== 'offDeck' &&
- 'moduleId' in labwareLocation &&
- getModuleType(modules[labwareLocation.moduleId].model) ===
- THERMOCYCLER_MODULE_TYPE
- )
-}
-
-const getIsLabwareOnTopOfHS = (
- modules: ProtocolFile<{}>['modules'],
- labwareId: string,
- commands: RunTimeCommand[]
-): boolean => {
- const labwareLocation = getLabwareLocation(labwareId, commands)
- return (
- labwareLocation !== 'offDeck' &&
- 'moduleId' in labwareLocation &&
- getModuleType(modules[labwareLocation.moduleId].model) ===
- HEATERSHAKER_MODULE_TYPE
- )
-}
-
-export const getMoveToTiprackSteps = (
- labwareIds: string[],
- pipetteId: string,
- section: DeprecatedSection
-): DeprecatedLabwarePositionCheckStep[] =>
- labwareIds.map(labwareId => {
- const commands = [
- {
- commandType: 'moveToWell' as const,
- params: {
- pipetteId: pipetteId,
- labwareId: labwareId,
- wellName: 'A1',
- wellLocation: { origin: 'top' as const },
- },
- },
- ]
-
- return { section, commands, labwareId }
- })
-
-export const getMoveToLabwareSteps = (
- labware: LoadedLabware[],
- modules: ProtocolFile<{}>['modules'],
- labwareIds: string[],
- pipetteId: string,
- section: DeprecatedSection,
- commands: RunTimeCommand[]
-): DeprecatedLabwarePositionCheckStep[] =>
- labwareIds.map(labwareId => {
- const moveToWellCommand: MoveToWellCreateCommand = {
- commandType: 'moveToWell' as const,
- params: {
- pipetteId: pipetteId,
- labwareId: labwareId,
- wellName: 'A1',
- wellLocation: { origin: 'top' as const },
- },
- }
-
- const isLabwareOnTopOfTC = getIsLabwareOnTopOfTC(
- modules,
- labwareId,
- commands
- )
-
- const isLabwareOnTopOfHS = getIsLabwareOnTopOfHS(
- modules,
- labwareId,
- commands
- )
- // change this to a create command
- let moveToLabwareCommands: LabwarePositionCheckCreateCommand[] = []
-
- if (isLabwareOnTopOfTC) {
- // @ts-expect-error moduleId will exist from type narrowing
- const moduleId = getLabwareLocation(labwareId, commands).moduleId
- const openTCLidCommand: TCOpenLidCreateCommand = {
- commandType: 'thermocycler/openLid',
- params: {
- moduleId,
- },
- }
- moveToLabwareCommands = [openTCLidCommand, moveToWellCommand]
- } else if (isLabwareOnTopOfHS) {
- // @ts-expect-error moduleId will exist from type narrowing
- const moduleId = getLabwareLocation(labwareId, commands).moduleId
- const closeLatchCommand: HeaterShakerCloseLatchCreateCommand = {
- commandType: 'heaterShaker/closeLabwareLatch',
- params: {
- moduleId,
- },
- }
- const stopShakingCommand: HeaterShakerDeactivateShakerCreateCommand = {
- commandType: 'heaterShaker/deactivateShaker',
- params: {
- moduleId,
- },
- }
- moveToLabwareCommands = [
- closeLatchCommand,
- stopShakingCommand,
- moveToWellCommand,
- ]
- } else {
- moveToLabwareCommands = [moveToWellCommand]
- }
-
- return {
- section,
- labwareId,
- commands: moveToLabwareCommands,
- }
- })
-
-export const getPickupTipStep = (
- tiprackId: string,
- pipetteId: string,
- section: DeprecatedSection
-): DeprecatedLabwarePositionCheckStep => ({
- labwareId: tiprackId,
- section,
- commands: [
- {
- commandType: 'pickUpTip',
- params: {
- pipetteId,
- labwareId: tiprackId,
- wellName: 'A1',
- },
- },
- ],
-})
-
-export const getDropTipStep = (
- tiprackId: string,
- pipetteId: string,
- section: DeprecatedSection
-): DeprecatedLabwarePositionCheckStep => ({
- labwareId: tiprackId,
- section,
- commands: [
- {
- commandType: 'dropTip',
- params: {
- pipetteId: pipetteId,
- labwareId: tiprackId,
- wellName: 'A1',
- },
- },
- ],
-})
diff --git a/app/src/organisms/LabwarePositionCheck/deprecatedUtils/getLatestLabwareOffsetCount.ts b/app/src/organisms/LabwarePositionCheck/deprecatedUtils/getLatestLabwareOffsetCount.ts
deleted file mode 100644
index 5820f0e1533..00000000000
--- a/app/src/organisms/LabwarePositionCheck/deprecatedUtils/getLatestLabwareOffsetCount.ts
+++ /dev/null
@@ -1,48 +0,0 @@
-import isEqual from 'lodash/isEqual'
-import uniqBy from 'lodash/uniqBy'
-import { IDENTITY_VECTOR } from '@opentrons/shared-data'
-import type { LabwareOffset } from '@opentrons/api-client'
-const TRASH_LOCATION = { slotName: '12' }
-
-// this util counts all "relevant" labware offsets that a user would care about
-// i.e. filters out all identity offsets that are applied at the beginning of
-// LPC, previous labware offsets that are no longer relevant, and offsets that
-// were applied to the trash
-export const getLatestLabwareOffsetCount = (
- labwareOffsets: LabwareOffset[]
-): number => {
- // labware offsets are in order of creation, we want to use the most recent ones
- const orderedLabwareOffsets = labwareOffsets
- .slice()
- // @ts-expect-error sort allows subtraction of dates
- .sort((a, b) => new Date(b.createdAt) - new Date(a.createdAt))
-
- const filteredLabwareOffsets = uniqBy(
- orderedLabwareOffsets,
- (offset: LabwareOffset) => {
- const location = offset.location
- const definitionUri = offset.definitionUri
- const locationKey =
- location.moduleModel != null
- ? `${location.moduleModel}_${location.slotName}`
- : location.slotName
- // key by definition uri AND location, because labware offsets are tied to a combo of both of these attributes
- return `${definitionUri}_${locationKey}`
- }
- )
-
- const uniqueOffsetCount = filteredLabwareOffsets.reduce(
- (acc: number, offset: LabwareOffset) => {
- const vector = offset.vector
- if (
- !isEqual(location, TRASH_LOCATION) &&
- !isEqual(vector, IDENTITY_VECTOR)
- ) {
- return acc + 1
- }
- return acc
- },
- 0
- )
- return uniqueOffsetCount
-}
diff --git a/app/src/organisms/LabwarePositionCheck/deprecatedUtils/getOnePipettePositionCheckSteps.ts b/app/src/organisms/LabwarePositionCheck/deprecatedUtils/getOnePipettePositionCheckSteps.ts
deleted file mode 100644
index c3670ed7a63..00000000000
--- a/app/src/organisms/LabwarePositionCheck/deprecatedUtils/getOnePipettePositionCheckSteps.ts
+++ /dev/null
@@ -1,76 +0,0 @@
-import { DEPRECATED_SECTIONS } from '../constants'
-import { getLabwareIdsInOrder, getTiprackIdsInOrder } from './deprecatedLabware'
-import {
- getMoveToTiprackSteps,
- getPickupTipStep,
- getMoveToLabwareSteps,
- getDropTipStep,
-} from './deprecatedStepCreators'
-import type {
- ProtocolFile,
- LabwareDefinition2,
- LoadedLabware,
- RunTimeCommand,
-} from '@opentrons/shared-data'
-import type { DeprecatedLabwarePositionCheckStep } from '../types'
-
-export const getOnePipettePositionCheckSteps = (args: {
- primaryPipetteId: string
- labware: LoadedLabware[]
- labwareDefinitions: Record
- modules: ProtocolFile<{}>['modules']
- commands: RunTimeCommand[]
-}): DeprecatedLabwarePositionCheckStep[] => {
- const {
- commands,
- primaryPipetteId,
- labware,
- labwareDefinitions,
- modules,
- } = args
-
- const orderedTiprackIds = getTiprackIdsInOrder(
- labware,
- labwareDefinitions,
- commands
- )
- const orderedLabwareIds = getLabwareIdsInOrder(
- labware,
- labwareDefinitions,
- modules,
- commands
- )
- const moveToTiprackSteps = getMoveToTiprackSteps(
- orderedTiprackIds,
- primaryPipetteId,
- DEPRECATED_SECTIONS.PRIMARY_PIPETTE_TIPRACKS
- )
-
- const lastTiprackId = orderedTiprackIds[orderedTiprackIds.length - 1]
- const pickupTipFromLastTiprackStep = getPickupTipStep(
- lastTiprackId,
- primaryPipetteId,
- DEPRECATED_SECTIONS.PRIMARY_PIPETTE_TIPRACKS
- )
- const moveToRemainingLabwareSteps = getMoveToLabwareSteps(
- labware,
- modules,
- orderedLabwareIds,
- primaryPipetteId,
- DEPRECATED_SECTIONS.CHECK_REMAINING_LABWARE_WITH_PRIMARY_PIPETTE,
- commands
- )
-
- const dropTipInLastTiprackStep = getDropTipStep(
- lastTiprackId,
- primaryPipetteId,
- DEPRECATED_SECTIONS.RETURN_TIP
- )
-
- return [
- ...moveToTiprackSteps,
- pickupTipFromLastTiprackStep,
- ...moveToRemainingLabwareSteps,
- dropTipInLastTiprackStep,
- ]
-}
diff --git a/app/src/organisms/LabwarePositionCheck/deprecatedUtils/getPipetteWorkflow.ts b/app/src/organisms/LabwarePositionCheck/deprecatedUtils/getPipetteWorkflow.ts
deleted file mode 100644
index 80f706f5f42..00000000000
--- a/app/src/organisms/LabwarePositionCheck/deprecatedUtils/getPipetteWorkflow.ts
+++ /dev/null
@@ -1,42 +0,0 @@
-import uniq from 'lodash/uniq'
-import { doesPipetteVisitAllTipracks } from '../utils/doesPipetteVisitAllTipracks'
-import type {
- LabwareDefinition2,
- PipetteName,
- LoadedLabware,
-} from '@opentrons/shared-data'
-import type { RunTimeCommand } from '@opentrons/shared-data/protocol/types/schemaV6'
-
-export const getPipetteWorkflow = (args: {
- pipetteNames: PipetteName[]
- primaryPipetteId: string
- labware: LoadedLabware[]
- labwareDefinitions: Record
- commands: RunTimeCommand[]
-}): 1 | 2 => {
- const {
- pipetteNames,
- primaryPipetteId,
- labware,
- labwareDefinitions,
- commands,
- } = args
-
- const uniquePipetteNames = uniq(pipetteNames)
- if (uniquePipetteNames.length === 1) {
- return 1
- }
-
- if (
- doesPipetteVisitAllTipracks(
- primaryPipetteId,
- labware,
- labwareDefinitions,
- commands
- )
- ) {
- return 1
- }
-
- return 2
-}
diff --git a/app/src/organisms/LabwarePositionCheck/deprecatedUtils/getTwoPipettePositionCheckSteps.ts b/app/src/organisms/LabwarePositionCheck/deprecatedUtils/getTwoPipettePositionCheckSteps.ts
deleted file mode 100644
index 173ca514c0d..00000000000
--- a/app/src/organisms/LabwarePositionCheck/deprecatedUtils/getTwoPipettePositionCheckSteps.ts
+++ /dev/null
@@ -1,111 +0,0 @@
-import { DEPRECATED_SECTIONS } from '../constants'
-import {
- getLabwareIdsInOrder,
- getAllTipracksIdsThatPipetteUsesInOrder,
-} from './deprecatedLabware'
-import {
- getMoveToTiprackSteps,
- getPickupTipStep,
- getMoveToLabwareSteps,
- getDropTipStep,
-} from './deprecatedStepCreators'
-import type {
- ProtocolFile,
- LabwareDefinition2,
- LoadedLabware,
-} from '@opentrons/shared-data'
-import type { RunTimeCommand } from '@opentrons/shared-data/protocol/types/schemaV6'
-import type { DeprecatedLabwarePositionCheckStep } from '../types'
-
-export const getTwoPipettePositionCheckSteps = (args: {
- primaryPipetteId: string
- secondaryPipetteId: string
- labware: LoadedLabware[]
- labwareDefinitions: Record
- modules: ProtocolFile<{}>['modules']
- commands: RunTimeCommand[]
-}): DeprecatedLabwarePositionCheckStep[] => {
- const {
- primaryPipetteId,
- secondaryPipetteId,
- labware,
- labwareDefinitions,
- modules,
- commands,
- } = args
- const orderedTiprackIdsThatSecondaryPipetteUses = getAllTipracksIdsThatPipetteUsesInOrder(
- secondaryPipetteId,
- commands,
- labware,
- labwareDefinitions
- )
-
- const orderedTiprackIdsThatPrimaryPipetteUses = getAllTipracksIdsThatPipetteUsesInOrder(
- primaryPipetteId,
- commands,
- labware,
- labwareDefinitions
- )
-
- const orderedTiprackIdsThatOnlySecondaryPipetteUses = orderedTiprackIdsThatSecondaryPipetteUses.filter(
- tiprackId => !orderedTiprackIdsThatPrimaryPipetteUses.includes(tiprackId)
- )
-
- const remainingTiprackIdsThatPrimaryPipetteUses = orderedTiprackIdsThatPrimaryPipetteUses.filter(
- tiprackId =>
- !orderedTiprackIdsThatOnlySecondaryPipetteUses.includes(tiprackId)
- )
-
- const orderedLabwareIds = getLabwareIdsInOrder(
- labware,
- labwareDefinitions,
- modules,
- commands
- )
-
- const moveSecondaryPipetteToTiprackSteps = getMoveToTiprackSteps(
- orderedTiprackIdsThatOnlySecondaryPipetteUses,
- secondaryPipetteId,
- DEPRECATED_SECTIONS.SECONDARY_PIPETTE_TIPRACKS
- )
-
- const movePrimaryPipetteToTiprackSteps = getMoveToTiprackSteps(
- remainingTiprackIdsThatPrimaryPipetteUses,
- primaryPipetteId,
- DEPRECATED_SECTIONS.PRIMARY_PIPETTE_TIPRACKS
- )
-
- const lastTiprackId =
- remainingTiprackIdsThatPrimaryPipetteUses[
- remainingTiprackIdsThatPrimaryPipetteUses.length - 1
- ]
-
- const pickupTipFromLastTiprackStep = getPickupTipStep(
- lastTiprackId,
- primaryPipetteId,
- DEPRECATED_SECTIONS.PRIMARY_PIPETTE_TIPRACKS
- )
-
- const moveToRemainingLabwareSteps = getMoveToLabwareSteps(
- labware,
- modules,
- orderedLabwareIds,
- primaryPipetteId,
- DEPRECATED_SECTIONS.CHECK_REMAINING_LABWARE_WITH_PRIMARY_PIPETTE,
- commands
- )
-
- const dropTipInLastTiprackStep = getDropTipStep(
- lastTiprackId,
- primaryPipetteId,
- DEPRECATED_SECTIONS.RETURN_TIP
- )
-
- return [
- ...moveSecondaryPipetteToTiprackSteps,
- ...movePrimaryPipetteToTiprackSteps,
- pickupTipFromLastTiprackStep,
- ...moveToRemainingLabwareSteps,
- dropTipInLastTiprackStep,
- ]
-}
diff --git a/app/src/organisms/LabwarePositionCheck/index.tsx b/app/src/organisms/LabwarePositionCheck/index.tsx
index ef46aef286c..6a2dd830f4d 100644
--- a/app/src/organisms/LabwarePositionCheck/index.tsx
+++ b/app/src/organisms/LabwarePositionCheck/index.tsx
@@ -4,9 +4,7 @@ import { AlertModal, Box, SPACING_2, Text } from '@opentrons/components'
import { useRunQuery } from '@opentrons/react-api-client'
import { Portal } from '../../App/portal'
import { useLogger } from '../../logger'
-import { useFeatureFlag } from '../../redux/config'
import { LabwarePositionCheckComponent } from './LabwarePositionCheckComponent'
-import { DeprecatedLabwarePositionCheckComponent } from './DeprecatedComponents/DeprecatedLabwarePositionCheckComponent'
import { useMostRecentCompletedAnalysis } from './useMostRecentCompletedAnalysis'
interface LabwarePositionCheckModalProps {
@@ -23,9 +21,6 @@ export const LabwarePositionCheck = (
props: LabwarePositionCheckModalProps
): JSX.Element => {
const logger = useLogger(__filename)
- const manualDeckStateModificationEnabled = useFeatureFlag(
- 'enableManualDeckStateModification'
- )
const mostRecentAnalysis = useMostRecentCompletedAnalysis(props.runId)
@@ -34,14 +29,10 @@ export const LabwarePositionCheck = (
return (
- {manualDeckStateModificationEnabled ? (
-
- ) : (
-
- )}
+
)
}
diff --git a/app/src/organisms/LabwarePositionCheck/types.ts b/app/src/organisms/LabwarePositionCheck/types.ts
index da5841c1fcf..35c87a52b69 100644
--- a/app/src/organisms/LabwarePositionCheck/types.ts
+++ b/app/src/organisms/LabwarePositionCheck/types.ts
@@ -1,46 +1,7 @@
-import { DEPRECATED_SECTIONS, SECTIONS } from './constants'
+import { SECTIONS } from './constants'
import { useCreateCommandMutation } from '@opentrons/react-api-client'
-import type { LabwareDefinition2 } from '@opentrons/shared-data'
-import type { MoveToWellCreateCommand } from '@opentrons/shared-data/protocol/types/schemaV6/command/gantry'
-import type {
- HeaterShakerCloseLatchCreateCommand,
- HeaterShakerDeactivateShakerCreateCommand,
- TCOpenLidCreateCommand,
-} from '@opentrons/shared-data/protocol/types/schemaV6/command/module'
-import type {
- DropTipCreateCommand,
- PickUpTipCreateCommand,
-} from '@opentrons/shared-data/protocol/types/schemaV6/command/pipetting'
import type { LabwareOffsetLocation, VectorOffset } from '@opentrons/api-client'
-
-/* START DEPRECATED TYPES */
-export type DeprecatedSection = keyof typeof DEPRECATED_SECTIONS
-export interface DeprecatedLabwarePositionCheckStep {
- labwareId: string
- section: DeprecatedSection
- commands: LabwarePositionCheckCreateCommand[]
-}
-export type LabwarePositionCheckCreateCommand =
- | MoveToWellCreateCommand
- | PickUpTipCreateCommand
- | DropTipCreateCommand
- | TCOpenLidCreateCommand
- | HeaterShakerDeactivateShakerCreateCommand
- | HeaterShakerCloseLatchCreateCommand
-// LabwarePositionCheckMovementCommand is used to distinguish commands that have pipette + labware ids
-export type LabwarePositionCheckMovementCommand =
- | MoveToWellCreateCommand
- | PickUpTipCreateCommand
- | DropTipCreateCommand
-export interface LabwareToOrder {
- definition: LabwareDefinition2
- labwareId: string
- slot: string
-}
-export interface SavePositionCommandData {
- [labwareId: string]: string[]
-}
-/* END DEPRECATED TYPES */
+import type { LabwareDefinition2 } from '@opentrons/shared-data'
export type LabwarePositionCheckStep =
| BeforeBeginningStep
@@ -115,3 +76,9 @@ export interface WorkingOffset {
initialPosition: VectorOffset | null
finalPosition: VectorOffset | null
}
+
+export interface LabwareToOrder {
+ definition: LabwareDefinition2
+ labwareId: string
+ slot: string
+}
diff --git a/app/src/organisms/LabwarePositionCheck/utils/getCheckSteps.ts b/app/src/organisms/LabwarePositionCheck/utils/getCheckSteps.ts
index 79c2ad64a9d..db8a9208cb5 100644
--- a/app/src/organisms/LabwarePositionCheck/utils/getCheckSteps.ts
+++ b/app/src/organisms/LabwarePositionCheck/utils/getCheckSteps.ts
@@ -82,7 +82,7 @@ function getCheckTipRackSectionSteps(args: LPCArgs): CheckTipRacksStep[] {
primaryPipetteId,
commands,
labware,
- modules,
+ modules = [],
} = args
const labwareLocationCombos = getLabwareLocationCombos(
diff --git a/app/src/organisms/ModuleCard/HeaterShakerSlideout.tsx b/app/src/organisms/ModuleCard/HeaterShakerSlideout.tsx
index d7381adffb5..83d3efa3608 100644
--- a/app/src/organisms/ModuleCard/HeaterShakerSlideout.tsx
+++ b/app/src/organisms/ModuleCard/HeaterShakerSlideout.tsx
@@ -25,7 +25,7 @@ import { useRunStatuses } from '../Devices/hooks'
import { useModuleIdFromRun } from './useModuleIdFromRun'
import type { HeaterShakerModule } from '../../redux/modules/types'
-import type { HeaterShakerStartSetTargetTemperatureCreateCommand } from '@opentrons/shared-data/protocol/types/schemaV6/command/module'
+import type { HeaterShakerSetTargetTemperatureCreateCommand } from '@opentrons/shared-data/protocol/types/schemaV6/command/module'
interface HeaterShakerSlideoutProps {
module: HeaterShakerModule
@@ -60,7 +60,7 @@ export const HeaterShakerSlideout = (
e.stopPropagation()
if (hsValue != null) {
- const setTempCommand: HeaterShakerStartSetTargetTemperatureCreateCommand = {
+ const setTempCommand: HeaterShakerSetTargetTemperatureCreateCommand = {
commandType: 'heaterShaker/setTargetTemperature',
params: {
moduleId: isRunIdle ? moduleIdFromRun : module.id,
diff --git a/app/src/organisms/OnDeviceDisplay/Navigation/index.tsx b/app/src/organisms/OnDeviceDisplay/Navigation/index.tsx
index ab65dcaacf5..4030ec50796 100644
--- a/app/src/organisms/OnDeviceDisplay/Navigation/index.tsx
+++ b/app/src/organisms/OnDeviceDisplay/Navigation/index.tsx
@@ -28,7 +28,6 @@ const NavigationLink = styled(NavLink)`
&.active {
color: ${COLORS.blueEnabled};
- border-bottom: 4px solid #006cfa;
}
`
@@ -44,7 +43,8 @@ export function Navigation({ routes }: { routes: RouteProps[] }): JSX.Element {
flexDirection={DIRECTION_ROW}
alignItems={ALIGN_CENTER}
justifyContent={JUSTIFY_SPACE_BETWEEN}
- padding={`${SPACING.spacing4} ${SPACING.spacing1}`}
+ paddingX={SPACING.spacing1}
+ paddingBottom="0.75rem"
height="7rem"
>
(false)
- const sortBy = useSelector(getProtocolsStoredSortKey) ?? 'alphabetical'
+ const sortBy = useSelector(getProtocolsDesktopSortKey) ?? 'alphabetical'
const [showSortByMenu, setShowSortByMenu] = React.useState(false)
const toggleSetShowSortByMenu = (): void => setShowSortByMenu(!showSortByMenu)
const { t } = useTranslation('protocol_info')
diff --git a/app/src/organisms/ProtocolsLanding/__tests__/ProtocolList.test.tsx b/app/src/organisms/ProtocolsLanding/__tests__/ProtocolList.test.tsx
index 0691538a9ad..0836a7cd598 100644
--- a/app/src/organisms/ProtocolsLanding/__tests__/ProtocolList.test.tsx
+++ b/app/src/organisms/ProtocolsLanding/__tests__/ProtocolList.test.tsx
@@ -5,7 +5,7 @@ import { fireEvent } from '@testing-library/react'
import { renderWithProviders } from '@opentrons/components'
import { i18n } from '../../../i18n'
-import { getProtocolsStoredSortKey } from '../../../redux/config'
+import { getProtocolsDesktopSortKey } from '../../../redux/config'
import {
storedProtocolData,
storedProtocolDataTwo,
@@ -30,8 +30,8 @@ const mockEmptyStateLinks = EmptyStateLinks as jest.MockedFunction<
const mockProtocolCard = ProtocolCard as jest.MockedFunction<
typeof ProtocolCard
>
-const mockGetProtocolsStoredSortKey = getProtocolsStoredSortKey as jest.MockedFunction<
- typeof getProtocolsStoredSortKey
+const mockGetProtocolsDesktopSortKey = getProtocolsDesktopSortKey as jest.MockedFunction<
+ typeof getProtocolsDesktopSortKey
>
const render = (props: React.ComponentProps) => {
@@ -57,7 +57,7 @@ describe('ProtocolList', () => {
when(mockUseSortedProtocols)
.calledWith('alphabetical', [storedProtocolData, storedProtocolDataTwo])
.mockReturnValue([storedProtocolData, storedProtocolDataTwo])
- when(mockGetProtocolsStoredSortKey).mockReturnValue('alphabetical')
+ when(mockGetProtocolsDesktopSortKey).mockReturnValue('alphabetical')
})
afterEach(() => {
@@ -101,7 +101,7 @@ describe('ProtocolList', () => {
when(mockUseSortedProtocols)
.calledWith('reverse', [storedProtocolData, storedProtocolDataTwo])
.mockReturnValue([storedProtocolDataTwo, storedProtocolData])
- when(mockGetProtocolsStoredSortKey).mockReturnValue('reverse')
+ when(mockGetProtocolsDesktopSortKey).mockReturnValue('reverse')
const { getByRole, getByText, getByTestId } = render(props)
fireEvent.click(getByTestId('ProtocolList_SortByMenu'))
@@ -117,7 +117,7 @@ describe('ProtocolList', () => {
when(mockUseSortedProtocols)
.calledWith('recent', [storedProtocolData, storedProtocolDataTwo])
.mockReturnValue([storedProtocolData, storedProtocolDataTwo])
- when(mockGetProtocolsStoredSortKey).mockReturnValue('recent')
+ when(mockGetProtocolsDesktopSortKey).mockReturnValue('recent')
const { getByRole, getByText, getByTestId } = render(props)
fireEvent.click(getByTestId('ProtocolList_SortByMenu'))
@@ -133,7 +133,7 @@ describe('ProtocolList', () => {
when(mockUseSortedProtocols)
.calledWith('oldest', [storedProtocolData, storedProtocolDataTwo])
.mockReturnValue([storedProtocolDataTwo, storedProtocolData])
- when(mockGetProtocolsStoredSortKey).mockReturnValue('oldest')
+ when(mockGetProtocolsDesktopSortKey).mockReturnValue('oldest')
const { getByRole, getByText, getByTestId } = render(props)
fireEvent.click(getByTestId('ProtocolList_SortByMenu'))
@@ -151,7 +151,7 @@ describe('ProtocolList', () => {
})
it('renders Oldest updates as the sort key when oldest was selected last time', () => {
- when(mockGetProtocolsStoredSortKey).mockReturnValue('oldest')
+ when(mockGetProtocolsDesktopSortKey).mockReturnValue('oldest')
const { getByText } = render(props)
getByText('Oldest updates')
})
diff --git a/app/src/organisms/ReapplyOffsetsModal/__tests__/ReapplyOffsetsModal.test.tsx b/app/src/organisms/ReapplyOffsetsModal/__tests__/ReapplyOffsetsModal.test.tsx
deleted file mode 100644
index ed1cff2ecae..00000000000
--- a/app/src/organisms/ReapplyOffsetsModal/__tests__/ReapplyOffsetsModal.test.tsx
+++ /dev/null
@@ -1,183 +0,0 @@
-import * as React from 'react'
-import '@testing-library/jest-dom'
-import { fireEvent } from '@testing-library/react'
-import { resetAllWhenMocks, when } from 'jest-when'
-import { useCreateLabwareOffsetMutation } from '@opentrons/react-api-client'
-import { renderWithProviders } from '@opentrons/components'
-import { TEMPERATURE_MODULE_V2 } from '@opentrons/shared-data'
-import { i18n } from '../../../i18n'
-import { mockRunningRun } from '../../RunTimeControl/__fixtures__'
-import {
- useClearAllOffsetsForCurrentRun,
- useOffsetCandidatesForCurrentRun,
-} from '../hooks'
-import { ReapplyOffsetsModal } from '../'
-
-import type { LabwareOffset } from '@opentrons/api-client'
-
-jest.mock('../hooks')
-jest.mock('@opentrons/react-api-client')
-
-const mockUseOffsetCandidateForCurrentRun = useOffsetCandidatesForCurrentRun as jest.MockedFunction<
- typeof useOffsetCandidatesForCurrentRun
->
-const mockUseCreateLabwareOffsetMutation = useCreateLabwareOffsetMutation as jest.MockedFunction<
- typeof useCreateLabwareOffsetMutation
->
-const mockUseClearAllOffsetsForCurrentRun = useClearAllOffsetsForCurrentRun as jest.MockedFunction<
- typeof useClearAllOffsetsForCurrentRun
->
-
-const MOCK_RUN_ID = 'fakeRunId'
-const mockOffsetCandidate: LabwareOffset = {
- id: 'fakeOffsetId',
- createdAt: 'fakeTimestamp',
- location: { slotName: '1' },
- definitionUri: 'fakeDefUri',
- vector: { x: 1, y: 2, z: 3 },
-}
-const mockOffsetCandidateOnMod: LabwareOffset = {
- id: 'fakeOffsetIdOnMod',
- location: { slotName: '3', moduleModel: TEMPERATURE_MODULE_V2 },
- vector: { x: 4, y: 5, z: 6 },
- createdAt: 'fakeTimestamp',
- definitionUri: 'fakeDefUri',
-}
-
-const render = () => {
- return renderWithProviders(, {
- i18nInstance: i18n,
- })[0]
-}
-
-describe('RunDetails', () => {
- let mockCreateLabwareOffset: jest.Mock
- let mockClearAllOffsets: jest.Mock
- beforeEach(() => {
- mockCreateLabwareOffset = jest.fn().mockReturnValue(Promise.resolve())
- mockClearAllOffsets = jest.fn()
- when(mockUseOffsetCandidateForCurrentRun).calledWith().mockReturnValue([])
- when(mockUseCreateLabwareOffsetMutation)
- .calledWith()
- .mockReturnValue({ createLabwareOffset: mockCreateLabwareOffset } as any)
- when(mockUseClearAllOffsetsForCurrentRun)
- .calledWith()
- .mockReturnValue(mockClearAllOffsets)
- })
-
- afterEach(() => {
- resetAllWhenMocks()
- })
-
- it('renders null if there are no candidate offsets', () => {
- const { queryByText } = render()
- expect(queryByText('Apply stored Labware Offset data?')).toBeNull()
- })
-
- it('renders title and explanatory text if there is at least one candidate', () => {
- when(mockUseOffsetCandidateForCurrentRun)
- .calledWith()
- .mockReturnValue([
- {
- ...mockOffsetCandidate,
- labwareDisplayName: 'Fake Labware',
- runCreatedAt: mockRunningRun.createdAt,
- },
- ])
- const { getByText } = render()
- expect(getByText('Apply stored Labware Offset data?')).toBeInTheDocument()
- expect(
- getByText(
- 'This robot has stored Labware Offset data from previous protocol runs. Do you want to apply that data to this protocol run? You can still adjust any offsets with Labware Position Check.'
- )
- ).toBeInTheDocument()
- })
-
- it('renders candidate table row for each candidate', () => {
- when(mockUseOffsetCandidateForCurrentRun)
- .calledWith()
- .mockReturnValue([
- {
- ...mockOffsetCandidate,
- labwareDisplayName: 'Fake Labware One',
- runCreatedAt: mockRunningRun.createdAt,
- },
- {
- ...mockOffsetCandidateOnMod,
- labwareDisplayName: 'Fake Labware Two',
- runCreatedAt: '2021-10-08T18:45:49.366581+00:00',
- },
- ])
- const { getByText } = render()
- expect(getByText(/10\/07\/2021/i)).toBeInTheDocument()
- expect(getByText(/:44:49/i)).toBeInTheDocument()
- expect(getByText('Slot 1')).toBeInTheDocument()
- expect(getByText('Fake Labware One')).toBeInTheDocument()
- expect(getByText('1.00')).toBeInTheDocument()
- expect(getByText('2.00')).toBeInTheDocument()
- expect(getByText('3.00')).toBeInTheDocument()
- expect(getByText(/10\/08\/2021/i)).toBeInTheDocument()
- expect(getByText(/:45:49/i)).toBeInTheDocument()
- expect(getByText('Slot 3 - Temperature Module GEN2')).toBeInTheDocument()
- expect(getByText('Fake Labware Two')).toBeInTheDocument()
- expect(getByText('4.00')).toBeInTheDocument()
- expect(getByText('5.00')).toBeInTheDocument()
- expect(getByText('6.00')).toBeInTheDocument()
- })
- it('clears all offsets if ignore is clicked', () => {
- when(mockUseOffsetCandidateForCurrentRun)
- .calledWith()
- .mockReturnValue([
- {
- ...mockOffsetCandidate,
- labwareDisplayName: 'Fake Labware One',
- runCreatedAt: mockRunningRun.createdAt,
- },
- ])
- const { getByRole } = render()
- const ignoreButton = getByRole('button', { name: 'Ignore stored data' })
- fireEvent.click(ignoreButton)
- expect(mockClearAllOffsets).toHaveBeenCalled()
- })
- it('clears applies all candidate offsets if apply is clicked', () => {
- when(mockUseOffsetCandidateForCurrentRun)
- .calledWith()
- .mockReturnValue([
- {
- ...mockOffsetCandidate,
- labwareDisplayName: 'Fake Labware One',
- runCreatedAt: mockRunningRun.createdAt,
- },
- {
- ...mockOffsetCandidateOnMod,
- labwareDisplayName: 'Fake Labware Two',
- runCreatedAt: '2021-10-08T18:45:49.366581+00:00',
- },
- ])
- const { getByRole } = render()
- const applyButton = getByRole('button', { name: 'Apply stored data' })
- fireEvent.click(applyButton)
- expect(mockCreateLabwareOffset.mock.calls).toEqual([
- [
- {
- runId: MOCK_RUN_ID,
- data: {
- definitionUri: mockOffsetCandidate.definitionUri,
- location: mockOffsetCandidate.location,
- vector: mockOffsetCandidate.vector,
- },
- },
- ],
- [
- {
- runId: MOCK_RUN_ID,
- data: {
- definitionUri: mockOffsetCandidateOnMod.definitionUri,
- location: mockOffsetCandidateOnMod.location,
- vector: mockOffsetCandidateOnMod.vector,
- },
- },
- ],
- ])
- })
-})
diff --git a/app/src/organisms/ReapplyOffsetsModal/hooks/__tests__/useClearAllOffsetsForCurrentRun.test.tsx b/app/src/organisms/ReapplyOffsetsModal/hooks/__tests__/useClearAllOffsetsForCurrentRun.test.tsx
deleted file mode 100644
index 9e06aa0f10e..00000000000
--- a/app/src/organisms/ReapplyOffsetsModal/hooks/__tests__/useClearAllOffsetsForCurrentRun.test.tsx
+++ /dev/null
@@ -1,158 +0,0 @@
-import * as React from 'react'
-import { resetAllWhenMocks, when } from 'jest-when'
-import { renderHook } from '@testing-library/react-hooks'
-import { useCreateLabwareOffsetMutation } from '@opentrons/react-api-client'
-import { IDENTITY_VECTOR } from '@opentrons/shared-data'
-import { useProtocolDetailsForRun } from '../../../Devices/hooks'
-import { useCurrentRunId } from '../../../ProtocolUpload/hooks'
-import { useClearAllOffsetsForCurrentRun } from '../useClearAllOffsetsForCurrentRun'
-
-import type { ProtocolAnalysisFile } from '@opentrons/shared-data'
-import type { ProtocolDetails } from '../../../Devices/hooks'
-
-import _uncastedProtocolWithTC from '@opentrons/shared-data/protocol/fixtures/6/multipleTipracksWithTC.json'
-
-const protocolWithTC = (_uncastedProtocolWithTC as unknown) as ProtocolAnalysisFile<{}>
-
-jest.mock('@opentrons/react-api-client')
-jest.mock('../../../ProtocolUpload/hooks')
-jest.mock('../../../Devices/hooks')
-
-const mockUseCurrentRunId = useCurrentRunId as jest.MockedFunction<
- typeof useCurrentRunId
->
-const mockUseProtocolDetailsForRun = useProtocolDetailsForRun as jest.MockedFunction<
- typeof useProtocolDetailsForRun
->
-const mockUseCreateLabwareOffsetMutation = useCreateLabwareOffsetMutation as jest.MockedFunction<
- typeof useCreateLabwareOffsetMutation
->
-
-const MOCK_RUN_ID = 'fakeRunId'
-const mockProtocolDetails: ProtocolDetails = {
- protocolData: {
- commands: protocolWithTC.commands,
- modules: protocolWithTC.modules,
- labware: [
- {
- id: 'fixedTrash',
- loadName: 'opentrons_1_trash_1100ml_fixed',
- displayName: 'Trash',
- definitionUri: 'opentrons/opentrons_1_trash_1100ml_fixed/1',
- },
- {
- id:
- '50d3ebb0-0042-11ec-8258-f7ffdf5ad45a:opentrons/opentrons_96_tiprack_300ul/1',
- loadName: 'opentrons_96_tiprack_300ul',
- displayName: 'Opentrons 96 Tip Rack 300 µL',
- definitionUri: 'opentrons/opentrons_96_tiprack_300ul/1',
- },
- {
- id:
- '9fbc1db0-0042-11ec-8258-f7ffdf5ad45a:opentrons/nest_12_reservoir_15ml/1',
- loadName: 'nest_12_reservoir_15ml',
- displayName: 'NEST 12 Well Reservoir 15 mL',
- definitionUri: 'opentrons/nest_12_reservoir_15ml/1',
- },
- {
- id: 'e24818a0-0042-11ec-8258-f7ffdf5ad45a',
- loadName: 'opentrons_96_tiprack_300ul',
- displayName: 'Opentrons 96 Tip Rack 300 µL (1)',
- definitionUri: 'opentrons/opentrons_96_tiprack_300ul/1',
- },
- {
- id:
- '1dc0c050-0122-11ec-88a3-f1745cf9b36c:opentrons/nest_96_wellplate_100ul_pcr_full_skirt/1',
- loadName: 'nest_96_wellplate_100ul_pcr_full_skirt',
- displayName: 'NEST 96 Well Plate 100 µL PCR Full Skirt',
- definitionUri: 'opentrons/nest_96_wellplate_100ul_pcr_full_skirt/1',
- },
- ],
- labwareDefinitions: protocolWithTC.labwareDefinitions,
- } as any,
- displayName: 'fake protocol name',
- protocolKey: 'fakeProtocolKey',
- robotType: 'OT-2 Standard',
-}
-
-describe('useClearAllOffsetsForCurrentRun', () => {
- let mockCreateOffset: jest.MockedFunction<
- ReturnType['createLabwareOffset']
- >
- beforeEach(() => {
- mockCreateOffset = jest.fn().mockReturnValue(Promise.resolve())
- when(mockUseCreateLabwareOffsetMutation)
- .calledWith()
- .mockReturnValue({ createLabwareOffset: mockCreateOffset } as any)
- when(mockUseCurrentRunId).calledWith().mockReturnValue(MOCK_RUN_ID)
- when(mockUseProtocolDetailsForRun)
- .calledWith(MOCK_RUN_ID)
- .mockReturnValue(mockProtocolDetails)
- })
- afterEach(() => {
- resetAllWhenMocks()
- })
-
- it('creates an identity labware offset for every labware listed in protocol details', () => {
- const wrapper: React.FunctionComponent<{}> = ({ children }) => (
- {children}
- )
- const { result } = renderHook(useClearAllOffsetsForCurrentRun, { wrapper })
- result.current()
- expect(mockCreateOffset).toHaveBeenCalledTimes(
- Object.keys(mockProtocolDetails?.protocolData?.labware ?? {}).length
- )
- expect(mockCreateOffset.mock.calls).toEqual([
- [
- {
- runId: MOCK_RUN_ID,
- data: {
- definitionUri: 'opentrons/opentrons_1_trash_1100ml_fixed/1',
- location: { slotName: '12' },
- vector: IDENTITY_VECTOR,
- },
- },
- ],
- [
- {
- runId: MOCK_RUN_ID,
- data: {
- definitionUri: 'opentrons/opentrons_96_tiprack_300ul/1',
- location: { slotName: '1' },
- vector: IDENTITY_VECTOR,
- },
- },
- ],
- [
- {
- runId: MOCK_RUN_ID,
- data: {
- definitionUri: 'opentrons/nest_12_reservoir_15ml/1',
- location: { slotName: '6' },
- vector: IDENTITY_VECTOR,
- },
- },
- ],
- [
- {
- runId: MOCK_RUN_ID,
- data: {
- definitionUri: 'opentrons/opentrons_96_tiprack_300ul/1',
- location: { slotName: '2' },
- vector: IDENTITY_VECTOR,
- },
- },
- ],
- [
- {
- runId: MOCK_RUN_ID,
- data: {
- definitionUri: 'opentrons/nest_96_wellplate_100ul_pcr_full_skirt/1',
- location: { slotName: '7', moduleModel: 'thermocyclerModuleV1' },
- vector: IDENTITY_VECTOR,
- },
- },
- ],
- ])
- })
-})
diff --git a/app/src/organisms/ReapplyOffsetsModal/hooks/__tests__/useHistoricRunDetails.test.tsx b/app/src/organisms/ReapplyOffsetsModal/hooks/__tests__/useHistoricRunDetails.test.tsx
deleted file mode 100644
index d82c50c289c..00000000000
--- a/app/src/organisms/ReapplyOffsetsModal/hooks/__tests__/useHistoricRunDetails.test.tsx
+++ /dev/null
@@ -1,67 +0,0 @@
-import * as React from 'react'
-import { when } from 'jest-when'
-import { renderHook } from '@testing-library/react-hooks'
-import { useAllRunsQuery, useRunQuery } from '@opentrons/react-api-client'
-import { useHistoricRunDetails } from '../useHistoricRunDetails'
-import { mockRunningRun } from '../../../RunTimeControl/__fixtures__'
-import { mockSuccessQueryResults } from '../../../../__fixtures__'
-
-import type { RunData } from '@opentrons/api-client'
-
-jest.mock('@opentrons/react-api-client')
-
-const mockUseAllRunsQuery = useAllRunsQuery as jest.MockedFunction<
- typeof useAllRunsQuery
->
-const mockUseRunQuery = useRunQuery as jest.MockedFunction
-
-const MOCK_RUN_LATER: RunData = {
- ...mockRunningRun,
- id: 'run_one',
- createdAt: '2022-05-02T14:34:48.843177',
- current: false,
- status: 'succeeded',
- protocolId: 'fakeProtocolId',
-}
-const MOCK_RUN_EARLIER: RunData = {
- ...mockRunningRun,
- id: 'run_zero',
- createdAt: '2022-05-01T14:34:48.843177',
- current: false,
- status: 'succeeded',
- protocolId: 'fakeProtocolId',
-}
-
-describe('useHistoricRunDetails', () => {
- when(mockUseAllRunsQuery)
- .calledWith()
- .mockReturnValue(
- mockSuccessQueryResults({
- data: [MOCK_RUN_LATER, MOCK_RUN_EARLIER],
- links: {},
- })
- )
- when(mockUseRunQuery)
- .calledWith(MOCK_RUN_LATER.id)
- .mockReturnValue(
- mockSuccessQueryResults({
- data: MOCK_RUN_LATER,
- })
- )
- when(mockUseRunQuery)
- .calledWith(MOCK_RUN_EARLIER.id)
- .mockReturnValue(
- mockSuccessQueryResults({
- data: MOCK_RUN_EARLIER,
- })
- )
-
- it('returns historical run details with newest first', async () => {
- const wrapper: React.FunctionComponent<{}> = ({ children }) => (
- {children}
- )
- const { result, waitFor } = renderHook(useHistoricRunDetails, { wrapper })
- await waitFor(() => result.current != null)
- expect(result.current).toEqual([MOCK_RUN_LATER, MOCK_RUN_EARLIER])
- })
-})
diff --git a/app/src/organisms/ReapplyOffsetsModal/hooks/__tests__/useOffsetCandidatesForCurrentRun.test.tsx b/app/src/organisms/ReapplyOffsetsModal/hooks/__tests__/useOffsetCandidatesForCurrentRun.test.tsx
deleted file mode 100644
index 93d06664121..00000000000
--- a/app/src/organisms/ReapplyOffsetsModal/hooks/__tests__/useOffsetCandidatesForCurrentRun.test.tsx
+++ /dev/null
@@ -1,234 +0,0 @@
-import * as React from 'react'
-import { resetAllWhenMocks, when } from 'jest-when'
-import { renderHook } from '@testing-library/react-hooks'
-import { useOffsetCandidatesForCurrentRun } from '../useOffsetCandidatesForCurrentRun'
-import { mockRunningRun } from '../../../RunTimeControl/__fixtures__'
-import { useProtocolDetailsForRun } from '../../../Devices/hooks'
-import { useCurrentRunId } from '../../../ProtocolUpload/hooks'
-
-import type { ProtocolAnalysisFile } from '@opentrons/shared-data'
-import type { LabwareOffset } from '@opentrons/api-client'
-import type { ProtocolDetails } from '../../../Devices/hooks'
-import { useHistoricRunDetails } from '../useHistoricRunDetails'
-
-import _uncastedProtocolWithTC from '@opentrons/shared-data/protocol/fixtures/6/multipleTipracksWithTC.json'
-
-const protocolWithTC = (_uncastedProtocolWithTC as unknown) as ProtocolAnalysisFile<{}>
-
-jest.mock('@opentrons/react-api-client')
-jest.mock('../../../ProtocolUpload/hooks')
-jest.mock('../../../Devices/hooks')
-jest.mock('../useHistoricRunDetails')
-
-const mockUseCurrentRunId = useCurrentRunId as jest.MockedFunction<
- typeof useCurrentRunId
->
-const mockUseProtocolDetailsForRun = useProtocolDetailsForRun as jest.MockedFunction<
- typeof useProtocolDetailsForRun
->
-const mockUseHistoricRunDetails = useHistoricRunDetails as jest.MockedFunction<
- typeof useHistoricRunDetails
->
-
-const MOCK_RUN_ID = 'fakeRunId'
-const mockProtocolDetails: ProtocolDetails = {
- protocolData: {
- commands: protocolWithTC.commands,
- modules: protocolWithTC.modules,
- labware: [
- {
- id: 'fixedTrash',
- displayName: 'Trash',
- definitionUri: 'opentrons/opentrons_1_trash_1100ml_fixed/1',
- loadName: 'opentrons_1_trash_1100ml_fixed',
- },
- {
- id:
- '50d3ebb0-0042-11ec-8258-f7ffdf5ad45a:opentrons/opentrons_96_tiprack_300ul/1',
- displayName: 'Opentrons 96 Tip Rack 300 µL',
- definitionUri: 'opentrons/opentrons_96_tiprack_300ul/1',
- loadName: 'opentrons_96_tiprack_300ul',
- },
- {
- id:
- '9fbc1db0-0042-11ec-8258-f7ffdf5ad45a:opentrons/nest_12_reservoir_15ml/1',
- displayName: 'NEST 12 Well Reservoir 15 mL',
- definitionUri: 'opentrons/nest_12_reservoir_15ml/1',
- loadName: 'nest_12_reservoir_15ml',
- },
- {
- id: 'e24818a0-0042-11ec-8258-f7ffdf5ad45a',
- displayName: 'Opentrons 96 Tip Rack 300 µL (1)',
- definitionUri: 'opentrons/opentrons_96_tiprack_300ul/1',
- loadName: 'opentrons_96_tiprack_300ul',
- },
- {
- id:
- '1dc0c050-0122-11ec-88a3-f1745cf9b36c:opentrons/nest_96_wellplate_100ul_pcr_full_skirt/1',
- displayName: 'NEST 96 Well Plate 100 µL PCR Full Skirt',
- definitionUri: 'opentrons/nest_96_wellplate_100ul_pcr_full_skirt/1',
- loadName: 'nest_96_wellplate_100ul_pcr_full_skirt',
- },
- ],
- labwareDefinitions: protocolWithTC.labwareDefinitions,
- } as any,
- displayName: 'fake protocol name',
- protocolKey: 'fakeProtocolKey',
- robotType: 'OT-2 Standard',
-}
-const FAKE_OFFSET_TIPRACK_IN_2: LabwareOffset = {
- id: 'fakeOffsetId',
- createdAt: '2021-10-07T18:44:49.366581+00:00',
- location: { slotName: '2' },
- vector: { x: 1, y: 2, z: 3 },
- definitionUri: 'opentrons/opentrons_96_tiprack_300ul/1',
-}
-const FAKE_OFFSET_PLATE_ON_TC: LabwareOffset = {
- id: 'fakeOffsetIdOnTC',
- createdAt: '2021-09-06T18:44:49.366581+00:00',
- location: { slotName: '7', moduleModel: 'thermocyclerModuleV1' },
- vector: { x: 4, y: 5, z: 6 },
- definitionUri: 'opentrons/nest_96_wellplate_100ul_pcr_full_skirt/1',
-}
-
-describe('useOffsetCandidatesForCurrentRun', () => {
- const wrapper: React.FunctionComponent<{}> = ({ children }) => (
- {children}
- )
- beforeEach(() => {
- when(mockUseCurrentRunId).calledWith().mockReturnValue(MOCK_RUN_ID)
- when(mockUseProtocolDetailsForRun)
- .calledWith(MOCK_RUN_ID)
- .mockReturnValue(mockProtocolDetails)
- when(mockUseHistoricRunDetails)
- .calledWith()
- .mockReturnValue([
- {
- ...mockRunningRun,
- labwareOffsets: [FAKE_OFFSET_TIPRACK_IN_2],
- },
- ])
- })
- afterEach(() => {
- resetAllWhenMocks()
- })
-
- it('returns candidate offset if available', () => {
- const { result } = renderHook(useOffsetCandidatesForCurrentRun, {
- wrapper,
- })
- expect(result.current).toEqual([
- {
- ...FAKE_OFFSET_TIPRACK_IN_2,
- labwareDisplayName: 'Opentrons 96 Tip Rack 300 µL',
- runCreatedAt: mockRunningRun.createdAt,
- },
- ])
- })
- it('returns first candidate offset if multiple available', () => {
- when(mockUseHistoricRunDetails)
- .calledWith()
- .mockReturnValue([
- {
- ...mockRunningRun,
- createdAt: '2021-10-07T18:44:30.366581+00:00',
- labwareOffsets: [
- {
- ...FAKE_OFFSET_TIPRACK_IN_2,
- createdAt: '2021-10-07T18:44:38.366581+00:00',
- id: 'third',
- },
- {
- ...FAKE_OFFSET_TIPRACK_IN_2,
- createdAt: '2021-10-07T18:44:49.366581+00:00',
- id: 'fourth',
- },
- ],
- },
- {
- ...mockRunningRun,
- createdAt: '2021-09-06T18:44:30.366581+00:00',
- labwareOffsets: [
- {
- ...FAKE_OFFSET_TIPRACK_IN_2,
- createdAt: '2021-09-06T18:44:38.366581+00:00',
- id: 'first',
- },
- {
- ...FAKE_OFFSET_TIPRACK_IN_2,
- createdAt: '2021-09-06T18:44:49.366581+00:00',
- id: 'second',
- },
- ],
- },
- ])
-
- const { result } = renderHook(useOffsetCandidatesForCurrentRun, {
- wrapper,
- })
- expect(result.current).toEqual([
- {
- ...FAKE_OFFSET_TIPRACK_IN_2,
- createdAt: '2021-10-07T18:44:49.366581+00:00',
- id: 'fourth',
- labwareDisplayName: 'Opentrons 96 Tip Rack 300 µL',
- runCreatedAt: '2021-10-07T18:44:30.366581+00:00',
- },
- ])
- })
- it('returns candidate offset from module location', () => {
- when(mockUseHistoricRunDetails)
- .calledWith()
- .mockReturnValue([
- {
- ...mockRunningRun,
- labwareOffsets: [FAKE_OFFSET_PLATE_ON_TC],
- },
- ])
-
- const { result } = renderHook(useOffsetCandidatesForCurrentRun, {
- wrapper,
- })
- expect(result.current).toEqual([
- {
- ...FAKE_OFFSET_PLATE_ON_TC,
- labwareDisplayName: 'NEST 96 Well Plate 100 µL PCR Full Skirt',
- runCreatedAt: mockRunningRun.createdAt,
- },
- ])
- })
- it('returns no candidate offset if location does not match', () => {
- when(mockUseHistoricRunDetails)
- .calledWith()
- .mockReturnValue([
- {
- ...mockRunningRun,
- labwareOffsets: [
- { ...FAKE_OFFSET_TIPRACK_IN_2, location: { slotName: '11' } },
- ],
- },
- ])
-
- const { result } = renderHook(useOffsetCandidatesForCurrentRun, {
- wrapper,
- })
- expect(result.current).toEqual([])
- })
- it('returns no candidate offset if defURI does not match', () => {
- when(mockUseHistoricRunDetails)
- .calledWith()
- .mockReturnValue([
- {
- ...mockRunningRun,
- labwareOffsets: [
- { ...FAKE_OFFSET_TIPRACK_IN_2, definitionUri: 'someBogusDefURI' },
- ],
- },
- ])
-
- const { result } = renderHook(useOffsetCandidatesForCurrentRun, {
- wrapper,
- })
- expect(result.current).toEqual([])
- })
-})
diff --git a/app/src/organisms/ReapplyOffsetsModal/hooks/index.tsx b/app/src/organisms/ReapplyOffsetsModal/hooks/index.tsx
deleted file mode 100644
index 4129c383868..00000000000
--- a/app/src/organisms/ReapplyOffsetsModal/hooks/index.tsx
+++ /dev/null
@@ -1,3 +0,0 @@
-export * from './useOffsetCandidatesForCurrentRun'
-export * from './useHistoricRunDetails'
-export * from './useClearAllOffsetsForCurrentRun'
diff --git a/app/src/organisms/ReapplyOffsetsModal/hooks/useAllHistoricOffsets.ts b/app/src/organisms/ReapplyOffsetsModal/hooks/useAllHistoricOffsets.ts
deleted file mode 100644
index 3b6f82d8ed0..00000000000
--- a/app/src/organisms/ReapplyOffsetsModal/hooks/useAllHistoricOffsets.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-import { useHistoricRunDetails } from './useHistoricRunDetails'
-
-import type { LabwareOffset } from '@opentrons/api-client'
-
-interface HistoricOffset extends LabwareOffset {
- runCreatedAt: string
-}
-export function useAllHistoricOffsets(): HistoricOffset[] {
- const historicRunDetails = useHistoricRunDetails()
- return historicRunDetails
- .map(
- run =>
- run.labwareOffsets
- ?.map(offset => ({
- ...offset,
- runCreatedAt: run.createdAt,
- }))
- ?.sort(
- (a, b) =>
- new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime()
- ) ?? []
- )
- .flat()
-}
diff --git a/app/src/organisms/ReapplyOffsetsModal/hooks/useClearAllOffsetsForCurrentRun.ts b/app/src/organisms/ReapplyOffsetsModal/hooks/useClearAllOffsetsForCurrentRun.ts
deleted file mode 100644
index 0cebdaa11d7..00000000000
--- a/app/src/organisms/ReapplyOffsetsModal/hooks/useClearAllOffsetsForCurrentRun.ts
+++ /dev/null
@@ -1,39 +0,0 @@
-import { IDENTITY_VECTOR } from '@opentrons/shared-data'
-import { useCreateLabwareOffsetMutation } from '@opentrons/react-api-client'
-import { useProtocolDetailsForRun } from '../../Devices/hooks'
-import { getLabwareDefinitionUri } from '../../Devices/ProtocolRun/utils/getLabwareDefinitionUri'
-import { getLabwareOffsetLocation } from '../../Devices/ProtocolRun/utils/getLabwareOffsetLocation'
-import { useCurrentRunId } from '../../ProtocolUpload/hooks'
-
-export function useClearAllOffsetsForCurrentRun(): () => void {
- const currentRunId = useCurrentRunId()
- const { protocolData } = useProtocolDetailsForRun(currentRunId)
- const { createLabwareOffset } = useCreateLabwareOffsetMutation()
-
- return () => {
- if (currentRunId == null || protocolData == null) return
- protocolData.labware.forEach(item => {
- const location = getLabwareOffsetLocation(
- item.id,
- protocolData.commands,
- protocolData.modules
- )
- if (location != null) {
- createLabwareOffset({
- runId: currentRunId,
- data: {
- definitionUri: getLabwareDefinitionUri(
- item.id,
- protocolData.labware,
- protocolData.labwareDefinitions
- ),
- location: location,
- vector: IDENTITY_VECTOR,
- },
- }).catch((e: Error) => {
- console.error(`error clearing labware offsets: ${e.message}`)
- })
- }
- })
- }
-}
diff --git a/app/src/organisms/ReapplyOffsetsModal/hooks/useHistoricRunDetails.ts b/app/src/organisms/ReapplyOffsetsModal/hooks/useHistoricRunDetails.ts
deleted file mode 100644
index 3735dad31cb..00000000000
--- a/app/src/organisms/ReapplyOffsetsModal/hooks/useHistoricRunDetails.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-import { useAllRunsQuery } from '@opentrons/react-api-client'
-
-import type { RunData } from '@opentrons/api-client'
-
-export function useHistoricRunDetails(): RunData[] {
- const { data: allHistoricRuns } = useAllRunsQuery()
-
- return allHistoricRuns == null
- ? []
- : allHistoricRuns.data
- .filter(run => !run.current)
- .sort(
- (a, b) =>
- new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()
- )
-}
diff --git a/app/src/organisms/ReapplyOffsetsModal/hooks/useOffsetCandidatesForCurrentRun.ts b/app/src/organisms/ReapplyOffsetsModal/hooks/useOffsetCandidatesForCurrentRun.ts
deleted file mode 100644
index c9d98020da7..00000000000
--- a/app/src/organisms/ReapplyOffsetsModal/hooks/useOffsetCandidatesForCurrentRun.ts
+++ /dev/null
@@ -1,97 +0,0 @@
-import isEqual from 'lodash/isEqual'
-import { getLabwareDefURI, getLabwareDisplayName } from '@opentrons/shared-data'
-import { useProtocolDetailsForRun } from '../../Devices/hooks'
-import { getLabwareOffsetLocation } from '../../Devices/ProtocolRun/utils/getLabwareOffsetLocation'
-import { useCurrentRunId } from '../../ProtocolUpload/hooks'
-import { useHistoricRunDetails } from './useHistoricRunDetails'
-
-import type { LabwareOffset } from '@opentrons/api-client'
-import type { ProtocolFile, LoadedLabware } from '@opentrons/shared-data'
-
-export interface OffsetCandidate extends LabwareOffset {
- labwareDisplayName: string
- runCreatedAt: string
-}
-export function useOffsetCandidatesForCurrentRun(): OffsetCandidate[] {
- const currentRunId = useCurrentRunId()
- const { protocolData } = useProtocolDetailsForRun(currentRunId)
- const historicRunDetails = useHistoricRunDetails()
- const allHistoricOffsets = historicRunDetails
- .map(
- run =>
- run.labwareOffsets
- ?.map(offset => ({
- offset,
- runCreatedAt: run.createdAt,
- }))
- ?.sort(
- (a, b) =>
- new Date(b.offset.createdAt).getTime() -
- new Date(a.offset.createdAt).getTime()
- ) ?? []
- )
- .flat()
-
- if (
- protocolData == null ||
- allHistoricOffsets == null ||
- allHistoricOffsets.length === 0
- )
- return []
-
- return protocolData.labware
- .filter(labware => labware.id !== 'fixedTrash')
- .reduce((acc: OffsetCandidate[], item) => {
- const location = getLabwareOffsetLocation(
- item.id,
- protocolData.commands,
- protocolData.modules
- )
- const definition = getLabwareDefinition(
- item.id,
- protocolData.labware,
- protocolData.labwareDefinitions
- )
- const defUri = getLabwareDefURI(definition)
- const labwareDisplayName = getLabwareDisplayName(definition)
-
- const offsetMatch = allHistoricOffsets.find(
- ({ offset }) =>
- !isEqual(offset.vector, { x: 0, y: 0, z: 0 }) &&
- isEqual(offset.location, location) &&
- offset.definitionUri === defUri
- )
-
- return offsetMatch == null
- ? acc
- : [
- ...acc,
- {
- ...offsetMatch.offset,
- runCreatedAt: offsetMatch.runCreatedAt,
- labwareDisplayName,
- },
- ]
- }, [])
-}
-
-function getLabwareDefinition(
- labwareId: string,
- labware: LoadedLabware[],
- labwareDefinitions: ProtocolFile<{}>['labwareDefinitions']
-): ProtocolFile<{}>['labwareDefinitions'][string] {
- const labwareDefinitionId = labware.find(item => item.id === labwareId)
- ?.definitionUri
- if (labwareDefinitionId == null) {
- throw new Error(
- 'expected to be able to find labware definition id for labware, but could not'
- )
- }
- const labwareDefinition = labwareDefinitions[labwareDefinitionId]
- if (labwareDefinition == null) {
- throw new Error(
- 'expected to be able to find labware definitions for protocol, but could not'
- )
- }
- return labwareDefinition
-}
diff --git a/app/src/organisms/ReapplyOffsetsModal/index.tsx b/app/src/organisms/ReapplyOffsetsModal/index.tsx
deleted file mode 100644
index b7fb17f2e33..00000000000
--- a/app/src/organisms/ReapplyOffsetsModal/index.tsx
+++ /dev/null
@@ -1,128 +0,0 @@
-import * as React from 'react'
-import isEqual from 'lodash/isEqual'
-import { useTranslation } from 'react-i18next'
-import { getModuleDisplayName, IDENTITY_VECTOR } from '@opentrons/shared-data'
-import { useCreateLabwareOffsetMutation } from '@opentrons/react-api-client'
-import {
- Flex,
- SPACING,
- TYPOGRAPHY,
- COLORS,
- JUSTIFY_FLEX_END,
-} from '@opentrons/components'
-import { PrimaryButton, SecondaryButton } from '../../atoms/buttons'
-import { Modal } from '../../molecules/Modal'
-import { StyledText } from '../../atoms/text'
-import { OffsetVector } from '../../molecules/OffsetVector'
-import {
- useOffsetCandidatesForCurrentRun,
- useClearAllOffsetsForCurrentRun,
-} from './hooks'
-import styled from 'styled-components'
-import { formatTimestamp } from '../Devices/utils'
-
-const OffsetTable = styled('table')`
- ${TYPOGRAPHY.labelRegular}
- table-layout: auto;
- width: 100%;
- border-spacing: 0 ${SPACING.spacing1};
- margin: ${SPACING.spacing4} 0;
- text-align: left;
-`
-const OffsetTableHeader = styled('th')`
- text-transform: ${TYPOGRAPHY.textTransformCapitalize};
- padding: ${SPACING.spacing2};
-`
-const OffsetTableRow = styled('tr')`
- background-color: ${COLORS.fundamentalsBackground};
- padding: ${SPACING.spacing3};
-`
-
-const OffsetTableDatum = styled('td')`
- padding: ${SPACING.spacing3};
- white-space: break-spaces;
- text-overflow: wrap;
-`
-interface ReapplyOffsetsModalProps {
- runId: string
-}
-
-/**
- * @deprecated This component is slated for removal along with the
- * enableManualDeckStateMod feature flag. It's functionality is being
- * replaced by ApplyHistoricOffsets
- */
-export function ReapplyOffsetsModal(
- props: ReapplyOffsetsModalProps
-): JSX.Element | null {
- const { runId } = props
- const { t } = useTranslation('run_details')
- const offsetCandidates = useOffsetCandidatesForCurrentRun()
- const { createLabwareOffset } = useCreateLabwareOffsetMutation()
- const clearAllOffsets = useClearAllOffsetsForCurrentRun()
-
- const handleApply = (): void => {
- if (offsetCandidates.length > 0) {
- offsetCandidates.forEach(offsetCandidate => {
- if (!isEqual(offsetCandidate.vector, IDENTITY_VECTOR)) {
- createLabwareOffset({
- runId: runId,
- data: {
- definitionUri: offsetCandidate.definitionUri,
- location: offsetCandidate.location,
- vector: offsetCandidate.vector,
- },
- }).catch((e: Error) => {
- console.error(`error applying labware offsets: ${e.message}`)
- })
- }
- })
- } else {
- console.error('no labware offset data found')
- }
- }
-
- return offsetCandidates.length > 0 ? (
-
- {t('robot_has_previous_offsets')}
-
-
- {t('location')}
- {t('run')}
- {t('labware')}
- {t('labware_offset_data')}
-
- {offsetCandidates.map(offset => (
-
-
- {t('slot', { slotName: offset.location.slotName })}
- {offset.location.moduleModel != null
- ? ` - ${String(
- getModuleDisplayName(offset.location.moduleModel)
- )}`
- : null}
-
-
- {formatTimestamp(offset.runCreatedAt)}
-
- {offset.labwareDisplayName}
-
-
-
-
- ))}
-
-
-
- {t('ignore_stored_data')}
-
-
- {t('apply_stored_data')}
-
-
-
- ) : null
-}
diff --git a/app/src/organisms/RobotSettingsCalibration/CalibrationDataDownload.tsx b/app/src/organisms/RobotSettingsCalibration/CalibrationDataDownload.tsx
index 9f27a8bc050..b12c38895fc 100644
--- a/app/src/organisms/RobotSettingsCalibration/CalibrationDataDownload.tsx
+++ b/app/src/organisms/RobotSettingsCalibration/CalibrationDataDownload.tsx
@@ -1,9 +1,8 @@
import * as React from 'react'
import { saveAs } from 'file-saver'
-import { useTranslation } from 'react-i18next'
+import { useTranslation, Trans } from 'react-i18next'
import {
- Box,
Flex,
Icon,
Link,
@@ -11,6 +10,7 @@ import {
JUSTIFY_SPACE_BETWEEN,
SPACING,
TYPOGRAPHY,
+ DIRECTION_COLUMN,
} from '@opentrons/components'
import { TertiaryButton } from '../../atoms/buttons'
@@ -24,7 +24,9 @@ import {
} from '../../organisms/Devices/hooks'
import { useTrackEvent } from '../../redux/analytics'
import { EVENT_CALIBRATION_DOWNLOADED } from '../../redux/calibration'
-import * as Config from '../../redux/config'
+
+// TODO(bc, 2022-02-08): replace with support article when available
+const FLEX_CALIBRATION_SUPPORT_URL = 'https://support.opentrons.com'
interface CalibrationDataDownloadProps {
robotName: string
@@ -44,10 +46,6 @@ export function CalibrationDataDownload({
])
const doTrackEvent = useTrackEvent()
- const enableCalibrationWizards = Config.useFeatureFlag(
- 'enableCalibrationWizards'
- )
-
const robot = useRobot(robotName)
const isOT3 = useIsOT3(robotName)
// wait for robot request to resolve instead of using name directly from params
@@ -90,83 +88,53 @@ export function CalibrationDataDownload({
}
return (
- <>
- {enableCalibrationWizards && !isOT3 ? (
-
-
-
-
- {t('robot_calibration:download_calibration_title')}
-
-
- {t(
- downloadIsPossible
- ? 'robot_calibration:download_calibration_data_available'
- : 'robot_calibration:download_calibration_data_unavailable'
- )}
-
-
-
-
-
- {t('download_calibration_data')}
-
-
-
-
- ) : (
-
-
-
-
- {t('about_calibration_title')}
-
-
- {isOT3
- ? t('about_calibration_description_ot3')
- : t('about_calibration_description')}
-
- setShowHowCalibrationWorksModal(true)}
- >
- {t('robot_calibration:see_how_robot_calibration_works')}
-
-
-
+
+
+ {isOT3
+ ? t('about_calibration_title')
+ : t('robot_calibration:download_calibration_title')}
+
+ {isOT3 ? (
+ <>
+ ,
+ }}
+ />
+
-
-
- {t('download_calibration_data')}
-
-
-
-
- )}
- >
+ {t('robot_calibration:see_how_robot_calibration_works')}
+
+ >
+ ) : (
+
+ {t(
+ downloadIsPossible
+ ? 'robot_calibration:download_calibration_data_available'
+ : 'robot_calibration:download_calibration_data_unavailable'
+ )}
+
+ )}
+
+
+
+
+ {t('download_calibration_data')}
+
+
+