Skip to content

Commit

Permalink
Merge branch 'chore_release-pd-8.2.3' into edge
Browse files Browse the repository at this point in the history
  • Loading branch information
jerader committed Jan 9, 2025
2 parents de97092 + 9bced85 commit ffbff3a
Show file tree
Hide file tree
Showing 8 changed files with 118 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3624,7 +3624,7 @@
"key": "dd1b37d6-eb8c-4616-bc8a-e1f17556234a",
"params": {
"pipetteId": "21087f15-4c03-4587-8a2b-1ba0b5a501a0",
"volume": 1
"volume": 10
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,5 +143,6 @@
"volume_per_well": "Volume per well",
"well_name": "Well {{wellName}}",
"well_order_title": "{{prefix}} well order",
"well_position": "Well position: X {{x}} Y {{y}} Z {{z}} (mm)"
"well_position": "Well position: X {{x}} Y {{y}} Z {{z}} (mm)",
"unknown_module": "Unknown module"
}
51 changes: 46 additions & 5 deletions protocol-designer/src/pages/Designer/DeckSetup/DeckSetupTools.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ import {
createDeckFixture,
deleteDeckFixture,
} from '../../../step-forms/actions/additionalItems'
import { createModule, deleteModule } from '../../../step-forms/actions'
import { getAdditionalEquipment } from '../../../step-forms/selectors'

Check failure on line 39 in protocol-designer/src/pages/Designer/DeckSetup/DeckSetupTools.tsx

View workflow job for this annotation

GitHub Actions / js checks

'../../../step-forms/selectors' imported multiple times
import { deleteModule } from '../../../step-forms/actions'
import { getSavedStepForms } from '../../../step-forms/selectors'

Check failure on line 41 in protocol-designer/src/pages/Designer/DeckSetup/DeckSetupTools.tsx

View workflow job for this annotation

GitHub Actions / js checks

'../../../step-forms/selectors' imported multiple times
import { getDeckSetupForActiveItem } from '../../../top-selectors/labware-locations'
import {
createContainer,
Expand All @@ -54,8 +55,11 @@ import { useBlockingHint } from '../../../organisms/BlockingHintModal/useBlockin
import { selectors } from '../../../labware-ingred/selectors'
import { useKitchen } from '../../../organisms/Kitchen/hooks'
import { getDismissedHints } from '../../../tutorial/selectors'
import { createContainerAboveModule } from '../../../step-forms/actions/thunks'
import { LINK_BUTTON_STYLE, NAV_BAR_HEIGHT_REM } from '../../../atoms'
import {
createContainerAboveModule,
createModuleEntityAndChangeForm,
} from '../../../step-forms/actions/thunks'
import { ConfirmDeleteStagingAreaModal } from '../../../organisms'
import { getSlotInformation } from '../utils'
import { ALL_ORDERED_CATEGORIES, FIXTURES, MOAM_MODELS } from './constants'
Expand All @@ -67,6 +71,13 @@ import type { AddressableAreaName, ModuleModel } from '@opentrons/shared-data'
import type { ThunkDispatch } from '../../../types'
import type { Fixture } from './constants'

const mapModTypeToStepType: Record<string, string> = {
heaterShakerModuleType: 'heaterShaker',
magneticModuleType: 'magnet',
temperatureModuleType: 'temperature',
thermocyclerModuleType: 'thermocycler',
}

interface DeckSetupToolsProps {
onCloseClick: () => void
setHoveredLabware: (defUri: string | null) => void
Expand All @@ -91,6 +102,7 @@ export function DeckSetupTools(props: DeckSetupToolsProps): JSX.Element | null {
const { makeSnackbar } = useKitchen()
const selectedSlotInfo = useSelector(selectors.getZoomedInSlotInfo)
const robotType = useSelector(getRobotType)
const savedSteps = useSelector(getSavedStepForms)
const [showDeleteLabwareModal, setShowDeleteLabwareModal] = useState<
ModuleModel | 'clear' | null
>(null)
Expand Down Expand Up @@ -272,7 +284,11 @@ export function DeckSetupTools(props: DeckSetupToolsProps): JSX.Element | null {
if (
createdLabwareForSlot != null &&
(!keepExistingLabware ||
createdLabwareForSlot.labwareDefURI !== selectedLabwareDefUri)
createdLabwareForSlot.labwareDefURI !== selectedLabwareDefUri ||
// if nested labware changes but labware doesn't, still delete both
(createdLabwareForSlot.labwareDefURI === selectedLabwareDefUri &&
createdNestedLabwareForSlot?.labwareDefURI !==
selectedNestedLabwareDefUri))
) {
dispatch(deleteContainer({ labwareId: createdLabwareForSlot.id }))
}
Expand Down Expand Up @@ -332,11 +348,32 @@ export function DeckSetupTools(props: DeckSetupToolsProps): JSX.Element | null {
makeSnackbar(t('gripper_required_for_plate_reader') as string)
return
}

const moduleSteps = Object.values(savedSteps).filter(step => {
return (
step.stepType === mapModTypeToStepType[moduleType] &&
// only update module steps that match the old moduleId
// to accommodate instances of MoaM
step.moduleId === createdModuleForSlot?.id
)
})

const pauseSteps = Object.values(savedSteps).filter(step => {
return (
step.stepType === 'pause' &&
// only update pause steps that match the old moduleId
// to accommodate instances of MoaM
step.moduleId === createdModuleForSlot?.id
)
})

dispatch(
createModule({
createModuleEntityAndChangeForm({
slot,
type: moduleType,
model: selectedModuleModel,
moduleSteps,
pauseSteps,
})
)
}
Expand Down Expand Up @@ -364,7 +401,11 @@ export function DeckSetupTools(props: DeckSetupToolsProps): JSX.Element | null {
if (
selectedModuleModel != null &&
selectedLabwareDefUri != null &&
createdLabwareForSlot?.labwareDefURI !== selectedLabwareDefUri
(createdLabwareForSlot?.labwareDefURI !== selectedLabwareDefUri ||
// if nested labware changes but labware doesn't, still create both both
(createdLabwareForSlot.labwareDefURI === selectedLabwareDefUri &&
createdNestedLabwareForSlot?.labwareDefURI !==
selectedNestedLabwareDefUri))
) {
// create adapter + labware on module
dispatch(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { deleteContainer } from '../../../../labware-ingred/actions'
import { useKitchen } from '../../../../organisms/Kitchen/hooks'
import { deleteModule } from '../../../../step-forms/actions'
import { getAdditionalEquipment } from '../../../../step-forms/selectors'

Check failure on line 15 in protocol-designer/src/pages/Designer/DeckSetup/__tests__/DeckSetupTools.test.tsx

View workflow job for this annotation

GitHub Actions / js checks

'../../../../step-forms/selectors' imported multiple times
import { getSavedStepForms } from '../../../../step-forms/selectors'

Check failure on line 16 in protocol-designer/src/pages/Designer/DeckSetup/__tests__/DeckSetupTools.test.tsx

View workflow job for this annotation

GitHub Actions / js checks

'../../../../step-forms/selectors' imported multiple times
import { getRobotType } from '../../../../file-data/selectors'
import { getEnableAbsorbanceReader } from '../../../../feature-flags/selectors'
import { deleteDeckFixture } from '../../../../step-forms/actions/additionalItems'
Expand Down Expand Up @@ -72,6 +73,7 @@ describe('DeckSetupTools', () => {
additionalEquipmentOnDeck: {},
pipettes: {},
})
vi.mocked(getSavedStepForms).mockReturnValue({})
vi.mocked(getDismissedHints).mockReturnValue([])
vi.mocked(getAdditionalEquipment).mockReturnValue({})
vi.mocked(useKitchen).mockReturnValue({
Expand Down
22 changes: 10 additions & 12 deletions protocol-designer/src/pages/Designer/ProtocolSteps/StepSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ interface StepSummaryProps {
export function StepSummary(props: StepSummaryProps): JSX.Element | null {
const { currentStep, stepDetails } = props
const { t } = useTranslation(['protocol_steps', 'application'])
const unknownModule = t('unkonwn_module')
const labwareNicknamesById = useSelector(getLabwareNicknamesById)
const additionalEquipmentEntities = useSelector(
getAdditionalEquipmentEntities
Expand Down Expand Up @@ -130,9 +131,8 @@ export function StepSummary(props: StepSummaryProps): JSX.Element | null {
engageHeight,
magnetAction,
} = currentStep
const magneticModuleDisplayName = getModuleDisplayName(
modules[magneticModuleId].model
)
const magneticModuleDisplayName =
getModuleDisplayName(modules[magneticModuleId]?.model) ?? unknownModule
stepSummaryContent =
magnetAction === 'engage' ? (
<StyledTrans
Expand Down Expand Up @@ -241,9 +241,8 @@ export function StepSummary(props: StepSummaryProps): JSX.Element | null {
)
break
case 'untilTemperature':
const pauseModuleDisplayName = getModuleDisplayName(
modules[pauseModuleId].model
)
const pauseModuleDisplayName =
getModuleDisplayName(modules[pauseModuleId]?.model) ?? unknownModule
stepSummaryContent = (
<StyledTrans
i18nKey="protocol_steps:pause.untilTemperature"
Expand Down Expand Up @@ -271,9 +270,8 @@ export function StepSummary(props: StepSummaryProps): JSX.Element | null {
targetTemperature,
} = currentStep
const isDeactivating = setTemperature === 'false'
const tempModuleDisplayName = getModuleDisplayName(
modules[tempModuleId].model
)
const tempModuleDisplayName =
getModuleDisplayName(modules[tempModuleId]?.model) ?? unknownModule
stepSummaryContent = isDeactivating ? (
<StyledTrans
i18nKey={'protocol_steps:temperature_module.deactivated'}
Expand Down Expand Up @@ -381,9 +379,9 @@ export function StepSummary(props: StepSummaryProps): JSX.Element | null {
targetHeaterShakerTemperature,
targetSpeed,
} = currentStep
const moduleDisplayName = getModuleDisplayName(
modules[heaterShakerModuleId].model
)
const moduleDisplayName =
getModuleDisplayName(modules[heaterShakerModuleId]?.model) ??
unknownModule
stepSummaryContent = (
<Flex flexDirection={DIRECTION_COLUMN} gridGap={SPACING.spacing4}>
<Flex gridGap={SPACING.spacing20} alignItems={ALIGN_CENTER}>
Expand Down
55 changes: 54 additions & 1 deletion protocol-designer/src/step-forms/actions/thunks.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
import { createContainer } from '../../labware-ingred/actions'
import { getDeckSetupForActiveItem } from '../../top-selectors/labware-locations'
import { uuid } from '../../utils'
import { changeSavedStepForm } from '../../steplist/actions'

import type { DeckSlotId } from '@opentrons/shared-data'
import type {
DeckSlotId,
ModuleModel,
ModuleType,
} from '@opentrons/shared-data'
import type { ThunkAction } from '../../types'
import type {
CreateContainerAction,
RenameLabwareAction,
} from '../../labware-ingred/actions'
import type { CreateModuleAction } from './modules'
import type { ChangeSavedStepFormAction } from '../../steplist/actions'
import type { FormData } from '../../form-types'

export interface CreateContainerAboveModuleArgs {
slot: DeckSlotId
Expand Down Expand Up @@ -37,3 +46,47 @@ export const createContainerAboveModule: (
})
)
}

interface ModuleAndChangeFormArgs {
slot: DeckSlotId
type: ModuleType
model: ModuleModel
moduleSteps: FormData[]
pauseSteps: FormData[]
}
export const createModuleEntityAndChangeForm: (
args: ModuleAndChangeFormArgs
) => ThunkAction<CreateModuleAction | ChangeSavedStepFormAction> = args => (
dispatch,
getState
) => {
const { slot, model, type, moduleSteps, pauseSteps } = args
const moduleId = `${uuid()}:${type}`

dispatch({
type: 'CREATE_MODULE',
payload: { slot, model, type, id: moduleId },
})

// if steps are created with the module that has been regenerated, migrate them to use the correct moduleId
moduleSteps.forEach(step => {
dispatch(
changeSavedStepForm({
stepId: step.id,
update: {
moduleId,
},
})
)
})
pauseSteps.forEach(step => {
dispatch(
changeSavedStepForm({
stepId: step.id,
update: {
moduleId,
},
})
)
})
}
4 changes: 2 additions & 2 deletions protocol-designer/src/steplist/fieldLevel/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ export type ErrorChecker = (value: unknown) => string | null
export const requiredField: ErrorChecker = (value: unknown) =>
!value ? FIELD_ERRORS.REQUIRED : null
export const isTimeFormat: ErrorChecker = (value: unknown): string | null => {
const timeRegex = new RegExp(/^\d{1,2}:\d{1,2}:\d{1,2}$/g)
const timeRegex = new RegExp(/^\d{1,2}:(?:[0-5]?\d):(?:[0-5]?\d)$/g)
return (typeof value === 'string' && timeRegex.test(value)) || !value
? null
: FIELD_ERRORS.BAD_TIME_HMS
}
export const isTimeFormatMinutesSeconds: ErrorChecker = (
value: unknown
): string | null => {
const timeRegex = new RegExp(/^\d{1,2}:\d{1,2}$/g)
const timeRegex = new RegExp(/^\d+:[0-5]?\d$/g)
return (typeof value === 'string' && timeRegex.test(value)) || !value
? null
: FIELD_ERRORS.BAD_TIME_MS
Expand Down
2 changes: 1 addition & 1 deletion step-generation/src/commandCreators/compound/transfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ export const transfer: CommandCreator<TransferArgs> = (
? [
curryCommandCreator(configureForVolume, {
pipetteId: args.pipette,
volume: chunksPerSubTransfer,
volume: subTransferVol,
}),
]
: []
Expand Down

0 comments on commit ffbff3a

Please sign in to comment.