Skip to content

Commit

Permalink
feat(protocol-designer): place tipracks on protocol creation (#2750)
Browse files Browse the repository at this point in the history
By default, when a user creates a protocol, one tip rack for each given mount should be placed on
the deck.

Closes #1327
  • Loading branch information
b-cooper authored Dec 5, 2018
1 parent b26abdd commit a110a8d
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion protocol-designer/src/labware-ingred/reducers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import type {
import * as actions from '../actions'
import {getPDMetadata} from '../../file-types'
import type {BaseState, Options} from '../../types'
import type {LoadFileAction} from '../../load-file'
import type {LoadFileAction, NewProtocolFields} from '../../load-file'
import type {
RemoveWellsContents,
DeleteLiquidGroup,
Expand Down Expand Up @@ -195,6 +195,27 @@ export const containers = handleActions({
}
}, {})
},
CREATE_NEW_PROTOCOL: (
state: ContainersState,
action: {payload: NewProtocolFields}
): ContainersState => {
const initialTipracks = [action.payload.left, action.payload.right].reduce((acc, mount) => {
if (mount.tiprackModel) {
const id = `${uuid()}:${String(mount.tiprackModel)}`
return {
...acc,
[id]: {
slot: nextEmptySlot(_loadedContainersBySlot(acc || {})),
type: mount.tiprackModel,
disambiguationNumber: getNextDisambiguationNumber(acc || {}, String(mount.tiprackModel)),
id,
name: null, // create with null name, so we force explicit naming.
},
}
}
}, state)
return initialTipracks || {}
},
}, initialLabwareState)

type SavedLabwareState = {[labwareId: string]: boolean}
Expand Down

0 comments on commit a110a8d

Please sign in to comment.