Skip to content

Commit

Permalink
fix(app): fix run log TC lid stacking issues and module icon formatti…
Browse files Browse the repository at this point in the history
  • Loading branch information
smb2268 authored Nov 7, 2024
1 parent 347a23e commit e813161
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 135 deletions.
13 changes: 5 additions & 8 deletions app/src/assets/localization/en/protocol_command_text.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"absorbance_reader_initialize": "Initializing Absorbance Reader to perform {{mode}} measurement at {{wavelengths}}",
"absorbance_reader_open_lid": "Opening Absorbance Reader lid",
"absorbance_reader_read": "Reading plate in Absorbance Reader",
"adapter_in_mod_in_slot": "{{adapter}} on {{module}} in {{slot}}",
"adapter_in_slot": "{{adapter}} in {{slot}}",
"adapter_in_mod_in_slot": "{{adapter}} on {{module}} in Slot {{slot}}",
"adapter_in_slot": "{{adapter}} in Slot {{slot}}",
"aspirate": "Aspirating {{volume}} µL from well {{well_name}} of {{labware}} in {{labware_location}} at {{flow_rate}} µL/sec",
"aspirate_in_place": "Aspirating {{volume}} µL in place at {{flow_rate}} µL/sec ",
"blowout": "Blowing out at well {{well_name}} of {{labware}} in {{labware_location}} at {{flow_rate}} µL/sec",
Expand All @@ -31,14 +31,10 @@
"engaging_magnetic_module": "Engaging Magnetic Module",
"fixed_trash": "Fixed Trash",
"home_gantry": "Homing all gantry, pipette, and plunger axes",
"in_location": "in {{location}}",
"latching_hs_latch": "Latching labware on Heater-Shaker",
"left": "Left",
"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_to_display_location": "Load {{labware}} {{display_location}}",
"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 +54,7 @@
"notes": "notes",
"off_deck": "off deck",
"offdeck": "offdeck",
"on_location": "on {{location}}",
"opening_tc_lid": "Opening Thermocycler lid",
"pause": "Pause",
"pause_on": "Pause on {{robot_name}}",
Expand Down
6 changes: 0 additions & 6 deletions app/src/assets/localization/zh/protocol_command_text.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@
"home_gantry": "复位所有龙门架、移液器和柱塞轴",
"latching_hs_latch": "在热震荡模块上锁定实验耗材",
"left": "",
"load_labware_info_protocol_setup_adapter_module": "在{{module_name}}的甲板槽{{slot_name}}上加载适配器{{adapter_name}}中的{{labware}}",
"load_labware_info_protocol_setup_adapter_off_deck": "在板外加载适配器{{adapter_name}}中的{{labware}}",
"load_labware_info_protocol_setup_adapter": "在甲板槽{{slot_name}}上加载适配器{{adapter_name}}中的{{labware}}",
"load_labware_info_protocol_setup_no_module": "在甲板槽{{slot_name}}中加载{{labware}}",
"load_labware_info_protocol_setup_off_deck": "在板外加载{{labware}}",
"load_labware_info_protocol_setup": "在{{module_name}}的甲板槽{{slot_name}}中加载{{labware}}",
"load_liquids_info_protocol_setup": "将{{liquid}}加载到{{labware}}中",
"load_module_protocol_setup": "在甲板槽{{slot_name}}中加载模块{{module}}",
"load_pipette_protocol_setup": "在{{mount_name}}支架上加载{{pipette_name}}",
Expand Down
6 changes: 0 additions & 6 deletions app/src/assets/localization/zh/run_details.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,6 @@
"labware": "耗材",
"left": "",
"listed_values": "列出的值仅供查看",
"load_labware_info_protocol_setup_adapter_off_deck": "在甲板外的{{adapter_name}}上加载{{labware}}",
"load_labware_info_protocol_setup_adapter": "在{{slot_name}}号板位中的{{adapter_name}}中加载{{labware}}",
"load_labware_info_protocol_setup_no_module": "在{{slot_name}}号板位中加载{{labware}}",
"load_labware_info_protocol_setup_off_deck": "在甲板外加载{{labware}}",
"load_labware_info_protocol_setup_plural": "在{{module_name}}中加载{{labware}}",
"load_labware_info_protocol_setup": "在{{slot_name}}号板位中的{{module_name}}中加载{{labware}}",
"load_liquids_info_protocol_setup": "将{{liquid}}加载到{{labware}}中",
"load_module_protocol_setup_plural": "加载{{module}}",
"load_module_protocol_setup": "在{{slot_name}}号板位中加载{{module}}",
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', { location })
if (command.params.location === 'offDeck') {
displayLocation = location
} else if ('labwareId' in command.params.location) {
displayLocation = t('on_location', { location })
}

return t('load_labware_to_display_location', {
labware: labwareName,
display_location: displayLocation,
})
}
case 'reloadLabware': {
const { labwareId } = command.params
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ describe('getLabwareDisplayLocation with translations', () => {
},
})

screen.getByText('Mock Adapter in D1')
screen.getByText('Mock Adapter in Slot D1')
})

it('should return a slot-only location when detailLevel is "slot-only"', () => {
Expand Down Expand Up @@ -168,6 +168,6 @@ describe('getLabwareDisplayLocation with translations', () => {
},
})

screen.getByText('Mock Adapter on Temperature Module in 2')
screen.getByText('Mock Adapter on Temperature Module in Slot 2')
})
})
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
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,15 @@
"slotName": "5"
},
"displayName": "NEST 1 Well Reservoir 195 mL"
},
{
"id": "29444782-bdc8-4ad8-92fe-5e28872e85e5:opentrons/opentrons_96_flat_bottom_adapter/1",
"loadName": "opentrons_96_flat_bottom_adapter",
"definitionUri": "opentrons/opentrons_96_flat_bottom_adapter/1",
"location": {
"slotName": "2"
},
"displayName": "Opentrons 96 Flat Bottom Adapter"
}
],
"modules": [
Expand Down
10 changes: 8 additions & 2 deletions app/src/molecules/Command/__tests__/CommandText.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -553,9 +553,15 @@ describe('CommandText', () => {
)
})
it('renders correct text for loadLabware in adapter', () => {
const flatBottomAdapterCommand = mockCommandTextData.commands.find(
c =>
c.commandType === 'loadLabware' &&
c.params.loadName === 'opentrons_96_flat_bottom_adapter'
)

renderWithProviders(
<CommandText
allRunDefs={[]}
allRunDefs={[flatBottomAdapterCommand?.result.definition]}
command={{
commandType: 'loadLabware',
params: {
Expand Down Expand Up @@ -589,7 +595,7 @@ describe('CommandText', () => {
}
)
screen.getByText(
'Load mock displayName in Opentrons 96 Flat Bottom Adapter in Slot 2'
'Load mock displayName on Opentrons 96 Flat Bottom Adapter in Slot 2'
)
})
it('renders correct text for loadLabware off deck', () => {
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

0 comments on commit e813161

Please sign in to comment.