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

feat(protocol-designer): place tipracks on protocol creation #2750

Merged
merged 2 commits into from
Dec 5, 2018
Merged
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
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