Skip to content

Commit

Permalink
fix(app): Allow valid pipette+ model names for display images (#3413)
Browse files Browse the repository at this point in the history
  • Loading branch information
Laura-Danielle authored May 10, 2019
1 parent 79a9f60 commit 1f77a08
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions app/src/components/InstrumentSettings/InstrumentInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import cx from 'classnames'

import type { Mount } from '../../robot'

import { getPipetteModelSpecs } from '@opentrons/shared-data'
import {
LabeledValue,
OutlineButton,
Expand All @@ -20,9 +21,6 @@ type Props = {
showSettings: boolean,
}

// TODO(mc, 2018-03-30): volume and channels should come from the API
const RE_CHANNELS = /p\d+_(single|multi)/

const LABEL_BY_MOUNT = {
left: 'Left pipette',
right: 'Right pipette',
Expand All @@ -31,8 +29,8 @@ const LABEL_BY_MOUNT = {
export default function PipetteInfo(props: Props) {
const { mount, model, name, onChangeClick, showSettings } = props
const label = LABEL_BY_MOUNT[mount]
const channelsMatch = model && model.match(RE_CHANNELS)
const channels = channelsMatch && channelsMatch[1]
const pipette = model ? getPipetteModelSpecs(model) : null
const channels = pipette?.channels
const direction = model ? 'change' : 'attach'

const changeUrl = `/robots/${name}/instruments/pipettes/change/${mount}`
Expand Down Expand Up @@ -62,7 +60,7 @@ export default function PipetteInfo(props: Props) {
<div className={styles.image}>
{channels && (
<InstrumentDiagram
channels={channels === 'multi' ? 8 : 1}
channels={channels}
className={styles.pipette_diagram}
/>
)}
Expand Down

0 comments on commit 1f77a08

Please sign in to comment.