Skip to content

Commit

Permalink
refactor(app): add heater shaker types (#9577)
Browse files Browse the repository at this point in the history
This PR adds the constants and types necessary for the heater shaker module in shared-data and
redux.
  • Loading branch information
sakibh authored Mar 3, 2022
1 parent fa6f9c6 commit 4dc3670
Show file tree
Hide file tree
Showing 34 changed files with 280 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def name(cls) -> str:
@staticmethod
def _model_from_revision(revision: Optional[str]) -> str:
"""Defines the revision -> model mapping"""
return "heaterShakerV1"
return "heaterShakerModuleV1"

@staticmethod
def _get_temperature_status(temperature: Temperature) -> TemperatureStatus:
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions app/src/organisms/Devices/ModuleCard/ModuleOverflowMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ export const ModuleOverflowMenu = (
isSecondary: false,
},
],
// TODO(sh, 2022-02-28): add heater shaker menu items
heaterShakerModuleType: [
{
setSetting: 'Start',
turnOffSetting: 'Deactivate',
isSecondary: true,
},
],
}

const AboutModuleBtn = (
Expand Down
6 changes: 5 additions & 1 deletion app/src/organisms/Devices/ModuleCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
import {
getModuleDisplayName,
MAGNETIC_MODULE_TYPE,
TEMPERATURE_MODULE_TYPE,
THERMOCYCLER_MODULE_TYPE,
} from '@opentrons/shared-data'
import { OverflowBtn } from '../../../atoms/MenuList/OverflowBtn'
Expand Down Expand Up @@ -217,7 +218,7 @@ const ModuleSlideout = (props: ModuleSlideoutProps): JSX.Element => {
isExpanded={showSlideout}
/>
)
} else {
} else if (module.type === TEMPERATURE_MODULE_TYPE) {
return (
<TemperatureModuleSlideout
model={module.model}
Expand All @@ -226,5 +227,8 @@ const ModuleSlideout = (props: ModuleSlideoutProps): JSX.Element => {
isExpanded={showSlideout}
/>
)
} else {
// TODO(sh, 2022-02-28): render heater shaker slideout
return <div>Heater Shaker Slide</div>
}
}
3 changes: 3 additions & 0 deletions app/src/organisms/Devices/ModuleIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react'
import {
HEATERSHAKER_MODULE_TYPE,
MAGNETIC_MODULE_TYPE,
TEMPERATURE_MODULE_TYPE,
THERMOCYCLER_MODULE_TYPE,
Expand All @@ -11,6 +12,7 @@ interface ModuleIconProps {
| typeof MAGNETIC_MODULE_TYPE
| typeof TEMPERATURE_MODULE_TYPE
| typeof THERMOCYCLER_MODULE_TYPE
| typeof HEATERSHAKER_MODULE_TYPE
}

export const ModuleIcon = (props: ModuleIconProps): JSX.Element => {
Expand All @@ -19,6 +21,7 @@ export const ModuleIcon = (props: ModuleIconProps): JSX.Element => {
[MAGNETIC_MODULE_TYPE]: 'ot-magnet-v2',
[TEMPERATURE_MODULE_TYPE]: 'ot-temperature-v2',
[THERMOCYCLER_MODULE_TYPE]: 'ot-thermocycler',
[HEATERSHAKER_MODULE_TYPE]: 'ot-heater-shaker',
} as const

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ const MODULE_IMGS: { [m in ModuleModel]: string } = {
magneticModuleV1: require('../../../../assets/images/modules/[email protected]'),
magneticModuleV2: require('../../../../assets/images/modules/[email protected]'),
thermocyclerModuleV1: require('../../../../assets/images/modules/[email protected]'),
heaterShakerModuleV1: require('../../../../assets/images/modules/[email protected]'),
}
15 changes: 10 additions & 5 deletions app/src/pages/Robots/ModuleSettings/ModuleItem/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ import { ModuleImage } from './ModuleImage'
import { ModuleUpdate } from './ModuleUpdate'
import { ModuleControls } from '../../../../molecules/ModuleControls'
import type { AttachedModule } from '../../../../redux/modules/types'
import { getModuleDisplayName } from '@opentrons/shared-data'
import {
getModuleDisplayName,
HEATERSHAKER_MODULE_TYPE,
} from '@opentrons/shared-data'

interface Props {
module: AttachedModule
Expand All @@ -43,10 +46,12 @@ export function ModuleItem(props: Props): JSX.Element {
<Flex flexDirection={DIRECTION_ROW}>
<ModuleImage model={module.model} />
<Box width="60%">
<ModuleControls
module={module}
controlDisabledReason={controlDisabledReason}
/>
{module.type !== HEATERSHAKER_MODULE_TYPE && (
<ModuleControls
module={module}
controlDisabledReason={controlDisabledReason}
/>
)}
</Box>
</Flex>
<Flex justifyContent={JUSTIFY_SPACE_BETWEEN} alignItems={ALIGN_CENTER}>
Expand Down
35 changes: 35 additions & 0 deletions app/src/redux/modules/api-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type {
MagneticModuleModel,
TemperatureModuleModel,
ThermocyclerModuleModel,
HeaterShakerModuleModel,
ModuleModel,
} from '@opentrons/shared-data'

Expand Down Expand Up @@ -58,6 +59,16 @@ export interface ThermocyclerData {
totalCycleCount: number | null
currentCycleIndex: number | null
}
export interface HeaterShakerData {
labwareLatchStatus: LatchStatus
speedStatus: SpeedStatus
temperatureStatus: TemperatureStatus
currentSpeed: number | null
currentTemp: number | null
targetSpeed: number | null
targetTemp: number | null
errorDetails: string | null
}

export type TemperatureStatus =
| 'idle'
Expand All @@ -74,6 +85,23 @@ export type ThermocyclerStatus =

export type MagneticStatus = 'engaged' | 'disengaged'

export type HeaterShakerStatus = 'idle' | 'running' | 'error'

export type SpeedStatus =
| 'holding at target'
| 'speeding up'
| 'slowing down'
| 'idle'
| 'error'

export type LatchStatus =
| 'opening'
| 'idle_open'
| 'closing'
| 'idle_closed'
| 'idle_unknown'
| 'unknown'

export interface ApiTemperatureModule extends ApiBaseModule {
moduleModel: TemperatureModuleModel
name: typeof TEMPDECK
Expand Down Expand Up @@ -113,10 +141,17 @@ export interface ApiThermocyclerModuleLegacy extends ApiBaseModuleLegacy {
status: ThermocyclerStatus
}

export interface ApiHeaterShakerModule extends ApiBaseModule {
moduleModel: HeaterShakerModuleModel
data: HeaterShakerData
status: HeaterShakerStatus
}

export type ApiAttachedModule =
| ApiThermocyclerModule
| ApiMagneticModule
| ApiTemperatureModule
| ApiHeaterShakerModule

export type ApiAttachedModuleLegacy =
| ApiThermocyclerModuleLegacy
Expand Down
1 change: 1 addition & 0 deletions app/src/redux/modules/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export {
MAGNETIC_MODULE_TYPE,
TEMPERATURE_MODULE_TYPE,
THERMOCYCLER_MODULE_TYPE,
HEATERSHAKER_MODULE_TYPE,
} from '@opentrons/shared-data'

// http paths
Expand Down
18 changes: 18 additions & 0 deletions app/src/redux/modules/epic/fetchModulesEpic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,20 @@ import {
MAGNETIC_MODULE_TYPE,
TEMPERATURE_MODULE_TYPE,
THERMOCYCLER_MODULE_TYPE,
HEATERSHAKER_MODULE_TYPE,
TEMPERATURE_MODULE_V1,
TEMPERATURE_MODULE_V2,
MAGNETIC_MODULE_V1,
MAGNETIC_MODULE_V2,
THERMOCYCLER_MODULE_V1,
HEATERSHAKER_MODULE_V1,
} from '@opentrons/shared-data'

import type {
MagneticModuleModel,
TemperatureModuleModel,
ThermocyclerModuleModel,
HeaterShakerModuleModel,
} from '@opentrons/shared-data'

import * as Actions from '../actions'
Expand All @@ -42,6 +45,8 @@ import type {
TemperatureStatus,
MagneticStatus,
ThermocyclerStatus,
HeaterShakerData,
HeaterShakerStatus,
} from '../api-types'

const mapActionToRequest: ActionToRequestMapper<FetchModulesAction> = action => ({
Expand All @@ -68,6 +73,12 @@ type IdentifierWithData =
data: ThermocyclerData
status: ThermocyclerStatus
}
| {
type: typeof HEATERSHAKER_MODULE_TYPE
model: HeaterShakerModuleModel
data: HeaterShakerData
status: HeaterShakerStatus
}

const normalizeModuleInfoLegacy = (
response: ApiAttachedModuleLegacy
Expand Down Expand Up @@ -126,6 +137,13 @@ const normalizeModuleInfoNew = (
data: response.data,
status: response.status,
}
case HEATERSHAKER_MODULE_V1:
return {
model: response.moduleModel,
type: HEATERSHAKER_MODULE_TYPE,
data: response.data,
status: response.status,
}
default:
throw new Error(`bad module model ${(response as any).moduleModel}`)
}
Expand Down
10 changes: 10 additions & 0 deletions app/src/redux/modules/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ import type {
TemperatureModuleModel,
ThermocyclerModuleModel,
MagneticModuleModel,
HeaterShakerModuleModel,
} from '@opentrons/shared-data'
import type { Slot } from '../robot/api-types'

import {
TEMPERATURE_MODULE_TYPE,
MAGNETIC_MODULE_TYPE,
THERMOCYCLER_MODULE_TYPE,
HEATERSHAKER_MODULE_TYPE,
} from '@opentrons/shared-data'

import * as ApiTypes from './api-types'
Expand Down Expand Up @@ -43,10 +45,18 @@ export interface ThermocyclerModule extends CommonModuleInfo {
data: ApiTypes.ThermocyclerData
}

export interface HeaterShakerModule extends CommonModuleInfo {
type: typeof HEATERSHAKER_MODULE_TYPE
model: HeaterShakerModuleModel
status: ApiTypes.HeaterShakerStatus
data: ApiTypes.HeaterShakerData
}

export type AttachedModule =
| TemperatureModule
| MagneticModule
| ThermocyclerModule
| HeaterShakerModule
// action object types

export interface MatchedModule {
Expand Down
48 changes: 24 additions & 24 deletions components/src/__tests__/__snapshots__/icons.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -773,30 +773,6 @@ exports[`icons folder-open renders correctly 1`] = `
</svg>
`;

exports[`icons heater-shaker renders correctly 1`] = `
.c0.spin {
-webkit-animation: GLFYz 0.8s steps(8) infinite;
animation: GLFYz 0.8s steps(8) infinite;
-webkit-transform-origin: center;
-ms-transform-origin: center;
transform-origin: center;
}
<svg
aria-hidden="true"
className="sc-fznyAO c0 foo"
fill="currentColor"
version="1.1"
viewBox="0 0 16 16"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M7.79174 2C8.86863 2 9.74161 2.74832 9.74161 3.67143C9.74161 5.33149 9.56715 6.8067 9.29202 7.99155C10.3317 8.52259 11.0415 9.58826 11.0415 10.8163C11.0415 12.5746 9.58643 14 7.7915 14C5.99658 14 4.5415 12.5746 4.5415 10.8163C4.5415 9.66132 5.16937 8.64997 6.109 8.09193C5.94153 6.97862 5.84187 5.5203 5.84187 3.67143C5.84187 2.74832 6.71485 2 7.79174 2ZM8.4417 3.67143C8.4417 3.36373 8.1507 3.11429 7.79174 3.11429C7.43278 3.11429 7.14178 3.36373 7.14178 3.67143V4.5H8.4417V3.67143ZM11.0378 3.23225C10.7672 3.28742 10.5926 3.55149 10.6478 3.82206C10.8156 4.64514 10.7827 5.31842 10.7108 5.77943C10.6749 6.01014 10.6292 6.18767 10.5941 6.3039C10.5765 6.36199 10.5616 6.40465 10.5519 6.43087C10.5471 6.44397 10.5435 6.45295 10.5417 6.45767L10.5403 6.46105L10.5402 6.46129L10.5402 6.46136L10.5401 6.46138C10.4324 6.71431 10.5492 7.00705 10.8019 7.11622C11.0554 7.22575 11.3497 7.10904 11.4592 6.85555L11.0002 6.65723C11.4592 6.85555 11.4593 6.85536 11.4593 6.85517L11.4595 6.85476L11.4599 6.85386L11.4608 6.85173L11.4631 6.84618L11.4698 6.82994C11.475 6.81684 11.4819 6.79922 11.49 6.7772C11.5063 6.73319 11.5276 6.67156 11.5512 6.59338C11.5985 6.43708 11.6552 6.21418 11.6989 5.93336C11.7865 5.37129 11.8223 4.57705 11.6276 3.62227C11.5724 3.3517 11.3084 3.17708 11.0378 3.23225ZM4.62176 3.82205C4.67693 3.55147 4.50231 3.2874 4.23173 3.23223C3.96116 3.17706 3.69709 3.35168 3.64192 3.62226C3.44724 4.57703 3.48305 5.37128 3.57061 5.93334C3.61436 6.21417 3.67101 6.43706 3.71829 6.59336C3.74193 6.67154 3.76326 6.73317 3.77951 6.77719C3.78763 6.7992 3.7945 6.81682 3.79975 6.82992L3.80638 6.84616L3.80871 6.85171L3.80962 6.85384L3.81001 6.85474L3.81018 6.85515C3.81027 6.85535 3.81035 6.85553 4.26934 6.65722L3.81035 6.85553C3.91988 7.10903 4.21416 7.22573 4.46766 7.11621C4.72033 7.00703 4.8371 6.7143 4.72938 6.46136L4.72937 6.46135L4.72934 6.46125L4.72924 6.46103L4.72788 6.45766C4.72598 6.45293 4.72245 6.44396 4.71762 6.43085C4.70794 6.40464 4.69304 6.36197 4.67547 6.30388C4.64032 6.18765 4.59463 6.01012 4.55869 5.77942C4.48687 5.31841 4.45393 4.64512 4.62176 3.82205ZM13.0378 3.23225C12.7672 3.28742 12.5926 3.55149 12.6478 3.82206C12.8156 4.64514 12.7827 5.31842 12.7108 5.77943C12.6749 6.01014 12.6292 6.18767 12.5941 6.3039C12.5765 6.36199 12.5616 6.40465 12.5519 6.43087C12.5471 6.44397 12.5435 6.45295 12.5417 6.45767L12.5403 6.46105L12.5402 6.46129L12.5402 6.46136L12.5401 6.46138C12.4324 6.71431 12.5492 7.00705 12.8019 7.11622C13.0554 7.22575 13.3497 7.10904 13.4592 6.85555L13.0002 6.65723C13.4592 6.85555 13.4593 6.85536 13.4593 6.85517L13.4595 6.85476L13.4599 6.85386L13.4608 6.85173L13.4631 6.84618L13.4698 6.82994C13.475 6.81684 13.4819 6.79922 13.49 6.7772C13.5063 6.73319 13.5276 6.67156 13.5512 6.59338C13.5985 6.43708 13.6552 6.21418 13.6989 5.93336C13.7865 5.37129 13.8223 4.57705 13.6276 3.62227C13.5724 3.3517 13.3084 3.17708 13.0378 3.23225ZM2.62176 3.82205C2.67693 3.55147 2.50231 3.2874 2.23173 3.23223C1.96116 3.17706 1.69709 3.35168 1.64192 3.62226C1.44724 4.57703 1.48305 5.37128 1.57061 5.93334C1.61436 6.21417 1.67101 6.43706 1.71828 6.59336C1.74193 6.67154 1.76326 6.73317 1.77951 6.77719C1.78763 6.7992 1.7945 6.81682 1.79975 6.82992L1.80638 6.84616L1.80871 6.85171L1.80962 6.85384L1.81001 6.85474L1.81018 6.85515C1.81027 6.85535 1.81035 6.85553 2.26934 6.65722L1.81035 6.85553C1.91988 7.10903 2.21416 7.22573 2.46766 7.11621C2.72033 7.00703 2.8371 6.7143 2.72938 6.46136L2.72937 6.46135L2.72934 6.46125L2.72924 6.46103L2.72788 6.45766C2.72598 6.45293 2.72245 6.44396 2.71762 6.43085C2.70794 6.40464 2.69304 6.36197 2.67547 6.30388C2.64032 6.18765 2.59463 6.01012 2.55869 5.77942C2.48687 5.31841 2.45393 4.64512 2.62176 3.82205Z"
fillRule="evenodd"
/>
</svg>
`;

exports[`icons help-circle renders correctly 1`] = `
.c0.spin {
-webkit-animation: GLFYz 0.8s steps(8) infinite;
Expand Down Expand Up @@ -1301,6 +1277,30 @@ exports[`icons ot-flat-bottom renders correctly 1`] = `
</svg>
`;

exports[`icons ot-heater-shaker renders correctly 1`] = `
.c0.spin {
-webkit-animation: GLFYz 0.8s steps(8) infinite;
animation: GLFYz 0.8s steps(8) infinite;
-webkit-transform-origin: center;
-ms-transform-origin: center;
transform-origin: center;
}
<svg
aria-hidden="true"
className="sc-fznyAO c0 foo"
fill="currentColor"
version="1.1"
viewBox="0 0 16 16"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M7.79174 2C8.86863 2 9.74161 2.74832 9.74161 3.67143C9.74161 5.33149 9.56715 6.8067 9.29202 7.99155C10.3317 8.52259 11.0415 9.58826 11.0415 10.8163C11.0415 12.5746 9.58643 14 7.7915 14C5.99658 14 4.5415 12.5746 4.5415 10.8163C4.5415 9.66132 5.16937 8.64997 6.109 8.09193C5.94153 6.97862 5.84187 5.5203 5.84187 3.67143C5.84187 2.74832 6.71485 2 7.79174 2ZM8.4417 3.67143C8.4417 3.36373 8.1507 3.11429 7.79174 3.11429C7.43278 3.11429 7.14178 3.36373 7.14178 3.67143V4.5H8.4417V3.67143ZM11.0378 3.23225C10.7672 3.28742 10.5926 3.55149 10.6478 3.82206C10.8156 4.64514 10.7827 5.31842 10.7108 5.77943C10.6749 6.01014 10.6292 6.18767 10.5941 6.3039C10.5765 6.36199 10.5616 6.40465 10.5519 6.43087C10.5471 6.44397 10.5435 6.45295 10.5417 6.45767L10.5403 6.46105L10.5402 6.46129L10.5402 6.46136L10.5401 6.46138C10.4324 6.71431 10.5492 7.00705 10.8019 7.11622C11.0554 7.22575 11.3497 7.10904 11.4592 6.85555L11.0002 6.65723C11.4592 6.85555 11.4593 6.85536 11.4593 6.85517L11.4595 6.85476L11.4599 6.85386L11.4608 6.85173L11.4631 6.84618L11.4698 6.82994C11.475 6.81684 11.4819 6.79922 11.49 6.7772C11.5063 6.73319 11.5276 6.67156 11.5512 6.59338C11.5985 6.43708 11.6552 6.21418 11.6989 5.93336C11.7865 5.37129 11.8223 4.57705 11.6276 3.62227C11.5724 3.3517 11.3084 3.17708 11.0378 3.23225ZM4.62176 3.82205C4.67693 3.55147 4.50231 3.2874 4.23173 3.23223C3.96116 3.17706 3.69709 3.35168 3.64192 3.62226C3.44724 4.57703 3.48305 5.37128 3.57061 5.93334C3.61436 6.21417 3.67101 6.43706 3.71829 6.59336C3.74193 6.67154 3.76326 6.73317 3.77951 6.77719C3.78763 6.7992 3.7945 6.81682 3.79975 6.82992L3.80638 6.84616L3.80871 6.85171L3.80962 6.85384L3.81001 6.85474L3.81018 6.85515C3.81027 6.85535 3.81035 6.85553 4.26934 6.65722L3.81035 6.85553C3.91988 7.10903 4.21416 7.22573 4.46766 7.11621C4.72033 7.00703 4.8371 6.7143 4.72938 6.46136L4.72937 6.46135L4.72934 6.46125L4.72924 6.46103L4.72788 6.45766C4.72598 6.45293 4.72245 6.44396 4.71762 6.43085C4.70794 6.40464 4.69304 6.36197 4.67547 6.30388C4.64032 6.18765 4.59463 6.01012 4.55869 5.77942C4.48687 5.31841 4.45393 4.64512 4.62176 3.82205ZM13.0378 3.23225C12.7672 3.28742 12.5926 3.55149 12.6478 3.82206C12.8156 4.64514 12.7827 5.31842 12.7108 5.77943C12.6749 6.01014 12.6292 6.18767 12.5941 6.3039C12.5765 6.36199 12.5616 6.40465 12.5519 6.43087C12.5471 6.44397 12.5435 6.45295 12.5417 6.45767L12.5403 6.46105L12.5402 6.46129L12.5402 6.46136L12.5401 6.46138C12.4324 6.71431 12.5492 7.00705 12.8019 7.11622C13.0554 7.22575 13.3497 7.10904 13.4592 6.85555L13.0002 6.65723C13.4592 6.85555 13.4593 6.85536 13.4593 6.85517L13.4595 6.85476L13.4599 6.85386L13.4608 6.85173L13.4631 6.84618L13.4698 6.82994C13.475 6.81684 13.4819 6.79922 13.49 6.7772C13.5063 6.73319 13.5276 6.67156 13.5512 6.59338C13.5985 6.43708 13.6552 6.21418 13.6989 5.93336C13.7865 5.37129 13.8223 4.57705 13.6276 3.62227C13.5724 3.3517 13.3084 3.17708 13.0378 3.23225ZM2.62176 3.82205C2.67693 3.55147 2.50231 3.2874 2.23173 3.23223C1.96116 3.17706 1.69709 3.35168 1.64192 3.62226C1.44724 4.57703 1.48305 5.37128 1.57061 5.93334C1.61436 6.21417 1.67101 6.43706 1.71828 6.59336C1.74193 6.67154 1.76326 6.73317 1.77951 6.77719C1.78763 6.7992 1.7945 6.81682 1.79975 6.82992L1.80638 6.84616L1.80871 6.85171L1.80962 6.85384L1.81001 6.85474L1.81018 6.85515C1.81027 6.85535 1.81035 6.85553 2.26934 6.65722L1.81035 6.85553C1.91988 7.10903 2.21416 7.22573 2.46766 7.11621C2.72033 7.00703 2.8371 6.7143 2.72938 6.46136L2.72937 6.46135L2.72934 6.46125L2.72924 6.46103L2.72788 6.45766C2.72598 6.45293 2.72245 6.44396 2.71762 6.43085C2.70794 6.40464 2.69304 6.36197 2.67547 6.30388C2.64032 6.18765 2.59463 6.01012 2.55869 5.77942C2.48687 5.31841 2.45393 4.64512 2.62176 3.82205Z"
fillRule="evenodd"
/>
</svg>
`;

exports[`icons ot-logo renders correctly 1`] = `
.c0.spin {
-webkit-animation: GLFYz 0.8s steps(8) infinite;
Expand Down
Loading

0 comments on commit 4dc3670

Please sign in to comment.