Skip to content

Commit

Permalink
fix(protocol-designer) hide view details item from Step Overflow Menu…
Browse files Browse the repository at this point in the history
… 96-channel (#17006)

* fix(protocol-designer) hide view details item from Step Overflow Menu 96-channel
  • Loading branch information
koji authored Dec 2, 2024
1 parent 36c3208 commit bc28c51
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { OPEN_STEP_DETAILS_EVENT } from '../../../../analytics/constants'
import {
getBatchEditFormHasUnsavedChanges,
getCurrentFormHasUnsavedChanges,
getPipetteEntities,
getSavedStepForms,
getUnsavedForm,
} from '../../../../step-forms/selectors'
Expand Down Expand Up @@ -61,12 +62,16 @@ export function StepOverflowMenu(props: StepOverflowMenuProps): JSX.Element {
const dispatch = useDispatch<ThunkDispatch<BaseState, any, any>>()
const formData = useSelector(getUnsavedForm)
const savedStepFormData = useSelector(getSavedStepForms)[stepId]
const pipetteEntities = useSelector(getPipetteEntities)

const isPipetteStep =
savedStepFormData.stepType === 'moveLiquid' ||
savedStepFormData.stepType === 'mix'
const isThermocyclerProfile =
savedStepFormData.stepType === 'thermocycler' &&
savedStepFormData.thermocyclerFormType === 'thermocyclerProfile'
const is96Channel =
pipetteEntities[savedStepFormData.pipette]?.name === 'p1000_96'

const duplicateStep = (
stepId: StepIdType
Expand Down Expand Up @@ -132,7 +137,8 @@ export function StepOverflowMenu(props: StepOverflowMenuProps): JSX.Element {
{formData != null ? null : (
<MenuItem onClick={handleEdit}>{t('edit_step')}</MenuItem>
)}
{isPipetteStep || isThermocyclerProfile ? (
{/* Note the following 96-channel check is temp */}
{(isPipetteStep && !is96Channel) || isThermocyclerProfile ? (
<MenuItem
disabled={formData != null}
onClick={() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { analyticsEvent } from '../../../../../analytics/actions'
import {
getCurrentFormHasUnsavedChanges,
getCurrentFormIsPresaved,
getPipetteEntities,
getSavedStepForms,
getUnsavedForm,
} from '../../../../../step-forms/selectors'
Expand All @@ -24,6 +25,8 @@ import type * as OpentronsComponents from '@opentrons/components'

const mockConfirm = vi.fn()
const mockCancel = vi.fn()
const mockId = 'mockId'
const mockId96 = '96MockId'

vi.mock('../../../../../ui/steps')
vi.mock('../../../../../step-forms/selectors')
Expand Down Expand Up @@ -72,6 +75,16 @@ describe('StepOverflowMenu', () => {
[moveLiquidStepId]: {
stepType: 'moveLiquid',
id: moveLiquidStepId,
pipette: mockId,
},
})
vi.mocked(getPipetteEntities).mockReturnValue({
[mockId]: {
name: 'p50_single_flex',
spec: {} as any,
id: mockId,
tiprackLabwareDef: [],
tiprackDefURI: ['mockDefURI1', 'mockDefURI2'],
},
})
})
Expand All @@ -94,4 +107,25 @@ describe('StepOverflowMenu', () => {
screen.getByText('Duplicate steps')
screen.getByText('Delete steps')
})

it('should not render view details button if pipette is 96-channel', () => {
vi.mocked(getSavedStepForms).mockReturnValue({
[moveLiquidStepId]: {
stepType: 'moveLiquid',
id: moveLiquidStepId,
pipette: mockId96,
},
})
vi.mocked(getPipetteEntities).mockReturnValue({
[mockId96]: {
name: 'p1000_96',
spec: {} as any,
id: mockId96,
tiprackLabwareDef: [],
tiprackDefURI: ['mockDefURI1_96'],
},
})
render(props)
expect(screen.queryByText('View details')).not.toBeInTheDocument()
})
})

0 comments on commit bc28c51

Please sign in to comment.