Skip to content

Commit

Permalink
feat(protocol-designer): remove multi modules feature flag (#16553)
Browse files Browse the repository at this point in the history
* feat(protocol-designer): remove multi modules feature flag
  • Loading branch information
koji authored Oct 21, 2024
1 parent d9dd918 commit 1b0a5a5
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@
"title": "Enable redesign",
"description": "A whole new world."
},
"OT_PD_ENABLE_MOAM": {
"title": "Enable multiple modules",
"description": "Enable multiple heater-shakers and magnetic blocks for Flex only."
},
"OT_PD_ENABLE_COMMENT": {
"title": "Enable comment step",
"description": "You can add comments anywhere between timeline steps."
Expand Down
10 changes: 5 additions & 5 deletions protocol-designer/src/components/EditModules.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
} from '../step-forms'
import { moveDeckItem } from '../labware-ingred/actions/actions'
import { getRobotType } from '../file-data/selectors'
import { getEnableMoam } from '../feature-flags/selectors'
import { EditMultipleModulesModal } from './modals/EditModulesModal/EditMultipleModulesModal'
import { useBlockingHint } from './Hints/useBlockingHint'
import { MagneticModuleWarningModalContent } from './modals/EditModulesModal/MagneticModuleWarningModalContent'
Expand All @@ -34,14 +33,15 @@ export interface ModelModuleInfo {

export const EditModules = (props: EditModulesProps): JSX.Element => {
const { onCloseClick, moduleToEdit } = props
const enableMoam = useSelector(getEnableMoam)
const { moduleId, moduleType } = moduleToEdit
const _initialDeckSetup = useSelector(stepFormSelectors.getInitialDeckSetup)
const robotType = useSelector(getRobotType)

const MOAM_MODULE_TYPES: ModuleType[] = enableMoam
? [TEMPERATURE_MODULE_TYPE, HEATERSHAKER_MODULE_TYPE, MAGNETIC_BLOCK_TYPE]
: [TEMPERATURE_MODULE_TYPE]
const MOAM_MODULE_TYPES: ModuleType[] = [
TEMPERATURE_MODULE_TYPE,
HEATERSHAKER_MODULE_TYPE,
MAGNETIC_BLOCK_TYPE,
]

const showMultipleModuleModal =
robotType === FLEX_ROBOT_TYPE && MOAM_MODULE_TYPES.includes(moduleType)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
import { i18n } from '../../assets/localization'
import { getInitialDeckSetup } from '../../step-forms/selectors'
import { getDismissedHints } from '../../tutorial/selectors'
import { getEnableMoam } from '../../feature-flags/selectors'
import { renderWithProviders } from '../../__testing-utils__'
import { getRobotType } from '../../file-data/selectors'
import { EditMultipleModulesModal } from '../modals/EditModulesModal/EditMultipleModulesModal'
Expand Down Expand Up @@ -58,7 +57,6 @@ describe('EditModules', () => {
labware: {},
additionalEquipmentOnDeck: {},
})
vi.mocked(getEnableMoam).mockReturnValue(true)
vi.mocked(EditModulesModal).mockReturnValue(
<div>mock EditModulesModal</div>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import gripperImage from '../../../assets/images/flex_gripper.png'
import wasteChuteImage from '../../../assets/images/waste_chute.png'
import trashBinImage from '../../../assets/images/flex_trash_bin.png'
import { uuid } from '../../../utils'
import { getEnableMoam } from '../../../feature-flags/selectors'
import { selectors as featureFlagSelectors } from '../../../feature-flags'
import { CrashInfoBox, ModuleDiagram } from '../../modules'
import { ModuleFields } from '../FilePipettesModal/ModuleFields'
Expand Down Expand Up @@ -202,15 +201,17 @@ export function ModulesAndOtherTile(props: WizardTileProps): JSX.Element {

function FlexModuleFields(props: WizardTileProps): JSX.Element {
const { watch, setValue } = props
const enableMoam = useSelector(getEnableMoam)
const modules = watch('modules')
const additionalEquipment = watch('additionalEquipment')
const enableAbsorbanceReader = useSelector(
featureFlagSelectors.getEnableAbsorbanceReader
)
const MOAM_MODULE_TYPES: ModuleType[] = enableMoam
? [TEMPERATURE_MODULE_TYPE, HEATERSHAKER_MODULE_TYPE, MAGNETIC_BLOCK_TYPE]
: [TEMPERATURE_MODULE_TYPE]
const MOAM_MODULE_TYPES: ModuleType[] = [
TEMPERATURE_MODULE_TYPE,
HEATERSHAKER_MODULE_TYPE,
MAGNETIC_BLOCK_TYPE,
]

const moduleTypesOnDeck =
modules != null ? Object.values(modules).map(module => module.type) : []

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ import { fireEvent, screen, cleanup } from '@testing-library/react'
import { FLEX_ROBOT_TYPE, OT2_ROBOT_TYPE } from '@opentrons/shared-data'
import { renderWithProviders } from '../../../../__testing-utils__'
import { i18n } from '../../../../assets/localization'
import {
getDisableModuleRestrictions,
getEnableMoam,
} from '../../../../feature-flags/selectors'
import { getDisableModuleRestrictions } from '../../../../feature-flags/selectors'
import { CrashInfoBox } from '../../../modules'
import { ModuleFields } from '../../FilePipettesModal/ModuleFields'
import { ModulesAndOtherTile } from '../ModulesAndOtherTile'
Expand Down Expand Up @@ -61,7 +58,6 @@ describe('ModulesAndOtherTile', () => {
...props,
...mockWizardTileProps,
} as WizardTileProps
vi.mocked(getEnableMoam).mockReturnValue(true)
vi.mocked(CrashInfoBox).mockReturnValue(<div> mock CrashInfoBox</div>)
vi.mocked(EquipmentOption).mockReturnValue(<div>mock EquipmentOption</div>)
vi.mocked(getDisableModuleRestrictions).mockReturnValue(false)
Expand Down
1 change: 0 additions & 1 deletion protocol-designer/src/feature-flags/reducers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ const initialFlags: Flags = {
OT_PD_ENABLE_ABSORBANCE_READER:
process.env.OT_PD_ENABLE_ABSORBANCE_READER === '1' || false,
OT_PD_ENABLE_REDESIGN: process.env.OT_PD_ENABLE_REDESIGN === '1' || false,
OT_PD_ENABLE_MOAM: process.env.OT_PD_ENABLE_MOAM === '1' || false,
OT_PD_ENABLE_COMMENT: process.env.OT_PD_ENABLE_COMMENT === '1' || false,
OT_PD_ENABLE_RETURN_TIP: process.env.OT_PD_ENABLE_RETURN_TIP === '1' || false,
OT_PD_ENABLE_HOT_KEYS_DISPLAY:
Expand Down
4 changes: 0 additions & 4 deletions protocol-designer/src/feature-flags/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ export const getEnableRedesign: Selector<boolean> = createSelector(
getFeatureFlagData,
flags => flags.OT_PD_ENABLE_REDESIGN ?? false
)
export const getEnableMoam: Selector<boolean> = createSelector(
getFeatureFlagData,
flags => flags.OT_PD_ENABLE_MOAM ?? false
)
export const getEnableComment: Selector<boolean> = createSelector(
getFeatureFlagData,
flags => flags.OT_PD_ENABLE_COMMENT ?? false
Expand Down
2 changes: 0 additions & 2 deletions protocol-designer/src/feature-flags/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export type FlagTypes =
| 'OT_PD_ALLOW_ALL_TIPRACKS'
| 'OT_PD_ENABLE_ABSORBANCE_READER'
| 'OT_PD_ENABLE_REDESIGN'
| 'OT_PD_ENABLE_MOAM'
| 'OT_PD_ENABLE_COMMENT'
| 'OT_PD_ENABLE_RETURN_TIP'
| 'OT_PD_ENABLE_HOT_KEYS_DISPLAY'
Expand All @@ -46,7 +45,6 @@ export const allFlags: FlagTypes[] = [
'PRERELEASE_MODE',
'OT_PD_ENABLE_ABSORBANCE_READER',
'OT_PD_ENABLE_REDESIGN',
'OT_PD_ENABLE_MOAM',
'OT_PD_ENABLE_COMMENT',
'OT_PD_ENABLE_RETURN_TIP',
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@ import {
TEMPERATURE_MODULE_TYPE,
} from '@opentrons/shared-data'
import { uuid } from '../../utils'
import {
getEnableAbsorbanceReader,
getEnableMoam,
} from '../../feature-flags/selectors'
import { getEnableAbsorbanceReader } from '../../feature-flags/selectors'
import { useKitchen } from '../../organisms/Kitchen/hooks'
import { ModuleDiagram } from '../../components/modules'
import { WizardBody } from './WizardBody'
Expand Down Expand Up @@ -56,7 +53,6 @@ export function SelectModules(props: WizardTileProps): JSX.Element | null {
const fields = watch('fields')
const modules = watch('modules')
const additionalEquipment = watch('additionalEquipment')
const enableMoam = useSelector(getEnableMoam)
const enableAbsorbanceReader = useSelector(getEnableAbsorbanceReader)
const robotType = fields.robotType
const supportedModules =
Expand All @@ -83,9 +79,11 @@ export function SelectModules(props: WizardTileProps): JSX.Element | null {
)
)
)
const MOAM_MODULE_TYPES: ModuleType[] = enableMoam
? [TEMPERATURE_MODULE_TYPE, HEATERSHAKER_MODULE_TYPE, MAGNETIC_BLOCK_TYPE]
: [TEMPERATURE_MODULE_TYPE]
const MOAM_MODULE_TYPES: ModuleType[] = [
TEMPERATURE_MODULE_TYPE,
HEATERSHAKER_MODULE_TYPE,
MAGNETIC_BLOCK_TYPE,
]

const handleAddModule = (moduleModel: ModuleModel): void => {
if (hasNoAvailableSlots) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ import '@testing-library/jest-dom/vitest'
import { FLEX_ROBOT_TYPE, OT2_ROBOT_TYPE } from '@opentrons/shared-data'
import { fireEvent, screen } from '@testing-library/react'
import { i18n } from '../../../assets/localization'
import {
getEnableAbsorbanceReader,
getEnableMoam,
} from '../../../feature-flags/selectors'
import { getEnableAbsorbanceReader } from '../../../feature-flags/selectors'
import { renderWithProviders } from '../../../__testing-utils__'
import { SelectModules } from '../SelectModules'
import type { WizardFormState, WizardTileProps } from '../types'
Expand Down Expand Up @@ -46,7 +43,6 @@ describe('SelectModules', () => {
props = {
...mockWizardTileProps,
} as WizardTileProps
vi.mocked(getEnableMoam).mockReturnValue(true)
vi.mocked(getEnableAbsorbanceReader).mockReturnValue(true)
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,11 @@ import {
selectNestedLabware,
selectZoomedIntoSlot,
} from '../../../labware-ingred/actions'
import {
getEnableAbsorbanceReader,
getEnableMoam,
} from '../../../feature-flags/selectors'
import { getEnableAbsorbanceReader } from '../../../feature-flags/selectors'
import { selectors } from '../../../labware-ingred/selectors'
import { useKitchen } from '../../../organisms/Kitchen/hooks'
import { createContainerAboveModule } from '../../../step-forms/actions/thunks'
import { FIXTURES, MOAM_MODELS, MOAM_MODELS_WITH_FF } from './constants'
import { FIXTURES, MOAM_MODELS } from './constants'
import { getSlotInformation } from '../utils'
import { getModuleModelsBySlot, getDeckErrors } from './utils'
import { LabwareTools } from './LabwareTools'
Expand All @@ -70,7 +67,6 @@ export function DeckSetupTools(props: DeckSetupToolsProps): JSX.Element | null {
const robotType = useSelector(getRobotType)
const dispatch = useDispatch<ThunkDispatch<any>>()
const enableAbsorbanceReader = useSelector(getEnableAbsorbanceReader)
const enableMoam = useSelector(getEnableMoam)
const deckSetup = useSelector(getDeckSetupForActiveItem)
const {
selectedLabwareDefUri,
Expand Down Expand Up @@ -293,9 +289,7 @@ export function DeckSetupTools(props: DeckSetupToolsProps): JSX.Element | null {
module.type === getModuleType(model) &&
module.slot !== slot
)
const moamModels = enableMoam
? MOAM_MODELS
: MOAM_MODELS_WITH_FF
const moamModels = MOAM_MODELS

const collisionError = getDeckErrors({
modules: deckSetupModules,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ import { renderWithProviders } from '../../../../__testing-utils__'
import { deleteContainer } from '../../../../labware-ingred/actions'
import { createModule, deleteModule } from '../../../../step-forms/actions'
import { getRobotType } from '../../../../file-data/selectors'
import {
getEnableAbsorbanceReader,
getEnableMoam,
} from '../../../../feature-flags/selectors'
import { getEnableAbsorbanceReader } from '../../../../feature-flags/selectors'
import {
createDeckFixture,
deleteDeckFixture,
Expand Down Expand Up @@ -63,7 +60,6 @@ describe('DeckSetupTools', () => {
vi.mocked(LabwareTools).mockReturnValue(<div>mock labware tools</div>)
vi.mocked(getRobotType).mockReturnValue(FLEX_ROBOT_TYPE)
vi.mocked(getEnableAbsorbanceReader).mockReturnValue(true)
vi.mocked(getEnableMoam).mockReturnValue(true)
vi.mocked(getDeckSetupForActiveItem).mockReturnValue({
labware: {},
modules: {},
Expand Down

0 comments on commit 1b0a5a5

Please sign in to comment.