Skip to content

Commit

Permalink
enforce idle temperature status
Browse files Browse the repository at this point in the history
  • Loading branch information
ncdiehl committed Apr 30, 2024
1 parent 8b53a60 commit 1ad14aa
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
25 changes: 22 additions & 3 deletions app/src/organisms/ModuleCard/ModuleOverflowMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ import { useTranslation } from 'react-i18next'

import { Flex, POSITION_RELATIVE, useHoverTooltip } from '@opentrons/components'

import { MODULE_MODELS_OT2_ONLY } from '@opentrons/shared-data'
import {
HEATERSHAKER_MODULE_TYPE,
MODULE_MODELS_OT2_ONLY,
TEMPERATURE_MODULE_TYPE,
THERMOCYCLER_MODULE_TYPE,
} from '@opentrons/shared-data'
import { MenuList } from '../../atoms/MenuList'
import { Tooltip } from '../../atoms/Tooltip'
import { MenuItem } from '../../atoms/MenuList/MenuItem'
Expand Down Expand Up @@ -69,8 +74,22 @@ export const ModuleOverflowMenu = (
isDisabled = true
}

const isHeatingOrCooling =
module.data.status === 'heating' || module.data.status === 'cooling'
let isHeatingOrCooling
switch (module.moduleType) {
case TEMPERATURE_MODULE_TYPE:
isHeatingOrCooling = module.data.status !== 'idle'
break
case HEATERSHAKER_MODULE_TYPE:
isHeatingOrCooling = module.data.temperatureStatus !== 'idle'
break
case THERMOCYCLER_MODULE_TYPE:
isHeatingOrCooling =
module.data.lidTemperatureStatus !== 'idle' ||
module.data.status !== 'idle'
break
default:
isHeatingOrCooling = false
}

const { menuOverflowItemsByModuleType } = useModuleOverflowMenu(
module,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
import { useCurrentRunId } from '../../ProtocolUpload/hooks'
import { ModuleOverflowMenu } from '../ModuleOverflowMenu'

import type { HeaterShakerStatus } from '@opentrons/api-client'
import type { TemperatureStatus } from '@opentrons/api-client'

vi.mock('../../Devices/hooks')
vi.mock('../../RunTimeControl/hooks')
Expand Down Expand Up @@ -543,7 +543,7 @@ describe('ModuleOverflowMenu', () => {
...mockHeaterShaker,
data: {
...mockHeaterShaker.data,
status: 'heating' as HeaterShakerStatus,
temperatureStatus: 'heating' as TemperatureStatus,
},
}
props = {
Expand Down

0 comments on commit 1ad14aa

Please sign in to comment.