Skip to content

Commit 917a7cf

Browse files
fix(app): Hide the option to reset labware offsets on OT-2s (#18348)
## Overview Closes RQA-4183. In the device reset slideout, the "Clear labware offset data" option is misleading on an OT-2. Although it does work in a technical sense—it sends a `DELETE /labwareOffsets` request and the server obeys it—it does not do anything meaningful in a user-facing sense. On OT-2s, the frontend does not use the `/labwareOffsets` endpoints to support Labware Position Check; it instead only reuses offsets from prior runs, via the `/runs` endpoints. So this option didn't actually clear anything, in practice. The solution is to just hide the option on OT-2s. ## Test Plan and Hands on Testing In the desktop app: * On an OT-2: * [x] The option is no longer present in the desktop app. * [x] Submitting the reset does not send a `DELETE /labwareOffsets` HTTP request. * On a Flex: * [x] The option is still present in the desktop app. * [x] Submitting the reset with the option selected actually resets labware offsets. ## Review requests None in particular, but [I've definitely made stupid mistakes here before](#18244), so double-check my logic. ## Risk assessment Low.
1 parent ca55691 commit 917a7cf

File tree

2 files changed

+22
-15
lines changed

2 files changed

+22
-15
lines changed

app/src/organisms/Desktop/Devices/RobotSettings/AdvancedTab/AdvancedTabSlideouts/DeviceResetSlideout.tsx

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -332,16 +332,18 @@ export function DeviceResetSlideout({
332332
value={displayedOptions.common.runsHistory}
333333
label={t('clear_option_runs_history')}
334334
/>
335-
<CheckboxField
336-
onChange={() => {
337-
const options = cloneDeep(displayedOptions)
338-
options.common.labwareOffsets = !options.common
339-
.labwareOffsets
340-
setDisplayedOptions(options)
341-
}}
342-
value={displayedOptions.common.labwareOffsets}
343-
label={t('clear_option_labware_offsets')}
344-
/>
335+
{isFlex && (
336+
<CheckboxField
337+
onChange={() => {
338+
const options = cloneDeep(displayedOptions)
339+
options.flexOnly.labwareOffsets = !options.flexOnly
340+
.labwareOffsets
341+
setDisplayedOptions(options)
342+
}}
343+
value={displayedOptions.flexOnly.labwareOffsets}
344+
label={t('clear_option_labware_offsets')}
345+
/>
346+
)}
345347
</Flex>
346348
</Box>
347349
<Box>
@@ -394,13 +396,17 @@ interface DisplayedResetOptionState {
394396
bootScripts: boolean
395397
authorizedKeys: boolean
396398
pipetteOffsetCalibrations: boolean
397-
labwareOffsets: boolean
398399
}
399400
ot2Only: {
400401
deckCalibration: boolean
401402
tipLengthCalibrations: boolean
402403
}
403404
flexOnly: {
405+
// labwareOffsets, corresponding to the server's /labwareOffsets endpoints, is also
406+
// resettable on OT-2, but in practice, there's no data to reset there. On OT-2s,
407+
// Labware Position Check never stores offsets into the /labwareOffsets endpoints;
408+
// instead it only reuses offsets from prior runs, via the /runs endpoints.
409+
labwareOffsets: boolean
404410
gripperCalibrations: boolean
405411
moduleCalibrations: boolean
406412
}
@@ -412,13 +418,13 @@ const ALL_DESELECTED: DisplayedResetOptionState = {
412418
bootScripts: false,
413419
authorizedKeys: false,
414420
pipetteOffsetCalibrations: false,
415-
labwareOffsets: false,
416421
},
417422
ot2Only: {
418423
deckCalibration: false,
419424
tipLengthCalibrations: false,
420425
},
421426
flexOnly: {
427+
labwareOffsets: false,
422428
gripperCalibrations: false,
423429
moduleCalibrations: false,
424430
},
@@ -430,13 +436,13 @@ const ALL_SELECTED: DisplayedResetOptionState = {
430436
bootScripts: true,
431437
authorizedKeys: true,
432438
pipetteOffsetCalibrations: true,
433-
labwareOffsets: true,
434439
},
435440
ot2Only: {
436441
deckCalibration: true,
437442
tipLengthCalibrations: true,
438443
},
439444
flexOnly: {
445+
labwareOffsets: true,
440446
gripperCalibrations: true,
441447
moduleCalibrations: true,
442448
},
@@ -470,7 +476,7 @@ function buildResetRequest(
470476
isFlex: boolean
471477
): ResetConfigRequest {
472478
let requestToReturn: ResetConfigRequest = {
473-
resetLabwareOffsets: displayedState.common.labwareOffsets,
479+
resetLabwareOffsets: displayedState.flexOnly.labwareOffsets,
474480

475481
settingsResets: {
476482
// Keys in this object need to follow the server's HTTP API.

app/src/organisms/Desktop/Devices/RobotSettings/AdvancedTab/AdvancedTabSlideouts/__tests__/DeviceResetSlideout.test.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ describe('RobotSettings DeviceResetSlideout', () => {
9494
screen.getByText('Clear pipette offset calibrations')
9595
screen.getByText('Clear tip length calibrations')
9696
screen.getByText('Protocol run data')
97+
expect(screen.queryByText('labware offset')).toBe(null)
9798
screen.getByText('Clear protocol run history')
98-
screen.getByText('Clear labware offset data')
9999
screen.getByText('Boot scripts')
100100
screen.getByText('Clear custom boot scripts')
101101
screen.getByText('Clear SSH public keys')
@@ -131,6 +131,7 @@ describe('RobotSettings DeviceResetSlideout', () => {
131131
expect(
132132
screen.queryByRole('checkbox', { name: 'Clear tip length calibrations' })
133133
).toBeNull()
134+
screen.getByRole('checkbox', { name: 'Clear labware offset data' })
134135
})
135136

136137
it('should enable Clear data and restart robot button when checked one checkbox', () => {

0 commit comments

Comments
 (0)