Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(protocol-designer): TC renders for OT-2 and fix isSlotEmpty logic #14177

Merged
merged 3 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions protocol-designer/src/components/DeckSetup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
TRASH_BIN_ADAPTER_FIXTURE,
WASTE_CHUTE_CUTOUT,
} from '@opentrons/shared-data'
import { SPAN7_8_10_11_SLOT } from '../../constants'
Copy link
Contributor

@koji koji Dec 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit
Maybe adding _ between SPAN and 7 if the changes wouldn't be a lot.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this const is used all over unfortunately so i'll just keep it as is. I hope we can deprecate the usage completely at some point.

import { selectors as labwareDefSelectors } from '../../labware-defs'

import { selectors as featureFlagSelectors } from '../../feature-flags'
Expand Down Expand Up @@ -190,16 +191,12 @@
<>
{/* all modules */}
{allModules.map(moduleOnDeck => {
// modules can be on the deck, including pseudo-slots (eg special 'spanning' slot for thermocycler position)
// const moduleParentSlots = [...deckSlots, ...values(PSEUDO_DECK_SLOTS)]
// const slot = moduleParentSlots.find(
// slot => slot.id === moduleOnDeck.slot
// )
const slotPosition = getPositionFromSlotId(moduleOnDeck.slot, deckDef)
const slotId =
moduleOnDeck.slot === SPAN7_8_10_11_SLOT ? '7' : moduleOnDeck.slot

const slotPosition = getPositionFromSlotId(slotId, deckDef)

Check warning on line 197 in protocol-designer/src/components/DeckSetup/index.tsx

View check run for this annotation

Codecov / codecov/patch

protocol-designer/src/components/DeckSetup/index.tsx#L197

Added line #L197 was not covered by tests
if (slotPosition == null) {
console.warn(
`no slot ${moduleOnDeck.slot} for module ${moduleOnDeck.id}`
)
console.warn(`no slot ${slotId} for module ${moduleOnDeck.id}`)

Check warning on line 199 in protocol-designer/src/components/DeckSetup/index.tsx

View check run for this annotation

Codecov / codecov/patch

protocol-designer/src/components/DeckSetup/index.tsx#L199

Added line #L199 was not covered by tests
return null
}
const moduleDef = getModuleDef2(moduleOnDeck.model)
Expand Down Expand Up @@ -257,7 +254,7 @@
def={moduleDef}
orientation={inferModuleOrientationFromXCoordinate(slotPosition[0])}
innerProps={getModuleInnerProps(moduleOnDeck.moduleState)}
targetSlotId={moduleOnDeck.slot}
targetSlotId={slotId}
targetDeckId={deckDef.otId}
>
{labwareLoadedOnModule != null && !shouldHideChildren ? (
Expand Down
42 changes: 31 additions & 11 deletions protocol-designer/src/step-forms/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,21 @@
import type { FormData } from '../../form-types'
export { createPresavedStepForm } from './createPresavedStepForm'

const slotToCutoutOt2Map: { [key: string]: string } = {
'1': 'cutout1',
'2': 'cutout2',
'3': 'cutout3',
'4': 'cutout4',
'5': 'cutout5',
'6': 'cutout6',
'7': 'cutout7',
'8': 'cutout8',
'9': 'cutout9',
'10': 'cutout10',
'11': 'cutout11',
'12': 'cutout12',
}

export function getIdsInRange<T extends string | number>(
orderedIds: T[],
startId: T,
Expand Down Expand Up @@ -128,17 +143,22 @@
return false
}

const filteredAdditionalEquipmentOnDeck = includeStagingAreas
? values(
initialDeckSetup.additionalEquipmentOnDeck
).filter((additionalEquipment: AdditionalEquipmentOnDeck) =>
additionalEquipment.location?.includes(slot)
)
: values(initialDeckSetup.additionalEquipmentOnDeck).filter(
(additionalEquipment: AdditionalEquipmentOnDeck) =>
additionalEquipment.location?.includes(slot) &&
additionalEquipment.name !== 'stagingArea'
)
const filteredAdditionalEquipmentOnDeck = values(

Check warning on line 146 in protocol-designer/src/step-forms/utils/index.ts

View check run for this annotation

Codecov / codecov/patch

protocol-designer/src/step-forms/utils/index.ts#L146

Added line #L146 was not covered by tests
initialDeckSetup.additionalEquipmentOnDeck
).filter((additionalEquipment: AdditionalEquipmentOnDeck) => {
const cutoutForSlotOt2 = slotToCutoutOt2Map[slot]

Check warning on line 149 in protocol-designer/src/step-forms/utils/index.ts

View check run for this annotation

Codecov / codecov/patch

protocol-designer/src/step-forms/utils/index.ts#L149

Added line #L149 was not covered by tests
const includeStaging = includeStagingAreas
? true
: additionalEquipment.name !== 'stagingArea'
jerader marked this conversation as resolved.
Show resolved Hide resolved
if (cutoutForSlotOt2 != null) {
// for Ot-2
return additionalEquipment.location === cutoutForSlotOt2 && includeStaging
} else {
// for Flex
return additionalEquipment.location?.includes(slot) && includeStaging
jerader marked this conversation as resolved.
Show resolved Hide resolved
}
})

return (
[
...values(initialDeckSetup.modules).filter((moduleOnDeck: ModuleOnDeck) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,7 @@ export const getUnoccupiedLabwareLocationOptions: Selector<
const isTrashSlot =
robotType === FLEX_ROBOT_TYPE
? MOVABLE_TRASH_ADDRESSABLE_AREAS.includes(slotId)
: slotId === 'fixedTrash'

: ['fixedTrash', '12'].includes(slotId)
return (
!slotIdsOccupiedByModules.includes(slotId) &&
!Object.values(labware)
Expand Down
1 change: 1 addition & 0 deletions shared-data/deck/types/schemaV4.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export type OT2AddressableAreaName =
| '9'
| '10'
| '11'
| '12'
Copy link
Collaborator Author

@jerader jerader Dec 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spoke to Brent about this and he said that its fine that it'll be merged into edge and not the release branch since no place in the app lists all the addressable areas for the ot-2.

| 'fixedTrash'

export type AddressableAreaName =
Expand Down
Loading