Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(app): remove subsystem update link from instrument card #14507

Merged
merged 2 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions app/src/assets/localization/en/device_details.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@
"estop_disengaged": "E-stop disengaged, but robot operation still halted.",
"estop_pressed": "E-stop pressed. Robot movement is halted.",
"failed": "failed",
"firmware_update_available_now_without_link": "Firmware update available.",
"firmware_update_available_now": "Firmware update available. <updateLink>Update now</updateLink>",
"firmware_update_needed": "Instrument firmware update needed. Start the update on the robot's touchscreen.",
"firmware_update_available": "Firmware update available.",
"firmware_update_failed": "Failed to update module firmware",
"firmware_update_installation_successful": "Installation successful",
Expand Down
21 changes: 0 additions & 21 deletions app/src/organisms/Devices/InstrumentsAndModules.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {

import {
Flex,
ModalShell,
ALIGN_CENTER,
ALIGN_FLEX_START,
COLORS,
Expand All @@ -26,7 +25,6 @@ import { Banner } from '../../atoms/Banner'
import { PipetteRecalibrationWarning } from './PipetteCard/PipetteRecalibrationWarning'
import { useCurrentRunId } from '../ProtocolUpload/hooks'
import { ModuleCard } from '../ModuleCard'
import { FirmwareUpdateModal } from '../FirmwareUpdateModal'
import { useIsFlex, useIsRobotViewable, useRunStatuses } from './hooks'
import {
getIs96ChannelPipetteAttached,
Expand All @@ -42,7 +40,6 @@ import type {
BadPipette,
GripperData,
PipetteData,
Subsystem,
} from '@opentrons/api-client'

const EQUIPMENT_POLL_MS = 5000
Expand All @@ -65,10 +62,6 @@ export function InstrumentsAndModules({
const currentRunId = useCurrentRunId()
const { isRunTerminal, isRunRunning } = useRunStatuses()
const isFlex = useIsFlex(robotName)
const [
subsystemToUpdate,
setSubsystemToUpdate,
] = React.useState<Subsystem | null>(null)
const isEstopNotDisengaged = useIsEstopNotDisengaged(robotName)

const { data: attachedInstruments } = useInstrumentsQuery({
Expand Down Expand Up @@ -153,17 +146,6 @@ export function InstrumentsAndModules({
flexDirection={DIRECTION_COLUMN}
width="100%"
>
{subsystemToUpdate != null && (
<ModalShell>
<FirmwareUpdateModal
subsystem={subsystemToUpdate}
proceed={() => setSubsystemToUpdate(null)}
description={t('updating_firmware')}
proceedDescription={t('firmware_up_to_date')}
isOnDevice={false}
/>
</ModalShell>
)}
<StyledText
as="h3"
fontWeight={TYPOGRAPHY.fontWeightSemiBold}
Expand Down Expand Up @@ -221,7 +203,6 @@ export function InstrumentsAndModules({
robotName={robotName}
pipetteIs96Channel={is96ChannelAttached}
pipetteIsBad={badLeftPipette != null}
updatePipette={() => setSubsystemToUpdate('pipette_left')}
isRunActive={currentRunId != null && isRunRunning}
isEstopNotDisengaged={isEstopNotDisengaged}
/>
Expand All @@ -233,7 +214,6 @@ export function InstrumentsAndModules({
attachedGripper?.data?.calibratedOffset?.last_modified !=
null
}
setSubsystemToUpdate={setSubsystemToUpdate}
isRunActive={currentRunId != null && isRunRunning}
isEstopNotDisengaged={isEstopNotDisengaged}
/>
Expand Down Expand Up @@ -276,7 +256,6 @@ export function InstrumentsAndModules({
robotName={robotName}
pipetteIs96Channel={false}
pipetteIsBad={badRightPipette != null}
updatePipette={() => setSubsystemToUpdate('pipette_right')}
isRunActive={currentRunId != null && isRunRunning}
isEstopNotDisengaged={isEstopNotDisengaged}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ describe('PipetteCard', () => {
pipetteIs96Channel: false,
isPipetteCalibrated: false,
pipetteIsBad: false,
updatePipette: jest.fn(),
isRunActive: false,
isEstopNotDisengaged: false,
}
Expand Down Expand Up @@ -132,7 +131,6 @@ describe('PipetteCard', () => {
pipetteIs96Channel: false,
isPipetteCalibrated: false,
pipetteIsBad: false,
updatePipette: jest.fn(),
isRunActive: false,
isEstopNotDisengaged: false,
}
Expand All @@ -149,7 +147,6 @@ describe('PipetteCard', () => {
pipetteIs96Channel: true,
isPipetteCalibrated: false,
pipetteIsBad: false,
updatePipette: jest.fn(),
isRunActive: false,
isEstopNotDisengaged: false,
}
Expand All @@ -172,7 +169,6 @@ describe('PipetteCard', () => {
pipetteIs96Channel: true,
isPipetteCalibrated: false,
pipetteIsBad: false,
updatePipette: jest.fn(),
isRunActive: false,
isEstopNotDisengaged: true,
}
Expand All @@ -194,7 +190,6 @@ describe('PipetteCard', () => {
pipetteIs96Channel: false,
isPipetteCalibrated: false,
pipetteIsBad: false,
updatePipette: jest.fn(),
isRunActive: false,
isEstopNotDisengaged: false,
}
Expand All @@ -210,7 +205,6 @@ describe('PipetteCard', () => {
pipetteIs96Channel: false,
isPipetteCalibrated: false,
pipetteIsBad: false,
updatePipette: jest.fn(),
isRunActive: false,
isEstopNotDisengaged: false,
}
Expand All @@ -226,7 +220,6 @@ describe('PipetteCard', () => {
pipetteIs96Channel: false,
isPipetteCalibrated: false,
pipetteIsBad: false,
updatePipette: jest.fn(),
isRunActive: false,
isEstopNotDisengaged: false,
}
Expand All @@ -243,7 +236,6 @@ describe('PipetteCard', () => {
pipetteIs96Channel: false,
isPipetteCalibrated: false,
pipetteIsBad: false,
updatePipette: jest.fn(),
isRunActive: false,
isEstopNotDisengaged: false,
}
Expand All @@ -259,7 +251,6 @@ describe('PipetteCard', () => {
pipetteIs96Channel: false,
isPipetteCalibrated: false,
pipetteIsBad: false,
updatePipette: jest.fn(),
isRunActive: false,
isEstopNotDisengaged: false,
}
Expand All @@ -274,7 +265,6 @@ describe('PipetteCard', () => {
pipetteIs96Channel: false,
isPipetteCalibrated: false,
pipetteIsBad: false,
updatePipette: jest.fn(),
isRunActive: false,
isEstopNotDisengaged: false,
}
Expand All @@ -298,16 +288,15 @@ describe('PipetteCard', () => {
pipetteIs96Channel: false,
isPipetteCalibrated: false,
pipetteIsBad: true,
updatePipette: jest.fn(),
isRunActive: false,
isEstopNotDisengaged: false,
}
render(props)
screen.getByText('Right mount')
screen.getByText('Instrument attached')
screen.getByText('Firmware update available.')
fireEvent.click(screen.getByText('Update now'))
expect(props.updatePipette).toHaveBeenCalled()
screen.getByText(
`Instrument firmware update needed. Start the update on the robot's touchscreen.`
)
})
it('renders firmware update in progress state if pipette is bad and update in progress', () => {
when(mockUseCurrentSubsystemUpdateQuery).mockReturnValue({
Expand All @@ -320,7 +309,6 @@ describe('PipetteCard', () => {
pipetteIs96Channel: false,
isPipetteCalibrated: false,
pipetteIsBad: true,
updatePipette: jest.fn(),
isRunActive: false,
isEstopNotDisengaged: false,
}
Expand Down
18 changes: 1 addition & 17 deletions app/src/organisms/Devices/PipetteCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,9 @@ interface PipetteCardProps {
robotName: string
pipetteIs96Channel: boolean
pipetteIsBad: boolean
updatePipette: () => void
isRunActive: boolean
isEstopNotDisengaged: boolean
}
const BANNER_LINK_STYLE = css`
text-decoration: underline;
cursor: pointer;
margin-left: ${SPACING.spacing8};
`

const INSTRUMENT_CARD_STYLE = css`
p {
Expand All @@ -91,7 +85,6 @@ export const PipetteCard = (props: PipetteCardProps): JSX.Element => {
pipetteId,
pipetteIs96Channel,
pipetteIsBad,
updatePipette,
isRunActive,
isEstopNotDisengaged,
} = props
Expand Down Expand Up @@ -356,17 +349,8 @@ export const PipetteCard = (props: PipetteCardProps): JSX.Element => {
i18nKey={
subsystemUpdateData != null
? 'firmware_update_occurring'
: 'firmware_update_available_now'
: 'firmware_update_needed'
}
components={{
updateLink: (
<StyledText
as="p"
css={BANNER_LINK_STYLE}
onClick={updatePipette}
/>
),
}}
/>
</Banner>
}
Expand Down
12 changes: 3 additions & 9 deletions app/src/organisms/GripperCard/__tests__/GripperCard.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ describe('GripperCard', () => {
},
} as GripperData,
isCalibrated: true,
setSubsystemToUpdate: jest.fn(),
isRunActive: false,
isEstopNotDisengaged: false,
}
Expand Down Expand Up @@ -88,7 +87,6 @@ describe('GripperCard', () => {
},
} as GripperData,
isCalibrated: false,
setSubsystemToUpdate: jest.fn(),
isRunActive: false,
isEstopNotDisengaged: false,
}
Expand All @@ -112,7 +110,6 @@ describe('GripperCard', () => {
},
} as GripperData,
isCalibrated: false,
setSubsystemToUpdate: jest.fn(),
isRunActive: false,
isEstopNotDisengaged: true,
}
Expand Down Expand Up @@ -156,7 +153,6 @@ describe('GripperCard', () => {
props = {
attachedGripper: null,
isCalibrated: false,
setSubsystemToUpdate: jest.fn(),
isRunActive: false,
isEstopNotDisengaged: false,
}
Expand All @@ -175,16 +171,15 @@ describe('GripperCard', () => {
ok: false,
} as any,
isCalibrated: false,
setSubsystemToUpdate: jest.fn(),
isRunActive: false,
isEstopNotDisengaged: false,
}
render(props)
screen.getByText('Extension mount')
screen.getByText('Instrument attached')
screen.getByText('Firmware update available.')
fireEvent.click(screen.getByText('Update now'))
expect(props.setSubsystemToUpdate).toHaveBeenCalledWith('gripper')
screen.getByText(
`Instrument firmware update needed. Start the update on the robot's touchscreen.`
)
})
it('renders firmware update in progress state if gripper is bad and update in progress', () => {
mockUseCurrentSubsystemUpdateQuery.mockReturnValue({
Expand All @@ -195,7 +190,6 @@ describe('GripperCard', () => {
ok: false,
} as any,
isCalibrated: true,
setSubsystemToUpdate: jest.fn(),
isRunActive: false,
isEstopNotDisengaged: false,
}
Expand Down
35 changes: 9 additions & 26 deletions app/src/organisms/GripperCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@ import { GripperWizardFlows } from '../GripperWizardFlows'
import { AboutGripperSlideout } from './AboutGripperSlideout'
import { GRIPPER_FLOW_TYPES } from '../GripperWizardFlows/constants'

import type { BadGripper, GripperData, Subsystem } from '@opentrons/api-client'
import type { BadGripper, GripperData } from '@opentrons/api-client'
import type { GripperWizardFlowType } from '../GripperWizardFlows/types'

interface GripperCardProps {
attachedGripper: GripperData | BadGripper | null
isCalibrated: boolean
setSubsystemToUpdate: (subsystem: Subsystem | null) => void
isRunActive: boolean
isEstopNotDisengaged: boolean
}
Expand All @@ -42,7 +41,6 @@ const POLL_DURATION_MS = 5000
export function GripperCard({
attachedGripper,
isCalibrated,
setSubsystemToUpdate,
isRunActive,
isEstopNotDisengaged,
}: GripperCardProps): JSX.Element {
Expand Down Expand Up @@ -177,29 +175,14 @@ export function GripperCard({
type={subsystemUpdateData != null ? 'warning' : 'error'}
marginBottom={SPACING.spacing4}
>
{isEstopNotDisengaged ? (
<StyledText as="p">
{t('firmware_update_available_now_without_link')}
</StyledText>
) : (
<Trans
t={t}
i18nKey={
subsystemUpdateData != null
? 'firmware_update_occurring'
: 'firmware_update_available_now'
}
components={{
updateLink: (
<StyledText
as="p"
css={BANNER_LINK_CSS}
onClick={() => setSubsystemToUpdate('gripper')}
/>
),
}}
/>
)}
<Trans
t={t}
i18nKey={
subsystemUpdateData != null
? 'firmware_update_occurring'
: 'firmware_update_needed'
}
/>
</Banner>
}
isEstopNotDisengaged={isEstopNotDisengaged}
Expand Down
Loading