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

refactor(step-generation, protocol-designer): atomic command args to … #17324

Open
wants to merge 9 commits into
base: edge
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { LabwareMovementStrategy } from '@opentrons/shared-data'
import type { HydratedMoveLabwareFormData } from '../../../form-types'
import type { MoveLabwareArgs } from '@opentrons/step-generation'

Expand All @@ -16,8 +17,10 @@ export const moveLabwareFormToArgs = (
commandCreatorFnName: 'moveLabware',
name: stepName,
description: stepDetails,
labware: labware.id,
useGripper,
labwareId: labware.id,
newLocation,
strategy: useGripper
? 'usingGripper'
: ('manualMoveWithPause' as LabwareMovementStrategy),
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const pauseFormToArgs = (
commandCreatorFnName: 'delay',
name: formData.stepName,
description: formData.stepDetails ?? '',
wait: totalSeconds,
seconds: totalSeconds,
message,
meta: {
hours,
Expand All @@ -48,7 +48,6 @@ export const pauseFormToArgs = (
commandCreatorFnName: 'delay',
name: formData.stepName,
description: formData.stepDetails ?? '',
wait: true,
message,
meta: {
hours,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ describe('pauseFormToArgs', () => {
const expected = {
commandCreatorFnName: 'delay',
name: 'pause step',
wait: true,
message: 'some message',
description: 'some details',
meta: {
Expand All @@ -66,7 +65,7 @@ describe('pauseFormToArgs', () => {
const expected = {
commandCreatorFnName: 'delay',
name: 'pause step',
wait: 3600 + 20 * 60 + 5,
seconds: 3600 + 20 * 60 + 5,
message: 'some message',
description: 'some details',
meta: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
reduceCommandCreators,
commandCreatorsTimeline,
getPipetteIdFromCCArgs,
ZERO_OFFSET,
} from '@opentrons/step-generation'
import { commandCreatorFromStepArgs } from '../file-data/helpers'
import type { StepArgsAndErrorsById } from '../steplist/types'
Expand Down Expand Up @@ -95,6 +96,7 @@ export const generateRobotStateTimeline = (
curryCommandCreator(moveToAddressableArea, {
pipetteId,
addressableAreaName,
offset: ZERO_OFFSET,
}),
curryCommandCreator(dropTipInPlace, {
pipetteId,
Expand Down
2 changes: 1 addition & 1 deletion protocol-designer/src/ui/steps/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export const getHoveredStepLabware = createSelector(
}

if (stepArgs.commandCreatorFnName === 'moveLabware') {
const src = stepArgs.labware
const src = stepArgs.labwareId
return [src]
}

Expand Down
14 changes: 9 additions & 5 deletions protocol-designer/src/ui/steps/test/selectors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { getMockMoveLiquidStep, getMockMixStep } from '../__fixtures__'

import * as utils from '../../modules/utils'

import type { MoveLabwareArgs } from '@opentrons/step-generation'
import type { FormData } from '../../../form-types'
import type { StepArgsAndErrorsById } from '../../../steplist/types'
import type { AllTemporalPropertiesForTimelineFrame } from '../../../step-forms'
Expand All @@ -46,7 +47,6 @@ function createArgsForStepId(
const hoveredStepId = 'hoveredStepId'
const labware = 'well plate'
const mixCommand = 'mix'
const moveLabwareCommand = 'moveLabware'
describe('getHoveredStepLabware', () => {
let initialDeckState: AllTemporalPropertiesForTimelineFrame
beforeEach(() => {
Expand Down Expand Up @@ -135,9 +135,13 @@ describe('getHoveredStepLabware', () => {
})

it('correct labware is returned when command is moveLabware', () => {
const stepArgs = {
commandCreatorFnName: moveLabwareCommand,
labware,
const stepArgs: MoveLabwareArgs = {
labwareId: labware,
strategy: 'usingGripper',
newLocation: { slotName: 'A1' },
commandCreatorFnName: 'moveLabware',
name: 'some name',
description: 'some description',
}
const argsByStepId = createArgsForStepId(hoveredStepId, stepArgs)
const result = getHoveredStepLabware.resultFunc(
Expand All @@ -146,7 +150,7 @@ describe('getHoveredStepLabware', () => {
initialDeckState
)

expect(result).toEqual([labware])
expect(result).toEqual([stepArgs.labwareId])
})

describe('modules', () => {
Expand Down
2 changes: 1 addition & 1 deletion shared-data/command/types/annotation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export interface CommentRunTimeCommand
result?: any
}

interface CommentParams {
export interface CommentParams {
message: string
}

Expand Down
2 changes: 1 addition & 1 deletion shared-data/command/types/gantry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ interface RetractAxisParams {
axis: MotorAxis
}

interface AddressableOffsetVector {
export interface AddressableOffsetVector {
x: number
y: number
z: number
Expand Down
2 changes: 1 addition & 1 deletion shared-data/command/types/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ interface NozzleConfigurationParams {
style: NozzleConfigurationStyle
}

interface ConfigureNozzleLayoutParams {
export interface ConfigureNozzleLayoutParams {
pipetteId: string
configurationParams: NozzleConfigurationParams
}
4 changes: 2 additions & 2 deletions shared-data/command/types/timing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export interface WaitForResumeRunTimeCommand
result?: any
}

interface WaitForResumeParams {
export interface WaitForResumeParams {
message?: string
}

Expand All @@ -37,7 +37,7 @@ export interface WaitForDurationRunTimeCommand
result?: any
}

interface WaitForDurationParams {
export interface WaitForDurationParams {
seconds: number
message?: string
}
Expand Down
Loading
Loading