Skip to content

Commit

Permalink
address brent's pr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
b-cooper committed Apr 23, 2024
1 parent 60bb160 commit a985585
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { useHistory } from 'react-router-dom'
import {
useDeckConfigurationQuery,
useModulesQuery,
useStopRunMutation,
} from '@opentrons/react-api-client'
import {
ALIGN_CENTER,
Expand All @@ -29,7 +28,7 @@ import { Modal } from '../../../../molecules/Modal'
import { FixtureOption } from '../../../DeviceDetailsDeckConfiguration/AddFixtureModal'

import { SmallButton } from '../../../../atoms/buttons'
import { useCurrentRunId } from '../../../ProtocolUpload/hooks'
import { useCloseCurrentRun } from '../../../ProtocolUpload/hooks'

import type { ModuleModel, DeckDefinition } from '@opentrons/shared-data'

Expand Down Expand Up @@ -63,8 +62,7 @@ export const ChooseModuleToConfigureModal = (
} = props
const { t } = useTranslation(['protocol_setup', 'shared'])
const history = useHistory()
const currentRunId = useCurrentRunId()
const { stopRun } = useStopRunMutation()
const { closeCurrentRun } = useCloseCurrentRun()
const attachedModules =
useModulesQuery({ refetchInterval: EQUIPMENT_POLL_MS })?.data?.data ?? []
const deckConfig = useDeckConfigurationQuery()?.data ?? []
Expand Down Expand Up @@ -109,13 +107,13 @@ export const ChooseModuleToConfigureModal = (
}
)
const handleCancelRun = (): void => {
if (currentRunId != null) stopRun(currentRunId)
closeCurrentRun()
}
const handleNavigateToDeviceDetails = (): void => {
history.push(`/devices/${robotName}`)
}
const emptyState = (
<Flex>
<Flex flexDirection={DIRECTION_COLUMN} gridGap={SPACING.spacing16}>
<StyledText as="p">
{t('there_are_no_unconfigured_modules', {
module: getModuleDisplayName(requiredModuleModel),
Expand All @@ -136,7 +134,7 @@ export const ChooseModuleToConfigureModal = (

const contents =
fixtureOptions.length > 0 ? (
<Flex flexDirection={DIRECTION_COLUMN}>
<Flex flexDirection={DIRECTION_COLUMN} gridGap={SPACING.spacing16}>
<StyledText as="p">{t('add_this_deck_hardware')}</StyledText>
<Flex flexDirection={DIRECTION_COLUMN} gridGap={SPACING.spacing8}>
{fixtureOptions}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@ import {
import {
useDeckConfigurationQuery,
useModulesQuery,
useStopRunMutation,
useUpdateDeckConfigurationMutation,
} from '@opentrons/react-api-client'
import { i18n } from '../../../../../i18n'
import { mockHeaterShaker } from '../../../../../redux/modules/__fixtures__'
import { useCurrentRunId } from '../../../../ProtocolUpload/hooks'
import { useCloseCurrentRun } from '../../../../ProtocolUpload/hooks'
import { LocationConflictModal } from '../LocationConflictModal'

import type { DeckConfiguration } from '@opentrons/shared-data'
Expand Down Expand Up @@ -54,8 +53,9 @@ describe('LocationConflictModal', () => {
deckDef: ot3StandardDeckV5 as any,
robotName: 'otie',
}
vi.mocked(useStopRunMutation).mockReturnValue({ stopRun: vi.fn() } as any)
vi.mocked(useCurrentRunId).mockReturnValue('RUNID')
vi.mocked(useCloseCurrentRun).mockReturnValue({
closeCurrentRun: vi.fn(),
} as any)
vi.mocked(useModulesQuery).mockReturnValue({ data: { data: [] } } as any)
vi.mocked(useDeckConfigurationQuery).mockReturnValue({
data: [mockFixture],
Expand Down

0 comments on commit a985585

Please sign in to comment.