diff --git a/app/src/molecules/PythonLabwareOffsetSnippet/createSnippet.ts b/app/src/molecules/PythonLabwareOffsetSnippet/createSnippet.ts index 7446158b52c..b63180628ef 100644 --- a/app/src/molecules/PythonLabwareOffsetSnippet/createSnippet.ts +++ b/app/src/molecules/PythonLabwareOffsetSnippet/createSnippet.ts @@ -1,8 +1,11 @@ import isEqual from 'lodash/isEqual' import { getLoadedLabwareDefinitionsByUri } from '@opentrons/shared-data' -import { getLabwareDefinitionUri } from '../../organisms/Devices/ProtocolRun/utils/getLabwareDefinitionUri' +import { + getLabwareDefinitionUri, + getLabwareOffsetLocation, +} from '../../organisms/Devices/ProtocolRun/utils' import { LabwareOffset } from '@opentrons/api-client' -import { getLabwareOffsetLocation } from '../../organisms/Devices/ProtocolRun/utils/getLabwareOffsetLocation' + import type { LoadedLabware, LoadedModule, diff --git a/app/src/organisms/Devices/ProtocolRun/ProtocolRunSetup.tsx b/app/src/organisms/Devices/ProtocolRun/ProtocolRunSetup.tsx index ab5fdaffd3c..d37858046c0 100644 --- a/app/src/organisms/Devices/ProtocolRun/ProtocolRunSetup.tsx +++ b/app/src/organisms/Devices/ProtocolRun/ProtocolRunSetup.tsx @@ -75,6 +75,7 @@ export function ProtocolRunSetup({ const storedProtocolAnalysis = useStoredProtocolAnalysis(runId) const protocolData = robotProtocolAnalysis ?? storedProtocolAnalysis const modules = parseAllRequiredModuleModels(protocolData?.commands ?? []) + const protocolAnalysis = robotProtocolAnalysis ?? storedProtocolAnalysis // TODO(Jr, 10/4/23): stubbed in the fixtures for now - delete IMMEDIATELY // const loadedFixturesBySlot = parseInitialLoadedFixturesByCutout( @@ -251,6 +252,7 @@ export function ProtocolRunSetup({ protocolRunHeaderRef={protocolRunHeaderRef} robotName={robotName} runId={runId} + protocolAnalysis={protocolAnalysis} /> ), description: hasLiquids diff --git a/app/src/organisms/Devices/ProtocolRun/SetupLabware/LabwareListItem.tsx b/app/src/organisms/Devices/ProtocolRun/SetupLabware/LabwareListItem.tsx index d91a0673d32..920ed8d4508 100644 --- a/app/src/organisms/Devices/ProtocolRun/SetupLabware/LabwareListItem.tsx +++ b/app/src/organisms/Devices/ProtocolRun/SetupLabware/LabwareListItem.tsx @@ -48,7 +48,7 @@ import type { } from '@opentrons/shared-data' import type { ModuleRenderInfoForProtocol } from '../../hooks' import type { LabwareSetupItem } from '../../../../pages/Protocols/utils' -import type { ModuleTypesThatRequireExtraAttention } from '../utils/getModuleTypesThatRequireExtraAttention' +import type { ModuleTypesThatRequireExtraAttention } from '../utils' import type { NestedLabwareInfo } from './getNestedLabwareInfo' const LabwareRow = styled.div` diff --git a/app/src/organisms/Devices/ProtocolRun/SetupLabware/SecureLabwareModal.tsx b/app/src/organisms/Devices/ProtocolRun/SetupLabware/SecureLabwareModal.tsx index ee62dc134b9..3ef0b935e3c 100644 --- a/app/src/organisms/Devices/ProtocolRun/SetupLabware/SecureLabwareModal.tsx +++ b/app/src/organisms/Devices/ProtocolRun/SetupLabware/SecureLabwareModal.tsx @@ -16,9 +16,9 @@ import { StyledText } from '../../../../atoms/text' import { LegacyModal } from '../../../../molecules/LegacyModal' import secureMagModBracketImage from '../../../../assets/images/secure_mag_mod_bracket.png' import secureTCLatchImage from '../../../../assets/images/secure_tc_latch.png' -import { getModuleName } from '../utils/getModuleName' +import { getModuleName } from '../utils' -import type { ModuleTypesThatRequireExtraAttention } from '../utils/getModuleTypesThatRequireExtraAttention' +import type { ModuleTypesThatRequireExtraAttention } from '../utils' interface SecureLabwareModalProps { onCloseClick: () => unknown diff --git a/app/src/organisms/Devices/ProtocolRun/SetupLabware/SetupLabwareList.tsx b/app/src/organisms/Devices/ProtocolRun/SetupLabware/SetupLabwareList.tsx index b45ed5ba84e..6073058b102 100644 --- a/app/src/organisms/Devices/ProtocolRun/SetupLabware/SetupLabwareList.tsx +++ b/app/src/organisms/Devices/ProtocolRun/SetupLabware/SetupLabwareList.tsx @@ -15,7 +15,7 @@ import { OffDeckLabwareList } from './OffDeckLabwareList' import { getNestedLabwareInfo } from './getNestedLabwareInfo' import type { ModuleRenderInfoForProtocol } from '../../hooks' -import type { ModuleTypesThatRequireExtraAttention } from '../utils/getModuleTypesThatRequireExtraAttention' +import type { ModuleTypesThatRequireExtraAttention } from '../utils' const HeaderRow = styled.div` display: grid; diff --git a/app/src/organisms/Devices/ProtocolRun/SetupLabware/SetupLabwareMap.tsx b/app/src/organisms/Devices/ProtocolRun/SetupLabware/SetupLabwareMap.tsx index 0225ff8e575..59bce7ac63c 100644 --- a/app/src/organisms/Devices/ProtocolRun/SetupLabware/SetupLabwareMap.tsx +++ b/app/src/organisms/Devices/ProtocolRun/SetupLabware/SetupLabwareMap.tsx @@ -21,8 +21,7 @@ import { getDeckConfigFromProtocolCommands } from '../../../../resources/deck_co import { getAttachedProtocolModuleMatches } from '../../../ProtocolSetupModulesAndDeck/utils' import { useAttachedModules } from '../../hooks' import { LabwareInfoOverlay } from '../LabwareInfoOverlay' -import { getLabwareRenderInfo } from '../utils/getLabwareRenderInfo' -import { getProtocolModulesInfo } from '../utils/getProtocolModulesInfo' +import { getLabwareRenderInfo, getProtocolModulesInfo } from '../utils' import { getStandardDeckViewLayerBlockList } from '../utils/getStandardDeckViewLayerBlockList' import { OffDeckLabwareList } from './OffDeckLabwareList' diff --git a/app/src/organisms/Devices/ProtocolRun/SetupLabware/__tests__/SetupLabware.test.tsx b/app/src/organisms/Devices/ProtocolRun/SetupLabware/__tests__/SetupLabware.test.tsx index 8707dbf854a..e2656939d63 100644 --- a/app/src/organisms/Devices/ProtocolRun/SetupLabware/__tests__/SetupLabware.test.tsx +++ b/app/src/organisms/Devices/ProtocolRun/SetupLabware/__tests__/SetupLabware.test.tsx @@ -7,7 +7,7 @@ import { renderWithProviders } from '@opentrons/components' import { i18n } from '../../../../../i18n' import { useLPCSuccessToast } from '../../../hooks/useLPCSuccessToast' import { LabwarePositionCheck } from '../../../../LabwarePositionCheck' -import { getModuleTypesThatRequireExtraAttention } from '../../utils/getModuleTypesThatRequireExtraAttention' +import { getModuleTypesThatRequireExtraAttention } from '../../utils' import { getIsLabwareOffsetCodeSnippetsOn } from '../../../../../redux/config' import { useLPCDisabledReason, diff --git a/app/src/organisms/Devices/ProtocolRun/SetupLabware/index.tsx b/app/src/organisms/Devices/ProtocolRun/SetupLabware/index.tsx index 6ee3657de84..7fb66730c99 100644 --- a/app/src/organisms/Devices/ProtocolRun/SetupLabware/index.tsx +++ b/app/src/organisms/Devices/ProtocolRun/SetupLabware/index.tsx @@ -9,7 +9,7 @@ import { DIRECTION_COLUMN, } from '@opentrons/components' import { useToggleGroup } from '../../../../molecules/ToggleGroup/useToggleGroup' -import { getModuleTypesThatRequireExtraAttention } from '../utils/getModuleTypesThatRequireExtraAttention' +import { getModuleTypesThatRequireExtraAttention } from '../utils' import { useMostRecentCompletedAnalysis } from '../../../LabwarePositionCheck/useMostRecentCompletedAnalysis' import { useIsFlex, diff --git a/app/src/organisms/Devices/ProtocolRun/SetupLabwarePositionCheck/__tests__/SetupLabwarePositionCheck.test.tsx b/app/src/organisms/Devices/ProtocolRun/SetupLabwarePositionCheck/__tests__/SetupLabwarePositionCheck.test.tsx index 86204d8623d..6eb13a81b4e 100644 --- a/app/src/organisms/Devices/ProtocolRun/SetupLabwarePositionCheck/__tests__/SetupLabwarePositionCheck.test.tsx +++ b/app/src/organisms/Devices/ProtocolRun/SetupLabwarePositionCheck/__tests__/SetupLabwarePositionCheck.test.tsx @@ -11,7 +11,7 @@ import { useProtocolAnalysisAsDocumentQuery, } from '@opentrons/react-api-client' import { useLPCSuccessToast } from '../../../hooks/useLPCSuccessToast' -import { getModuleTypesThatRequireExtraAttention } from '../../utils/getModuleTypesThatRequireExtraAttention' +import { getModuleTypesThatRequireExtraAttention } from '../../utils' import { useLaunchLPC } from '../../../../LabwarePositionCheck/useLaunchLPC' import { getIsLabwareOffsetCodeSnippetsOn } from '../../../../../redux/config' import { diff --git a/app/src/organisms/Devices/ProtocolRun/SetupLiquids/LiquidsLabwareDetailsModal.tsx b/app/src/organisms/Devices/ProtocolRun/SetupLiquids/LiquidsLabwareDetailsModal.tsx index b53936add28..b2e400dc0db 100644 --- a/app/src/organisms/Devices/ProtocolRun/SetupLiquids/LiquidsLabwareDetailsModal.tsx +++ b/app/src/organisms/Devices/ProtocolRun/SetupLiquids/LiquidsLabwareDetailsModal.tsx @@ -21,8 +21,7 @@ import { getIsOnDevice } from '../../../../redux/config' import { useMostRecentCompletedAnalysis } from '../../../LabwarePositionCheck/useMostRecentCompletedAnalysis' import { LegacyModal } from '../../../../molecules/LegacyModal' import { StyledText } from '../../../../atoms/text' -import { getLocationInfoNames } from '../utils/getLocationInfoNames' -import { getSlotLabwareDefinition } from '../utils/getSlotLabwareDefinition' +import { getLocationInfoNames, getSlotLabwareDefinition } from '../utils' import { LiquidDetailCard } from './LiquidDetailCard' import { getLiquidsByIdForLabware, diff --git a/app/src/organisms/Devices/ProtocolRun/SetupLiquids/SetupLiquidsMap.tsx b/app/src/organisms/Devices/ProtocolRun/SetupLiquids/SetupLiquidsMap.tsx index 5bc7e4eb54f..0de0ec9cd84 100644 --- a/app/src/organisms/Devices/ProtocolRun/SetupLiquids/SetupLiquidsMap.tsx +++ b/app/src/organisms/Devices/ProtocolRun/SetupLiquids/SetupLiquidsMap.tsx @@ -7,208 +7,215 @@ import { parseInitialLoadedLabwareByAdapter, } from '@opentrons/api-client' import { + ALIGN_CENTER, + BaseDeck, DIRECTION_COLUMN, Flex, - RobotWorkSpace, - SlotLabels, + JUSTIFY_CENTER, LabwareRender, Module, - ALIGN_CENTER, - JUSTIFY_CENTER, + SlotLabels, } from '@opentrons/components' import { getDeckDefFromRobotType, inferModuleOrientationFromXCoordinate, THERMOCYCLER_MODULE_V1, + getRobotTypeFromLoadedLabware, } from '@opentrons/shared-data' -import { - useLabwareRenderInfoForRunById, - useModuleRenderInfoForProtocolById, - useProtocolDetailsForRun, -} from '../../hooks' -import { useMostRecentCompletedAnalysis } from '../../../LabwarePositionCheck/useMostRecentCompletedAnalysis' +import { useAttachedModules } from '../../hooks' import { LabwareInfoOverlay } from '../LabwareInfoOverlay' -import { getStandardDeckViewLayerBlockList } from '../utils/getStandardDeckViewLayerBlockList' +import { + getLabwareRenderInfo, + getStandardDeckViewLayerBlockList, + getProtocolModulesInfo, +} from '../utils' +import { getDeckConfigFromProtocolCommands } from '../../../../resources/deck_configuration/utils' import { LiquidsLabwareDetailsModal } from './LiquidsLabwareDetailsModal' import { getWellFillFromLabwareId } from './utils' -import type { RobotType } from '@opentrons/shared-data' +import { getAttachedProtocolModuleMatches } from '../../../ProtocolSetupModulesAndDeck/utils' -const OT2_VIEWBOX = '-80 -40 550 500' -const OT3_VIEWBOX = '-144.31 -76.59 750 681.74' +import type { + CompletedProtocolAnalysis, + ProtocolAnalysisOutput, +} from '@opentrons/shared-data' + +const ATTACHED_MODULE_POLL_MS = 5000 -const getViewBox = (robotType: RobotType): string | null => { - switch (robotType) { - case 'OT-2 Standard': - return OT2_VIEWBOX - case 'OT-3 Standard': - return OT3_VIEWBOX - default: - return null - } -} interface SetupLiquidsMapProps { runId: string robotName: string + protocolAnalysis: CompletedProtocolAnalysis | ProtocolAnalysisOutput | null } -export function SetupLiquidsMap(props: SetupLiquidsMapProps): JSX.Element { - const { runId, robotName } = props +export function SetupLiquidsMap({ + runId, + robotName, + protocolAnalysis, +}: SetupLiquidsMapProps): JSX.Element | null { const [hoverLabwareId, setHoverLabwareId] = React.useState('') - const moduleRenderInfoById = useModuleRenderInfoForProtocolById( - robotName, - runId - ) - const labwareRenderInfoById = useLabwareRenderInfoForRunById(runId) - const { robotType } = useProtocolDetailsForRun(runId) - const protocolData = useMostRecentCompletedAnalysis(runId) + const attachedModules = + useAttachedModules({ + refetchInterval: ATTACHED_MODULE_POLL_MS, + }) ?? [] + const [liquidDetailsLabwareId, setLiquidDetailsLabwareId] = React.useState< + string | null + >(null) + + if (protocolAnalysis == null) return null + const robotType = getRobotTypeFromLoadedLabware(protocolAnalysis?.labware) + const liquids = parseLiquidsInLoadOrder( - protocolData?.liquids != null ? protocolData?.liquids : [], - protocolData?.commands ?? [] + protocolAnalysis.liquids != null ? protocolAnalysis.liquids : [], + protocolAnalysis.commands ) const initialLoadedLabwareByAdapter = parseInitialLoadedLabwareByAdapter( - protocolData?.commands ?? [] + protocolAnalysis.commands ) const deckDef = getDeckDefFromRobotType(robotType) const labwareByLiquidId = parseLabwareInfoByLiquidId( - protocolData?.commands ?? [] + protocolAnalysis.commands ) - const [liquidDetailsLabwareId, setLiquidDetailsLabwareId] = React.useState< - string | null - >(null) + + const deckConfig = getDeckConfigFromProtocolCommands( + protocolAnalysis.commands + ) + const labwareRenderInfo = getLabwareRenderInfo(protocolAnalysis, deckDef) + const protocolModulesInfo = getProtocolModulesInfo(protocolAnalysis, deckDef) + const attachedProtocolModuleMatches = getAttachedProtocolModuleMatches( + attachedModules, + protocolModulesInfo + ) + const labwareLocations = map( + labwareRenderInfo, + ({ labwareDef, displayName, slotName }, labwareId) => { + const labwareInAdapter = initialLoadedLabwareByAdapter[labwareId] + const topLabwareDefinition = + labwareInAdapter?.result?.definition ?? labwareDef + const topLabwareId = labwareInAdapter?.result?.labwareId ?? labwareId + const topLabwareDisplayName = + labwareInAdapter?.params.displayName ?? displayName + + return { + labwareLocation: { slotName }, + definition: topLabwareDefinition, + topLabwareDisplayName, + labwareChildren: ( + + ), + } + } + ) + + const moduleLocations = attachedProtocolModuleMatches.map(module => { + const labwareInAdapterInMod = + module.nestedLabwareId != null + ? initialLoadedLabwareByAdapter[module.nestedLabwareId] + : null + const topLabwareDefinition = + labwareInAdapterInMod?.result?.definition ?? module.nestedLabwareDef + const topLabwareId = + labwareInAdapterInMod?.result?.labwareId ?? module.nestedLabwareId + const topLabwareDisplayName = + labwareInAdapterInMod?.params.displayName ?? + module.nestedLabwareDisplayName + + return { + moduleModel: module.moduleDef.model, + moduleLocation: { slotName: module.slotName }, + innerProps: + module.moduleDef.model === THERMOCYCLER_MODULE_V1 + ? { lidMotorState: 'open' } + : {}, + nestedLabwareDef: topLabwareDefinition, + moduleChildren: ( + <> + {topLabwareDefinition != null && topLabwareId != null ? ( + + ) : null} + + ), + } + }) return ( - - {() => ( - <> - {map( - moduleRenderInfoById, - ({ - x, - y, - moduleDef, - nestedLabwareDef, - nestedLabwareId, - nestedLabwareDisplayName, - moduleId, - }) => { - const labwareInAdapterInMod = - nestedLabwareId != null - ? initialLoadedLabwareByAdapter[nestedLabwareId] - : null - // only rendering the labware on top most layer so - // either the adapter or the labware are rendered but not both - const topLabwareDefinition = - labwareInAdapterInMod?.result?.definition ?? nestedLabwareDef - const topLabwareId = - labwareInAdapterInMod?.result?.labwareId ?? nestedLabwareId - const topLabwareDisplayName = - labwareInAdapterInMod?.params.displayName ?? - nestedLabwareDisplayName + {map( + protocolModulesInfo, + ({ + x, + y, + moduleDef, + nestedLabwareDef, + nestedLabwareId, + nestedLabwareDisplayName, + moduleId, + }) => { + const labwareInAdapterInMod = + nestedLabwareId != null + ? initialLoadedLabwareByAdapter[nestedLabwareId] + : null + // only rendering the labware on top most layer so + // either the adapter or the labware are rendered but not both + const topLabwareDefinition = + labwareInAdapterInMod?.result?.definition ?? nestedLabwareDef + const topLabwareId = + labwareInAdapterInMod?.result?.labwareId ?? nestedLabwareId + const topLabwareDisplayName = + labwareInAdapterInMod?.params.displayName ?? + nestedLabwareDisplayName - const wellFill = getWellFillFromLabwareId( - topLabwareId ?? '', - liquids, - labwareByLiquidId - ) - const labwareHasLiquid = !isEmpty(wellFill) + const wellFill = getWellFillFromLabwareId( + topLabwareId ?? '', + liquids, + labwareByLiquidId + ) + const labwareHasLiquid = !isEmpty(wellFill) - return ( - - {topLabwareDefinition != null && - topLabwareDisplayName != null && - topLabwareId != null ? ( - - setHoverLabwareId(topLabwareId)} - onMouseLeave={() => setHoverLabwareId('')} - onClick={() => - labwareHasLiquid - ? setLiquidDetailsLabwareId(topLabwareId) - : null - } - cursor={labwareHasLiquid ? 'pointer' : ''} - > - - - - - ) : null} - - ) - } - )} - {map( - labwareRenderInfoById, - ({ x, y, labwareDef, displayName }, labwareId) => { - const labwareInAdapter = - initialLoadedLabwareByAdapter[labwareId] - // only rendering the labware on top most layer so - // either the adapter or the labware are rendered but not both - const topLabwareDefinition = - labwareInAdapter?.result?.definition ?? labwareDef - const topLabwareId = - labwareInAdapter?.result?.labwareId ?? labwareId - const topLabwareDisplayName = - labwareInAdapter?.params.displayName ?? displayName - const wellFill = getWellFillFromLabwareId( - topLabwareId ?? '', - liquids, - labwareByLiquidId - ) - const labwareHasLiquid = !isEmpty(wellFill) - return ( + return ( + + {topLabwareDefinition != null && + topLabwareDisplayName != null && + topLabwareId != null ? ( setHoverLabwareId(topLabwareId)} onMouseLeave={() => setHoverLabwareId('')} onClick={() => @@ -220,26 +227,81 @@ export function SetupLiquidsMap(props: SetupLiquidsMapProps): JSX.Element { > - ) - } - )} - - + ) : null} + + ) + } + )} + {map( + labwareRenderInfo, + ({ x, y, labwareDef, displayName }, labwareId) => { + const labwareInAdapter = initialLoadedLabwareByAdapter[labwareId] + // only rendering the labware on top most layer so + // either the adapter or the labware are rendered but not both + const topLabwareDefinition = + labwareInAdapter?.result?.definition ?? labwareDef + const topLabwareId = + labwareInAdapter?.result?.labwareId ?? labwareId + const topLabwareDisplayName = + labwareInAdapter?.params.displayName ?? displayName + const wellFill = getWellFillFromLabwareId( + topLabwareId ?? '', + liquids, + labwareByLiquidId + ) + const labwareHasLiquid = !isEmpty(wellFill) + return ( + + setHoverLabwareId(topLabwareId)} + onMouseLeave={() => setHoverLabwareId('')} + onClick={() => + labwareHasLiquid + ? setLiquidDetailsLabwareId(topLabwareId) + : null + } + cursor={labwareHasLiquid ? 'pointer' : ''} + > + + + + + ) + } )} - + + {liquidDetailsLabwareId != null && ( ) => { return renderWithProviders( - , + , { i18nInstance: i18n, } @@ -47,13 +54,13 @@ describe('SetupLiquids', () => { it('renders the map view when you press that toggle button', () => { const [{ getByRole, getByText }] = render(props) const mapViewButton = getByRole('button', { name: 'Map View' }) - fireEvent.click(mapViewButton) + mapViewButton.click() getByText('Mock setup liquids map') }) it('renders the list view when you press that toggle button', () => { const [{ getByRole, getByText }] = render(props) const mapViewButton = getByRole('button', { name: 'List View' }) - fireEvent.click(mapViewButton) + mapViewButton.click() getByText('Mock setup liquids list') }) }) diff --git a/app/src/organisms/Devices/ProtocolRun/SetupLiquids/__tests__/SetupLiquidsList.test.tsx b/app/src/organisms/Devices/ProtocolRun/SetupLiquids/__tests__/SetupLiquidsList.test.tsx index 726683aedf4..1cab408bc05 100644 --- a/app/src/organisms/Devices/ProtocolRun/SetupLiquids/__tests__/SetupLiquidsList.test.tsx +++ b/app/src/organisms/Devices/ProtocolRun/SetupLiquids/__tests__/SetupLiquidsList.test.tsx @@ -16,7 +16,7 @@ import { ANALYTICS_EXPAND_LIQUID_SETUP_ROW, ANALYTICS_OPEN_LIQUID_LABWARE_DETAIL_MODAL, } from '../../../../../redux/analytics' -import { getLocationInfoNames } from '../../utils/getLocationInfoNames' +import { getLocationInfoNames } from '../../utils' import { SetupLiquidsList } from '../SetupLiquidsList' import { getTotalVolumePerLiquidId, diff --git a/app/src/organisms/Devices/ProtocolRun/SetupLiquids/__tests__/SetupLiquidsMap.test.tsx b/app/src/organisms/Devices/ProtocolRun/SetupLiquids/__tests__/SetupLiquidsMap.test.tsx index 51ded61559c..3e2abf65de1 100644 --- a/app/src/organisms/Devices/ProtocolRun/SetupLiquids/__tests__/SetupLiquidsMap.test.tsx +++ b/app/src/organisms/Devices/ProtocolRun/SetupLiquids/__tests__/SetupLiquidsMap.test.tsx @@ -1,39 +1,72 @@ import * as React from 'react' import { when, resetAllWhenMocks } from 'jest-when' -import { i18n } from '../../../../../i18n' + import { - renderWithProviders, - partialComponentPropsMatcher, - RobotWorkSpace, + BaseDeck, + EXTENDED_DECK_CONFIG_FIXTURE, LabwareRender, Module, + partialComponentPropsMatcher, + renderWithProviders, } from '@opentrons/components' import { + FLEX_ROBOT_TYPE, + getDeckDefFromRobotType, inferModuleOrientationFromXCoordinate, - LabwareDefinition2, - ModuleModel, - ModuleType, } from '@opentrons/shared-data' import fixture_tiprack_300_ul from '@opentrons/shared-data/labware/fixtures/2/fixture_tiprack_300_ul.json' -import standardDeckDef from '@opentrons/shared-data/deck/definitions/3/ot2_standard.json' +// import standardDeckDef from '@opentrons/shared-data/deck/definitions/3/ot2_standard.json' +import ot3StandardDeckDef from '@opentrons/shared-data/deck/definitions/3/ot3_standard.json' +import { + parseInitialLoadedLabwareByAdapter, + parseLabwareInfoByLiquidId, + parseLiquidsInLoadOrder, + simpleAnalysisFileFixture, +} from '@opentrons/api-client' + +import { i18n } from '../../../../../i18n' import { + useAttachedModules, useLabwareRenderInfoForRunById, useModuleRenderInfoForProtocolById, useProtocolDetailsForRun, } from '../../../hooks' import { getWellFillFromLabwareId } from '../utils' -import { SetupLiquidsMap } from '../SetupLiquidsMap' import { LabwareInfoOverlay } from '../../LabwareInfoOverlay' +import { + getLabwareRenderInfo, + getStandardDeckViewLayerBlockList, + getProtocolModulesInfo, +} from '../../utils' +import { getAttachedProtocolModuleMatches } from '../../../../ProtocolSetupModulesAndDeck/utils' +import { getDeckConfigFromProtocolCommands } from '../../../../../resources/deck_configuration/utils' +import { mockProtocolModuleInfo } from '../../../../ProtocolSetupInstruments/__fixtures__' +import { mockFetchModulesSuccessActionPayloadModules } from '../../../../../redux/modules/__fixtures__' +import { SetupLiquidsMap } from '../SetupLiquidsMap' -jest.mock('@opentrons/components', () => { +import type { + LabwareDefinition2, + ModuleModel, + ModuleType, +} from '@opentrons/shared-data' + +jest.mock('@opentrons/components/src/hardware-sim/Module', () => { const actualComponents = jest.requireActual('@opentrons/components') return { ...actualComponents, Module: jest.fn(() =>
mock Module
), - RobotWorkSpace: jest.fn(() =>
mock RobotWorkSpace
), - LabwareRender: jest.fn(() =>
mock LabwareRender
), } }) +jest.mock( + '@opentrons/components/src/hardware-sim/Labware/LabwareRender', + () => { + const actualComponents = jest.requireActual('@opentrons/components') + return { + ...actualComponents, + LabwareRender: jest.fn(() =>
mock LabwareRender
), + } + } +) jest.mock('@opentrons/shared-data', () => { const actualSharedData = jest.requireActual('@opentrons/shared-data') return { @@ -41,9 +74,15 @@ jest.mock('@opentrons/shared-data', () => { inferModuleOrientationFromXCoordinate: jest.fn(), } }) +jest.mock('@opentrons/api-client') +jest.mock('@opentrons/components/src/hardware-sim/BaseDeck') +jest.mock('@opentrons/shared-data/js/helpers') jest.mock('../../LabwareInfoOverlay') jest.mock('../../../hooks') jest.mock('../utils') +jest.mock('../../utils') +jest.mock('../../../../ProtocolSetupModulesAndDeck/utils') +jest.mock('../../../../../resources/deck_configuration/utils') const mockUseProtocolDetailsForRun = useProtocolDetailsForRun as jest.MockedFunction< typeof useProtocolDetailsForRun @@ -55,9 +94,6 @@ const mockModule = Module as jest.MockedFunction const mockInferModuleOrientationFromXCoordinate = inferModuleOrientationFromXCoordinate as jest.MockedFunction< typeof inferModuleOrientationFromXCoordinate > -const mockRobotWorkSpace = RobotWorkSpace as jest.MockedFunction< - typeof RobotWorkSpace -> const mockLabwareRender = LabwareRender as jest.MockedFunction< typeof LabwareRender > @@ -70,13 +106,44 @@ const mockUseModuleRenderInfoForProtocolById = useModuleRenderInfoForProtocolByI const mockGetWellFillFromLabwareId = getWellFillFromLabwareId as jest.MockedFunction< typeof getWellFillFromLabwareId > +const mockGetDeckDefFromRobotType = getDeckDefFromRobotType as jest.MockedFunction< + typeof getDeckDefFromRobotType +> +const mockGetLabwareRenderInfo = getLabwareRenderInfo as jest.MockedFunction< + typeof getLabwareRenderInfo +> +const mockGetProtocolModulesInfo = getProtocolModulesInfo as jest.MockedFunction< + typeof getProtocolModulesInfo +> +const mockGetAttachedProtocolModuleMatches = getAttachedProtocolModuleMatches as jest.MockedFunction< + typeof getAttachedProtocolModuleMatches +> +const mockUseAttachedModules = useAttachedModules as jest.MockedFunction< + typeof useAttachedModules +> +const mockParseInitialLoadedLabwareByAdapter = parseInitialLoadedLabwareByAdapter as jest.MockedFunction< + typeof parseInitialLoadedLabwareByAdapter +> +const mockParseLabwareInfoByLiquidId = parseLabwareInfoByLiquidId as jest.MockedFunction< + typeof parseLabwareInfoByLiquidId +> +const mockParseLiquidsInLoadOrder = parseLiquidsInLoadOrder as jest.MockedFunction< + typeof parseLiquidsInLoadOrder +> +const mockGetDeckConfigFromProtocolCommands = getDeckConfigFromProtocolCommands as jest.MockedFunction< + typeof getDeckConfigFromProtocolCommands +> +const mockGetStandardDeckViewLayerBlockList = getStandardDeckViewLayerBlockList as jest.MockedFunction< + typeof getStandardDeckViewLayerBlockList +> +const mockBaseDeck = BaseDeck as jest.MockedFunction const MOCK_WELL_FILL = { C1: '#ff4888', C2: '#ff4888' } -const deckSlotsById = standardDeckDef.locations.orderedSlots.reduce( - (acc, deckSlot) => ({ ...acc, [deckSlot.id]: deckSlot }), - {} -) +// const deckSlotsById = standardDeckDef.locations.orderedSlots.reduce( +// (acc, deckSlot) => ({ ...acc, [deckSlot.id]: deckSlot }), +// {} +// ) const ROBOT_NAME = 'otie' const RUN_ID = '1' @@ -85,6 +152,7 @@ const MOCK_300_UL_TIPRACK_ID = '300_ul_tiprack_id' const MOCK_MAGNETIC_MODULE_COORDS = [10, 20, 0] const MOCK_TC_COORDS = [20, 30, 0] const MOCK_300_UL_TIPRACK_COORDS = [30, 40, 0] +const MOCK_SECOND_MAGNETIC_MODULE_COORDS = [100, 200, 0] const mockMagneticModule = { moduleId: 'someMagneticModule', @@ -106,6 +174,29 @@ const mockMagneticModule = { quirks: [], } +const mockLabwareLocations = [ + { + labwareLocation: { slotName: '1' }, + definition: fixture_tiprack_300_ul as LabwareDefinition2, + topLabwareId: '300_ul_tiprack_id', + topLabwareDisplayName: 'fresh tips', + }, +] +const mockModuleLocations = [ + { + moduleModel: 'magneticModuleV2', + moduleLocation: { slotName: '1' }, + innerProps: {}, + nestedLabwareDef: null, + }, + { + moduleModel: 'magneticModuleV2', + moduleLocation: { slotName: '2' }, + innerProps: {}, + nestedLabwareDef: null, + }, +] + const mockTCModule = { labwareOffset: { x: 3, y: 3, z: 3 }, moduleId: 'TCModuleId', @@ -113,6 +204,17 @@ const mockTCModule = { type: 'thermocyclerModuleType' as ModuleType, } +const mockLabwareRenderInfoById = { + [MOCK_300_UL_TIPRACK_ID]: { + labwareDef: fixture_tiprack_300_ul as LabwareDefinition2, + displayName: 'fresh tips', + x: MOCK_300_UL_TIPRACK_COORDS[0], + y: MOCK_300_UL_TIPRACK_COORDS[1], + z: MOCK_300_UL_TIPRACK_COORDS[2], + slotName: '1', + }, +} + const render = (props: React.ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, @@ -122,7 +224,11 @@ const render = (props: React.ComponentProps) => { describe('SetupLiquidsMap', () => { let props: React.ComponentProps beforeEach(() => { - props = { runId: RUN_ID, robotName: ROBOT_NAME } + props = { + runId: RUN_ID, + robotName: ROBOT_NAME, + protocolAnalysis: null, + } when(mockInferModuleOrientationFromXCoordinate) .calledWith(expect.anything()) .mockReturnValue(STUBBED_ORIENTATION_VALUE) @@ -163,23 +269,23 @@ describe('SetupLiquidsMap', () => { .calledWith(partialComponentPropsMatcher({ labwareHasLiquid: true })) .mockReturnValue(
mock labware overlay with liquid
) - when(mockRobotWorkSpace) - .mockReturnValue(
) // this (default) empty div will be returned when RobotWorkSpace isn't called with expected props - .calledWith( - partialComponentPropsMatcher({ - deckDef: standardDeckDef, - children: expect.anything(), - }) - ) - .mockImplementation(({ children }) => ( - - {/* @ts-expect-error children won't be null since we checked for expect.anything() above */} - {children({ - deckSlotsById, - getRobotCoordsFromDOMCoords: {} as any, - })} - - )) + // For BaseDeck + when(mockParseInitialLoadedLabwareByAdapter) + .calledWith(simpleAnalysisFileFixture.commands as any) + .mockReturnValue({}) + when(mockParseLabwareInfoByLiquidId) + .calledWith(simpleAnalysisFileFixture.commands as any) + .mockReturnValue({}) + when(mockParseLiquidsInLoadOrder).calledWith( + simpleAnalysisFileFixture.liquids as any, + simpleAnalysisFileFixture.commands as any + ) + when(mockGetDeckConfigFromProtocolCommands) + .calledWith(simpleAnalysisFileFixture.commands as any) + .mockReturnValue(EXTENDED_DECK_CONFIG_FIXTURE) + mockUseAttachedModules.mockReturnValue( + mockFetchModulesSuccessActionPayloadModules + ) when(mockUseProtocolDetailsForRun) .calledWith(RUN_ID) .mockReturnValue({ @@ -201,10 +307,81 @@ describe('SetupLiquidsMap', () => { ], labwareDefinitions: {}, commands: [], + robotType: FLEX_ROBOT_TYPE, }, } as any) }) - afterEach(() => resetAllWhenMocks()) + when(mockGetDeckDefFromRobotType) + .calledWith(FLEX_ROBOT_TYPE) + .mockReturnValue(ot3StandardDeckDef as any) + when(mockGetLabwareRenderInfo) + .calledWith(simpleAnalysisFileFixture as any, ot3StandardDeckDef as any) + .mockReturnValue(mockLabwareRenderInfoById) + + // when(mockGetProtocolModulesInfo) + // .calledWith(simpleAnalysisFileFixture as any, ot3StandardDeckDef as any) + // .mockReturnValue(mockProtocolModuleInfo) + mockGetProtocolModulesInfo.mockReturnValue(mockProtocolModuleInfo) + when(mockGetAttachedProtocolModuleMatches) + .calledWith( + mockFetchModulesSuccessActionPayloadModules, + mockProtocolModuleInfo + ) + .mockReturnValue([ + { + moduleId: mockMagneticModule.moduleId, + x: MOCK_MAGNETIC_MODULE_COORDS[0], + y: MOCK_MAGNETIC_MODULE_COORDS[1], + z: MOCK_MAGNETIC_MODULE_COORDS[2], + moduleDef: mockMagneticModule as any, + nestedLabwareDef: null, + nestedLabwareDisplayName: null, + nestedLabwareId: null, + slotName: '1', + protocolLoadOrder: 1, + attachedModuleMatch: null, + }, + { + moduleId: mockMagneticModule.moduleId, + x: MOCK_SECOND_MAGNETIC_MODULE_COORDS[0], + y: MOCK_SECOND_MAGNETIC_MODULE_COORDS[1], + z: MOCK_SECOND_MAGNETIC_MODULE_COORDS[2], + moduleDef: mockMagneticModule as any, + nestedLabwareDef: null, + nestedLabwareDisplayName: null, + nestedLabwareId: null, + slotName: '1', + protocolLoadOrder: 0, + attachedModuleMatch: null, + }, + ]) + + when(mockGetStandardDeckViewLayerBlockList) + .calledWith(FLEX_ROBOT_TYPE) + .mockReturnValue([ + 'DECK_BASE', + 'BARCODE_COVERS', + 'SLOT_SCREWS', + 'SLOT_10_EXPANSION', + 'CALIBRATION_CUTOUTS', + ]) + + when(mockBaseDeck) + .calledWith( + partialComponentPropsMatcher({ + robotType: FLEX_ROBOT_TYPE, + deckLayerBlocklist: getStandardDeckViewLayerBlockList(FLEX_ROBOT_TYPE), + deckConfig: EXTENDED_DECK_CONFIG_FIXTURE, + labwareLocations: mockLabwareLocations, + moduleLocations: mockModuleLocations as any, + }) + ) + .mockReturnValue(
mock BaseDeck
) + + afterEach(() => { + resetAllWhenMocks() + jest.clearAllMocks() + }) it('should render a deck WITHOUT labware and WITHOUT modules', () => { when(mockUseLabwareRenderInfoForRunById) @@ -220,10 +397,14 @@ describe('SetupLiquidsMap', () => { expect(mockLabwareInfoOverlay).not.toHaveBeenCalled() }) it('should render a deck WITH labware and WITHOUT modules', () => { + // when(mockUseLabwareRenderInfoForRunById) + // .calledWith(RUN_ID) + // .mockReturnValue(mockLabwareRenderInfoById) + when(mockUseLabwareRenderInfoForRunById) .calledWith(RUN_ID) .mockReturnValue({ - '300_ul_tiprack_id': { + [MOCK_300_UL_TIPRACK_ID]: { labwareDef: fixture_tiprack_300_ul as LabwareDefinition2, displayName: 'fresh tips', x: MOCK_300_UL_TIPRACK_COORDS[0], @@ -237,12 +418,24 @@ describe('SetupLiquidsMap', () => { .calledWith(ROBOT_NAME, RUN_ID) .mockReturnValue({}) + // when(mockUseProtocolDetailsForRun) + // .calledWith(RUN_ID) + // .mockReturnValue({ + // robotType: FLEX_ROBOT_TYPE, + // } as any) + + props = { + ...props, + protocolAnalysis: simpleAnalysisFileFixture as any, + } + const [{ getByText }] = render(props) - expect(mockModule).not.toHaveBeenCalled() - expect(mockLabwareRender).toHaveBeenCalled() - expect(mockLabwareInfoOverlay).toHaveBeenCalled() - getByText('mock labware render of 300ul Tiprack FIXTURE') - getByText('mock labware info overlay of 300ul Tiprack FIXTURE') + // expect(mockModule).not.toHaveBeenCalled() + // expect(mockLabwareRender).toHaveBeenCalled() + // expect(mockLabwareInfoOverlay).toHaveBeenCalled() + // getByText('mock labware render of 300ul Tiprack FIXTURE') + // getByText('mock labware info overlay of 300ul Tiprack FIXTURE') + getByText('mock BaseDeck') }) it('should render a deck WITH labware and WITH modules', () => { @@ -326,7 +519,7 @@ describe('SetupLiquidsMap', () => { }, }) mockGetWellFillFromLabwareId.mockReturnValue(MOCK_WELL_FILL) - const [{ getByText }] = render({ ...props }) + const [{ getByText }] = render(props) getByText('mock labware overlay with liquid') getByText('mock labware render with well fill') }) diff --git a/app/src/organisms/Devices/ProtocolRun/SetupLiquids/index.tsx b/app/src/organisms/Devices/ProtocolRun/SetupLiquids/index.tsx index 85e2e2761fb..c306a942aab 100644 --- a/app/src/organisms/Devices/ProtocolRun/SetupLiquids/index.tsx +++ b/app/src/organisms/Devices/ProtocolRun/SetupLiquids/index.tsx @@ -13,13 +13,24 @@ import { BackToTopButton } from '../BackToTopButton' import { SetupLiquidsList } from './SetupLiquidsList' import { SetupLiquidsMap } from './SetupLiquidsMap' +import type { + CompletedProtocolAnalysis, + ProtocolAnalysisOutput, +} from '@opentrons/shared-data' + interface SetupLiquidsProps { protocolRunHeaderRef: React.RefObject | null robotName: string runId: string + protocolAnalysis: CompletedProtocolAnalysis | ProtocolAnalysisOutput | null } -export function SetupLiquids(props: SetupLiquidsProps): JSX.Element { +export function SetupLiquids({ + protocolRunHeaderRef, + robotName, + runId, + protocolAnalysis, +}: SetupLiquidsProps): JSX.Element { const { t } = useTranslation('protocol_setup') const [selectedValue, toggleGroup] = useToggleGroup( t('list_view'), @@ -35,15 +46,19 @@ export function SetupLiquids(props: SetupLiquidsProps): JSX.Element { > {toggleGroup} {selectedValue === t('list_view') ? ( - + ) : ( - + )} diff --git a/app/src/organisms/Devices/ProtocolRun/SetupModuleAndDeck/SetupModulesMap.tsx b/app/src/organisms/Devices/ProtocolRun/SetupModuleAndDeck/SetupModulesMap.tsx index 6d24f7b6eee..e1c73b85bc1 100644 --- a/app/src/organisms/Devices/ProtocolRun/SetupModuleAndDeck/SetupModulesMap.tsx +++ b/app/src/organisms/Devices/ProtocolRun/SetupModuleAndDeck/SetupModulesMap.tsx @@ -18,7 +18,7 @@ import { getAttachedProtocolModuleMatches } from '../../../ProtocolSetupModulesA import { ModuleInfo } from '../../ModuleInfo' import { useAttachedModules, useStoredProtocolAnalysis } from '../../hooks' import { getProtocolModulesInfo } from '../utils/getProtocolModulesInfo' -import { getStandardDeckViewLayerBlockList } from '../utils/getStandardDeckViewLayerBlockList' +import { getStandardDeckViewLayerBlockList } from '../utils' const ATTACHED_MODULE_POLL_MS = 5000 diff --git a/app/src/organisms/Devices/ProtocolRun/__tests__/LabwareInfoOverlay.test.tsx b/app/src/organisms/Devices/ProtocolRun/__tests__/LabwareInfoOverlay.test.tsx index 97c89f309a1..ece036e23e8 100644 --- a/app/src/organisms/Devices/ProtocolRun/__tests__/LabwareInfoOverlay.test.tsx +++ b/app/src/organisms/Devices/ProtocolRun/__tests__/LabwareInfoOverlay.test.tsx @@ -10,9 +10,8 @@ import fixture_tiprack_300_ul from '@opentrons/shared-data/labware/fixtures/2/fi import { nestedTextMatcher, renderWithProviders } from '@opentrons/components' import { i18n } from '../../../../i18n' import { useCurrentRun } from '../../../ProtocolUpload/hooks' -import { getLabwareLocation } from '../utils/getLabwareLocation' +import { getLabwareLocation, getLabwareDefinitionUri } from '../utils' import { LabwareInfoOverlay } from '../LabwareInfoOverlay' -import { getLabwareDefinitionUri } from '../utils/getLabwareDefinitionUri' import { useLabwareOffsetForLabware } from '../useLabwareOffsetForLabware' jest.mock('../../../ProtocolUpload/hooks') diff --git a/app/src/organisms/Devices/ProtocolRun/useLabwareOffsetForLabware.ts b/app/src/organisms/Devices/ProtocolRun/useLabwareOffsetForLabware.ts index 262a0376093..e9936cb121a 100644 --- a/app/src/organisms/Devices/ProtocolRun/useLabwareOffsetForLabware.ts +++ b/app/src/organisms/Devices/ProtocolRun/useLabwareOffsetForLabware.ts @@ -1,9 +1,11 @@ import { useRunQuery } from '@opentrons/react-api-client' import { getLoadedLabwareDefinitionsByUri } from '@opentrons/shared-data' -import { getCurrentOffsetForLabwareInLocation } from '../../Devices/ProtocolRun/utils/getCurrentOffsetForLabwareInLocation' -import { getLabwareDefinitionUri } from '../../Devices/ProtocolRun/utils/getLabwareDefinitionUri' -import { getLabwareOffsetLocation } from '../../Devices/ProtocolRun/utils/getLabwareOffsetLocation' +import { + getLabwareOffsetLocation, + getLabwareDefinitionUri, + getCurrentOffsetForLabwareInLocation, +} from '../../Devices/ProtocolRun/utils' import type { LabwareOffset } from '@opentrons/api-client' import { useMostRecentCompletedAnalysis } from '../../LabwarePositionCheck/useMostRecentCompletedAnalysis' diff --git a/app/src/organisms/Devices/ProtocolRun/utils/index.ts b/app/src/organisms/Devices/ProtocolRun/utils/index.ts new file mode 100644 index 00000000000..03777595316 --- /dev/null +++ b/app/src/organisms/Devices/ProtocolRun/utils/index.ts @@ -0,0 +1,17 @@ +export * from './getCurrentOffsetForLabwareInLocation' +export * from './getInitialLabwareLocation' +export * from './getLabwareDefinitionUri' +export * from './getLabwareLocation' +export * from './getLabwareOffsetLocation' +export * from './getLabwareRenderInfo' +export * from './getLocationInfoNames' +export * from './getModuleInitialLoadInfo' +export * from './getModuleName' +export * from './getModuleTypesThatRequireExtraAttention' +export * from './getPickUpTipCommandsWithPipette' +export * from './getPipetteMount' +export * from './getProtocolModulesInfo' +export * from './getSlotLabwareDefinition' +export * from './getStandardDeckViewBox' +export * from './getStandardDeckViewLayerBlockList' +export * from './getTipracksVisited' diff --git a/app/src/organisms/Devices/hooks/__tests__/useLabwareRenderInfoForRunById.test.tsx b/app/src/organisms/Devices/hooks/__tests__/useLabwareRenderInfoForRunById.test.tsx index 2f596a43c23..0c719c233b9 100644 --- a/app/src/organisms/Devices/hooks/__tests__/useLabwareRenderInfoForRunById.test.tsx +++ b/app/src/organisms/Devices/hooks/__tests__/useLabwareRenderInfoForRunById.test.tsx @@ -5,7 +5,7 @@ import standardDeckDef from '@opentrons/shared-data/deck/definitions/3/ot2_stand import _heaterShakerCommandsWithResultsKey from '@opentrons/shared-data/protocol/fixtures/6/heaterShakerCommandsWithResultsKey.json' import { useMostRecentCompletedAnalysis } from '../../../LabwarePositionCheck/useMostRecentCompletedAnalysis' -import { getLabwareRenderInfo } from '../../ProtocolRun/utils/getLabwareRenderInfo' +import { getLabwareRenderInfo } from '../../ProtocolRun/utils' import { useLabwareRenderInfoForRunById, useProtocolDetailsForRun, diff --git a/app/src/organisms/Devices/hooks/useLabwareRenderInfoForRunById.ts b/app/src/organisms/Devices/hooks/useLabwareRenderInfoForRunById.ts index 726493a63ac..46059b7452d 100644 --- a/app/src/organisms/Devices/hooks/useLabwareRenderInfoForRunById.ts +++ b/app/src/organisms/Devices/hooks/useLabwareRenderInfoForRunById.ts @@ -1,5 +1,5 @@ import { getDeckDefFromRobotType } from '@opentrons/shared-data' -import { getLabwareRenderInfo } from '../ProtocolRun/utils/getLabwareRenderInfo' +import { getLabwareRenderInfo } from '../ProtocolRun/utils' import { useMostRecentCompletedAnalysis } from '../../LabwarePositionCheck/useMostRecentCompletedAnalysis' import { useProtocolDetailsForRun, useStoredProtocolAnalysis } from '.' diff --git a/app/src/organisms/LabwarePositionCheck/CheckItem.tsx b/app/src/organisms/LabwarePositionCheck/CheckItem.tsx index 7cfb76e79d0..5ccc01c53f5 100644 --- a/app/src/organisms/LabwarePositionCheck/CheckItem.tsx +++ b/app/src/organisms/LabwarePositionCheck/CheckItem.tsx @@ -27,7 +27,7 @@ import { getLabwareDefinitionsFromCommands, } from './utils/labware' import { UnorderedList } from '../../molecules/UnorderedList' -import { getCurrentOffsetForLabwareInLocation } from '../Devices/ProtocolRun/utils/getCurrentOffsetForLabwareInLocation' +import { getCurrentOffsetForLabwareInLocation } from '../Devices/ProtocolRun/utils' import { useChainRunCommands } from '../../resources/runs/hooks' import { getIsOnDevice } from '../../redux/config' import { getDisplayLocation } from './utils/getDisplayLocation' diff --git a/app/src/organisms/LabwarePositionCheck/PickUpTip.tsx b/app/src/organisms/LabwarePositionCheck/PickUpTip.tsx index 3f85daae02d..ce41d3726eb 100644 --- a/app/src/organisms/LabwarePositionCheck/PickUpTip.tsx +++ b/app/src/organisms/LabwarePositionCheck/PickUpTip.tsx @@ -20,7 +20,7 @@ import { } from '@opentrons/shared-data' import { useChainRunCommands } from '../../resources/runs/hooks' import { UnorderedList } from '../../molecules/UnorderedList' -import { getCurrentOffsetForLabwareInLocation } from '../Devices/ProtocolRun/utils/getCurrentOffsetForLabwareInLocation' +import { getCurrentOffsetForLabwareInLocation } from '../Devices/ProtocolRun/utils' import { TipConfirmation } from './TipConfirmation' import { getLabwareDef, diff --git a/app/src/organisms/LabwarePositionCheck/ResultsSummary.tsx b/app/src/organisms/LabwarePositionCheck/ResultsSummary.tsx index 0356b71b083..aafd6462416 100644 --- a/app/src/organisms/LabwarePositionCheck/ResultsSummary.tsx +++ b/app/src/organisms/LabwarePositionCheck/ResultsSummary.tsx @@ -38,7 +38,7 @@ import { } from '../../redux/config' import { SmallButton } from '../../atoms/buttons' import { LabwareOffsetTabs } from '../LabwareOffsetTabs' -import { getCurrentOffsetForLabwareInLocation } from '../Devices/ProtocolRun/utils/getCurrentOffsetForLabwareInLocation' +import { getCurrentOffsetForLabwareInLocation } from '../Devices/ProtocolRun/utils' import { getLabwareDefinitionsFromCommands } from './utils/labware' import { getDisplayLocation } from './utils/getDisplayLocation' diff --git a/app/src/organisms/LabwarePositionCheck/utils/doesPipetteVisitAllTipracks.ts b/app/src/organisms/LabwarePositionCheck/utils/doesPipetteVisitAllTipracks.ts index 526451c467f..22515bc6910 100644 --- a/app/src/organisms/LabwarePositionCheck/utils/doesPipetteVisitAllTipracks.ts +++ b/app/src/organisms/LabwarePositionCheck/utils/doesPipetteVisitAllTipracks.ts @@ -1,6 +1,8 @@ import { getIsTiprack, LabwareDefinition2 } from '@opentrons/shared-data' -import { getPickUpTipCommandsWithPipette } from '../../Devices/ProtocolRun/utils/getPickUpTipCommandsWithPipette' -import { getTipracksVisited } from '../../Devices/ProtocolRun/utils/getTipracksVisited' +import { + getPickUpTipCommandsWithPipette, + getTipracksVisited, +} from '../../Devices/ProtocolRun/utils' import type { LoadedLabware, RunTimeCommand } from '@opentrons/shared-data' export const doesPipetteVisitAllTipracks = ( diff --git a/app/src/organisms/LabwarePositionCheck/utils/labware.ts b/app/src/organisms/LabwarePositionCheck/utils/labware.ts index fdaa37ba2ee..6f852d1365a 100644 --- a/app/src/organisms/LabwarePositionCheck/utils/labware.ts +++ b/app/src/organisms/LabwarePositionCheck/utils/labware.ts @@ -4,7 +4,7 @@ import { getTiprackVolume, getLabwareDefURI, } from '@opentrons/shared-data' -import { getModuleInitialLoadInfo } from '../../Devices/ProtocolRun/utils/getModuleInitialLoadInfo' +import { getModuleInitialLoadInfo } from '../../Devices/ProtocolRun/utils' import type { CompletedProtocolAnalysis, LabwareDefinition2, diff --git a/app/src/organisms/ProtocolSetupLabware/LabwareMapViewModal.tsx b/app/src/organisms/ProtocolSetupLabware/LabwareMapViewModal.tsx index b56629a6876..85d98d4ead5 100644 --- a/app/src/organisms/ProtocolSetupLabware/LabwareMapViewModal.tsx +++ b/app/src/organisms/ProtocolSetupLabware/LabwareMapViewModal.tsx @@ -6,8 +6,10 @@ import { FLEX_ROBOT_TYPE, THERMOCYCLER_MODULE_V1 } from '@opentrons/shared-data' import { Modal } from '../../molecules/Modal' import { getDeckConfigFromProtocolCommands } from '../../resources/deck_configuration/utils' -import { getStandardDeckViewLayerBlockList } from '../Devices/ProtocolRun/utils/getStandardDeckViewLayerBlockList' -import { getLabwareRenderInfo } from '../Devices/ProtocolRun/utils/getLabwareRenderInfo' +import { + getStandardDeckViewLayerBlockList, + getLabwareRenderInfo, +} from '../Devices/ProtocolRun/utils' import { AttachedProtocolModuleMatch } from '../ProtocolSetupModulesAndDeck/utils' import type { diff --git a/app/src/organisms/ProtocolSetupLabware/__tests__/LabwareMapViewModal.test.tsx b/app/src/organisms/ProtocolSetupLabware/__tests__/LabwareMapViewModal.test.tsx index 5c9bf19d6ed..a3c41da85ff 100644 --- a/app/src/organisms/ProtocolSetupLabware/__tests__/LabwareMapViewModal.test.tsx +++ b/app/src/organisms/ProtocolSetupLabware/__tests__/LabwareMapViewModal.test.tsx @@ -11,8 +11,10 @@ import deckDefFixture from '@opentrons/shared-data/deck/fixtures/3/deckExample.j import fixture_tiprack_300_ul from '@opentrons/shared-data/labware/fixtures/2/fixture_tiprack_300_ul.json' import { i18n } from '../../../i18n' import { getDeckConfigFromProtocolCommands } from '../../../resources/deck_configuration/utils' -import { getLabwareRenderInfo } from '../../Devices/ProtocolRun/utils/getLabwareRenderInfo' -import { getStandardDeckViewLayerBlockList } from '../../Devices/ProtocolRun/utils/getStandardDeckViewLayerBlockList' +import { + getLabwareRenderInfo, + getStandardDeckViewLayerBlockList, +} from '../../Devices/ProtocolRun/utils' import { mockProtocolModuleInfo } from '../__fixtures__' import { LabwareMapViewModal } from '../LabwareMapViewModal' diff --git a/app/src/organisms/ProtocolSetupLiquids/LiquidDetails.tsx b/app/src/organisms/ProtocolSetupLiquids/LiquidDetails.tsx index aa0e45555b1..a9c02181e11 100644 --- a/app/src/organisms/ProtocolSetupLiquids/LiquidDetails.tsx +++ b/app/src/organisms/ProtocolSetupLiquids/LiquidDetails.tsx @@ -15,7 +15,7 @@ import { import { MICRO_LITERS } from '@opentrons/shared-data' import { StyledText } from '../../atoms/text' import { LiquidsLabwareDetailsModal } from '../Devices/ProtocolRun/SetupLiquids/LiquidsLabwareDetailsModal' -import { getLocationInfoNames } from '../Devices/ProtocolRun/utils/getLocationInfoNames' +import { getLocationInfoNames } from '../Devices/ProtocolRun/utils' import { getTotalVolumePerLiquidId } from '../Devices/ProtocolRun/SetupLiquids/utils' import type { RunTimeCommand } from '@opentrons/shared-data' import type { LabwareByLiquidId, ParsedLiquid } from '@opentrons/api-client' diff --git a/app/src/organisms/ProtocolSetupLiquids/__tests__/LiquidDetails.test.tsx b/app/src/organisms/ProtocolSetupLiquids/__tests__/LiquidDetails.test.tsx index a2b703d8024..9f6907921ef 100644 --- a/app/src/organisms/ProtocolSetupLiquids/__tests__/LiquidDetails.test.tsx +++ b/app/src/organisms/ProtocolSetupLiquids/__tests__/LiquidDetails.test.tsx @@ -2,7 +2,7 @@ import * as React from 'react' import { renderWithProviders } from '@opentrons/components' import { i18n } from '../../../i18n' import { RUN_ID_1 } from '../../RunTimeControl/__fixtures__' -import { getLocationInfoNames } from '../../Devices/ProtocolRun/utils/getLocationInfoNames' +import { getLocationInfoNames } from '../../Devices/ProtocolRun/utils' import { getTotalVolumePerLiquidId } from '../../Devices/ProtocolRun/SetupLiquids/utils' import { LiquidDetails } from '../LiquidDetails' import { LiquidsLabwareDetailsModal } from '../../Devices/ProtocolRun/SetupLiquids/LiquidsLabwareDetailsModal' diff --git a/app/src/organisms/ProtocolSetupModulesAndDeck/ModulesAndDeckMapViewModal.tsx b/app/src/organisms/ProtocolSetupModulesAndDeck/ModulesAndDeckMapViewModal.tsx index 5045795d771..4598e889c71 100644 --- a/app/src/organisms/ProtocolSetupModulesAndDeck/ModulesAndDeckMapViewModal.tsx +++ b/app/src/organisms/ProtocolSetupModulesAndDeck/ModulesAndDeckMapViewModal.tsx @@ -7,7 +7,7 @@ import { FLEX_ROBOT_TYPE } from '@opentrons/shared-data' import { Modal } from '../../molecules/Modal' import { ModuleInfo } from '../Devices/ModuleInfo' import { getDeckConfigFromProtocolCommands } from '../../resources/deck_configuration/utils' -import { getStandardDeckViewLayerBlockList } from '../Devices/ProtocolRun/utils/getStandardDeckViewLayerBlockList' +import { getStandardDeckViewLayerBlockList } from '../Devices/ProtocolRun/utils' import type { CompletedProtocolAnalysis } from '@opentrons/shared-data' import type { ModalHeaderBaseProps } from '../../molecules/Modal/types'