Skip to content

Commit

Permalink
refactor(labware-library): remove python test protocol affordances fr…
Browse files Browse the repository at this point in the history
…om labware-creator

The utility of the python test protocol generated from the labware creator has worn-down and been
replaced by other more helpful trouble shooting tools. Return the labware json file by itself
instead of a zip

Closes RAUT-198
  • Loading branch information
b-cooper committed Nov 1, 2023
1 parent 177c09d commit 3b77d51
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 667 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ describe('labwareDefToFields', () => {

loadName: null, // should be cleared
displayName: null, // should be cleared

pipetteName: null,
})
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ const fixture24TubeRack = _fixture24TubeRack as LabwareDefinition2
jest.mock('../../definitions')

describe('load and immediately save integrity test', () => {
const pipetteName = 'p10_single'
const fakeDisplayName = 'Fake Display Name'
const fakeLoadName = 'fake_load_name'

Expand All @@ -25,19 +24,19 @@ describe('load and immediately save integrity test', () => {
const testCases = [
{
inputDef: fixture96Plate,
extraFields: { pipetteName },
extraFields: {},
},
{
inputDef: fixture12Trough,
extraFields: { pipetteName },
extraFields: {},
},
{
inputDef: fixtureTiprack,
extraFields: { pipetteName },
extraFields: {},
},
{
inputDef: fixture24TubeRack,
extraFields: { pipetteName, tubeRackInsertLoadName: 'customTubeRack' },
extraFields: { tubeRackInsertLoadName: 'customTubeRack' },
},
]
testCases.forEach(({ inputDef, extraFields }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('Export', () => {
onExportClick = jest.fn()

when(isEveryFieldHiddenMock)
.calledWith(['pipetteName'], formikConfig.initialValues)
.calledWith(['loadName'], formikConfig.initialValues)
.mockReturnValue(false)
})

Expand All @@ -59,8 +59,8 @@ describe('Export', () => {

it('should render alert when error is present', () => {
const FAKE_ERROR = 'ahh'
formikConfig.initialErrors = { pipetteName: FAKE_ERROR }
formikConfig.initialTouched = { pipetteName: true }
formikConfig.initialErrors = { loadName: FAKE_ERROR }
formikConfig.initialTouched = { loadName: true }
render(wrapInFormik(<Export onExportClick={onExportClick} />, formikConfig))

// TODO(IL, 2021-05-26): AlertItem should have role="alert", then we can `getByRole('alert', {name: FAKE_ERROR})`
Expand All @@ -83,7 +83,7 @@ describe('Export', () => {

it('should not render when all of the fields are hidden', () => {
when(isEveryFieldHiddenMock)
.calledWith(['pipetteName'], formikConfig.initialValues)
.calledWith(['loadName'], formikConfig.initialValues)
.mockReturnValue(true)

const { container } = render(
Expand Down
129 changes: 0 additions & 129 deletions labware-library/src/labware-creator/components/getPipetteOptions.tsx

This file was deleted.

105 changes: 5 additions & 100 deletions labware-library/src/labware-creator/components/sections/Export.tsx
Original file line number Diff line number Diff line change
@@ -1,117 +1,22 @@
import cx from 'classnames'
import * as React from 'react'
import { useFormikContext } from 'formik'
import { PrimaryBtn } from '@opentrons/components'
import { reportEvent } from '../../../analytics'
import { FormStatus, LabwareFields } from '../../fields'
import { isEveryFieldHidden } from '../../utils'
import { getPipetteNameOptions } from '../getPipetteOptions'
import { FormAlerts } from '../alerts/FormAlerts'
import { Dropdown } from '../Dropdown'
import { LinkOut } from '../LinkOut'
import { SectionBody } from './SectionBody'
import { PrimaryButton } from '@opentrons/components'
import styles from '../../styles.css'
import { determineMultiChannelSupport } from '../../utils/determineMultiChannelSupport'

const LABWARE_PDF_URL =
'https://insights.opentrons.com/hubfs/Products/Consumables%20and%20Reagents/labwareDefinition_testGuide.pdf'
const TIPRACK_PDF_URL =
'https://insights.opentrons.com/hubfs/Products/Consumables%20and%20Reagents/labwareDefinition_tipRack_testGuide.pdf'

interface ExportProps {
onExportClick: (e: React.MouseEvent) => unknown
}

export const Export = (props: ExportProps): JSX.Element | null => {
const fieldList: Array<keyof LabwareFields> = ['pipetteName']
const _context = useFormikContext<LabwareFields>()
const { values, errors, touched } = _context
const status: FormStatus = _context.status
const { defaultedDef } = status

const testGuideUrl =
values.labwareType === 'tipRack' ? TIPRACK_PDF_URL : LABWARE_PDF_URL
const testGuideLabel =
values.labwareType === 'tipRack'
? 'tip rack test guide'
: 'labware test guide'

if (isEveryFieldHidden(fieldList, values)) {
return null
}

const {
disablePipetteField,
allowMultiChannel,
} = determineMultiChannelSupport(defaultedDef)

return (
<SectionBody label="Labware Test Protocol" id="Export">
<FormAlerts
values={values}
touched={touched}
errors={errors}
fieldList={fieldList}
/>

<div className={cx(styles.flex_row, styles.flex_row_start)}>
<div className={styles.instructions_column}>
<p>
Your file will be exported with a protocol that will help you test
and troubleshoot your labware definition on the robot. The protocol
requires a Single or 8-Channel pipette on the right mount of your
robot.
</p>
</div>
<div className={styles.pipette_field_wrapper}>
<Dropdown
disabled={disablePipetteField}
tooltip={
disablePipetteField ? (
<div>Add missing measurements to select a test pipette</div>
) : undefined
}
name="pipetteName"
options={getPipetteNameOptions(allowMultiChannel)}
width="18rem"
/>
</div>
</div>
<div>
<div className={styles.export_section} id="DefinitionTest">
<div className={cx(styles.callout, styles.export_callout)}>
<h4 className={styles.test_labware_heading}>
Please test your definition file!
</h4>

<p>
Use the labware test protocol contained in the downloaded file to
check the accuracy of your definition. It’s important to create
definitions that are precise and do not rely on excessive
calibration prior to each run to achieve accuracy.
</p>
<p>
Use the Tip Rack guide to troubleshoot Tip Rack definitions. Use the
Labware guide for all other labware types.
</p>
<LinkOut
onClick={() =>
reportEvent({
name: 'labwareCreatorClickTestLabware',
})
}
href={testGuideUrl}
className={styles.test_guide_button}
>
{testGuideLabel}
</LinkOut>
</div>
<PrimaryBtn
<PrimaryButton
className={styles.export_button}
onClick={props.onExportClick}
>
EXPORT FILE
</PrimaryBtn>
</PrimaryButton>
</div>
</SectionBody>
</div>
)
}
10 changes: 0 additions & 10 deletions labware-library/src/labware-creator/fields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,6 @@ export interface LabwareFields {

loadName: string | null | undefined
displayName: string | null | undefined

// fields for test protocol
pipetteName: string | null | undefined
}

// NOTE: these fields & types should be kept in sync with Yup schema `labwareFormSchema`.
Expand Down Expand Up @@ -196,9 +193,6 @@ export interface ProcessedLabwareFields {
// if loadName or displayName are left blank, Yup schema generates them
loadName: string
displayName: string

// fields for test protocol
pipetteName: string
}

export const tubeRackInsertOptions: Options = [
Expand Down Expand Up @@ -404,9 +398,6 @@ export const getDefaultFormState = (): LabwareFields => ({

loadName: null,
displayName: null,

// fields for test protocol
pipetteName: null,
})

export const LABELS: Record<keyof LabwareFields, string> = {
Expand Down Expand Up @@ -440,7 +431,6 @@ export const LABELS: Record<keyof LabwareFields, string> = {
groupBrandId: 'Manufacturer/Catalog #',
displayName: 'Display Name',
loadName: 'API Load Name',
pipetteName: 'Test Pipette',
}

export const getLabel = (
Expand Down
1 change: 0 additions & 1 deletion labware-library/src/labware-creator/getDefaultedDef.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export const DEFAULTED_DEF_PATCH: Readonly<Partial<LabwareFields>> = {
homogeneousWells: 'true',
regularRowSpacing: 'true',
regularColumnSpacing: 'true',
pipetteName: 'whatever',
}

export const getDefaultedDefPatch = (
Expand Down
Loading

0 comments on commit 3b77d51

Please sign in to comment.