Skip to content

Commit

Permalink
fix(app): Re-enable change pipette and pipette settings (#3475)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kadee80 authored May 21, 2019
1 parent da03025 commit 2419110
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
13 changes: 8 additions & 5 deletions app/src/components/ChangePipette/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ type OP = {|
mount: Mount,
robot: Robot,
wantedPipette: ?PipetteNameSpecs,
setWantedName: (name: string) => mixed,
baseUrl: string,
confirmUrl: string,
exitUrl: string,
Expand Down Expand Up @@ -155,7 +156,7 @@ function makeMapStateToProps(): (State, OP) => SP {
}

function mapDispatchToProps(dispatch: Dispatch, ownProps: OP): DP {
const { confirmUrl, parentUrl, baseUrl, robot, mount } = ownProps
const { confirmUrl, parentUrl, robot, mount } = ownProps
const disengage = () => dispatch(disengagePipetteMotors(robot, mount))
const checkPipette = () =>
disengage().then(() => dispatch(fetchPipettes(robot, true)))
Expand All @@ -165,7 +166,7 @@ function mapDispatchToProps(dispatch: Dispatch, ownProps: OP): DP {
exit: () =>
dispatch(home(robot, mount)).then(() => dispatch(push(parentUrl))),
back: () => dispatch(goBack()),
onPipetteSelect: evt => dispatch(push(`${baseUrl}/${evt.target.value}`)),
onPipetteSelect: evt => ownProps.setWantedName(evt.target.value),
moveToFront: () =>
dispatch(
moveRobotTo(robot, {
Expand All @@ -178,6 +179,7 @@ function mapDispatchToProps(dispatch: Dispatch, ownProps: OP): DP {
}

export default function ChangePipette(props: Props) {
const [wantedName, setWantedName] = React.useState<string | null>(null)
const {
robot,
parentUrl,
Expand All @@ -186,13 +188,13 @@ export default function ChangePipette(props: Props) {

return (
<Route
path={`${path}/:mount${RE_MOUNT}/:name?`}
path={`${path}/:mount${RE_MOUNT}`}
render={propsWithMount => {
const { params, url: baseUrl } = propsWithMount.match
const mount: Mount = (params.mount: any)

const wantedPipette = params.name
? getPipetteNameSpecs(params.name)
const wantedPipette = wantedName
? getPipetteNameSpecs(wantedName)
: null

return (
Expand All @@ -202,6 +204,7 @@ export default function ChangePipette(props: Props) {
subtitle={`${mount} mount`}
mount={mount}
wantedPipette={wantedPipette}
setWantedName={setWantedName}
parentUrl={parentUrl}
baseUrl={baseUrl}
confirmUrl={`${baseUrl}/confirm`}
Expand Down
8 changes: 4 additions & 4 deletions app/src/components/InstrumentSettings/AttachedPipettesCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ function AttachedPipettesCard(props: Props) {
<CardContentFlex>
<InstrumentInfo
mount="left"
name={props.robot.name}
{...props.left}
robotName={props.robot.name}
model={props.left?.model}
onChangeClick={props.clearMove}
showSettings={props.showLeftSettings}
/>
<InstrumentInfo
mount="right"
name={props.robot.name}
{...props.right}
robotName={props.robot.name}
model={props.right?.model}
onChangeClick={props.clearMove}
showSettings={props.showRightSettings}
/>
Expand Down
8 changes: 4 additions & 4 deletions app/src/components/InstrumentSettings/InstrumentInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import styles from './styles.css'
type Props = {
mount: Mount,
model: ?string,
name: string,
robotName: string,
onChangeClick: () => mixed,
showSettings: boolean,
}
Expand All @@ -27,14 +27,14 @@ const LABEL_BY_MOUNT = {
}

export default function PipetteInfo(props: Props) {
const { mount, model, name, onChangeClick, showSettings } = props
const { mount, model, robotName, onChangeClick, showSettings } = props
const label = LABEL_BY_MOUNT[mount]
const pipette = model ? getPipetteModelSpecs(model) : null
const channels = pipette?.channels
const direction = model ? 'change' : 'attach'

const changeUrl = `/robots/${name}/instruments/pipettes/change/${mount}`
const configUrl = `/robots/${name}/instruments/pipettes/config/${mount}`
const changeUrl = `/robots/${robotName}/instruments/pipettes/change/${mount}`
const configUrl = `/robots/${robotName}/instruments/pipettes/config/${mount}`

const className = cx(styles.pipette_card, {
[styles.right]: mount === 'right',
Expand Down

0 comments on commit 2419110

Please sign in to comment.