Skip to content

Commit

Permalink
remove deck config ff
Browse files Browse the repository at this point in the history
  • Loading branch information
jerader committed Dec 6, 2023
1 parent 42194c6 commit 1aa2df6
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 112 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,8 @@ export function ModulesAndOtherTile(props: WizardTileProps): JSX.Element {
featureFlagSelectors.getDisableModuleRestrictions
)
const [targetProps, tooltipProps] = useHoverTooltip()
const enableDeckModification = useSelector(
featureFlagSelectors.getEnableDeckModification
)
const hasATrash =
robotType === FLEX_ROBOT_TYPE && enableDeckModification
robotType === FLEX_ROBOT_TYPE
? values.additionalEquipment.includes('wasteChute') ||
values.additionalEquipment.includes('trashBin')
: true
Expand Down Expand Up @@ -151,10 +148,7 @@ export function ModulesAndOtherTile(props: WizardTileProps): JSX.Element {
onSetFieldTouched={setFieldTouched}
/>
) : (
<FlexModuleFields
{...props}
enableDeckModification={enableDeckModification}
/>
<FlexModuleFields {...props} />
)}
{robotType === OT2_ROBOT_TYPE && moduleRestrictionsDisabled !== true
? modCrashWarning
Expand All @@ -168,23 +162,10 @@ export function ModulesAndOtherTile(props: WizardTileProps): JSX.Element {
>
<GoBack
onClick={() => {
if (!enableDeckModification || robotType === OT2_ROBOT_TYPE) {
if (robotType === OT2_ROBOT_TYPE) {
if (values.pipettesByMount.left.pipetteName === 'p1000_96') {
goBack(4)
} else if (
values.pipettesByMount.right.pipetteName === '' &&
robotType === FLEX_ROBOT_TYPE
) {
goBack(3)
} else if (
values.pipettesByMount.right.pipetteName === '' &&
robotType === OT2_ROBOT_TYPE
) {
goBack(2)
} else if (
values.pipettesByMount.right.pipetteName !== '' &&
robotType === FLEX_ROBOT_TYPE
) {
} else if (values.pipettesByMount.right.pipetteName === '') {
goBack(2)
} else {
goBack()
Expand All @@ -211,11 +192,9 @@ export function ModulesAndOtherTile(props: WizardTileProps): JSX.Element {
</HandleEnter>
)
}
interface FlexModuleFieldsProps extends WizardTileProps {
enableDeckModification: boolean
}
function FlexModuleFields(props: FlexModuleFieldsProps): JSX.Element {
const { values, setFieldValue, enableDeckModification } = props

function FlexModuleFields(props: WizardTileProps): JSX.Element {
const { values, setFieldValue } = props

const isFlex = values.fields.robotType === FLEX_ROBOT_TYPE
const trashBinDisabled = getTrashBinOptionDisabled(values)
Expand Down Expand Up @@ -284,7 +263,7 @@ function FlexModuleFields(props: FlexModuleFieldsProps): JSX.Element {
text="Gripper"
showCheckbox
/>
{enableDeckModification && isFlex ? (
{isFlex ? (
<>
<EquipmentOption
onClick={() => handleSetEquipmentOption('wasteChute')}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as React from 'react'
import { useSelector } from 'react-redux'
import without from 'lodash/without'
import {
DIRECTION_COLUMN,
Expand All @@ -18,7 +17,6 @@ import {
STAGING_AREA_RIGHT_SLOT_FIXTURE,
} from '@opentrons/shared-data'
import { i18n } from '../../../localization'
import { getEnableDeckModification } from '../../../feature-flags/selectors'
import { GoBack } from './GoBack'
import { HandleEnter } from './HandleEnter'

Expand All @@ -28,7 +26,6 @@ import type { WizardTileProps } from './types'
export function StagingAreaTile(props: WizardTileProps): JSX.Element | null {
const { values, goBack, proceed, setFieldValue } = props
const isOt2 = values.fields.robotType === OT2_ROBOT_TYPE
const deckConfigurationFF = useSelector(getEnableDeckModification)
const stagingAreaItems = values.additionalEquipment.filter(equipment =>
// TODO(bc, 11/14/2023): refactor the additional items field to include a cutoutId
// and a cutoutFixtureId so that we don't have to string parse here to generate them
Expand Down Expand Up @@ -73,7 +70,7 @@ export function StagingAreaTile(props: WizardTileProps): JSX.Element | null {
initialSlots
)

if (!deckConfigurationFF || isOt2) {
if (isOt2) {
proceed()
return null
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ import {
toggleIsGripperRequired,
createDeckFixture,
} from '../../../../step-forms/actions/additionalItems'
import {
getAllowAllTipracks,
getEnableDeckModification,
} from '../../../../feature-flags/selectors'
import { getAllowAllTipracks } from '../../../../feature-flags/selectors'
import { getTiprackOptions } from '../../utils'
import { CreateFileWizard } from '..'

Expand Down Expand Up @@ -76,9 +73,6 @@ const mockCreateModule = createModule as jest.MockedFunction<
const mockCreateDeckFixture = createDeckFixture as jest.MockedFunction<
typeof createDeckFixture
>
const mockGetEnableDeckModification = getEnableDeckModification as jest.MockedFunction<
typeof getEnableDeckModification
>
const render = () => {
return renderWithProviders(<CreateFileWizard />)[0]
}
Expand All @@ -91,7 +85,6 @@ const ten = '10uL'

describe('CreateFileWizard', () => {
beforeEach(() => {
mockGetEnableDeckModification.mockReturnValue(false)
mockGetNewProtocolModal.mockReturnValue(true)
mockGetAllowAllTipracks.mockReturnValue(false)
mockGetLabwareDefsByURI.mockReturnValue({
Expand Down Expand Up @@ -155,7 +148,6 @@ describe('CreateFileWizard', () => {
expect(mockToggleNewProtocolModal).toHaveBeenCalled()
})
it('renders the wizard for a Flex with custom tiprack', () => {
mockGetEnableDeckModification.mockReturnValue(true)
const Custom = 'custom'
mockGetCustomLabwareDefsByURI.mockReturnValue({
[Custom]: fixtureTipRack10ul,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,18 @@ import * as React from 'react'
import i18n from 'i18next'
import { renderWithProviders } from '@opentrons/components'
import { FLEX_ROBOT_TYPE, OT2_ROBOT_TYPE } from '@opentrons/shared-data'
import {
getDisableModuleRestrictions,
getEnableDeckModification,
} from '../../../../feature-flags/selectors'
import { getDisableModuleRestrictions } from '../../../../feature-flags/selectors'
import { CrashInfoBox } from '../../../modules'
import { ModuleFields } from '../../FilePipettesModal/ModuleFields'
import { ModulesAndOtherTile } from '../ModulesAndOtherTile'
import { EquipmentOption } from '../EquipmentOption'
import type { FormPipettesByMount } from '../../../../step-forms'
import type { FormState, WizardTileProps } from '../types'

jest.mock('../../../../feature-flags/selectors')
jest.mock('../../../modules')
jest.mock('../../FilePipettesModal/ModuleFields')
jest.mock('../EquipmentOption')
jest.mock('../../../../feature-flags/selectors')
jest.mock('../../FilePipettesModal')

const mockEquipmentOption = EquipmentOption as jest.MockedFunction<
Expand All @@ -31,9 +28,6 @@ const mockGetDisableModuleRestrictions = getDisableModuleRestrictions as jest.Mo
const mockModuleFields = ModuleFields as jest.MockedFunction<
typeof ModuleFields
>
const mockGetEnableDeckModification = getEnableDeckModification as jest.MockedFunction<
typeof getEnableDeckModification
>
const render = (props: React.ComponentProps<typeof ModulesAndOtherTile>) => {
return renderWithProviders(<ModulesAndOtherTile {...props} />, {
i18nInstance: i18n,
Expand Down Expand Up @@ -79,21 +73,8 @@ describe('ModulesAndOtherTile', () => {
mockEquipmentOption.mockReturnValue(<div>mock EquipmentOption</div>)
mockGetDisableModuleRestrictions.mockReturnValue(false)
mockModuleFields.mockReturnValue(<div>mock ModuleFields</div>)
mockGetEnableDeckModification.mockReturnValue(false)
})

it('renders correct module + gripper length for flex', () => {
const { getByText, getAllByText, getByRole } = render(props)
getByText('Choose additional items')
expect(getAllByText('mock EquipmentOption')).toHaveLength(5)
getByText('Go back')
getByRole('button', { name: 'GoBack_button' }).click()
expect(props.goBack).toHaveBeenCalled()
getByText('Review file details').click()
expect(props.proceed).toHaveBeenCalled()
})
it('renders correct module, gripper and trash length for flex with disabled button', () => {
mockGetEnableDeckModification.mockReturnValue(true)
const { getByText, getAllByText, getByRole } = render(props)
getByText('Choose additional items')
expect(getAllByText('mock EquipmentOption')).toHaveLength(7)
Expand All @@ -110,7 +91,6 @@ describe('ModulesAndOtherTile', () => {
additionalEquipment: ['trashBin'],
},
} as WizardTileProps
mockGetEnableDeckModification.mockReturnValue(true)
const { getByText, getAllByText, getByRole } = render(props)
getByText('Choose additional items')
expect(getAllByText('mock EquipmentOption')).toHaveLength(7)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,12 @@ import * as React from 'react'
import i18n from 'i18next'
import { FLEX_ROBOT_TYPE, OT2_ROBOT_TYPE } from '@opentrons/shared-data'
import { DeckConfigurator, renderWithProviders } from '@opentrons/components'
import { getEnableDeckModification } from '../../../../feature-flags/selectors'
import { StagingAreaTile } from '../StagingAreaTile'

import type { FormState, WizardTileProps } from '../types'

jest.mock('../../../../feature-flags/selectors')
jest.mock('@opentrons/components/src/hardware-sim/DeckConfigurator/index')

const mockGetEnableDeckModification = getEnableDeckModification as jest.MockedFunction<
typeof getEnableDeckModification
>
const mockDeckConfigurator = DeckConfigurator as jest.MockedFunction<
typeof DeckConfigurator
>
Expand Down Expand Up @@ -44,7 +39,6 @@ describe('StagingAreaTile', () => {
...props,
...mockWizardTileProps,
} as WizardTileProps
mockGetEnableDeckModification.mockReturnValue(true)
mockDeckConfigurator.mockReturnValue(<div>mock deck configurator</div>)
})
it('renders null when robot type is ot-2', () => {
Expand Down
16 changes: 3 additions & 13 deletions protocol-designer/src/components/modals/CreateFileWizard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ import * as labwareDefSelectors from '../../../labware-defs/selectors'
import * as labwareDefActions from '../../../labware-defs/actions'
import * as labwareIngredActions from '../../../labware-ingred/actions'
import { actions as steplistActions } from '../../../steplist'
import { getEnableDeckModification } from '../../../feature-flags/selectors'
import {
createDeckFixture,
toggleIsGripperRequired,
Expand Down Expand Up @@ -100,8 +99,6 @@ export function CreateFileWizard(): JSX.Element | null {
const customLabware = useSelector(
labwareDefSelectors.getCustomLabwareDefsByURI
)
const enableDeckModification = useSelector(getEnableDeckModification)

const [currentStepIndex, setCurrentStepIndex] = React.useState<number>(0)
const [wizardSteps, setWizardSteps] = React.useState<WizardStep[]>(
WIZARD_STEPS
Expand Down Expand Up @@ -209,11 +206,7 @@ export function CreateFileWizard(): JSX.Element | null {
)

// add trash
if (
(enableDeckModification &&
values.additionalEquipment.includes('trashBin')) ||
!enableDeckModification
) {
if (values.additionalEquipment.includes('trashBin')) {
// defaulting trash to appropriate locations
dispatch(
createDeckFixture(
Expand All @@ -226,17 +219,14 @@ export function CreateFileWizard(): JSX.Element | null {
}

// add waste chute
if (
enableDeckModification &&
values.additionalEquipment.includes('wasteChute')
) {
if (values.additionalEquipment.includes('wasteChute')) {
dispatch(createDeckFixture('wasteChute', WASTE_CHUTE_CUTOUT))
}
// add staging areas
const stagingAreas = values.additionalEquipment.filter(equipment =>
equipment.includes('stagingArea')
)
if (enableDeckModification && stagingAreas.length > 0) {
if (stagingAreas.length > 0) {
stagingAreas.forEach(stagingArea => {
const [, location] = stagingArea.split('_')
dispatch(createDeckFixture('stagingArea', location))
Expand Down
4 changes: 1 addition & 3 deletions protocol-designer/src/components/modules/EditModulesCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
} from '../../step-forms'
import { selectors as featureFlagSelectors } from '../../feature-flags'
import { SUPPORTED_MODULE_TYPES } from '../../modules'
import { getEnableDeckModification } from '../../feature-flags/selectors'
import { getAdditionalEquipment } from '../../step-forms/selectors'
import {
deleteDeckFixture,
Expand All @@ -39,7 +38,6 @@ export interface Props {

export function EditModulesCard(props: Props): JSX.Element {
const { modules, openEditModuleModal } = props
const enableDeckModification = useSelector(getEnableDeckModification)
const pipettesByMount = useSelector(
stepFormSelectors.getPipettesForEditPipetteForm
)
Expand Down Expand Up @@ -153,7 +151,7 @@ export function EditModulesCard(props: Props): JSX.Element {
)
}
})}
{enableDeckModification && isFlex ? (
{isFlex ? (
<>
<StagingAreasRow
handleAttachment={handleDeleteStagingAreas}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
selectors as stepFormSelectors,
} from '../../../step-forms'
import { getRobotType } from '../../../file-data/selectors'
import { getEnableDeckModification } from '../../../feature-flags/selectors'
import { FormPipette } from '../../../step-forms/types'
import {
getAdditionalEquipment,
Expand All @@ -32,7 +31,6 @@ import { AdditionalItemsRow } from '../AdditionalItemsRow'
import { FLEX_TRASH_DEF_URI } from '../../../constants'
import { StagingAreasRow } from '../StagingAreasRow'

jest.mock('../../../feature-flags')
jest.mock('../../../step-forms/selectors')
jest.mock('../../../file-data/selectors')
jest.mock('../../../feature-flags/selectors')
Expand All @@ -49,9 +47,6 @@ const mockGetRobotType = getRobotType as jest.MockedFunction<
const mockGetAdditionalEquipment = getAdditionalEquipment as jest.MockedFunction<
typeof getAdditionalEquipment
>
const mockGetEnableDeckModification = getEnableDeckModification as jest.MockedFunction<
typeof getEnableDeckModification
>
const mockGetLabwareEntities = getLabwareEntities as jest.MockedFunction<
typeof getLabwareEntities
>
Expand Down Expand Up @@ -107,7 +102,6 @@ describe('EditModulesCard', () => {
tiprackDefURI: null,
},
})
mockGetEnableDeckModification.mockReturnValue(false)
mockGetLabwareEntities.mockReturnValue({})
mockGetInitialDeckSetup.mockReturnValue({
labware: {
Expand Down Expand Up @@ -274,10 +268,14 @@ describe('EditModulesCard', () => {
it('displays gripper row with no gripper', () => {
mockGetRobotType.mockReturnValue(FLEX_ROBOT_TYPE)
const wrapper = render(props)
expect(wrapper.find(AdditionalItemsRow)).toHaveLength(1)
expect(wrapper.find(AdditionalItemsRow).props().isEquipmentAdded).toEqual(
false
)
expect(wrapper.find(AdditionalItemsRow)).toHaveLength(3)
expect(
wrapper.find(AdditionalItemsRow).filter({ name: 'gripper' }).props()
).toEqual({
isEquipmentAdded: false,
name: 'gripper',
handleAttachment: expect.anything(),
})
})
it('displays gripper row with gripper attached', () => {
const mockGripperId = 'gripeprId'
Expand All @@ -286,16 +284,19 @@ describe('EditModulesCard', () => {
[mockGripperId]: { name: 'gripper', id: mockGripperId },
})
const wrapper = render(props)
expect(wrapper.find(AdditionalItemsRow)).toHaveLength(1)
expect(wrapper.find(AdditionalItemsRow).props().isEquipmentAdded).toEqual(
true
)
expect(wrapper.find(AdditionalItemsRow)).toHaveLength(3)
expect(
wrapper.find(AdditionalItemsRow).filter({ name: 'gripper' }).props()
).toEqual({
isEquipmentAdded: true,
name: 'gripper',
handleAttachment: expect.anything(),
})
})
it('displays gripper waste chute, staging area, and trash row with all are attached', () => {
const mockGripperId = 'gripperId'
const mockWasteChuteId = 'wasteChuteId'
const mockStagingAreaId = 'stagingAreaId'
mockGetEnableDeckModification.mockReturnValue(true)
mockGetRobotType.mockReturnValue(FLEX_ROBOT_TYPE)
mockGetAdditionalEquipment.mockReturnValue({
mockGripperId: { name: 'gripper', id: mockGripperId },
Expand Down
2 changes: 0 additions & 2 deletions protocol-designer/src/feature-flags/reducers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ const initialFlags: Flags = {
OT_PD_ALLOW_ALL_TIPRACKS:
process.env.OT_PD_ALLOW_ALL_TIPRACKS === '1' || false,
OT_PD_ALLOW_96_CHANNEL: process.env.OT_PD_ALLOW_96_CHANNEL === '1' || false,
OT_PD_ENABLE_FLEX_DECK_MODIFICATION:
process.env.OT_PD_ENABLE_FLEX_DECK_MODIFICATION === '1' || false,
OT_PD_ENABLE_MULTI_TIP: process.env.OT_PD_ENABLE_MULTI_TIP === '1' || false,
}
// @ts-expect-error(sa, 2021-6-10): cannot use string literals as action type
Expand Down
Loading

0 comments on commit 1aa2df6

Please sign in to comment.