Skip to content

Commit

Permalink
start maintenance run after altering deck config
Browse files Browse the repository at this point in the history
  • Loading branch information
b-cooper committed Apr 19, 2024
1 parent 0713b85 commit 73ee626
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 60 deletions.
35 changes: 4 additions & 31 deletions app/src/organisms/ModuleWizardFlows/BeforeBeginning.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as React from 'react'
import { UseMutateFunction } from 'react-query'
import { Trans, useTranslation } from 'react-i18next'

import {
Expand All @@ -12,12 +11,7 @@ import { StyledText } from '@opentrons/components'
import { GenericWizardTile } from '../../molecules/GenericWizardTile'
import { WizardRequiredEquipmentList } from '../../molecules/WizardRequiredEquipmentList'

import type {
CreateMaintenanceRunData,
MaintenanceRun,
AttachedModule,
} from '@opentrons/api-client'
import type { AxiosError } from 'axios'
import type { AttachedModule } from '@opentrons/api-client'
import type { ModuleCalibrationWizardStepProps } from './types'

interface EqipmentItem {
Expand All @@ -26,34 +20,14 @@ interface EqipmentItem {
subtitle?: string
}

interface BeforeBeginningProps extends ModuleCalibrationWizardStepProps {
createMaintenanceRun: UseMutateFunction<
MaintenanceRun,
AxiosError<any>,
CreateMaintenanceRunData,
unknown
>
isCreateLoading: boolean
createdMaintenanceRunId: string | null
}
type BeforeBeginningProps = ModuleCalibrationWizardStepProps

export const BeforeBeginning = (
props: BeforeBeginningProps
): JSX.Element | null => {
const {
proceed,
createMaintenanceRun,
isCreateLoading,
attachedModule,
maintenanceRunId,
createdMaintenanceRunId,
} = props
const { proceed, attachedModule } = props
const { t } = useTranslation(['module_wizard_flows', 'shared'])
React.useEffect(() => {
if (createdMaintenanceRunId == null) {
createMaintenanceRun({})
}
}, [])

const moduleDisplayName = getModuleDisplayName(attachedModule.moduleModel)

let adapterLoadname: string
Expand Down Expand Up @@ -109,7 +83,6 @@ export const BeforeBeginning = (
/>
}
proceedButtonText={t('start_setup')}
proceedIsDisabled={isCreateLoading || maintenanceRunId == null}
proceed={proceed}
/>
)
Expand Down
24 changes: 24 additions & 0 deletions app/src/organisms/ModuleWizardFlows/PlaceAdapter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,24 @@ import { LEFT_SLOTS } from './constants'

import type { DeckConfiguration, CreateCommand } from '@opentrons/shared-data'
import type { ModuleCalibrationWizardStepProps } from './types'
import type { AxiosError } from 'axios'
import type { UseMutateFunction } from 'react-query'
import type {
CreateMaintenanceRunData,
MaintenanceRun,
} from '@opentrons/api-client'

interface PlaceAdapterProps extends ModuleCalibrationWizardStepProps {
deckConfig: DeckConfiguration
setCreatedAdapterId: (adapterId: string) => void
createMaintenanceRun: UseMutateFunction<
MaintenanceRun,
AxiosError<any>,
CreateMaintenanceRunData,
unknown
>
isCreateLoading: boolean
createdMaintenanceRunId: string | null
}

export const BODY_STYLE = css`
Expand All @@ -59,8 +73,17 @@ export const PlaceAdapter = (props: PlaceAdapterProps): JSX.Element | null => {
setCreatedAdapterId,
attachedPipette,
isRobotMoving,
maintenanceRunId,
createMaintenanceRun,
isCreateLoading,
createdMaintenanceRunId,
} = props
const { t } = useTranslation('module_wizard_flows')
React.useEffect(() => {
if (createdMaintenanceRunId == null) {
createMaintenanceRun({})
}
}, [])
const mount = attachedPipette.mount
const cutoutId = deckConfig.find(
cc =>
Expand Down Expand Up @@ -208,6 +231,7 @@ export const PlaceAdapter = (props: PlaceAdapterProps): JSX.Element | null => {
bodyText={bodyText}
proceedButtonText={t('confirm_placement')}
proceed={handleOnClick}
proceedIsDisabled={isCreateLoading || maintenanceRunId == null}
back={goBack}
/>
)
Expand Down
13 changes: 4 additions & 9 deletions app/src/organisms/ModuleWizardFlows/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -300,15 +300,7 @@ export const ModuleWizardFlows = (
} else if (isExiting) {
modalContent = <InProgressModal description={t('stand_back_exiting')} />
} else if (currentStep.section === SECTIONS.BEFORE_BEGINNING) {
modalContent = (
<BeforeBeginning
{...currentStep}
{...calibrateBaseProps}
createMaintenanceRun={createTargetedMaintenanceRun}
isCreateLoading={isCreateLoading}
createdMaintenanceRunId={createdMaintenanceRunId}
/>
)
modalContent = <BeforeBeginning {...currentStep} {...calibrateBaseProps} />
} else if (currentStep.section === SECTIONS.SELECT_LOCATION) {
modalContent = (
<SelectLocation
Expand All @@ -327,6 +319,9 @@ export const ModuleWizardFlows = (
{...calibrateBaseProps}
deckConfig={deckConfig}
setCreatedAdapterId={setCreatedAdapterId}
createMaintenanceRun={createTargetedMaintenanceRun}
isCreateLoading={isCreateLoading}
createdMaintenanceRunId={createdMaintenanceRunId}
/>
)
} else if (currentStep.section === SECTIONS.ATTACH_PROBE) {
Expand Down
37 changes: 17 additions & 20 deletions components/src/hardware-sim/DeckConfigurator/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,45 +66,42 @@ export function DeckConfigurator(props: DeckConfiguratorProps): JSX.Element {
} = props
const deckDef = getDeckDefFromRobotType(FLEX_ROBOT_TYPE)

const configurableDeckConfig = deckConfig.filter(({ cutoutId }) =>
editableCutoutIds.includes(cutoutId)
)

const stagingAreaFixtures = configurableDeckConfig.filter(
const stagingAreaFixtures = deckConfig.filter(
({ cutoutFixtureId }) => cutoutFixtureId === STAGING_AREA_RIGHT_SLOT_FIXTURE
)
const wasteChuteFixtures = configurableDeckConfig.filter(
const wasteChuteFixtures = deckConfig.filter(
({ cutoutFixtureId }) =>
cutoutFixtureId != null &&
WASTE_CHUTE_ONLY_FIXTURES.includes(cutoutFixtureId)
)
const wasteChuteStagingAreaFixtures = configurableDeckConfig.filter(
const wasteChuteStagingAreaFixtures = deckConfig.filter(
({ cutoutFixtureId }) =>
cutoutFixtureId != null &&
WASTE_CHUTE_STAGING_AREA_FIXTURES.includes(cutoutFixtureId)
)
const emptyCutouts = configurableDeckConfig.filter(
({ cutoutFixtureId }) =>
cutoutFixtureId != null && SINGLE_SLOT_FIXTURES.includes(cutoutFixtureId)
const emptyCutouts = deckConfig.filter(
({ cutoutFixtureId, cutoutId }) =>
editableCutoutIds.includes(cutoutId) &&
cutoutFixtureId != null &&
SINGLE_SLOT_FIXTURES.includes(cutoutFixtureId)
)
const trashBinFixtures = configurableDeckConfig.filter(
const trashBinFixtures = deckConfig.filter(
({ cutoutFixtureId }) => cutoutFixtureId === TRASH_BIN_ADAPTER_FIXTURE
)
const thermocyclerFixtures = configurableDeckConfig.filter(
const thermocyclerFixtures = deckConfig.filter(
({ cutoutFixtureId }) => cutoutFixtureId === THERMOCYCLER_V2_FRONT_FIXTURE
)
const heaterShakerFixtures = configurableDeckConfig.filter(
const heaterShakerFixtures = deckConfig.filter(
({ cutoutFixtureId }) => cutoutFixtureId === HEATERSHAKER_MODULE_V1_FIXTURE
)
const temperatureModuleFixtures = configurableDeckConfig.filter(
const temperatureModuleFixtures = deckConfig.filter(
({ cutoutFixtureId }) => cutoutFixtureId === TEMPERATURE_MODULE_V2_FIXTURE
)
const magneticBlockFixtures = configurableDeckConfig.filter(
({ cutoutFixtureId }) =>
([
MAGNETIC_BLOCK_V1_FIXTURE,
STAGING_AREA_SLOT_WITH_MAGNETIC_BLOCK_V1_FIXTURE,
] as CutoutFixtureId[]).includes(cutoutFixtureId)
const magneticBlockFixtures = deckConfig.filter(({ cutoutFixtureId }) =>
([
MAGNETIC_BLOCK_V1_FIXTURE,
STAGING_AREA_SLOT_WITH_MAGNETIC_BLOCK_V1_FIXTURE,
] as CutoutFixtureId[]).includes(cutoutFixtureId)
)

return (
Expand Down

0 comments on commit 73ee626

Please sign in to comment.