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): avoid use of labware "format" #4070

Merged
merged 6 commits into from
Sep 18, 2019
Merged
Show file tree
Hide file tree
Changes from 5 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
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
import * as React from 'react'
import reduce from 'lodash/reduce'

import { getCollidingWells, arrayToWellGroup } from '../../utils'
import {
arrayToWellGroup,
getCollidingWells,
getWellSetForMultichannel,
} from '../../utils'
import { SELECTABLE_WELL_CLASS } from '../../constants'
import { getWellSetForMultichannel } from '../../well-selection/utils'
import SingleLabware from './SingleLabware'
import SelectionRect from '../SelectionRect'
import WellTooltip from './WellTooltip'
Expand Down
2 changes: 1 addition & 1 deletion protocol-designer/src/labware-defs/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import uniqBy from 'lodash/uniqBy'
import labwareSchema from '@opentrons/shared-data/labware/schemas/2.json'
import { getLabwareDefURI } from '@opentrons/shared-data'
import * as labwareDefSelectors from './selectors'
import { getAllWellSetsForLabware } from '../well-selection/utils'
import { getAllWellSetsForLabware } from '../utils'
import type { LabwareDefinition2 } from '@opentrons/shared-data'
import type { GetState, ThunkAction, ThunkDispatch } from '../types'
import type { LabwareUploadMessage } from './types'
Expand Down
2 changes: 1 addition & 1 deletion protocol-designer/src/steplist/formLevel/errors.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @flow
import * as React from 'react'
import { getWellRatio } from '../utils'
import { canPipetteUseLabware } from '@opentrons/shared-data'
import { canPipetteUseLabware } from '../../utils'
import type { StepFieldName } from '../../form-types'

/*******************
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
import assert from 'assert'
import round from 'lodash/round'
import uniq from 'lodash/uniq'
import { canPipetteUseLabware } from '@opentrons/shared-data'
import { getWellSetForMultichannel, canPipetteUseLabware } from '../../../utils'
import { getPipetteCapacity } from '../../../pipettes/pipetteData'
import { getWellSetForMultichannel } from '../../../well-selection/utils'
import type {
LabwareDefinition2,
PipetteChannels,
Expand Down
2 changes: 1 addition & 1 deletion protocol-designer/src/top-selectors/substep-highlight.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// @flow
import { createSelector } from 'reselect'
import { getWellNamePerMultiTip } from '@opentrons/shared-data'
import { getWellSetForMultichannel } from '../utils'
import type { Command } from '@opentrons/shared-data/protocol/flowTypes/schemaV3'

import mapValues from 'lodash/mapValues'
Expand All @@ -10,7 +11,6 @@ import * as StepGeneration from '../step-generation'
import { selectors as stepFormSelectors } from '../step-forms'
import { selectors as fileDataSelectors } from '../file-data'
import { selectors as stepsSelectors } from '../ui/steps'
import { getWellSetForMultichannel } from '../well-selection/utils'

import type { WellGroup } from '@opentrons/components'
import type { Selector } from '../types'
Expand Down
15 changes: 7 additions & 8 deletions protocol-designer/src/top-selectors/tip-contents/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import { createSelector } from 'reselect'
import noop from 'lodash/noop'
import reduce from 'lodash/reduce'
import mapValues from 'lodash/mapValues'
import type { WellGroup } from '@opentrons/components'
import { getWellSetForMultichannel } from '../../utils'
import * as StepGeneration from '../../step-generation'
import { allSubsteps as getAllSubsteps } from '../substeps'
import { START_TERMINAL_ITEM_ID, END_TERMINAL_ITEM_ID } from '../../steplist'
import { selectors as stepFormSelectors } from '../../step-forms'
import { selectors as stepsSelectors } from '../../ui/steps'
import { selectors as fileDataSelectors } from '../../file-data'
import { getWellSetForMultichannel } from '../../well-selection/utils'
import type { WellGroup } from '@opentrons/components'
import type { LabwareDefinition2 } from '@opentrons/shared-data'
import type { Command } from '@opentrons/shared-data/protocol/flowTypes/schemaV3'
import type { OutputSelector } from 'reselect'
Expand Down Expand Up @@ -226,12 +226,11 @@ export const getTipsForCurrentStep: GetTipSelector = createSelector(
const hoveredSubstepData =
substepsForStep.multiRows[substepIndex][0] // just use first multi row

const wellSet = hoveredSubstepData.activeTips
? getWellSetForMultichannel(
labwareDef,
hoveredSubstepData.activeTips.well
)
: []
let wellSet: ?Array<string> = []
const hoveredTipWell = hoveredSubstepData.activeTips?.well
if (hoveredTipWell != null) {
wellSet = getWellSetForMultichannel(labwareDef, hoveredTipWell)
}

highlighted =
(hoveredSubstepData &&
Expand Down
26 changes: 11 additions & 15 deletions protocol-designer/src/ui/labware/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@
import { createSelector } from 'reselect'
import mapValues from 'lodash/mapValues'
import reduce from 'lodash/reduce'
import {
getIsTiprack,
getLabwareDisplayName,
getLabwareFormat,
} from '@opentrons/shared-data'
import { getIsTiprack, getLabwareDisplayName } from '@opentrons/shared-data'
import { selectors as stepFormSelectors } from '../../step-forms'
import { selectors as labwareIngredSelectors } from '../../labware-ingred/selectors'

Expand Down Expand Up @@ -57,16 +53,16 @@ export const getDisposalLabwareOptions: Selector<Options> = createSelector(
reduce(
labwareEntities,
(acc: Options, labware: LabwareEntity, labwareId): Options => {
if (getLabwareFormat(labware.def) === 'trash') {
return [
...acc,
{
name: names[labwareId],
value: labwareId,
},
]
}
return acc
// TODO: Ian 2019-09-17 if we create a way to distinguish "intended for disposal"
// labware, use that here as a filter.
// Until then, allow all labware to be used for disposal
return [
...acc,
{
name: names[labwareId],
value: labwareId,
},
]
},
[]
)
Expand Down
8 changes: 8 additions & 0 deletions protocol-designer/src/utils/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// @flow
import uuidv1 from 'uuid/v1'
import { makeWellSetHelpers } from '@opentrons/shared-data'
import type { WellGroup } from '@opentrons/components'
import type { BoundingRect, GenericRect } from '../collision-types'

Expand Down Expand Up @@ -70,3 +71,10 @@ export const getCollidingWells = (
// TODO IMMEDIATELY use where appropriate
export const arrayToWellGroup = (w: Array<string>): WellGroup =>
w.reduce((acc, wellName) => ({ ...acc, [wellName]: null }), {})

// cross-PD memoization of well set utils
export const {
canPipetteUseLabware,
getAllWellSetsForLabware,
getWellSetForMultichannel,
} = makeWellSetHelpers()
108 changes: 0 additions & 108 deletions protocol-designer/src/well-selection/test/utils.test.js

This file was deleted.

61 changes: 0 additions & 61 deletions protocol-designer/src/well-selection/utils.js

This file was deleted.

Loading