Skip to content

Commit ffc27df

Browse files
committed
Merge back 'chore_release-pd-8.5.0' into 'edge' (#18924)
2 parents 2946074 + 5da5aaf commit ffc27df

File tree

19 files changed

+136
-156
lines changed

19 files changed

+136
-156
lines changed

protocol-designer/src/assets/localization/en/starting_deck_state.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@
6060
"num_liquid_plural": "{{count}} liquids",
6161
"num_liquid": "{{count}} liquid",
6262
"off_deck_labware": "Off-deck Labware",
63-
"off_deck_title": "Off deck",
64-
"offDeck": "Off deck",
63+
"off_deck_title": "Off-deck",
64+
"offDeck": "Off-deck",
6565
"onDeck": "On deck",
6666
"one_item": "No more than 1 {{hardware}} allowed on the deck at one time",
6767
"only_display_rec": "Only display recommended labware",

protocol-designer/src/components/organisms/LiquidsOverflowMenu/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export function LiquidsOverflowMenu({
6060
right = undefined
6161
left =
6262
targetWidth !== undefined
63-
? `${targetWidth - OVERFLOW_MENU_POSITION_ADJUSTMENT}px`
63+
? `${targetWidth + OVERFLOW_MENU_POSITION_ADJUSTMENT}px`
6464
: undefined
6565
}
6666

protocol-designer/src/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export const OFFDECK: 'offDeck' = 'offDeck'
9595
export const PROTOCOL_DESIGNER_SOURCE: 'Protocol Designer' = 'Protocol Designer' // protocolSource for tracking analytics in the app
9696

9797
export const DECK_SETUP_TOOLS_WIDTH_REM = 21.875
98-
export const OVERFLOW_MENU_POSITION_ADJUSTMENT = 4
98+
export const OVERFLOW_MENU_POSITION_ADJUSTMENT = 8
9999

100100
// Below values copied from opentrons/api/src/opentrons/config/defaults_ot[2/3].py
101101
export const FLEX_X_Y_MAX_SPEED = 300

protocol-designer/src/load-file/migration/8_5_0.ts

Lines changed: 35 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import min from 'lodash/min'
44

55
import {
66
FLEX_ROBOT_TYPE,
7+
getAllLabwareDefs,
78
getPipetteSpecsV2,
89
POSITION_REFERENCE_BOTTOM,
910
POSITION_REFERENCE_TOP,
@@ -16,12 +17,10 @@ import {
1617
PROTOCOL_DESIGNER_SOURCE,
1718
} from '../../constants'
1819
import { getDefaultBlowoutFlowRate, getDefaultPushOutVolume } from '../../utils'
19-
import { getEquipmentLoadInfoFromCommands } from './utils/getEquipmentLoadInfoFromCommands'
2020
import { getMigratedPositionFromTop } from './utils/getMigrationPositionFromTop'
2121

2222
import type {
2323
LabwareDefinition2,
24-
LoadLabwareCreateCommand,
2524
PipetteV2Specs,
2625
ProtocolFile,
2726
} from '@opentrons/shared-data'
@@ -56,21 +55,25 @@ const getMigratedBlowoutLocation = (
5655
export const migrateFile = (
5756
appData: ProtocolFile<PDMetadata>
5857
): ProtocolFile<PDMetadata> => {
59-
const { designerApplication, commands, labwareDefinitions, robot } = appData
58+
const { designerApplication, robot, labwareDefinitions } = appData
6059
if (designerApplication == null || designerApplication?.data == null) {
6160
throw Error('The designerApplication key in your file is corrupt.')
6261
}
63-
const { savedStepForms, ingredients } = designerApplication.data
62+
const {
63+
savedStepForms,
64+
ingredients,
65+
labware,
66+
pipettes,
67+
} = designerApplication.data
6468
const { model: robotType } = robot
65-
const loadLabwareCommands = commands.filter(
66-
(command): command is LoadLabwareCreateCommand =>
67-
command.commandType === 'loadLabware'
68-
)
69-
const equipmentLoadInfoFromCommands = getEquipmentLoadInfoFromCommands(
70-
commands,
71-
labwareDefinitions
72-
)
7369

70+
const allLabwareDefsByURI =
71+
// read the labware definitions key first
72+
// otherwise map to all labware defs as a fallback
73+
// for OpentronsAI
74+
Object.values(labwareDefinitions).length > 0
75+
? labwareDefinitions
76+
: getAllLabwareDefs()
7477
const migratedIngredients: Ingredients = Object.entries(
7578
ingredients
7679
).reduce<Ingredients>((acc, [id, ingredient]) => {
@@ -127,19 +130,17 @@ export const migrateFile = (
127130
blowout_z_offset,
128131
...rest
129132
} = form
130-
const aspirateLabwareUri =
131-
equipmentLoadInfoFromCommands.labware[aspirate_labware].labwareDefURI
132-
const isAspirateLabwareTouchtipDisabled = labwareDefinitions[
133+
const aspirateLabwareUri = labware[aspirate_labware].labwareDefURI
134+
const isAspirateLabwareTouchtipDisabled = allLabwareDefsByURI[
133135
aspirateLabwareUri
134136
].parameters.quirks?.includes('touchTipDisabled')
135-
const dispenseLabwareUri =
136-
equipmentLoadInfoFromCommands.labware[dispense_labware]?.labwareDefURI
137+
const dispenseLabwareUri = labware[dispense_labware]?.labwareDefURI
137138

138139
const isDispenseLabwareTouchtipDisabled =
139140
// dispense is in a waste chute/trash bin
140-
labwareDefinitions[dispenseLabwareUri] == null
141+
allLabwareDefsByURI[dispenseLabwareUri] == null
141142
? true
142-
: labwareDefinitions[dispenseLabwareUri].parameters.quirks?.includes(
143+
: allLabwareDefsByURI[dispenseLabwareUri].parameters.quirks?.includes(
143144
'touchTipDisabled'
144145
)
145146

@@ -148,21 +149,19 @@ export const migrateFile = (
148149
firstTrashBinOrWasteChuteId
149150
)
150151
const matchingAspirateLabwareWellDepth = getMigratedPositionFromTop(
151-
labwareDefinitions,
152-
loadLabwareCommands,
152+
allLabwareDefsByURI,
153153
aspirate_labware as string,
154+
labware,
154155
'aspirate'
155156
)
156157
const matchingDispenseLabwareWellDepth = getMigratedPositionFromTop(
157-
labwareDefinitions,
158-
loadLabwareCommands,
158+
allLabwareDefsByURI,
159159
dispense_labware as string,
160+
labware,
160161
'dispense'
161162
)
162-
const tipRackDef = labwareDefinitions[form.tipRack]
163-
const pipetteName =
164-
equipmentLoadInfoFromCommands.pipettes?.[form.pipette]?.pipetteName ??
165-
null
163+
const tipRackDef = allLabwareDefsByURI[form.tipRack]
164+
const pipetteName = pipettes?.[form.pipette]?.pipetteName ?? null
166165
const pipetteSpecs =
167166
pipetteName != null ? getPipetteSpecsV2(pipetteName) : null
168167
const defaultPushOutVolume =
@@ -272,20 +271,17 @@ export const migrateFile = (
272271
const {
273272
id,
274273
mix_touchTip_mmFromBottom,
275-
labware,
274+
labware: formLabware,
276275
liquidClassesSupported,
277276
mix_touchTip_checkbox,
278277
...rest
279278
} = form
280-
const tipRackDef = labwareDefinitions[form.tipRack]
281-
const mixLabwareUri =
282-
equipmentLoadInfoFromCommands.labware[labware].labwareDefURI
283-
const isLabwareTouchtipDisabled = labwareDefinitions[
279+
const tipRackDef = allLabwareDefsByURI[form.tipRack]
280+
const mixLabwareUri = labware[formLabware].labwareDefURI
281+
const isLabwareTouchtipDisabled = allLabwareDefsByURI[
284282
mixLabwareUri
285283
].parameters.quirks?.includes('touchTipDisabled')
286-
const pipetteName =
287-
equipmentLoadInfoFromCommands.pipettes?.[form.pipette]?.pipetteName ??
288-
null
284+
const pipetteName = pipettes?.[form.pipette]?.pipetteName ?? null
289285
const pipetteSpecs =
290286
pipetteName != null ? getPipetteSpecsV2(pipetteName) : null
291287
const defaultPushOutVolume =
@@ -298,9 +294,9 @@ export const migrateFile = (
298294
)
299295

300296
const matchingLabwareWellDepth = getMigratedPositionFromTop(
301-
labwareDefinitions,
302-
loadLabwareCommands,
303-
labware as string,
297+
allLabwareDefsByURI,
298+
formLabware as string,
299+
labware,
304300
'mix'
305301
)
306302

@@ -321,7 +317,7 @@ export const migrateFile = (
321317
[id]: {
322318
...rest,
323319
id,
324-
labware,
320+
labware: formLabware,
325321
mix_touchTip_checkbox: isLabwareTouchtipDisabled
326322
? false
327323
: mix_touchTip_checkbox,

protocol-designer/src/load-file/migration/utils/getMigrationPositionFromTop.ts

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,33 @@
1-
import type {
2-
LabwareDefinition2,
3-
LoadLabwareCreateCommand,
4-
} from '@opentrons/shared-data'
1+
import type { LabwareDefinition2 } from '@opentrons/shared-data'
2+
import type { Labware } from '../../../file-types'
53
import type { MoveLiquidPrefixType } from '../../../resources/types'
64

75
export const getMigratedPositionFromTop = (
8-
labwareDefinitions: {
9-
[definitionId: string]: LabwareDefinition2
10-
},
11-
loadLabwareCommands: LoadLabwareCreateCommand[],
12-
labware: string,
6+
labwareDefsByURI: Record<string, LabwareDefinition2>,
7+
formLabwareId: string,
8+
labware: Labware,
139
type: MoveLiquidPrefixType
1410
): number => {
15-
const matchingLoadLabware = loadLabwareCommands.find(
16-
command =>
17-
command.commandType === 'loadLabware' &&
18-
command.params.labwareId === labware
19-
)
20-
if (matchingLoadLabware == null) {
11+
const labwareDefUri = labware[formLabwareId].labwareDefURI
12+
13+
if (labwareDefUri == null) {
2114
console.error(
22-
`expected to find matching ${type} labware load command but could not with ${type}_labware from form data as ${labware}`
15+
`unable to find matching labware def uri from form labware id ${formLabwareId}`
2316
)
2417
}
25-
const labwareUri =
26-
matchingLoadLabware != null
27-
? `${matchingLoadLabware.params.namespace}/${matchingLoadLabware.params.loadName}/${matchingLoadLabware.params.version}`
28-
: ''
2918

3019
// early exit for dispense_labware equaling trashBin or wasteChute
31-
if (labwareDefinitions[labwareUri] == null) {
20+
if (labwareDefsByURI[labwareDefUri] == null) {
3221
return 0
3322
}
3423

35-
const matchingLabwareWellDepth = labwareUri
36-
? labwareDefinitions[labwareUri].wells.A1.depth
24+
const matchingLabwareWellDepth = labwareDefUri
25+
? labwareDefsByURI[labwareDefUri].wells.A1.depth
3726
: 0
3827

3928
if (matchingLabwareWellDepth === 0) {
4029
console.error(
41-
`error in finding the ${type} labware well depth with labware uri ${labwareUri}`
30+
`error in finding the ${type} labware well depth with labware uri ${labwareDefUri}`
4231
)
4332
}
4433
return matchingLabwareWellDepth

protocol-designer/src/pages/Designer/OffDeck/OffDeckDetails.tsx

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,14 @@ export function OffDeckDetails(props: OffDeckDetailsProps): JSX.Element {
6464
<Flex
6565
backgroundColor={COLORS.white}
6666
borderRadius={BORDERS.borderRadius12}
67-
width="100%"
68-
height="100%"
69-
padding={`${SPACING.spacing40} ${SPACING.spacing40} 0 ${SPACING.spacing40}`}
67+
padding={SPACING.spacing40}
7068
gridGap={SPACING.spacing24}
7169
alignItems={ALIGN_CENTER}
7270
justifyContent={JUSTIFY_FLEX_END}
7371
>
7472
<Flex
7573
flex="0 0 auto"
7674
width={OFF_DECK_MAP_WIDTH}
77-
height="100%"
7875
maxHeight={OFF_DECK_MAP_HEIGHT_FOR_STEP}
7976
minHeight={OFF_DECK_MAP_HEIGHT_FOR_STEP}
8077
alignItems={ALIGN_CENTER}
@@ -85,11 +82,7 @@ export function OffDeckDetails(props: OffDeckDetailsProps): JSX.Element {
8582
flexDirection={DIRECTION_COLUMN}
8683
gridGap={SPACING.spacing40}
8784
>
88-
<Flex
89-
justifyContent={JUSTIFY_CENTER}
90-
width="100%"
91-
color={COLORS.grey60}
92-
>
85+
<Flex justifyContent={JUSTIFY_CENTER} color={COLORS.grey60}>
9386
<StyledText desktopStyle="bodyDefaultSemiBold">
9487
{i18n.format(t('off_deck_labware'), 'upperCase')}
9588
</StyledText>
@@ -119,12 +112,7 @@ export function OffDeckDetails(props: OffDeckDetailsProps): JSX.Element {
119112
zDimension: dimensions.zDimension ?? 0,
120113
}
121114
return (
122-
<Flex
123-
id={lw.id}
124-
flexDirection={DIRECTION_COLUMN}
125-
key={lw.id}
126-
paddingBottom="0"
127-
>
115+
<Flex id={lw.id} flexDirection={DIRECTION_COLUMN} key={lw.id}>
128116
<RobotWorkSpace
129117
key={lw.id}
130118
viewBox={`${definition.cornerOffsetFromSlot.x} ${definition.cornerOffsetFromSlot.y} ${dimensions.xDimension} ${dimensions.yDimension}`}
@@ -184,7 +172,7 @@ export function OffDeckDetails(props: OffDeckDetailsProps): JSX.Element {
184172
</Flex>
185173
</Flex>
186174
{hoverSlot != null && terminalItemId === START_TERMINAL_ITEM_ID ? (
187-
<Flex width="100%" height="8rem">
175+
<Flex>
188176
<SlotDetailsContainer
189177
robotType={robotType}
190178
slot="offDeck"

protocol-designer/src/pages/Designer/ProtocolSteps/Timeline/AddStepButton.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { useState } from 'react'
22
import { createPortal } from 'react-dom'
33
import { useTranslation } from 'react-i18next'
44
import { useDispatch, useSelector } from 'react-redux'
5-
import { last } from 'lodash'
5+
import last from 'lodash/last'
66
import { css } from 'styled-components'
77

88
import {
@@ -66,9 +66,13 @@ import type { BaseState } from '../../../../types'
6666

6767
interface AddStepButtonProps {
6868
hasText: boolean
69+
sidebarWidth: number
6970
}
7071

71-
export function AddStepButton({ hasText }: AddStepButtonProps): JSX.Element {
72+
export function AddStepButton({
73+
hasText,
74+
sidebarWidth,
75+
}: AddStepButtonProps): JSX.Element {
7276
const { t } = useTranslation(['tooltip', 'button', 'starting_deck_state'])
7377
const enableComment = useSelector(getEnableComment)
7478
const { makeSnackbar } = useKitchen()

protocol-designer/src/pages/Designer/ProtocolSteps/Timeline/AddStepOverflowButton.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@ export function AddStepOverflowButton(
2525
): JSX.Element {
2626
const { onClick, stepType, isFirstStep = false, isLastStep = false } = props
2727
const { t, i18n } = useTranslation(['tooltip', 'application'])
28-
// TODO(ja): add or delete tooltips when designs are finalized
29-
// const [targetProps, tooltipProps] = useHoverTooltip({
30-
// placement: TOOLTIP_RIGHT,
31-
// })
32-
// const tooltipMessage = t(`step_description.${stepType}`)
3328

3429
const selectHoverStyle = (): string => {
3530
if (isFirstStep) {
@@ -52,7 +47,6 @@ export function AddStepOverflowButton(
5247
)}
5348
</StyledText>
5449
</MenuButton>
55-
{/* <Tooltip tooltipProps={tooltipProps}>{tooltipMessage}</Tooltip> */}
5650
</>
5751
)
5852
}

protocol-designer/src/pages/Designer/ProtocolSteps/Timeline/StepOverflowMenu.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414

1515
import { analyticsEvent } from '../../../../analytics/actions'
1616
import { OPEN_STEP_DETAILS_EVENT } from '../../../../analytics/constants'
17+
import { OVERFLOW_MENU_POSITION_ADJUSTMENT } from '../../../../constants'
1718
import {
1819
getBatchEditFormHasUnsavedChanges,
1920
getCurrentFormHasUnsavedChanges,
@@ -44,8 +45,6 @@ interface StepOverflowMenuProps {
4445
sidebarWidth: number // adjust the position of the overflow menu
4546
}
4647

47-
const POSITION_ADJUSTMENT = 4
48-
4948
export function StepOverflowMenu(props: StepOverflowMenuProps): JSX.Element {
5049
const {
5150
stepId,
@@ -102,7 +101,7 @@ export function StepOverflowMenu(props: StepOverflowMenuProps): JSX.Element {
102101
ref={menuRootRef}
103102
zIndex={12}
104103
top={top}
105-
left={sidebarWidth - POSITION_ADJUSTMENT} // the space between kebab menu button and overflow menu is 8px
104+
left={sidebarWidth + OVERFLOW_MENU_POSITION_ADJUSTMENT} // the space between kebab menu button and overflow menu is 8px
106105
position={POSITION_ABSOLUTE}
107106
whiteSpace={NO_WRAP}
108107
borderRadius={BORDERS.borderRadius8}

protocol-designer/src/pages/Designer/ProtocolSteps/Timeline/TimelineToolbox.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,10 @@ export function TimelineToolbox({
156156
childrenPadding="0px"
157157
confirmButton={
158158
formData != null ? undefined : (
159-
<AddStepButton hasText={sidebarWidth > SIDEBAR_MIN_WIDTH_FOR_ICON} />
159+
<AddStepButton
160+
hasText={sidebarWidth > SIDEBAR_MIN_WIDTH_FOR_ICON}
161+
sidebarWidth={sidebarWidth}
162+
/>
160163
)
161164
}
162165
>

0 commit comments

Comments
 (0)