Skip to content

Commit a29f67c

Browse files
authored
refactor(protocol-designer): deprecate unused equipment modal (#18537)
closes AUTH-1957
1 parent 0a79fa1 commit a29f67c

File tree

13 files changed

+39
-449
lines changed

13 files changed

+39
-449
lines changed

protocol-designer/cypress/e2e/migrations.cy.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,53 +13,46 @@ describe('Protocol fixtures migrate and match snapshots', () => {
1313
title: 'example_1_1_0 (schema 1, PD version 1.1.1) -> PD 8.5.x, schema 8',
1414
importTestFile: TestFilePath.Example_1_1_0,
1515
expectedTestFile: TestFilePath.Example_1_1_0V8,
16-
unusedHardware: true,
1716
migrationModal: 'newLabwareDefs',
1817
},
1918
{
2019
title: 'doItAllV3 (schema 3, PD version 4.0.0) -> PD 8.5.x, schema 8',
2120
importTestFile: TestFilePath.DoItAllV3V4,
2221
expectedTestFile: TestFilePath.DoItAllV3MigratedToV8,
23-
unusedHardware: false,
2422
migrationModal: 'v8.1',
2523
},
2624
{
2725
title: 'doItAllV4 (schema 4, PD version 4.0.0) -> PD 8.5.x, schema 8',
2826
importTestFile: TestFilePath.DoItAllV4V4,
2927
expectedTestFile: TestFilePath.DoItAllV4MigratedToV8,
30-
unusedHardware: false,
3128
migrationModal: 'v8.1',
3229
},
3330
{
3431
title:
3532
'doItAllv7MigratedToV8 (schema 7, PD version 8.0.0) -> should migrate to 8.5.x, schema 8',
3633
importTestFile: TestFilePath.DoItAllV7,
3734
expectedTestFile: TestFilePath.DoItAllV7MigratedToV8,
38-
unusedHardware: false,
3935
migrationModal: 'v8.1',
4036
},
4137
{
4238
title:
4339
'96-channel full and column schema 8 -> should migrate to 8.5.x, schema 8',
4440
importTestFile: TestFilePath.NinetySixChannelFullAndColumn,
4541
expectedTestFile: TestFilePath.NinetySixChannelFullAndColumn,
46-
unusedHardware: false,
4742
migrationModal: null,
4843
},
4944
{
5045
title:
5146
'doItAllV8 flex robot -> reimported, should migrate to 8.5.x, schema 8',
5247
importTestFile: TestFilePath.DoItAllV8,
5348
expectedTestFile: TestFilePath.DoItAllV8,
54-
unusedHardware: false,
5549
migrationModal: null,
5650
},
5751
{
5852
title:
5953
'new advanced settings with multi temp => reimported, should not migrate and stay at 8.5.x, schema 8',
6054
importTestFile: TestFilePath.NewAdvancedSettingsAndMultiTemp,
6155
expectedTestFile: TestFilePath.NewAdvancedSettingsAndMultiTemp,
62-
unusedHardware: false,
6356
migrationModal: null,
6457
},
6558
{
@@ -68,24 +61,16 @@ describe('Protocol fixtures migrate and match snapshots', () => {
6861
importTestFile: TestFilePath.ThermocyclerOnOt2V7,
6962
expectedTestFile: TestFilePath.ThermocyclerOnOt2V7MigratedToV8,
7063
migrationModal: 'v8.1',
71-
unusedHardware: true,
7264
},
7365
]
7466

7567
testCases.forEach(
76-
({
77-
title,
78-
importTestFile,
79-
expectedTestFile,
80-
unusedHardware,
81-
migrationModal,
82-
}) => {
68+
({ title, importTestFile, expectedTestFile, migrationModal }) => {
8369
it(title, () => {
8470
migrateAndMatchSnapshot({
8571
title,
8672
importTestFile,
8773
expectedTestFile,
88-
unusedHardware,
8974
migrationModal,
9075
})
9176
})

protocol-designer/cypress/support/Import.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export interface MigrateTestCase {
1111
title: string
1212
importTestFile: TestFilePath
1313
expectedTestFile: TestFilePath
14-
unusedHardware: boolean
1514
migrationModal: 'newLabwareDefs' | 'v8.1' | 'noBehaviorChange' | null
1615
}
1716

@@ -20,7 +19,6 @@ export const ContentStrings = {
2019
v8_1: 'The default dispense height is now 1 mm from the bottom of the well',
2120
noBehaviorChange:
2221
'We have added new features since the last time this protocol was updated, but have not made any changes to existing protocol behavior',
23-
unusedHardwareWarning: 'Protocol has unused hardware',
2422
exportButton: 'Export',
2523
continueButton: 'continue',
2624
continueWithExport: 'Continue with export',
@@ -66,7 +64,6 @@ export const verifyImportProtocolPage = (protocol: TestFile): void => {
6664
export const migrateAndMatchSnapshot = ({
6765
importTestFile,
6866
expectedTestFile,
69-
unusedHardware,
7067
migrationModal,
7168
}: MigrateTestCase): void => {
7269
const uploadProtocol: TestFile = getTestFile(importTestFile)
@@ -87,10 +84,6 @@ export const migrateAndMatchSnapshot = ({
8784

8885
cy.get(LocatorStrings.exportProtocol).click({ force: true })
8986

90-
if (unusedHardware) {
91-
cy.get('div').contains(ContentStrings.unusedHardwareWarning).should('exist')
92-
cy.contains(ContentStrings.continueWithExport).click({ force: true })
93-
}
9487
const expectedProtocol: TestFile = getTestFile(expectedTestFile)
9588

9689
cy.readFile(expectedProtocol.path).then(expectedProtocolRead => {

protocol-designer/fixtures/protocol/8/thermocyclerOnOt2V7MigratedToV8.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
},
1515
"designerApplication": {
1616
"name": "opentrons/protocol-designer",
17-
"version": "8.4.3-alpha.0",
17+
"version": "8.5.0",
1818
"data": {
1919
"_internalAppBuildDate": "Mon, 10 Mar 2025 14:05:38 GMT",
2020
"pipetteTiprackAssignments": {

protocol-designer/src/assets/localization/en/alert.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@
2929
},
3030
"hint": {
3131
"dont_show_again": "Don't show me again",
32-
"unused_hardware": {
33-
"title": "Protocol has unused hardware"
34-
},
3532
"no_commands": {
3633
"title": "Protocol has no steps"
3734
},

protocol-designer/src/components/organisms/BlockingHintModal/index.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,7 @@ export function BlockingHintModal(props: HintProps): JSX.Element {
5151
}
5252

5353
const confirmButtonText =
54-
hintKey === 'no_commands' || hintKey === 'unused_hardware'
55-
? 'continue_with_export'
56-
: 'confirm'
54+
hintKey === 'no_commands' ? 'continue_with_export' : 'confirm'
5755

5856
return createPortal(
5957
<Modal

protocol-designer/src/pages/Designer/ProtocolSteps/index.tsx

Lines changed: 7 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,13 @@ import { useKitchen } from '../../../components/organisms/Kitchen/hooks'
3535
import { DECK_SETUP_TOOLS_WIDTH_REM } from '../../../constants'
3636
import { getEnableHotKeysDisplay } from '../../../feature-flags/selectors'
3737
import {
38-
createFile,
3938
getRobotStateTimeline,
4039
getRobotType,
4140
} from '../../../file-data/selectors'
4241
import { selectZoomedIntoSlot } from '../../../labware-ingred/actions'
4342
import { saveProtocolFile } from '../../../load-file/actions'
4443
import { useProtocolExportHandler } from '../../../resources/hooks'
4544
import {
46-
getAdditionalEquipmentEntities,
4745
getSavedStepForms,
4846
getUnsavedForm,
4947
} from '../../../step-forms/selectors'
@@ -58,12 +56,6 @@ import {
5856
getSelectedTerminalItemId,
5957
} from '../../../ui/steps/selectors'
6058
import { getHasTrash } from '../../../utils'
61-
import { LOAD_COMMANDS } from '../../ProtocolOverview'
62-
import {
63-
getUnusedEntities,
64-
getUnusedStagingAreas,
65-
getUnusedTrash,
66-
} from '../../ProtocolOverview/utils'
6759
import { DeckSetupContainer } from '../DeckSetup'
6860
import { zoomInOnCoordinate } from '../DeckSetup/utils'
6961
import { OffDeck } from '../OffDeck'
@@ -75,7 +67,6 @@ import { TimelineEditHardware } from './TimelineEditHardware'
7567

7668
import type { Dispatch, SetStateAction } from 'react'
7769
import type { DeckSlot, ThunkDispatch } from '../../../types'
78-
import type { Fixture } from '../../ProtocolOverview'
7970

8071
const CONTENT_MAX_WIDTH = '46.9375rem'
8172
const STEP_SUMMARY_HEIGHT = '18.2rem'
@@ -107,7 +98,7 @@ export function ProtocolSteps({
10798
const robotType = useSelector(getRobotType)
10899
const activeItem = useSelector(getActiveItem)
109100
const deckSetup = useSelector(getDeckSetupForActiveItem)
110-
const { pipettes, modules, labware, additionalEquipmentOnDeck } = deckSetup
101+
const { labware, additionalEquipmentOnDeck } = deckSetup
111102
const [hoverSlot, setHoverSlot] = useState<DeckSlot | null>(null)
112103
const savedStepForms = useSelector(getSavedStepForms)
113104
const deckDef = useMemo(() => getDeckDefFromRobotType(robotType), [robotType])
@@ -130,7 +121,11 @@ export function ProtocolSteps({
130121
const initialViewBox = `${viewBoxX} ${viewBoxY} ${viewBoxWidth} ${viewBoxHeight}`
131122
const [viewBox, setViewBox] = useState<string>(initialViewBox)
132123

133-
const { errors: timelineErrors } = useSelector(getRobotStateTimeline)
124+
const { errors: timelineErrors, timeline } = useSelector(
125+
getRobotStateTimeline
126+
)
127+
const hasCommands = timeline.length > 0
128+
134129
const leftString = t('onDeck')
135130
const rightString = t('offDeck')
136131
const [deckView, setDeckView] = useState<
@@ -139,61 +134,11 @@ export function ProtocolSteps({
139134
const isOffDeck = deckView === rightString
140135
const isZoomedIn = zoomedInSlot != null
141136

142-
const fileData = useSelector(createFile)
143-
const additionalEquipment = useSelector(getAdditionalEquipmentEntities)
144-
145-
const nonLoadCommands =
146-
fileData?.commands.filter(
147-
command => !LOAD_COMMANDS.includes(command.commandType)
148-
) ?? []
149-
const gripperInUse =
150-
fileData?.commands.find(
151-
command =>
152-
(command.commandType === 'moveLabware' &&
153-
command.params.strategy === 'usingGripper') ||
154-
command.commandType === 'absorbanceReader/closeLid' ||
155-
command.commandType === 'absorbanceReader/openLid'
156-
) != null
157-
const noCommands = fileData != null ? nonLoadCommands.length === 0 : true
158-
const modulesWithoutStep = getUnusedEntities(
159-
modules,
160-
savedStepForms,
161-
'moduleId',
162-
robotType
163-
)
164-
const pipettesWithoutStep = getUnusedEntities(
165-
pipettes,
166-
savedStepForms,
167-
'pipette',
168-
robotType
169-
)
170-
const isGripperAttached = Object.values(additionalEquipment).some(
171-
equipment => equipment?.name === 'gripper'
172-
)
173-
const gripperWithoutStep = isGripperAttached && !gripperInUse
174-
175-
const { trashBinUnused, wasteChuteUnused } = getUnusedTrash(
176-
additionalEquipmentOnDeck,
177-
fileData?.commands
178-
)
179-
const fixtureWithoutStep: Fixture = {
180-
trashBin: trashBinUnused,
181-
wasteChute: wasteChuteUnused,
182-
stagingAreaSlots: getUnusedStagingAreas(
183-
additionalEquipmentOnDeck,
184-
fileData?.commands
185-
),
186-
}
187-
188137
const {
189138
handleExportClick,
190139
exportWarningModalElement,
191140
} = useProtocolExportHandler({
192-
noCommands,
193-
modulesWithoutStep,
194-
pipettesWithoutStep,
195-
gripperWithoutStep,
196-
fixtureWithoutStep,
141+
hasCommands,
197142
onConfirmExport: () => {
198143
dispatch(saveProtocolFile())
199144
},

protocol-designer/src/pages/ProtocolOverview/UnusedModalContent.tsx

Lines changed: 0 additions & 105 deletions
This file was deleted.

protocol-designer/src/pages/ProtocolOverview/__tests__/ProtocolOverview.test.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ import { FLEX_ROBOT_TYPE } from '@opentrons/shared-data'
66
import { renderWithProviders } from '../../../__testing-utils__'
77
import { i18n } from '../../../assets/localization'
88
import { MaterialsListModal } from '../../../components/organisms/MaterialsListModal'
9-
import { getFileMetadata, getRobotType } from '../../../file-data/selectors'
9+
import {
10+
getFileMetadata,
11+
getRobotStateTimeline,
12+
getRobotType,
13+
} from '../../../file-data/selectors'
1014
import { selectors as labwareIngredSelectors } from '../../../labware-ingred/selectors'
1115
import {
1216
getAdditionalEquipmentEntities,
@@ -55,6 +59,7 @@ const render = () => {
5559

5660
describe('ProtocolOverview', () => {
5761
beforeEach(() => {
62+
vi.mocked(getRobotStateTimeline).mockReturnValue({ timeline: [] })
5863
vi.mocked(getAdditionalEquipmentEntities).mockReturnValue({})
5964
vi.mocked(getSavedStepForms).mockReturnValue({
6065
__INITIAL_DECK_SETUP_STEP__: {} as any,

0 commit comments

Comments
 (0)