Skip to content

Commit

Permalink
feat(protocol-designer): save v3/v4 files correctly (#5100)
Browse files Browse the repository at this point in the history
Closes #4919
  • Loading branch information
IanLondon authored Mar 2, 2020
1 parent 225c12a commit 53e8ddf
Show file tree
Hide file tree
Showing 11 changed files with 556 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('FileSidebar', () => {
metadata: {},
pipettes: {},
robot: { model: 'OT-2 Standard' },
schemaVersion: 4,
schemaVersion: 3,
commands: [],
},
fileName: 'protocol.json',
Expand Down
2 changes: 1 addition & 1 deletion protocol-designer/src/components/FileSidebar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function mapStateToProps(state: BaseState): SP {
// Ignore clicking 'CREATE NEW' button in these cases
_canCreateNew: !selectors.getNewProtocolModal(state),
_hasUnsavedChanges: loadFileSelectors.getHasUnsavedChanges(state),
isV4Protocol: stepFormSelectors.getIsV4Protocol(state),
isV4Protocol: fileDataSelectors.getIsV4Protocol(state),
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// @flow
// Named arguments to createFile selector. This data would be the result of several selectors.
import { fixtureP10Single } from '@opentrons/shared-data/pipette/fixtures/name'
import fixture_96_plate from '@opentrons/shared-data/labware/fixtures/2/fixture_96_plate.json'
import fixture_tiprack_10_ul from '@opentrons/shared-data/labware/fixtures/2/fixture_tiprack_10_ul.json'
import fixture_trash from '@opentrons/shared-data/labware/fixtures/2/fixture_trash.json'
import type { DismissedWarningState } from '../../../dismiss/reducers'
import type { IngredientsState } from '../../../labware-ingred/reducers'
import type { LabwareDefByDefURI } from '../../../labware-defs'
import type { LabwareEntities, PipetteEntities } from '../../../step-forms'
import type { LabwareLiquidState } from '../../../step-generation'
import type { FileMetadataFields } from '../../types'

export const fileMetadata: FileMetadataFields = {
protocolName: 'Test Protocol',
author: 'The Author',
description: 'Protocol description',
created: 1582667312515,
}

export const dismissedWarnings: DismissedWarningState = {
form: {},
timeline: {},
}

export const ingredients: IngredientsState = {}

export const ingredLocations: LabwareLiquidState = {}

export const labwareEntities: LabwareEntities = {
trashId: {
labwareDefURI: 'opentrons/opentrons_1_trash_1100ml_fixed/1',
id: 'trashId',
def: fixture_trash,
},
tiprackId: {
labwareDefURI: 'opentrons/opentrons_96_tiprack_10ul/1',
id: 'tiprackId',
def: fixture_tiprack_10_ul,
},
plateId: {
labwareDefURI: 'opentrons/nest_96_wellplate_100ul_pcr_full_skirt/1',
id: 'plateId',
def: fixture_96_plate,
},
}

export const pipetteEntities: PipetteEntities = {
pipetteId: {
id: 'pipetteId',
name: 'p10_single',
spec: fixtureP10Single,
tiprackDefURI: 'opentrons/opentrons_96_tiprack_10ul/1',
tiprackLabwareDef: fixture_tiprack_10_ul,
},
}
export const labwareNicknamesById: { [labwareId: string]: string } = {
trashId: 'Trash',
tiprackId: 'Opentrons 96 Tip Rack 10 µL',
plateId: 'NEST 96 Well Plate 100 µL PCR Full Skirt',
}
export const labwareDefsByURI: LabwareDefByDefURI = {
'opentrons/opentrons_96_tiprack_10ul/1': fixture_tiprack_10_ul,
'opentrons/nest_96_wellplate_100ul_pcr_full_skirt/1': fixture_96_plate,
'opentrons/opentrons_1_trash_1100ml_fixed/1': fixture_trash,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
// @flow
// Named arguments to createFile selector. This data would be the result of several selectors.
import type { SavedStepFormState, ModuleEntities } from '../../../step-forms'
import type { RobotState, Timeline } from '../../../step-generation'
import type { StepIdType } from '../../../form-types'

export const initialRobotState: RobotState = {
labware: {
trashId: {
slot: '12',
},
tiprackId: {
slot: '2',
},
plateId: {
slot: 'magneticModuleId',
},
},
modules: {
magneticModuleId: {
slot: '1',
moduleState: {
type: 'magneticModuleType',
engaged: true,
},
},
},
pipettes: {
pipetteId: {
mount: 'left',
},
},
liquidState: { labware: {}, pipettes: {} },
tipState: { tipracks: {}, pipettes: {} },
}

export const robotStateTimeline: Timeline = {
timeline: [
{
commands: [
{
command: 'magneticModule/engageMagnet',
params: {
module: 'magneticModuleId',
engageHeight: 16,
},
},
],
robotState: initialRobotState,
},
],
errors: null,
}

export const savedStepForms: SavedStepFormState = {
__INITIAL_DECK_SETUP_STEP__: {
stepType: 'manualIntervention',
id: '__INITIAL_DECK_SETUP_STEP__',
labwareLocationUpdate: {
trashId: '12',
tiprackId: '2',
plateId: 'magneticModuleId',
},
pipetteLocationUpdate: {
pipetteId: 'left',
},
moduleLocationUpdate: {
magneticModuleId: '1',
},
},
engageMagnetStepId: {
id: 'engageMagnetStepId',
stepType: 'magnet',
stepName: 'magnet',
stepDetails: '',
moduleId: 'magneticModuleId',
magnetAction: 'engage',
engageHeight: '16',
},
}

export const orderedStepIds: Array<StepIdType> = ['engageMagnetStepId']

export const moduleEntities: ModuleEntities = {
magneticModuleId: {
id: 'magneticModuleId',
type: 'magneticModuleType',
model: 'magneticModuleV1',
},
}
176 changes: 176 additions & 0 deletions protocol-designer/src/file-data/__fixtures__/createFile/noModules.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
// @flow
// Named arguments to createFile selector. This data would be the result of several selectors.
import type { SavedStepFormState, ModuleEntities } from '../../../step-forms'
import type { RobotState, Timeline } from '../../../step-generation'
import type { StepIdType } from '../../../form-types'

export const initialRobotState: RobotState = {
labware: {
trashId: {
slot: '12',
},
tiprackId: {
slot: '2',
},
plateId: {
slot: '1',
},
},
modules: {},
pipettes: {
pipetteId: {
mount: 'left',
},
},
liquidState: {
pipettes: {},
labware: {},
},
tipState: {
pipettes: {},
tipracks: {},
},
}

export const robotStateTimeline: Timeline = {
timeline: [
{
commands: [
{
command: 'pickUpTip',
params: {
pipette: 'pipetteId',
labware: 'tiprackId',
well: 'A1',
},
},
{
command: 'aspirate',
params: {
pipette: 'pipetteId',
volume: 6,
labware: 'plateId',
well: 'A1',
offsetFromBottomMm: 1,
flowRate: 3.78,
},
},
{
command: 'dispense',
params: {
pipette: 'pipetteId',
volume: 6,
labware: 'trashId',
well: 'A1',
offsetFromBottomMm: 0.5,
flowRate: 3.78,
},
},
{
command: 'dropTip',
params: {
pipette: 'pipetteId',
labware: 'trashId',
well: 'A1',
},
},
{
command: 'pickUpTip',
params: {
pipette: 'pipetteId',
labware: 'tiprackId',
well: 'B1',
},
},
{
command: 'aspirate',
params: {
pipette: 'pipetteId',
volume: 6,
labware: 'plateId',
well: 'B1',
offsetFromBottomMm: 1,
flowRate: 3.78,
},
},
{
command: 'dispense',
params: {
pipette: 'pipetteId',
volume: 6,
labware: 'trashId',
well: 'A1',
offsetFromBottomMm: 0.5,
flowRate: 3.78,
},
},
{
command: 'dropTip',
params: {
pipette: 'pipetteId',
labware: 'trashId',
well: 'A1',
},
},
],
robotState: initialRobotState,
warnings: [],
},
],
errors: null,
}

export const savedStepForms: SavedStepFormState = {
__INITIAL_DECK_SETUP_STEP__: {
stepType: 'manualIntervention',
id: '__INITIAL_DECK_SETUP_STEP__',
labwareLocationUpdate: {
trashId: '12',
tiprackId: '2',
plateId: '1',
},
pipetteLocationUpdate: {
pipetteId: 'left',
},
moduleLocationUpdate: {},
},
moveLiquidStepId: {
id: 'moveLiquidStepId',
stepType: 'moveLiquid',
stepName: 'transfer',
stepDetails: '',
pipette: 'pipetteId',
volume: '6',
changeTip: 'always',
path: 'single',
aspirate_wells_grouped: false,
aspirate_flowRate: null,
aspirate_labware: 'plateId',
aspirate_wells: ['A1', 'B1'],
aspirate_wellOrder_first: 't2b',
aspirate_wellOrder_second: 'l2r',
aspirate_mix_checkbox: false,
aspirate_mix_times: null,
aspirate_mix_volume: null,
aspirate_mmFromBottom: 1,
aspirate_touchTip_checkbox: false,
dispense_flowRate: null,
dispense_labware: 'trashId',
dispense_wells: ['A1'],
dispense_wellOrder_first: 't2b',
dispense_wellOrder_second: 'l2r',
dispense_mix_checkbox: false,
dispense_mix_times: null,
dispense_mix_volume: null,
dispense_mmFromBottom: 0.5,
dispense_touchTip_checkbox: false,
disposalVolume_checkbox: true,
disposalVolume_volume: '1',
blowout_checkbox: false,
blowout_location: 'trashId',
preWetTip: false,
},
}
export const orderedStepIds: Array<StepIdType> = ['moveLiquidStepId']

export const moduleEntities: ModuleEntities = {}
Loading

0 comments on commit 53e8ddf

Please sign in to comment.