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 log TC lid stacking issues and module icon formatting #16705

Merged
merged 5 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 4 additions & 0 deletions app/src/assets/localization/en/protocol_command_text.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,17 @@
"engaging_magnetic_module": "Engaging Magnetic Module",
"fixed_trash": "Fixed Trash",
"home_gantry": "Homing all gantry, pipette, and plunger axes",
"in": "in",
smb2268 marked this conversation as resolved.
Show resolved Hide resolved
"latching_hs_latch": "Latching labware on Heater-Shaker",
"left": "Left",
"load_labware_to_display_location": "Load {{labware}} {{display_location}}",
"load_labware_info_protocol_setup": "Load {{labware}} in {{module_name}} in Slot {{slot_name}}",
"load_labware_info_protocol_setup_adapter": "Load {{labware}} in {{adapter_name}} in Slot {{slot_name}}",
"load_labware_info_protocol_setup_adapter_module": "Load {{labware}} in {{adapter_name}} in {{module_name}} in Slot {{slot_name}}",
"load_labware_info_protocol_setup_adapter_off_deck": "Load {{labware}} in {{adapter_name}} off deck",
"load_labware_info_protocol_setup_no_module": "Load {{labware}} in Slot {{slot_name}}",
"load_labware_info_protocol_setup_off_deck": "Load {{labware}} off deck",
"load_labware_info_protocol_setup_stack": "Load {{labware}} onto {{second_labware}} stack",
"load_liquids_info_protocol_setup": "Load {{liquid}} into {{labware}}",
"load_module_protocol_setup": "Load {{module}} in Slot {{slot_name}}",
"load_pipette_protocol_setup": "Load {{pipette_name}} in {{mount_name}} Mount",
Expand All @@ -58,6 +61,7 @@
"notes": "notes",
"off_deck": "off deck",
"offdeck": "offdeck",
"on": "on",
smb2268 marked this conversation as resolved.
Show resolved Hide resolved
"opening_tc_lid": "Opening Thermocycler lid",
"pause": "Pause",
"pause_on": "Pause on {{robot_name}}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@ import {
import { getPipetteNameOnMount } from '../getPipetteNameOnMount'
import { getLiquidDisplayName } from '../getLiquidDisplayName'

import { getLabwareName } from '/app/local-resources/labware'
import {
getModuleModel,
getModuleDisplayLocation,
} from '/app/local-resources/modules'
getLabwareName,
getLabwareDisplayLocation,
} from '/app/local-resources/labware'

import type { LoadLabwareRunTimeCommand } from '@opentrons/shared-data'
import type { GetCommandText } from '../..'

export const getLoadCommandText = ({
Expand Down Expand Up @@ -53,103 +51,27 @@ export const getLoadCommandText = ({
})
}
case 'loadLabware': {
if (
command.params.location !== 'offDeck' &&
'moduleId' in command.params.location
) {
const moduleModel =
commandTextData != null
? getModuleModel(
commandTextData.modules ?? [],
command.params.location.moduleId
)
: null
const moduleName =
moduleModel != null ? getModuleDisplayName(moduleModel) : ''

return t('load_labware_info_protocol_setup', {
count:
moduleModel != null
? getOccludedSlotCountForModule(
getModuleType(moduleModel),
robotType
)
: 1,
labware: command.result?.definition.metadata.displayName,
slot_name:
commandTextData != null
? getModuleDisplayLocation(
commandTextData.modules ?? [],
command.params.location.moduleId
)
: null,
module_name: moduleName,
})
} else if (
command.params.location !== 'offDeck' &&
'labwareId' in command.params.location
) {
const labwareId = command.params.location.labwareId
const labwareName = command.result?.definition.metadata.displayName
const matchingAdapter = commandTextData?.commands.find(
(command): command is LoadLabwareRunTimeCommand =>
command.commandType === 'loadLabware' &&
command.result?.labwareId === labwareId
)
const adapterName =
matchingAdapter?.result?.definition.metadata.displayName
const adapterLoc = matchingAdapter?.params.location
if (adapterLoc === 'offDeck') {
return t('load_labware_info_protocol_setup_adapter_off_deck', {
labware: labwareName,
adapter_name: adapterName,
})
} else if (adapterLoc != null && 'slotName' in adapterLoc) {
return t('load_labware_info_protocol_setup_adapter', {
labware: labwareName,
adapter_name: adapterName,
slot_name: adapterLoc?.slotName,
})
} else if (adapterLoc != null && 'moduleId' in adapterLoc) {
const moduleModel =
commandTextData != null
? getModuleModel(
commandTextData.modules ?? [],
adapterLoc?.moduleId ?? ''
)
: null
const moduleName =
moduleModel != null ? getModuleDisplayName(moduleModel) : ''
return t('load_labware_info_protocol_setup_adapter_module', {
labware: labwareName,
adapter_name: adapterName,
module_name: moduleName,
slot_name:
commandTextData != null
? getModuleDisplayLocation(
commandTextData.modules ?? [],
adapterLoc?.moduleId ?? ''
)
: null,
})
} else {
// shouldn't reach here, adapter shouldn't have location type labwareId
return ''
}
} else {
const labware =
command.result?.definition.metadata.displayName ??
command.params.displayName
return command.params.location === 'offDeck'
? t('load_labware_info_protocol_setup_off_deck', { labware })
: t('load_labware_info_protocol_setup_no_module', {
labware,
slot_name:
'addressableAreaName' in command.params.location
? command.params.location.addressableAreaName
: command.params.location.slotName,
})
const location = getLabwareDisplayLocation({
location: command.params.location,
robotType,
allRunDefs,
loadedLabwares: commandTextData?.labware ?? [],
loadedModules: commandTextData?.modules ?? [],
t,
})
const labwareName = command.result?.definition.metadata.displayName
// use in preposition for modules and slots, on for labware and adapters
let displayLocation = `${t('in')} ${location}`
if (command.params.location === 'offDeck') {
displayLocation = location
} else if ('labwareId' in command.params.location) {
displayLocation = `${t('on')} ${location}`
}

return t('load_labware_to_display_location', {
labware: labwareName,
display_location: displayLocation,
})
}
case 'reloadLabware': {
const { labwareId } = command.params
Expand Down
5 changes: 5 additions & 0 deletions app/src/local-resources/labware/utils/getLabwareLocation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@ export function getLabwareLocation(
moduleModel,
adapterName,
}
} else if ('labwareId' in adapter.location) {
return getLabwareLocation({
...params,
location: adapter.location,
})
} else {
return null
}
Expand Down
23 changes: 13 additions & 10 deletions app/src/organisms/LabwarePositionCheck/ResultsSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
SPACING,
LegacyStyledText,
TYPOGRAPHY,
DIRECTION_ROW,
} from '@opentrons/components'
import { PythonLabwareOffsetSnippet } from '/app/molecules/PythonLabwareOffsetSnippet'
import {
Expand Down Expand Up @@ -373,16 +374,18 @@ export const TerseOffsetTable = (props: OffsetTableProps): JSX.Element => {
return (
<TerseTableRow key={index}>
<TerseTableDatum>
<DeckInfoLabel deckLabel={location.slotName} />
{location.moduleModel != null ? (
<DeckInfoLabel
iconName={
MODULE_ICON_NAME_BY_TYPE[
getModuleType(location.moduleModel)
]
}
/>
) : null}
<Flex flexDirection={DIRECTION_ROW} gridGap={SPACING.spacing4}>
<DeckInfoLabel deckLabel={location.slotName} />
{location.moduleModel != null ? (
<DeckInfoLabel
iconName={
MODULE_ICON_NAME_BY_TYPE[
getModuleType(location.moduleModel)
]
}
/>
) : null}
</Flex>
</TerseTableDatum>
<TerseTableDatum>
<LegacyStyledText
Expand Down
Loading