Skip to content

Commit

Permalink
fix(app): refactor instrument cards for bad instruments (#13468)
Browse files Browse the repository at this point in the history
  • Loading branch information
smb2268 authored and jerader committed Sep 12, 2023
1 parent 75c39f3 commit 6fbb593
Show file tree
Hide file tree
Showing 13 changed files with 551 additions and 264 deletions.
1 change: 1 addition & 0 deletions app/src/assets/localization/en/device_details.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"firmware_update_available_now": "Firmware update available. <updateLink>Update now</updateLink>",
"firmware_update_failed": "Failed to update module firmware",
"firmware_update_installation_successful": "Installation successful",
"firmware_update_occurring": "Firmware update in progress...",
"got_it": "Got it",
"have_not_run": "No recent runs",
"have_not_run_description": "After you run some protocols, they will appear here.",
Expand Down
9 changes: 8 additions & 1 deletion app/src/assets/localization/en/firmware_update.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
{
"download_logs": "Download the robot logs from the Opentrons App and send them to [email protected] for assistance.",
"firmware_out_of_date": "The firmware for <bold>{{mount}} {{instrument}}</bold> is out of date. You need to update it before running protocols that use this instrument.",
"gantry_x": "Gantry X",
"gantry_y": "Gantry Y",
"gripper": "Gripper",
"head": "Head",
"pipette_left": "Left Pipette",
"pipette_right": "Right Pipette",
"ready_to_use": "Your <bold>{{instrument}}</bold> is ready to use!",
"rear_panel": "Rear Panel",
"successful_update": "Successful update!",
"update_failed": "Update failed",
"update_firmware": "Update firmware",
"update_needed": "Instrument firmware update needed",
"updating_firmware": "Updating firmware..."
"updating_firmware": "Updating {{subsystem}} firmware..."
}
119 changes: 30 additions & 89 deletions app/src/organisms/Devices/InstrumentsAndModules.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ import {

import { StyledText } from '../../atoms/text'
import { Banner } from '../../atoms/Banner'
import { UpdateBanner } from '../../molecules/UpdateBanner'
import { InstrumentCard } from '../../molecules/InstrumentCard'
import { useCurrentRunId } from '../ProtocolUpload/hooks'
import { ModuleCard } from '../ModuleCard'
import { FirmwareUpdateModal } from '../FirmwareUpdateModal'
Expand Down Expand Up @@ -74,11 +72,7 @@ export function InstrumentsAndModules({

const attachedGripper =
(attachedInstruments?.data ?? []).find(
(i): i is GripperData => i.instrumentType === 'gripper' && i.ok
) ?? null
const badGripper =
(attachedInstruments?.data ?? []).find(
(i): i is BadGripper => i.subsystem === 'gripper' && !i.ok
(i): i is GripperData | BadGripper => i.subsystem === 'gripper'
) ?? null
const attachedLeftPipette =
attachedInstruments?.data?.find(
Expand Down Expand Up @@ -193,68 +187,32 @@ export function InstrumentsAndModules({
flexDirection={DIRECTION_COLUMN}
gridGap={SPACING.spacing8}
>
{badLeftPipette == null ? (
<PipetteCard
pipetteId={attachedPipettes.left?.id}
pipetteInfo={
attachedPipettes.left?.model != null
? getPipetteModelSpecs(attachedPipettes.left?.model) ??
null
: null
}
isPipetteCalibrated={
isOT3
? attachedLeftPipette?.data?.calibratedOffset != null
: leftMountOffsetCalibration != null
}
mount={LEFT}
robotName={robotName}
is96ChannelAttached={is96ChannelAttached}
/>
) : (
<InstrumentCard
label={t('mount', { side: 'left' })}
description={t('instrument_attached')}
banner={
<UpdateBanner
robotName={robotName}
serialNumber={
attachedLeftPipette != null
? attachedLeftPipette.serialNumber
: 'no_left_pipette'
}
setShowBanner={() => null}
updateType="firmware_important"
handleUpdateClick={() =>
setSubsystemToUpdate('pipette_left')
}
/>
}
/>
)}
{isOT3 && badGripper == null && (
<PipetteCard
pipetteId={attachedPipettes.left?.id}
pipetteModelSpecs={
attachedPipettes.left?.model != null
? getPipetteModelSpecs(attachedPipettes.left?.model) ?? null
: null
}
isPipetteCalibrated={
isOT3 && attachedLeftPipette?.ok
? attachedLeftPipette?.data?.calibratedOffset != null
: leftMountOffsetCalibration != null
}
mount={LEFT}
robotName={robotName}
pipetteIs96Channel={is96ChannelAttached}
pipetteIsBad={badLeftPipette != null}
updatePipette={() => setSubsystemToUpdate('pipette_left')}
/>
{isOT3 && (
<GripperCard
attachedGripper={attachedGripper}
isCalibrated={attachedGripper?.data?.calibratedOffset != null}
/>
)}
{isOT3 && badGripper != null && (
<InstrumentCard
label={t('shared:extension_mount')}
description={t('instrument_attached')}
banner={
<UpdateBanner
robotName={robotName}
serialNumber={
attachedGripper != null
? attachedGripper.serialNumber
: 'no_gripper'
}
setShowBanner={() => null}
updateType="firmware"
handleUpdateClick={() => setSubsystemToUpdate('gripper')}
/>
isCalibrated={
attachedGripper?.ok === true &&
attachedGripper?.data?.calibratedOffset != null
}
setSubsystemToUpdate={setSubsystemToUpdate}
/>
)}
{leftColumnModules.map((module, index) => (
Expand All @@ -275,42 +233,25 @@ export function InstrumentsAndModules({
flexDirection={DIRECTION_COLUMN}
gridGap={SPACING.spacing8}
>
{!Boolean(is96ChannelAttached) && badRightPipette == null && (
{!Boolean(is96ChannelAttached) && (
<PipetteCard
pipetteId={attachedPipettes.right?.id}
pipetteInfo={
pipetteModelSpecs={
attachedPipettes.right?.model != null
? getPipetteModelSpecs(attachedPipettes.right?.model) ??
null
: null
}
isPipetteCalibrated={
isOT3
isOT3 && attachedRightPipette?.ok
? attachedRightPipette?.data?.calibratedOffset != null
: rightMountOffsetCalibration != null
}
mount={RIGHT}
robotName={robotName}
is96ChannelAttached={false}
/>
)}
{badRightPipette != null && (
<InstrumentCard
label={t('mount', { side: 'error' })}
description={t('instrument_attached')}
banner={
<UpdateBanner
robotName={robotName}
serialNumber={
attachedRightPipette != null
? attachedRightPipette.serialNumber
: 'no_right_pipette'
}
setShowBanner={() => null}
updateType="firmware_important"
handleUpdateClick={() => setSubsystemToUpdate('gripper')}
/>
}
pipetteIs96Channel={false}
pipetteIsBad={badRightPipette != null}
updatePipette={() => setSubsystemToUpdate('pipette_right')}
/>
)}
{rightColumnModules.map((module, index) => (
Expand Down
Loading

0 comments on commit 6fbb593

Please sign in to comment.