From 1aa2df6c4db911b915ffd7600692f9037f4b8c52 Mon Sep 17 00:00:00 2001 From: Jethary Date: Fri, 1 Dec 2023 09:39:44 -0500 Subject: [PATCH] remove deck config ff --- .../CreateFileWizard/ModulesAndOtherTile.tsx | 37 ++++--------------- .../CreateFileWizard/StagingAreaTile.tsx | 5 +-- .../__tests__/CreateFileWizard.test.tsx | 10 +---- .../__tests__/ModulesAndOtherTile.test.tsx | 24 +----------- .../__tests__/StagingAreaTile.test.tsx | 6 --- .../modals/CreateFileWizard/index.tsx | 16 ++------ .../components/modules/EditModulesCard.tsx | 4 +- .../__tests__/EditModulesCard.test.tsx | 31 ++++++++-------- .../src/feature-flags/reducers.ts | 2 - .../src/feature-flags/selectors.ts | 4 -- protocol-designer/src/feature-flags/types.ts | 2 +- .../src/localization/en/feature_flags.json | 4 -- 12 files changed, 33 insertions(+), 112 deletions(-) diff --git a/protocol-designer/src/components/modals/CreateFileWizard/ModulesAndOtherTile.tsx b/protocol-designer/src/components/modals/CreateFileWizard/ModulesAndOtherTile.tsx index 51ae447f8fb7..143f2816d423 100644 --- a/protocol-designer/src/components/modals/CreateFileWizard/ModulesAndOtherTile.tsx +++ b/protocol-designer/src/components/modals/CreateFileWizard/ModulesAndOtherTile.tsx @@ -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 @@ -151,10 +148,7 @@ export function ModulesAndOtherTile(props: WizardTileProps): JSX.Element { onSetFieldTouched={setFieldTouched} /> ) : ( - + )} {robotType === OT2_ROBOT_TYPE && moduleRestrictionsDisabled !== true ? modCrashWarning @@ -168,23 +162,10 @@ export function ModulesAndOtherTile(props: WizardTileProps): JSX.Element { > { - 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() @@ -211,11 +192,9 @@ export function ModulesAndOtherTile(props: WizardTileProps): JSX.Element { ) } -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) @@ -284,7 +263,7 @@ function FlexModuleFields(props: FlexModuleFieldsProps): JSX.Element { text="Gripper" showCheckbox /> - {enableDeckModification && isFlex ? ( + {isFlex ? ( <> handleSetEquipmentOption('wasteChute')} diff --git a/protocol-designer/src/components/modals/CreateFileWizard/StagingAreaTile.tsx b/protocol-designer/src/components/modals/CreateFileWizard/StagingAreaTile.tsx index 423b0c93689e..7b3c754e5e5d 100644 --- a/protocol-designer/src/components/modals/CreateFileWizard/StagingAreaTile.tsx +++ b/protocol-designer/src/components/modals/CreateFileWizard/StagingAreaTile.tsx @@ -1,5 +1,4 @@ import * as React from 'react' -import { useSelector } from 'react-redux' import without from 'lodash/without' import { DIRECTION_COLUMN, @@ -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' @@ -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 @@ -73,7 +70,7 @@ export function StagingAreaTile(props: WizardTileProps): JSX.Element | null { initialSlots ) - if (!deckConfigurationFF || isOt2) { + if (isOt2) { proceed() return null } diff --git a/protocol-designer/src/components/modals/CreateFileWizard/__tests__/CreateFileWizard.test.tsx b/protocol-designer/src/components/modals/CreateFileWizard/__tests__/CreateFileWizard.test.tsx index 1e8adbaa1aa2..2790175db47d 100644 --- a/protocol-designer/src/components/modals/CreateFileWizard/__tests__/CreateFileWizard.test.tsx +++ b/protocol-designer/src/components/modals/CreateFileWizard/__tests__/CreateFileWizard.test.tsx @@ -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 '..' @@ -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()[0] } @@ -91,7 +85,6 @@ const ten = '10uL' describe('CreateFileWizard', () => { beforeEach(() => { - mockGetEnableDeckModification.mockReturnValue(false) mockGetNewProtocolModal.mockReturnValue(true) mockGetAllowAllTipracks.mockReturnValue(false) mockGetLabwareDefsByURI.mockReturnValue({ @@ -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, diff --git a/protocol-designer/src/components/modals/CreateFileWizard/__tests__/ModulesAndOtherTile.test.tsx b/protocol-designer/src/components/modals/CreateFileWizard/__tests__/ModulesAndOtherTile.test.tsx index 22aa30f301f8..4f169c8d689b 100644 --- a/protocol-designer/src/components/modals/CreateFileWizard/__tests__/ModulesAndOtherTile.test.tsx +++ b/protocol-designer/src/components/modals/CreateFileWizard/__tests__/ModulesAndOtherTile.test.tsx @@ -2,10 +2,7 @@ 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' @@ -13,10 +10,10 @@ 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< @@ -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) => { return renderWithProviders(, { i18nInstance: i18n, @@ -79,21 +73,8 @@ describe('ModulesAndOtherTile', () => { mockEquipmentOption.mockReturnValue(
mock EquipmentOption
) mockGetDisableModuleRestrictions.mockReturnValue(false) mockModuleFields.mockReturnValue(
mock ModuleFields
) - 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) @@ -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) diff --git a/protocol-designer/src/components/modals/CreateFileWizard/__tests__/StagingAreaTile.test.tsx b/protocol-designer/src/components/modals/CreateFileWizard/__tests__/StagingAreaTile.test.tsx index 87029c3450dc..b8b665d93853 100644 --- a/protocol-designer/src/components/modals/CreateFileWizard/__tests__/StagingAreaTile.test.tsx +++ b/protocol-designer/src/components/modals/CreateFileWizard/__tests__/StagingAreaTile.test.tsx @@ -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 > @@ -44,7 +39,6 @@ describe('StagingAreaTile', () => { ...props, ...mockWizardTileProps, } as WizardTileProps - mockGetEnableDeckModification.mockReturnValue(true) mockDeckConfigurator.mockReturnValue(
mock deck configurator
) }) it('renders null when robot type is ot-2', () => { diff --git a/protocol-designer/src/components/modals/CreateFileWizard/index.tsx b/protocol-designer/src/components/modals/CreateFileWizard/index.tsx index d00890051e7f..845256cb336a 100644 --- a/protocol-designer/src/components/modals/CreateFileWizard/index.tsx +++ b/protocol-designer/src/components/modals/CreateFileWizard/index.tsx @@ -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, @@ -100,8 +99,6 @@ export function CreateFileWizard(): JSX.Element | null { const customLabware = useSelector( labwareDefSelectors.getCustomLabwareDefsByURI ) - const enableDeckModification = useSelector(getEnableDeckModification) - const [currentStepIndex, setCurrentStepIndex] = React.useState(0) const [wizardSteps, setWizardSteps] = React.useState( WIZARD_STEPS @@ -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( @@ -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)) diff --git a/protocol-designer/src/components/modules/EditModulesCard.tsx b/protocol-designer/src/components/modules/EditModulesCard.tsx index ccec79d91741..3b8c1b3f7d91 100644 --- a/protocol-designer/src/components/modules/EditModulesCard.tsx +++ b/protocol-designer/src/components/modules/EditModulesCard.tsx @@ -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, @@ -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 ) @@ -153,7 +151,7 @@ export function EditModulesCard(props: Props): JSX.Element { ) } })} - {enableDeckModification && isFlex ? ( + {isFlex ? ( <> -const mockGetEnableDeckModification = getEnableDeckModification as jest.MockedFunction< - typeof getEnableDeckModification -> const mockGetLabwareEntities = getLabwareEntities as jest.MockedFunction< typeof getLabwareEntities > @@ -107,7 +102,6 @@ describe('EditModulesCard', () => { tiprackDefURI: null, }, }) - mockGetEnableDeckModification.mockReturnValue(false) mockGetLabwareEntities.mockReturnValue({}) mockGetInitialDeckSetup.mockReturnValue({ labware: { @@ -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' @@ -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 }, diff --git a/protocol-designer/src/feature-flags/reducers.ts b/protocol-designer/src/feature-flags/reducers.ts index 031a2add102a..31802641570b 100644 --- a/protocol-designer/src/feature-flags/reducers.ts +++ b/protocol-designer/src/feature-flags/reducers.ts @@ -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 diff --git a/protocol-designer/src/feature-flags/selectors.ts b/protocol-designer/src/feature-flags/selectors.ts index 461b0448917d..e90c50f9877a 100644 --- a/protocol-designer/src/feature-flags/selectors.ts +++ b/protocol-designer/src/feature-flags/selectors.ts @@ -23,10 +23,6 @@ export const getAllow96Channel: Selector = createSelector( getFeatureFlagData, flags => flags.OT_PD_ALLOW_96_CHANNEL ?? false ) -export const getEnableDeckModification: Selector = createSelector( - getFeatureFlagData, - flags => flags.OT_PD_ENABLE_FLEX_DECK_MODIFICATION ?? false -) export const getEnableMultiTip: Selector = createSelector( getFeatureFlagData, flags => flags.OT_PD_ENABLE_MULTI_TIP ?? false diff --git a/protocol-designer/src/feature-flags/types.ts b/protocol-designer/src/feature-flags/types.ts index 729ecd0226fc..c62ff5e756d2 100644 --- a/protocol-designer/src/feature-flags/types.ts +++ b/protocol-designer/src/feature-flags/types.ts @@ -20,6 +20,7 @@ export const DEPRECATED_FLAGS = [ 'OT_PD_ENABLE_THERMOCYCLER_GEN_2', 'OT_PD_ENABLE_LIQUID_COLOR_ENHANCEMENTS', 'OT_PD_ENABLE_OT_3', + 'OT_PD_ENABLE_FLEX_DECK_MODIFICATION', ] // union of feature flag string constant IDs export type FlagTypes = @@ -27,7 +28,6 @@ export type FlagTypes = | 'OT_PD_DISABLE_MODULE_RESTRICTIONS' | 'OT_PD_ALLOW_ALL_TIPRACKS' | 'OT_PD_ALLOW_96_CHANNEL' - | 'OT_PD_ENABLE_FLEX_DECK_MODIFICATION' | 'OT_PD_ENABLE_MULTI_TIP' // flags that are not in this list only show in prerelease mode export const userFacingFlags: FlagTypes[] = [ diff --git a/protocol-designer/src/localization/en/feature_flags.json b/protocol-designer/src/localization/en/feature_flags.json index 12043dc1267d..e02c8c1d85b4 100644 --- a/protocol-designer/src/localization/en/feature_flags.json +++ b/protocol-designer/src/localization/en/feature_flags.json @@ -16,10 +16,6 @@ "title": "Enable 96-channel pipette", "description": "Allow users to select 96-channel pipette" }, - "OT_PD_ENABLE_FLEX_DECK_MODIFICATION": { - "title": "Enable Flex deck modification", - "description": "Allow users to select waste chute, Flex staging, and modify trash slot" - }, "OT_PD_ENABLE_MULTI_TIP": { "title": "Enable multi tiprack support", "description": "Allow users to select multiple tipracks per pipette"