Skip to content

Commit 6a67bb8

Browse files
authored
fix(protocol-designer): allow moving off-deck labware (#18464)
closes RQA-4226
1 parent b29b429 commit 6a67bb8

File tree

5 files changed

+26
-11
lines changed

5 files changed

+26
-11
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@
5252
"invalid_json_file": "Invalid JSON file",
5353
"invalid_python_body": "Protocol files must be created in Protocol Designer to be compatible.",
5454
"labware_detail": "Labware detail",
55+
"labware_in_slot": "{{name}} in {{slot}}",
5556
"labware_name_conflict": "Duplicate labware name",
57+
"labware_offdeck": "{{name}} off-deck",
5658
"labware": "Labware",
5759
"learn_more": "Learn more about the recent changes in the {{version}} release.",
5860
"left_right": "Left + Right",

protocol-designer/src/pages/Designer/ProtocolSteps/StepForm/PipetteFields/LabwareField.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export function LabwareField(props: FieldProps): JSX.Element {
1212
const { name } = props
1313
const { i18n, t } = useTranslation(['protocol_steps', 'application'])
1414
const disposalOptions = useSelector(getDisposalOptions)
15-
const options = useLabwareDropdownOptions('labware')
15+
const options = useLabwareDropdownOptions('labware', false)
1616
const dispatch = useDispatch()
1717

1818
const allOptions =

protocol-designer/src/pages/Designer/ProtocolSteps/StepForm/StepTools/MoveLabwareTools/MoveLabwareField.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@ import { useLabwareDropdownOptions } from '../../../../utils'
77

88
import type { FieldProps } from '../../types'
99

10-
export function MoveLabwareField(props: FieldProps): JSX.Element {
11-
const options = useLabwareDropdownOptions('moveLabware')
10+
interface MoveLabwareFieldProps extends FieldProps {
11+
useGripper: boolean
12+
}
13+
export function MoveLabwareField(props: MoveLabwareFieldProps): JSX.Element {
14+
const options = useLabwareDropdownOptions('moveLabware', props.useGripper)
1215
const dispatch = useDispatch()
1316
const { t } = useTranslation(['protocol_steps', 'application'])
1417
return (

protocol-designer/src/pages/Designer/ProtocolSteps/StepForm/StepTools/MoveLabwareTools/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export function MoveLabwareTools(props: StepFormProps): JSX.Element {
5656
<MoveLabwareField
5757
{...propsForFields.labware}
5858
errorToShow={getFormLevelError('labware', mappedErrorsToField)}
59+
useGripper={propsForFields.useGripper.value === true}
5960
/>
6061
<Divider marginY="0" />
6162
<LabwareLocationField

protocol-designer/src/pages/Designer/utils.ts

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { useTranslation } from 'react-i18next'
12
import { useSelector } from 'react-redux'
23
import { reduce } from 'lodash'
34

@@ -241,22 +242,27 @@ const getNickname = (
241242
nicknamesById: Record<string, string>,
242243
activeDeckSetup: AllTemporalPropertiesForTimelineFrame,
243244
labwareId: string,
244-
robotType: RobotType
245+
robotType: RobotType,
246+
t: any
245247
): string => {
246248
const { modules } = activeDeckSetup
247249
const stack = activeDeckSetup.labware[labwareId].stack
248250
const latestSlot = resolveSlotLocation(modules, stack, robotType)
249-
250-
let nickName: string = nicknamesById[labwareId]
251+
const name = nicknamesById[labwareId]
252+
let nickName: string = name
251253
if (latestSlot != null && latestSlot !== 'offDeck') {
252-
nickName = `${nicknamesById[labwareId]} in ${latestSlot}`
254+
nickName = t('labware_in_slot', { name, slot: latestSlot })
255+
} else if (latestSlot != null && latestSlot === 'offDeck') {
256+
nickName = t('labware_offdeck', { name })
253257
}
254258
return nickName
255259
}
256260

257261
export const useLabwareDropdownOptions = (
258-
type: 'moveLabware' | 'labware'
262+
type: 'moveLabware' | 'labware',
263+
useGripper: boolean
259264
): DropdownOption[] => {
265+
const { t } = useTranslation('shared')
260266
const labwareEntities = useSelector(getLabwareEntities)
261267
const activeDeckSetup = useSelector(getDeckSetupForActiveItem)
262268
const nicknamesById = useSelector(getLabwareNicknamesById)
@@ -279,18 +285,21 @@ export const useLabwareDropdownOptions = (
279285
nicknamesById,
280286
activeDeckSetup,
281287
labwareId,
282-
robotType
288+
robotType,
289+
t
283290
)
284291
const isTiprack = getIsTiprack(labwareEntity.def)
285-
const isOffDeck = deckSlot === 'offDeck'
292+
const isFilterOffDeck =
293+
deckSlot === 'offDeck' &&
294+
(type === 'labware' || (type === 'moveLabware' && useGripper))
286295

287296
// filter out moving adapters, and labware in
288297
// waste chute for moveLabware, labware off-deck and
289298
// labware that is a tiprack for the labware dropdown only
290299
return isAdapter ||
291300
isLabwareInWasteChute ||
292301
(type === 'labware' && isTiprack) ||
293-
isOffDeck
302+
isFilterOffDeck
294303
? acc
295304
: [
296305
...acc,

0 commit comments

Comments
 (0)