Skip to content

Commit 326d65a

Browse files
committed
aa hardware, tests and bug fix for waste chute aa
1 parent 4a73b48 commit 326d65a

File tree

11 files changed

+162
-51
lines changed

11 files changed

+162
-51
lines changed

app/src/organisms/DeviceDetailsDeckConfiguration/index.tsx

Lines changed: 35 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,14 @@ import { useModulesQuery } from '@opentrons/react-api-client'
2424
import {
2525
FAKE_STAGING_AREA_RIGHT_SLOT,
2626
FLEX_ROBOT_TYPE,
27-
FLEX_STACKER_FIXTURES,
2827
getAAByAAId,
29-
getAADisplayName,
28+
getAAFixtureDisplayName,
3029
getAASlotNameForAA,
3130
getCutoutDisplayName,
3231
getDeckDefFromRobotType,
33-
getDeckDefWithFakes,
3432
getFixtureDisplayName,
3533
replaceFixtureToFakeFixtureAndTransformCutoutFixturesToAA,
36-
SINGLE_RIGHT_CUTOUTS,
3734
SINGLE_SLOT_FIXTURES,
38-
STAGING_AREA_RIGHT_SLOT_FIXTURE,
3935
} from '@opentrons/shared-data'
4036

4137
import { useIsRobotViewable } from '/app/redux-resources/robots'
@@ -76,9 +72,9 @@ export function DeviceDetailsDeckConfiguration({
7672
useNotifyDeckConfigurationQuery({
7773
refetchInterval: DECK_CONFIG_REFETCH_INTERVAL,
7874
}).data ?? []
79-
75+
8076
const deckConfigWithAA = replaceFixtureToFakeFixtureAndTransformCutoutFixturesToAA(
81-
deckConfig
77+
deckConfig
8278
)
8379
const deckDef = getDeckDefFromRobotType(FLEX_ROBOT_TYPE)
8480
const { isRunRunning } = useRunStatuses()
@@ -95,18 +91,30 @@ export function DeviceDetailsDeckConfiguration({
9591
addFixtureModal,
9692
} = useDeckConfigurationEditingTools(false)
9793

94+
console.log('deckConfigWithAA: ', deckConfigWithAA)
9895
// do not show standard slot in fixture display list
9996
const { displayList: fixtureDisplayList } = deckConfigWithAA.reduce<{
10097
displayList: Array<{ displayLocation: string; displayName: string }>
10198
groupedCutoutIds: CutoutId[]
10299
}>(
103-
(acc, { cutoutId, cutoutFixtureId, opentronsModuleSerialNumber, addressableAreaId }) => {
100+
(
101+
acc,
102+
{
103+
cutoutId,
104+
cutoutFixtureId,
105+
opentronsModuleSerialNumber,
106+
addressableAreaId,
107+
}
108+
) => {
104109
const areaInCheck = getAAByAAId(addressableAreaId, deckDef)
105-
const shouldShow = areaInCheck.areaType != 'slot' && areaInCheck.areaType!= 'stagingSlot'
110+
const shouldShowAA =
111+
areaInCheck.areaType != 'slot' &&
112+
areaInCheck.areaType != 'fakeStagingSlot'
106113
if (
107114
cutoutFixtureId == null ||
108-
SINGLE_SLOT_FIXTURES.includes(cutoutFixtureId)
109-
|| FAKE_STAGING_AREA_RIGHT_SLOT === cutoutFixtureId || !shouldShow
115+
SINGLE_SLOT_FIXTURES.includes(cutoutFixtureId) ||
116+
FAKE_STAGING_AREA_RIGHT_SLOT === cutoutFixtureId ||
117+
!shouldShowAA
110118
) {
111119
return acc
112120
}
@@ -117,12 +125,15 @@ export function DeviceDetailsDeckConfiguration({
117125
usbPort?.hubPort != null
118126
? `${usbPort.port}.${usbPort.hubPort}`
119127
: usbPort?.port
120-
const displayName = getFixtureDisplayName(cutoutFixtureId, portDisplay)
121-
console.log("displayName: ", displayName)
128+
const displayName =
129+
getAAFixtureDisplayName(
130+
cutoutFixtureId,
131+
addressableAreaId,
132+
portDisplay
133+
) ?? getFixtureDisplayName(cutoutFixtureId, portDisplay)
122134
const fixtureGroup =
123135
deckDef.cutoutFixtures.find(cf => cf.id === cutoutFixtureId)
124136
?.fixtureGroup ?? {}
125-
const name = getAASlotNameForAA(cutoutId, cutoutFixtureId, addressableAreaId)
126137
if (cutoutId in fixtureGroup) {
127138
const groupMap =
128139
fixtureGroup[cutoutId]?.find(group =>
@@ -135,24 +146,28 @@ export function DeviceDetailsDeckConfiguration({
135146
) ?? {}
136147
const groupedCutoutIds = Object.keys(groupMap) as CutoutId[]
137148
const displayLocation = getDisplayLocationForCutoutIds(groupedCutoutIds)
138-
console.log("displayLocation: ", displayLocation
139-
)
140149
if (acc.groupedCutoutIds.includes(cutoutId)) {
141150
return acc // only list grouped fixtures once
142151
} else {
143-
console.log("in elsse")
144152
return {
145-
displayList: [...acc.displayList, { displayLocation: (name ?? displayLocation), displayName }],
153+
displayList: [...acc.displayList, { displayLocation, displayName }],
146154
groupedCutoutIds: [...acc.groupedCutoutIds, ...groupedCutoutIds],
147155
}
148156
}
149157
}
158+
const name = getAASlotNameForAA(
159+
cutoutId,
160+
cutoutFixtureId,
161+
addressableAreaId
162+
)
150163
return {
151164
...acc,
152165
displayList: [
153166
...acc.displayList,
154167
{
155-
displayLocation: name ? name.replace('fake', '') : getDisplayLocationForCutoutIds([cutoutId]),
168+
displayLocation: name
169+
? name.replace('fake', '')
170+
: getDisplayLocationForCutoutIds([cutoutId]),
156171
displayName,
157172
},
158173
],
@@ -161,6 +176,7 @@ export function DeviceDetailsDeckConfiguration({
161176
{ displayList: [], groupedCutoutIds: [] }
162177
)
163178

179+
console.log('fixtureDisplayList: ', fixtureDisplayList)
164180
return (
165181
<>
166182
{addFixtureModal}

app/src/resources/deck_configuration/hooks/useDeckConfigurationEditingTools.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import { useNotifyDeckConfigurationQuery } from '../useNotifyDeckConfigurationQu
1717
import type { ReactNode } from 'react'
1818
import type {
1919
AddressableAreaNamesWithFakes,
20+
CutoutFixtureId,
2021
CutoutId,
21-
CutoutFixtureId
2222
} from '@opentrons/shared-data'
2323

2424
const DECK_CONFIG_REFETCH_INTERVAL = 5000

components/src/hardware-sim/DeckConfigurator/AbsorbanceReaderItem.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ import { TYPOGRAPHY } from '../../ui-style-constants'
88
import { RobotCoordsForeignObject } from '../Deck/RobotCoordsForeignObject'
99
import {
1010
COLUMN_DEFAULT_X_ADJUSTMENT,
11-
LARGE_SINGLE_ITEM_SLOT_WIDTH,
1211
CONFIG_STYLE_EDITABLE,
1312
CONFIG_STYLE_READ_ONLY,
1413
CONFIG_STYLE_SELECTED,
1514
FIXTURE_HEIGHT,
15+
LARGE_SINGLE_ITEM_SLOT_WIDTH,
1616
Y_ADJUSTMENT,
1717
} from './constants'
1818

components/src/hardware-sim/DeckConfigurator/HeaterShakerItem.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import { useTranslation } from 'react-i18next'
22

3-
import {
4-
SINGLE_LEFT_CUTOUTS,
5-
} from '@opentrons/shared-data'
3+
import { SINGLE_LEFT_CUTOUTS } from '@opentrons/shared-data'
64

75
import { StyledText } from '../../atoms/StyledText/StyledText'
86
import { COLORS } from '../../helix-design-system'
@@ -23,10 +21,10 @@ import {
2321
} from './constants'
2422

2523
import type {
24+
AddressableAreaNamesWithFakes,
2625
CutoutFixtureIdsWithFakes,
2726
CutoutId,
2827
DeckDefinition,
29-
AddressableAreaNamesWithFakes,
3028
} from '@opentrons/shared-data'
3129

3230
// TODO(BC, 2024-03-21): This component is almost identical to TemperatureModuleFixture, consider consolidating?

components/src/hardware-sim/DeckConfigurator/MagneticBlockItem.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import { useTranslation } from 'react-i18next'
22

3-
import {
4-
SINGLE_LEFT_CUTOUTS,
5-
} from '@opentrons/shared-data'
3+
import { SINGLE_LEFT_CUTOUTS } from '@opentrons/shared-data'
64

75
import { StyledText } from '../../atoms/StyledText/StyledText'
86
import { COLORS } from '../../helix-design-system'
@@ -23,10 +21,10 @@ import {
2321
} from './constants'
2422

2523
import type {
24+
AddressableAreaNamesWithFakes,
2625
CutoutFixtureIdsWithFakes,
2726
CutoutId,
2827
DeckDefinition,
29-
AddressableAreaNamesWithFakes
3028
} from '@opentrons/shared-data'
3129

3230
interface MagneticBlockItemProps {

components/src/hardware-sim/DeckConfigurator/TemperatureModuleItem.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import { useTranslation } from 'react-i18next'
22

3-
import {
4-
SINGLE_LEFT_CUTOUTS,
5-
} from '@opentrons/shared-data'
3+
import { SINGLE_LEFT_CUTOUTS } from '@opentrons/shared-data'
64

75
import { StyledText } from '../../atoms/StyledText/StyledText'
86
import { COLORS } from '../../helix-design-system'
@@ -23,10 +21,10 @@ import {
2321
} from './constants'
2422

2523
import type {
24+
AddressableAreaNamesWithFakes,
2625
CutoutFixtureIdsWithFakes,
2726
CutoutId,
2827
DeckDefinition,
29-
AddressableAreaNamesWithFakes
3028
} from '@opentrons/shared-data'
3129

3230
// TODO(BC, 2024-03-21): This component is almost identical to HeaterShakerFixture, consider consolidating?

components/src/hardware-sim/DeckConfigurator/TrashBinConfigItem.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import { useTranslation } from 'react-i18next'
22

3-
import {
4-
SINGLE_LEFT_CUTOUTS,
5-
} from '@opentrons/shared-data'
3+
import { SINGLE_LEFT_CUTOUTS } from '@opentrons/shared-data'
64

75
import { StyledText } from '../../atoms/StyledText/StyledText'
86
import { COLORS } from '../../helix-design-system'
@@ -23,10 +21,10 @@ import {
2321
} from './constants'
2422

2523
import type {
24+
AddressableAreaNamesWithFakes,
2625
CutoutFixtureIdsWithFakes,
2726
CutoutId,
2827
DeckDefinition,
29-
AddressableAreaNamesWithFakes
3028
} from '@opentrons/shared-data'
3129

3230
interface TrashBinConfigItemProps {

components/src/hardware-sim/DeckConfigurator/WasteChuteConfigItem.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
import { useTranslation } from 'react-i18next'
22

3-
import {
4-
type AddressableAreaNamesWithFakes,
5-
type CutoutFixtureIdsWithFakes,
6-
type CutoutId,
7-
type DeckDefinition,
8-
DEFAULT_AA_FOR_WASTE_CHUTE,
9-
} from '@opentrons/shared-data'
3+
import { DEFAULT_AA_FOR_WASTE_CHUTE } from '@opentrons/shared-data'
104

115
import { StyledText } from '../../atoms/StyledText/StyledText'
126
import { COLORS } from '../../helix-design-system'
@@ -24,6 +18,13 @@ import {
2418
Y_ADJUSTMENT,
2519
} from './constants'
2620

21+
import type {
22+
AddressableAreaNamesWithFakes,
23+
CutoutFixtureIdsWithFakes,
24+
CutoutId,
25+
DeckDefinition,
26+
} from '@opentrons/shared-data'
27+
2728
interface WasteChuteConfigItemProps {
2829
deckDefinition: DeckDefinition
2930
fixtureLocation: CutoutId

shared-data/js/__tests__/fixtures.test.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
WASTE_CHUTE_RIGHT_ADAPTER_NO_COVER_FIXTURE,
1919
} from '..'
2020
import {
21+
getAAFixtureDisplayName,
2122
getAASlotNameForAA,
2223
getAAWithFakesFromCutoutFixtureId,
2324
getCutoutFixtureReplacementIfNeeded,
@@ -438,3 +439,37 @@ describe('replaceCutoutFixtureRemove', () => {
438439
expect(result).toEqual(WASTE_CHUTE_RIGHT_ADAPTER_NO_COVER_FIXTURE)
439440
})
440441
})
442+
443+
describe('getAAFixtureDisplayName', () => {
444+
it('Should return flex stacker name when using combo fixtures and aa for stacker', () => {
445+
const name = getAAFixtureDisplayName(
446+
FLEX_STACKER_WTIH_WASTE_CHUTE_ADAPTER_NO_COVER_FIXTURE,
447+
'flexStackerModuleV1D4'
448+
)
449+
expect(name).toEqual('Flex Stacker Module GEN1 in USB-0')
450+
})
451+
452+
it('Should return mag block name when using combo fixtures with mag block', () => {
453+
const name = getAAFixtureDisplayName(
454+
FLEX_STACKER_WITH_MAG_BLOCK_FIXTURE,
455+
'magneticBlockV1D3'
456+
)
457+
expect(name).toEqual('Magnetic block')
458+
})
459+
460+
it('Should return mag block name when using combo fixtures with mag block', () => {
461+
const name = getAAFixtureDisplayName(
462+
FLEX_STACKER_WITH_MAG_BLOCK_FIXTURE,
463+
'magneticBlockV1D3'
464+
)
465+
expect(name).toEqual('Magnetic block')
466+
})
467+
468+
it('Should return waste chute name when using waste chute fixture', () => {
469+
const name = getAAFixtureDisplayName(
470+
FAKE_WASTE_CHUTE_WITH_EMPTY_SLOT,
471+
'96ChannelWasteChute'
472+
)
473+
expect(name).toEqual('Waste chute')
474+
})
475+
})

shared-data/js/constants.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ export const MAGNETIC_BLOCK_FIXTURES: CutoutFixtureId[] = [
656656
FLEX_STACKER_WITH_MAG_BLOCK_FIXTURE,
657657
]
658658

659-
export const SINGLE_SLOT_FIXTURES: CutoutFixtureId[] = [
659+
export const SINGLE_SLOT_FIXTURES: CutoutFixtureIdsWithFakes[] = [
660660
SINGLE_LEFT_SLOT_FIXTURE,
661661
SINGLE_CENTER_SLOT_FIXTURE,
662662
SINGLE_RIGHT_SLOT_FIXTURE,
@@ -678,7 +678,7 @@ export const WASTE_CHUTE_WITH_FAKE_FIXTURES: CutoutFixtureIdsWithFakes[] = [
678678
STAGING_AREA_SLOT_WITH_WASTE_CHUTE_RIGHT_ADAPTER_COVERED_FIXTURE,
679679
STAGING_AREA_SLOT_WITH_WASTE_CHUTE_RIGHT_ADAPTER_NO_COVER_FIXTURE,
680680
FLEX_STACKER_WTIH_WASTE_CHUTE_ADAPTER_NO_COVER_FIXTURE,
681-
FAKE_WASTE_CHUTE_WITH_EMPTY_SLOT
681+
FAKE_WASTE_CHUTE_WITH_EMPTY_SLOT,
682682
]
683683

684684
export const WASTE_CHUTE_ONLY_FIXTURES: CutoutFixtureId[] = [

0 commit comments

Comments
 (0)