From e813161f90a8dd02c0c064b8cc9adea3f40f5bf1 Mon Sep 17 00:00:00 2001 From: Sarah Breen Date: Thu, 7 Nov 2024 14:55:48 -0500 Subject: [PATCH] fix(app): fix run log TC lid stacking issues and module icon formatting (#16705) fix RQA-3485, RQA-3468, RQA-3463 --- .../en/protocol_command_text.json | 13 +- .../zh/protocol_command_text.json | 6 - .../assets/localization/zh/run_details.json | 6 - .../utils/commandText/getLoadCommandText.ts | 124 ++++-------------- .../getLabwareDisplayLocation.test.tsx | 4 +- .../labware/utils/getLabwareLocation.ts | 5 + .../__fixtures__/mockRobotSideAnalysis.json | 9 ++ .../Command/__tests__/CommandText.test.tsx | 10 +- .../LabwarePositionCheck/ResultsSummary.tsx | 23 ++-- 9 files changed, 65 insertions(+), 135 deletions(-) diff --git a/app/src/assets/localization/en/protocol_command_text.json b/app/src/assets/localization/en/protocol_command_text.json index 6dbee9af16f..a472c55432c 100644 --- a/app/src/assets/localization/en/protocol_command_text.json +++ b/app/src/assets/localization/en/protocol_command_text.json @@ -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", @@ -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", @@ -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}}", diff --git a/app/src/assets/localization/zh/protocol_command_text.json b/app/src/assets/localization/zh/protocol_command_text.json index 74ab15b69b7..9d976c2bc88 100644 --- a/app/src/assets/localization/zh/protocol_command_text.json +++ b/app/src/assets/localization/zh/protocol_command_text.json @@ -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}}", diff --git a/app/src/assets/localization/zh/run_details.json b/app/src/assets/localization/zh/run_details.json index 00d584bb4ba..2bfa9c1a5e1 100644 --- a/app/src/assets/localization/zh/run_details.json +++ b/app/src/assets/localization/zh/run_details.json @@ -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}}", diff --git a/app/src/local-resources/commands/hooks/useCommandTextString/utils/commandText/getLoadCommandText.ts b/app/src/local-resources/commands/hooks/useCommandTextString/utils/commandText/getLoadCommandText.ts index cba135218c8..52663e94305 100644 --- a/app/src/local-resources/commands/hooks/useCommandTextString/utils/commandText/getLoadCommandText.ts +++ b/app/src/local-resources/commands/hooks/useCommandTextString/utils/commandText/getLoadCommandText.ts @@ -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 = ({ @@ -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 diff --git a/app/src/local-resources/labware/utils/__tests__/getLabwareDisplayLocation.test.tsx b/app/src/local-resources/labware/utils/__tests__/getLabwareDisplayLocation.test.tsx index 22e02478ded..ca4b095f00e 100644 --- a/app/src/local-resources/labware/utils/__tests__/getLabwareDisplayLocation.test.tsx +++ b/app/src/local-resources/labware/utils/__tests__/getLabwareDisplayLocation.test.tsx @@ -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"', () => { @@ -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') }) }) diff --git a/app/src/local-resources/labware/utils/getLabwareLocation.ts b/app/src/local-resources/labware/utils/getLabwareLocation.ts index bb8231679c5..aec9e30a186 100644 --- a/app/src/local-resources/labware/utils/getLabwareLocation.ts +++ b/app/src/local-resources/labware/utils/getLabwareLocation.ts @@ -134,6 +134,11 @@ export function getLabwareLocation( moduleModel, adapterName, } + } else if ('labwareId' in adapter.location) { + return getLabwareLocation({ + ...params, + location: adapter.location, + }) } else { return null } diff --git a/app/src/molecules/Command/__fixtures__/mockRobotSideAnalysis.json b/app/src/molecules/Command/__fixtures__/mockRobotSideAnalysis.json index cd2bd35c802..848be62365c 100644 --- a/app/src/molecules/Command/__fixtures__/mockRobotSideAnalysis.json +++ b/app/src/molecules/Command/__fixtures__/mockRobotSideAnalysis.json @@ -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": [ diff --git a/app/src/molecules/Command/__tests__/CommandText.test.tsx b/app/src/molecules/Command/__tests__/CommandText.test.tsx index f2762b622d7..483e739bbcb 100644 --- a/app/src/molecules/Command/__tests__/CommandText.test.tsx +++ b/app/src/molecules/Command/__tests__/CommandText.test.tsx @@ -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( { } ) 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', () => { diff --git a/app/src/organisms/LabwarePositionCheck/ResultsSummary.tsx b/app/src/organisms/LabwarePositionCheck/ResultsSummary.tsx index 98f88fac2bd..eafda1a2c8a 100644 --- a/app/src/organisms/LabwarePositionCheck/ResultsSummary.tsx +++ b/app/src/organisms/LabwarePositionCheck/ResultsSummary.tsx @@ -29,6 +29,7 @@ import { SPACING, LegacyStyledText, TYPOGRAPHY, + DIRECTION_ROW, } from '@opentrons/components' import { PythonLabwareOffsetSnippet } from '/app/molecules/PythonLabwareOffsetSnippet' import { @@ -373,16 +374,18 @@ export const TerseOffsetTable = (props: OffsetTableProps): JSX.Element => { return ( - - {location.moduleModel != null ? ( - - ) : null} + + + {location.moduleModel != null ? ( + + ) : null} +