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(app): moveLabware command text support for waste chute #14153

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
15 changes: 11 additions & 4 deletions app/src/organisms/CommandText/MoveLabwareCommandText.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { useTranslation } from 'react-i18next'
import type {
import {
CompletedProtocolAnalysis,
MoveLabwareRunTimeCommand,
RobotType,
} from '@opentrons/shared-data/'
GRIPPER_WASTE_CHUTE_ADDRESSABLE_AREA,
} from '@opentrons/shared-data'
Copy link
Contributor

@koji koji Dec 8, 2023

Choose a reason for hiding this comment

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

I think these are types so probably getting back type and moving them down would be better.
Then import GRIPPER_WASTE_CHUTE_ADDRESSABLE_AREA separately.

import { getLabwareName } from './utils'
import { getLabwareDisplayLocation } from './utils/getLabwareDisplayLocation'
import { getFinalLabwareLocation } from './utils/getFinalLabwareLocation'
Expand Down Expand Up @@ -32,6 +33,12 @@ export function MoveLabwareCommandText(
robotType
)

const location = newDisplayLocation.includes(
GRIPPER_WASTE_CHUTE_ADDRESSABLE_AREA
)
? 'Waste Chute'
: newDisplayLocation

return strategy === 'usingGripper'
? t('move_labware_using_gripper', {
labware: getLabwareName(robotSideAnalysis, labwareId),
Expand All @@ -44,7 +51,7 @@ export function MoveLabwareCommandText(
robotType
)
: '',
new_location: newDisplayLocation,
new_location: location,
})
: t('move_labware_manually', {
labware: getLabwareName(robotSideAnalysis, labwareId),
Expand All @@ -57,6 +64,6 @@ export function MoveLabwareCommandText(
robotType
)
: '',
new_location: newDisplayLocation,
new_location: location,
})
}
44 changes: 38 additions & 6 deletions app/src/organisms/CommandText/__tests__/CommandText.test.tsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
import * as React from 'react'
import { renderWithProviders } from '@opentrons/components'
import {
AspirateInPlaceRunTimeCommand,
BlowoutInPlaceRunTimeCommand,
DispenseInPlaceRunTimeCommand,
DropTipInPlaceRunTimeCommand,
FLEX_ROBOT_TYPE,
MoveToAddressableAreaRunTimeCommand,
OT2_ROBOT_TYPE,
PrepareToAspirateRunTimeCommand,
GRIPPER_WASTE_CHUTE_ADDRESSABLE_AREA,
} from '@opentrons/shared-data'
import { i18n } from '../../../i18n'
import { CommandText } from '../'
import { mockRobotSideAnalysis } from '../__fixtures__'

import type {
AspirateInPlaceRunTimeCommand,
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

BlowoutInPlaceRunTimeCommand,
BlowoutRunTimeCommand,
ConfigureForVolumeRunTimeCommand,
DispenseInPlaceRunTimeCommand,
DispenseRunTimeCommand,
DropTipInPlaceRunTimeCommand,
DropTipRunTimeCommand,
LabwareDefinition2,
LoadLabwareRunTimeCommand,
LoadLiquidRunTimeCommand,
MoveToAddressableAreaRunTimeCommand,
MoveToWellRunTimeCommand,
PrepareToAspirateRunTimeCommand,
RunTimeCommand,
} from '@opentrons/shared-data'

Expand Down Expand Up @@ -1280,6 +1281,37 @@ describe('CommandText', () => {
'Moving Opentrons 96 Tip Rack 300 µL using gripper from Slot 9 to off deck'
)
})
it('renders correct text for move labware with gripper to waste chute', () => {
const { getByText } = renderWithProviders(
<CommandText
command={{
commandType: 'moveLabware',
params: {
strategy: 'usingGripper',
labwareId: mockRobotSideAnalysis.labware[2].id,
newLocation: {
addressableAreaName: GRIPPER_WASTE_CHUTE_ADDRESSABLE_AREA,
},
},
id: 'def456',
result: { offsetId: 'fake_offset_id' },
status: 'queued',
error: null,
createdAt: 'fake_timestamp',
startedAt: null,
completedAt: null,
}}
robotSideAnalysis={mockRobotSideAnalysis}
robotType={FLEX_ROBOT_TYPE}
/>,
{
i18nInstance: i18n,
}
)[0]
getByText(
'Moving Opentrons 96 Tip Rack 300 µL using gripper from Slot 9 to Waste Chute'
)
})
it('renders correct text for move labware with gripper to module', () => {
const { getByText } = renderWithProviders(
<CommandText
Expand Down
Loading