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): Fix run cancel redirection, pipette path copy #16166

Merged
merged 4 commits into from
Aug 29, 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
2 changes: 1 addition & 1 deletion app/src/assets/localization/en/quick_transfer.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"pipette_path": "Pipette path",
"pipette_path_multi_aspirate": "Multi-aspirate",
"pipette_path_multi_dispense": "Multi-dispense",
"pipette_path_multi_dispense_volume_blowout": "Multi-dispense, {{volume}} disposal volume, blowout into {{blowOutLocation}}",
"pipette_path_multi_dispense_volume_blowout": "Multi-dispense, {{volume}} disposal volume, blowout {{blowOutLocation}}",
"pipette_path_single": "Single transfers",
"pre_wet_tip": "Pre-wet tip",
"quick_transfer": "Quick transfer",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,8 @@ export function ConfirmCancelRunModal({
isLoading: isDismissing,
} = useDismissCurrentRunMutation({
onSettled: () => {
if (isQuickTransfer && protocolId != null) {
if (isQuickTransfer) {
deleteRun(runId)
navigate(`/quick-transfer/${protocolId}`)
} else if (isQuickTransfer) {
deleteRun(runId)
navigate('/quick-transfer')
} else if (protocolId != null) {
navigate(`/protocols/${protocolId}`)
} else {
navigate('/protocols')
}
},
})
Expand Down Expand Up @@ -97,6 +89,15 @@ export function ConfirmCancelRunModal({
trackProtocolRunEvent({ name: ANALYTICS_PROTOCOL_RUN_ACTION.CANCEL })
if (!isActiveRun) {
dismissCurrentRun(runId)
if (isQuickTransfer && protocolId != null) {
navigate(`/quick-transfer/${protocolId}`)
} else if (isQuickTransfer) {
navigate('/quick-transfer')
} else if (protocolId != null) {
navigate(`/protocols/${protocolId}`)
} else {
navigate('/protocols')
}
}
}
}, [runStatus])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,21 @@ describe('ConfirmCancelRunModal', () => {

expect(mockDismissCurrentRun).toHaveBeenCalled()
expect(mockTrackProtocolRunEvent).toHaveBeenCalled()
expect(mockNavigate).toHaveBeenCalledWith('/protocols')
})

it('when quick transfer run is stopped, the run is dismissed and the modal closes if the run is not yet active', () => {
props = {
...props,
isActiveRun: false,
isQuickTransfer: true,
}
when(useRunStatus).calledWith(RUN_ID).thenReturn(RUN_STATUS_STOPPED)
render(props)

expect(mockDismissCurrentRun).toHaveBeenCalled()
expect(mockTrackProtocolRunEvent).toHaveBeenCalled()
expect(mockNavigate).toHaveBeenCalledWith('/quick-transfer')
})

it('when run is stopped, the run is not dismissed if the run is active', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from 'react'
import isEqual from 'lodash/isEqual'
import { useTranslation } from 'react-i18next'
import { createPortal } from 'react-dom'
import {
Expand Down Expand Up @@ -197,7 +198,10 @@ export function BlowOut(props: BlowOutProps): JSX.Element {
{blowOutLocationItems.map(blowOutLocationItem => (
<RadioButton
key={blowOutLocationItem.description}
isSelected={blowOutLocation === blowOutLocationItem.location}
isSelected={
isEqual(blowOutLocation, blowOutLocationItem.location) ||
blowOutLocation === blowOutLocationItem.location
}
onChange={() => {
setBlowOutLocation(
blowOutLocationItem.location as BlowOutLocation
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from 'react'
import isEqual from 'lodash/isEqual'
import { useTranslation } from 'react-i18next'
import { createPortal } from 'react-dom'
import {
Expand Down Expand Up @@ -218,7 +219,10 @@ export function PipettePath(props: PipettePathProps): JSX.Element {
{blowOutLocationItems.map(option => (
<RadioButton
key={option.description}
isSelected={blowOutLocation === option.location}
isSelected={
isEqual(blowOutLocation, option.location) ||
blowOutLocation === option.location
}
onChange={() => {
setBlowOutLocation(option.location)
}}
Expand Down
Loading