Skip to content
9 changes: 7 additions & 2 deletions api/src/opentrons/config/reset.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,13 @@ class ResetOptionId(str, Enum):
# This option is defined here only as a convenience for robot-server.
# Find a way to split things up and define this in robot-server instead.
ResetOptionId.runs_history: CommonResetOption(
name="Clear Runs History",
description="Erase this device's stored history of protocols and runs.",
name="Clear Robot Server Data",
description=(
"Erase everything stored by the robot server. This is *not* everything stored"
" on the robot. It currently includes runs, protocols, labware offsets, and more,"
" and the exact list may change over time. This is exposed for troubleshooting"
" and system recovery. The name `runsHistory` is a misnomer, for historical reasons."
),
),
ResetOptionId.on_device_display: CommonResetOption(
name="On-Device Display Configuration",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ import {
SUCCESS,
PENDING,
} from '/app/redux/robot-api'
import { getResetConfigOptions, resetConfig } from '/app/redux/robot-admin'
import { useIsFlex } from '/app/redux-resources/robots'
import { resetConfig } from '/app/redux/robot-admin'

import type { State } from '/app/redux/types'
import type { ResetConfigRequest } from '/app/redux/robot-admin/types'
Expand All @@ -45,36 +44,13 @@ export function DeviceResetModal({
const { t } = useTranslation(['device_settings', 'shared', 'branded'])
const navigate = useNavigate()
const [dispatchRequest, requestIds] = useDispatchApiRequest()
const isFlex = useIsFlex(robotName)
const resetRequestStatus = useSelector((state: State) => {
const lastId = last(requestIds)
return lastId != null ? getRequestById(state, lastId) : null
})?.status

const serverResetOptions = useSelector((state: State) =>
getResetConfigOptions(state, robotName)
)

const triggerReset = (): void => {
if (resetOptions != null) {
if (isFlex) {
const totalOptionsSelected = Object.values(resetOptions).filter(
selected => selected === true
).length

const isEveryOptionSelected =
totalOptionsSelected > 0 &&
totalOptionsSelected ===
// filtering out ODD setting because this gets implicitly cleared if all settings are selected
serverResetOptions.filter(o => o.id !== 'onDeviceDisplay').length

if (isEveryOptionSelected) {
resetOptions = {
...resetOptions,
onDeviceDisplay: true,
}
}
}
dispatchRequest(resetConfig(robotName, resetOptions))
navigate('/devices/')
}
Expand Down
Loading
Loading