-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(protocol-designer): pipette tiprack assignment
- refactor pipette reducer to 'byMount' and 'byId' (instead of 'left' and 'right') - update pipette selectors with new reducer state shape - NewFileModal allows & requires user to save tiprack model per pipette - only allow adding assigned tiprack models Closes #1750
- Loading branch information
Showing
12 changed files
with
262 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,41 @@ | ||
// @flow | ||
import { connect } from 'react-redux' | ||
import * as React from 'react' | ||
import {connect} from 'react-redux' | ||
import type {Dispatch} from 'redux' | ||
import { closeLabwareSelector, createContainer } from '../labware-ingred/actions' | ||
import { selectors } from '../labware-ingred/reducers' | ||
import {closeLabwareSelector, createContainer} from '../labware-ingred/actions' | ||
import {selectors as labwareIngredSelectors} from '../labware-ingred/reducers' | ||
import {selectors as pipetteSelectors} from '../pipettes' | ||
import LabwareDropdown from '../components/LabwareDropdown.js' | ||
import type {BaseState} from '../types' | ||
|
||
export default connect( | ||
(state: BaseState) => ({ | ||
slot: selectors.canAdd(state) | ||
}), | ||
(dispatch: Dispatch<*>) => ({dispatch}), // TODO Ian 2018-02-19 what does flow want for no-op mapDispatchToProps? | ||
(stateProps, dispatchProps: {dispatch: Dispatch<*>}) => { | ||
// TODO Ian 2017-12-04: Use thunks to grab slot, don't use this funky mergeprops | ||
const dispatch = dispatchProps.dispatch | ||
type Props = React.ElementProps<typeof LabwareDropdown> | ||
|
||
return { | ||
...stateProps, | ||
onClose: () => { | ||
dispatch(closeLabwareSelector()) | ||
}, | ||
onContainerChoose: (containerType) => { | ||
if (stateProps.slot) { | ||
dispatch(createContainer({slot: stateProps.slot, containerType})) | ||
} | ||
type SP = { | ||
slot: $PropertyType<Props, 'slot'>, | ||
permittedTipracks: $PropertyType<Props, 'permittedTipracks'> | ||
} | ||
|
||
function mapStateToProps (state: BaseState): SP { | ||
return { | ||
slot: labwareIngredSelectors.canAdd(state), | ||
permittedTipracks: pipetteSelectors.permittedTipracks(state) | ||
} | ||
} | ||
|
||
function mergeProps (stateProps: SP, dispatchProps: {dispatch: Dispatch<*>}): Props { | ||
const dispatch = dispatchProps.dispatch | ||
|
||
return { | ||
...stateProps, | ||
onClose: () => { | ||
dispatch(closeLabwareSelector()) | ||
}, | ||
onContainerChoose: (containerType) => { | ||
if (stateProps.slot) { | ||
dispatch(createContainer({slot: stateProps.slot, containerType})) | ||
} | ||
} | ||
} | ||
)(LabwareDropdown) | ||
} | ||
|
||
export default connect(mapStateToProps, null, mergeProps)(LabwareDropdown) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,13 @@ | ||
// @flow | ||
import type {PipetteName} from './pipetteData' | ||
|
||
export const updatePipettes = (payload: {'left'?: ?PipetteName, 'right'?: ?PipetteName}) => ({ | ||
type UpdatePipettesPayload = { | ||
left: ?PipetteName, | ||
right: ?PipetteName, | ||
leftTiprackModel: ?string, | ||
rightTiprackModel: ?string | ||
} | ||
export const updatePipettes = (payload: UpdatePipettesPayload) => ({ | ||
type: 'UPDATE_PIPETTES', | ||
payload | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.