From d7161f27533bc645d006f7473a792c0f6eee05b5 Mon Sep 17 00:00:00 2001 From: Nick Diehl <47604184+ncdiehl11@users.noreply.github.com> Date: Wed, 8 May 2024 13:01:35 -0400 Subject: [PATCH] refactor(app, api-client, react-api-client): unify analysis and run record for CommandText use (#15125) AUTH-380 --- api-client/src/runs/types.ts | 2 + .../organisms/CommandText/LoadCommandText.tsx | 29 ++-- .../CommandText/MoveLabwareCommandText.tsx | 21 +-- .../CommandText/PipettingCommandText.tsx | 40 ++--- .../CommandText/__fixtures__/index.ts | 9 + .../__tests__/CommandText.test.tsx | 162 +++++++++--------- app/src/organisms/CommandText/index.tsx | 37 ++-- app/src/organisms/CommandText/types.ts | 6 + .../organisms/CommandText/utils/accessors.ts | 25 +-- .../utils/getAddressableAreaDisplayName.ts | 6 +- .../CommandText/utils/getCommandTextData.ts | 16 ++ .../utils/getLabwareDisplayLocation.ts | 22 +-- .../CommandText/utils/getLabwareName.ts | 13 +- .../CommandText/utils/getLiquidDisplayName.ts | 8 +- .../utils/getModuleDisplayLocation.ts | 6 +- .../CommandText/utils/getModuleModel.ts | 10 +- .../utils/getPipetteNameOnMount.ts | 10 +- .../InterventionModal/__fixtures__/index.ts | 8 + .../CurrentRunningProtocolCommand.tsx | 3 +- .../RunningProtocolCommandList.tsx | 3 +- app/src/organisms/RunPreview/index.tsx | 18 +- app/src/organisms/RunProgressMeter/index.tsx | 5 +- .../RunTimeControl/__fixtures__/index.ts | 9 + .../src/runs/__fixtures__/runs.ts | 2 + 24 files changed, 251 insertions(+), 219 deletions(-) create mode 100644 app/src/organisms/CommandText/types.ts create mode 100644 app/src/organisms/CommandText/utils/getCommandTextData.ts diff --git a/api-client/src/runs/types.ts b/api-client/src/runs/types.ts index 36c5f9a3a20..adde54b26ce 100644 --- a/api-client/src/runs/types.ts +++ b/api-client/src/runs/types.ts @@ -1,4 +1,5 @@ import type { + Liquid, LoadedLabware, LoadedModule, LoadedPipette, @@ -45,6 +46,7 @@ export interface LegacyGoodRunData { errors: RunError[] pipettes: LoadedPipette[] labware: LoadedLabware[] + liquids: Liquid[] modules: LoadedModule[] protocolId?: string labwareOffsets?: LabwareOffset[] diff --git a/app/src/organisms/CommandText/LoadCommandText.tsx b/app/src/organisms/CommandText/LoadCommandText.tsx index 8dd2f8e64d1..87eac184546 100644 --- a/app/src/organisms/CommandText/LoadCommandText.tsx +++ b/app/src/organisms/CommandText/LoadCommandText.tsx @@ -6,12 +6,6 @@ import { LoadLabwareRunTimeCommand, getPipetteNameSpecs, } from '@opentrons/shared-data' - -import type { - RunTimeCommand, - CompletedProtocolAnalysis, - RobotType, -} from '@opentrons/shared-data' import { getLabwareName, getPipetteNameOnMount, @@ -20,15 +14,18 @@ import { getLiquidDisplayName, } from './utils' +import type { RunTimeCommand, RobotType } from '@opentrons/shared-data' +import type { CommandTextData } from './types' + interface LoadCommandTextProps { command: RunTimeCommand - robotSideAnalysis: CompletedProtocolAnalysis + commandTextData: CommandTextData robotType: RobotType } export const LoadCommandText = ({ command, - robotSideAnalysis, + commandTextData, robotType, }: LoadCommandTextProps): JSX.Element | null => { const { t } = useTranslation('run_details') @@ -36,7 +33,7 @@ export const LoadCommandText = ({ switch (command.commandType) { case 'loadPipette': { const pipetteModel = getPipetteNameOnMount( - robotSideAnalysis, + commandTextData, command.params.mount ) return t('load_pipette_protocol_setup', { @@ -64,7 +61,7 @@ export const LoadCommandText = ({ 'moduleId' in command.params.location ) { const moduleModel = getModuleModel( - robotSideAnalysis, + commandTextData, command.params.location.moduleId ) const moduleName = @@ -80,7 +77,7 @@ export const LoadCommandText = ({ : 1, labware: command.result?.definition.metadata.displayName, slot_name: getModuleDisplayLocation( - robotSideAnalysis, + commandTextData, command.params.location.moduleId ), module_name: moduleName, @@ -91,7 +88,7 @@ export const LoadCommandText = ({ ) { const labwareId = command.params.location.labwareId const labwareName = command.result?.definition.metadata.displayName - const matchingAdapter = robotSideAnalysis.commands.find( + const matchingAdapter = commandTextData.commands.find( (command): command is LoadLabwareRunTimeCommand => command.commandType === 'loadLabware' && command.result?.labwareId === labwareId @@ -112,7 +109,7 @@ export const LoadCommandText = ({ }) } else if (adapterLoc != null && 'moduleId' in adapterLoc) { const moduleModel = getModuleModel( - robotSideAnalysis, + commandTextData, adapterLoc?.moduleId ?? '' ) const moduleName = @@ -122,7 +119,7 @@ export const LoadCommandText = ({ adapter_name: adapterName, module_name: moduleName, slot_name: getModuleDisplayLocation( - robotSideAnalysis, + commandTextData, adapterLoc?.moduleId ?? '' ), }) @@ -148,8 +145,8 @@ export const LoadCommandText = ({ case 'loadLiquid': { const { liquidId, labwareId } = command.params return t('load_liquids_info_protocol_setup', { - liquid: getLiquidDisplayName(robotSideAnalysis, liquidId), - labware: getLabwareName(robotSideAnalysis, labwareId), + liquid: getLiquidDisplayName(commandTextData, liquidId), + labware: getLabwareName(commandTextData, labwareId), }) } default: { diff --git a/app/src/organisms/CommandText/MoveLabwareCommandText.tsx b/app/src/organisms/CommandText/MoveLabwareCommandText.tsx index f2a68a76fd2..4296b3a2aa1 100644 --- a/app/src/organisms/CommandText/MoveLabwareCommandText.tsx +++ b/app/src/organisms/CommandText/MoveLabwareCommandText.tsx @@ -4,29 +4,30 @@ import { getLabwareName } from './utils' import { getLabwareDisplayLocation } from './utils/getLabwareDisplayLocation' import { getFinalLabwareLocation } from './utils/getFinalLabwareLocation' import type { - CompletedProtocolAnalysis, MoveLabwareRunTimeCommand, RobotType, } from '@opentrons/shared-data' +import type { CommandTextData } from './types' + interface MoveLabwareCommandTextProps { command: MoveLabwareRunTimeCommand - robotSideAnalysis: CompletedProtocolAnalysis + commandTextData: CommandTextData robotType: RobotType } export function MoveLabwareCommandText( props: MoveLabwareCommandTextProps ): JSX.Element { const { t } = useTranslation('protocol_command_text') - const { command, robotSideAnalysis, robotType } = props + const { command, commandTextData, robotType } = props const { labwareId, newLocation, strategy } = command.params - const allPreviousCommands = robotSideAnalysis.commands.slice( + const allPreviousCommands = commandTextData.commands.slice( 0, - robotSideAnalysis.commands.findIndex(c => c.id === command.id) + commandTextData.commands.findIndex(c => c.id === command.id) ) const oldLocation = getFinalLabwareLocation(labwareId, allPreviousCommands) const newDisplayLocation = getLabwareDisplayLocation( - robotSideAnalysis, + commandTextData, newLocation, t, robotType @@ -40,11 +41,11 @@ export function MoveLabwareCommandText( return strategy === 'usingGripper' ? t('move_labware_using_gripper', { - labware: getLabwareName(robotSideAnalysis, labwareId), + labware: getLabwareName(commandTextData, labwareId), old_location: oldLocation != null ? getLabwareDisplayLocation( - robotSideAnalysis, + commandTextData, oldLocation, t, robotType @@ -53,11 +54,11 @@ export function MoveLabwareCommandText( new_location: location, }) : t('move_labware_manually', { - labware: getLabwareName(robotSideAnalysis, labwareId), + labware: getLabwareName(commandTextData, labwareId), old_location: oldLocation != null ? getLabwareDisplayLocation( - robotSideAnalysis, + commandTextData, oldLocation, t, robotType diff --git a/app/src/organisms/CommandText/PipettingCommandText.tsx b/app/src/organisms/CommandText/PipettingCommandText.tsx index 2ac59c1a788..ff6ce1e1bbf 100644 --- a/app/src/organisms/CommandText/PipettingCommandText.tsx +++ b/app/src/organisms/CommandText/PipettingCommandText.tsx @@ -1,10 +1,6 @@ import { useTranslation } from 'react-i18next' -import { - CompletedProtocolAnalysis, - getLabwareDefURI, - RobotType, -} from '@opentrons/shared-data' +import { getLabwareDefURI } from '@opentrons/shared-data' import { getLabwareDefinitionsFromCommands } from '../LabwarePositionCheck/utils/labware' import { getLoadedLabware } from './utils/accessors' @@ -17,17 +13,19 @@ import { import type { PipetteName, PipettingRunTimeCommand, + RobotType, } from '@opentrons/shared-data' +import type { CommandTextData } from './types' interface PipettingCommandTextProps { command: PipettingRunTimeCommand - robotSideAnalysis: CompletedProtocolAnalysis + commandTextData: CommandTextData robotType: RobotType } export const PipettingCommandText = ({ command, - robotSideAnalysis, + commandTextData, robotType, }: PipettingCommandTextProps): JSX.Element | null => { const { t } = useTranslation('protocol_command_text') @@ -36,9 +34,9 @@ export const PipettingCommandText = ({ 'labwareId' in command.params ? command.params.labwareId : '' const wellName = 'wellName' in command.params ? command.params.wellName : '' - const allPreviousCommands = robotSideAnalysis.commands.slice( + const allPreviousCommands = commandTextData.commands.slice( 0, - robotSideAnalysis.commands.findIndex(c => c.id === command.id) + commandTextData.commands.findIndex(c => c.id === command.id) ) const labwareLocation = getFinalLabwareLocation( labwareId, @@ -47,7 +45,7 @@ export const PipettingCommandText = ({ const displayLocation = labwareLocation != null ? getLabwareDisplayLocation( - robotSideAnalysis, + commandTextData, labwareLocation, t, robotType @@ -58,7 +56,7 @@ export const PipettingCommandText = ({ const { volume, flowRate } = command.params return t('aspirate', { well_name: wellName, - labware: getLabwareName(robotSideAnalysis, labwareId), + labware: getLabwareName(commandTextData, labwareId), labware_location: displayLocation, volume: volume, flow_rate: flowRate, @@ -69,7 +67,7 @@ export const PipettingCommandText = ({ return pushOut ? t('dispense_push_out', { well_name: wellName, - labware: getLabwareName(robotSideAnalysis, labwareId), + labware: getLabwareName(commandTextData, labwareId), labware_location: displayLocation, volume: volume, flow_rate: flowRate, @@ -77,7 +75,7 @@ export const PipettingCommandText = ({ }) : t('dispense', { well_name: wellName, - labware: getLabwareName(robotSideAnalysis, labwareId), + labware: getLabwareName(commandTextData, labwareId), labware_location: displayLocation, volume: volume, flow_rate: flowRate, @@ -87,15 +85,15 @@ export const PipettingCommandText = ({ const { flowRate } = command.params return t('blowout', { well_name: wellName, - labware: getLabwareName(robotSideAnalysis, labwareId), + labware: getLabwareName(commandTextData, labwareId), labware_location: displayLocation, flow_rate: flowRate, }) } case 'dropTip': { - const loadedLabware = getLoadedLabware(robotSideAnalysis, labwareId) + const loadedLabware = getLoadedLabware(commandTextData, labwareId) const labwareDefinitions = getLabwareDefinitionsFromCommands( - robotSideAnalysis.commands + commandTextData.commands ) const labwareDef = labwareDefinitions.find( lw => getLabwareDefURI(lw) === loadedLabware?.definitionUri @@ -103,20 +101,20 @@ export const PipettingCommandText = ({ return labwareDef?.parameters.isTiprack ? t('return_tip', { well_name: wellName, - labware: getLabwareName(robotSideAnalysis, labwareId), + labware: getLabwareName(commandTextData, labwareId), labware_location: displayLocation, }) : t('drop_tip', { well_name: wellName, - labware: getLabwareName(robotSideAnalysis, labwareId), + labware: getLabwareName(commandTextData, labwareId), }) } case 'pickUpTip': { const pipetteId = command.params.pipetteId const pipetteName: | PipetteName - | undefined = robotSideAnalysis.pipettes.find( - pip => pip.id === pipetteId + | undefined = commandTextData.pipettes.find( + pipette => pipette.id === pipetteId )?.pipetteName return t('pickup_tip', { @@ -126,7 +124,7 @@ export const PipettingCommandText = ({ wellName, pipetteName ), - labware: getLabwareName(robotSideAnalysis, labwareId), + labware: getLabwareName(commandTextData, labwareId), labware_location: displayLocation, }) } diff --git a/app/src/organisms/CommandText/__fixtures__/index.ts b/app/src/organisms/CommandText/__fixtures__/index.ts index ff40346cc6b..016bb909602 100644 --- a/app/src/organisms/CommandText/__fixtures__/index.ts +++ b/app/src/organisms/CommandText/__fixtures__/index.ts @@ -1,4 +1,13 @@ import robotSideAnalysis from './mockRobotSideAnalysis.json' import type { CompletedProtocolAnalysis } from '@opentrons/shared-data' +import type { CommandTextData } from '../types' export const mockRobotSideAnalysis: CompletedProtocolAnalysis = robotSideAnalysis as CompletedProtocolAnalysis + +export const mockCommandTextData: CommandTextData = { + commands: mockRobotSideAnalysis.commands, + pipettes: mockRobotSideAnalysis.pipettes, + labware: mockRobotSideAnalysis.labware, + modules: mockRobotSideAnalysis.modules, + liquids: mockRobotSideAnalysis.liquids, +} diff --git a/app/src/organisms/CommandText/__tests__/CommandText.test.tsx b/app/src/organisms/CommandText/__tests__/CommandText.test.tsx index 418584e80e6..422583bcb3b 100644 --- a/app/src/organisms/CommandText/__tests__/CommandText.test.tsx +++ b/app/src/organisms/CommandText/__tests__/CommandText.test.tsx @@ -11,12 +11,14 @@ import { import { renderWithProviders } from '../../../__testing-utils__' import { i18n } from '../../../i18n' import { CommandText } from '../' -import { mockRobotSideAnalysis } from '../__fixtures__' +import { mockCommandTextData } from '../__fixtures__' +import { getCommandTextData } from '../utils/getCommandTextData' import type { AspirateInPlaceRunTimeCommand, BlowoutInPlaceRunTimeCommand, BlowoutRunTimeCommand, + CompletedProtocolAnalysis, ConfigureForVolumeRunTimeCommand, DispenseInPlaceRunTimeCommand, DispenseRunTimeCommand, @@ -33,14 +35,14 @@ import type { describe('CommandText', () => { it('renders correct text for aspirate', () => { - const command = mockRobotSideAnalysis.commands.find( + const command = mockCommandTextData.commands.find( c => c.commandType === 'aspirate' ) expect(command).not.toBeUndefined() if (command != null) { const { getByText } = renderWithProviders( , @@ -52,14 +54,14 @@ describe('CommandText', () => { } }) it('renders correct text for dispense without pushOut', () => { - const command = mockRobotSideAnalysis.commands.find( + const command = mockCommandTextData.commands.find( c => c.commandType === 'dispense' ) expect(command).not.toBeUndefined() if (command != null) { const { getByText } = renderWithProviders( , @@ -71,7 +73,7 @@ describe('CommandText', () => { } }) it('renders correct text for dispense with pushOut', () => { - const command = mockRobotSideAnalysis.commands.find( + const command = mockCommandTextData.commands.find( c => c.commandType === 'dispense' ) const pushOutDispenseCommand = { @@ -85,7 +87,7 @@ describe('CommandText', () => { if (pushOutDispenseCommand != null) { const { getByText } = renderWithProviders( , @@ -99,7 +101,7 @@ describe('CommandText', () => { it('renders correct text for dispenseInPlace', () => { const { getByText } = renderWithProviders( { getByText('Dispensing 50 µL in place at 300 µL/sec') }) it('renders correct text for blowout', () => { - const dispenseCommand = mockRobotSideAnalysis.commands.find( + const dispenseCommand = mockCommandTextData.commands.find( c => c.commandType === 'dispense' ) const blowoutCommand = { @@ -128,7 +130,7 @@ describe('CommandText', () => { if (blowoutCommand != null) { const { getByText } = renderWithProviders( , @@ -142,7 +144,7 @@ describe('CommandText', () => { it('renders correct text for blowOutInPlace', () => { const { getByText } = renderWithProviders( { it('renders correct text for aspirateInPlace', () => { const { getByText } = renderWithProviders( { getByText('Aspirating 10 µL in place at 300 µL/sec') }) it('renders correct text for moveToWell', () => { - const dispenseCommand = mockRobotSideAnalysis.commands.find( + const dispenseCommand = mockCommandTextData.commands.find( c => c.commandType === 'aspirate' ) const moveToWellCommand = { @@ -190,7 +192,7 @@ describe('CommandText', () => { if (moveToWellCommand != null) { const { getByText } = renderWithProviders( , @@ -206,7 +208,7 @@ describe('CommandText', () => { commandType: 'moveLabware', params: { strategy: 'usingGripper', - labwareId: mockRobotSideAnalysis.labware[2].id, + labwareId: mockCommandTextData.labware[2].id, newLocation: { addressableAreaName: '5' }, }, id: 'def456', @@ -217,7 +219,7 @@ describe('CommandText', () => { startedAt: null, completedAt: null, }} - robotSideAnalysis={mockRobotSideAnalysis} + commandTextData={mockCommandTextData} robotType={FLEX_ROBOT_TYPE} />, { @@ -231,7 +233,7 @@ describe('CommandText', () => { it('renders correct text for moveToAddressableArea for Waste Chutes', () => { const { getByText } = renderWithProviders( { it('renders correct text for moveToAddressableArea for Fixed Trash', () => { const { getByText } = renderWithProviders( { it('renders correct text for moveToAddressableArea for Trash Bins', () => { const { getByText } = renderWithProviders( { it('renders correct text for moveToAddressableAreaForDropTip for Trash Bin', () => { const { getByText } = renderWithProviders( { it('renders correct text for moveToAddressableArea for slots', () => { const { getByText } = renderWithProviders( { const { getByText } = renderWithProviders( , @@ -358,7 +360,7 @@ describe('CommandText', () => { const { getByText } = renderWithProviders( , @@ -367,14 +369,14 @@ describe('CommandText', () => { getByText('Preparing P300 Single-Channel GEN1 to aspirate') }) it('renders correct text for dropTip', () => { - const command = mockRobotSideAnalysis.commands.find( + const command = mockCommandTextData.commands.find( c => c.commandType === 'dropTip' ) expect(command).not.toBeUndefined() if (command != null) { const { getByText } = renderWithProviders( , @@ -386,7 +388,7 @@ describe('CommandText', () => { it('renders correct text for dropTip into a labware', () => { const { getByText } = renderWithProviders( { it('renders correct text for dropTipInPlace', () => { const { getByText } = renderWithProviders( { getByText('Dropping tip in place') }) it('renders correct text for pickUpTip', () => { - const command = mockRobotSideAnalysis.commands.find( + const command = mockCommandTextData.commands.find( c => c.commandType === 'pickUpTip' ) expect(command).not.toBeUndefined() if (command != null) { const { getByText } = renderWithProviders( , @@ -442,14 +444,14 @@ describe('CommandText', () => { } }) it('renders correct text for loadPipette', () => { - const command = mockRobotSideAnalysis.commands.find( + const command = mockCommandTextData.commands.find( c => c.commandType === 'loadPipette' ) expect(command).not.toBeNull() if (command != null) { const { getByText } = renderWithProviders( , @@ -459,14 +461,14 @@ describe('CommandText', () => { } }) it('renders correct text for loadModule', () => { - const command = mockRobotSideAnalysis.commands.find( + const command = mockCommandTextData.commands.find( c => c.commandType === 'loadModule' ) expect(command).not.toBeNull() if (command != null) { const { getByText } = renderWithProviders( , @@ -476,13 +478,13 @@ describe('CommandText', () => { } }) it('renders correct text for loadLabware that is category adapter in slot', () => { - const loadLabwareCommands = mockRobotSideAnalysis.commands.filter( + const loadLabwareCommands = mockCommandTextData.commands.filter( c => c.commandType === 'loadLabware' ) const loadLabwareCommand = loadLabwareCommands[0] const { getByText } = renderWithProviders( , @@ -491,13 +493,13 @@ describe('CommandText', () => { getByText('Load Opentrons 96 Flat Bottom Adapter in Slot 2') }) it('renders correct text for loadLabware in slot', () => { - const loadLabwareCommands = mockRobotSideAnalysis.commands.filter( + const loadLabwareCommands = mockCommandTextData.commands.filter( c => c.commandType === 'loadLabware' ) const loadTipRackCommand = loadLabwareCommands[2] const { getByText } = renderWithProviders( , @@ -506,13 +508,13 @@ describe('CommandText', () => { getByText('Load Opentrons 96 Tip Rack 300 µL in Slot 9') }) it('renders correct text for loadLabware in module', () => { - const loadLabwareCommands = mockRobotSideAnalysis.commands.filter( + const loadLabwareCommands = mockCommandTextData.commands.filter( c => c.commandType === 'loadLabware' ) const loadOnModuleCommand = loadLabwareCommands[3] const { getByText } = renderWithProviders( , @@ -550,7 +552,7 @@ describe('CommandText', () => { startedAt: null, completedAt: null, }} - robotSideAnalysis={mockRobotSideAnalysis} + commandTextData={mockCommandTextData} robotType={FLEX_ROBOT_TYPE} />, { @@ -562,7 +564,7 @@ describe('CommandText', () => { ) }) it('renders correct text for loadLabware off deck', () => { - const loadLabwareCommands = mockRobotSideAnalysis.commands.filter( + const loadLabwareCommands = mockCommandTextData.commands.filter( c => c.commandType === 'loadLabware' ) const loadOffDeckCommand = { @@ -574,7 +576,7 @@ describe('CommandText', () => { } as LoadLabwareRunTimeCommand const { getByText } = renderWithProviders( , @@ -583,7 +585,7 @@ describe('CommandText', () => { getByText('Load NEST 96 Well Plate 100 µL PCR Full Skirt off deck') }) it('renders correct text for loadLiquid', () => { - const loadLabwareCommands = mockRobotSideAnalysis.commands.filter( + const loadLabwareCommands = mockCommandTextData.commands.filter( c => c.commandType === 'loadLabware' ) const liquidId = 'zxcvbn' @@ -594,7 +596,7 @@ describe('CommandText', () => { params: { liquidId, labwareId }, } as LoadLiquidRunTimeCommand const analysisWithLiquids = { - ...mockRobotSideAnalysis, + ...mockCommandTextData, liquids: [ { id: 'zxcvbn', @@ -615,7 +617,9 @@ describe('CommandText', () => { } const { getByText } = renderWithProviders( , @@ -638,7 +642,7 @@ describe('CommandText', () => { startedAt: null, completedAt: null, }} - robotSideAnalysis={mockRobotSideAnalysis} + commandTextData={mockCommandTextData} robotType={FLEX_ROBOT_TYPE} />, { @@ -662,7 +666,7 @@ describe('CommandText', () => { startedAt: null, completedAt: null, }} - robotSideAnalysis={mockRobotSideAnalysis} + commandTextData={mockCommandTextData} robotType={FLEX_ROBOT_TYPE} />, { @@ -685,7 +689,7 @@ describe('CommandText', () => { startedAt: null, completedAt: null, }} - robotSideAnalysis={mockRobotSideAnalysis} + commandTextData={mockCommandTextData} robotType={FLEX_ROBOT_TYPE} />, { @@ -709,7 +713,7 @@ describe('CommandText', () => { startedAt: null, completedAt: null, }} - robotSideAnalysis={mockRobotSideAnalysis} + commandTextData={mockCommandTextData} robotType={FLEX_ROBOT_TYPE} />, { @@ -735,7 +739,7 @@ describe('CommandText', () => { startedAt: null, completedAt: null, }} - robotSideAnalysis={mockRobotSideAnalysis} + commandTextData={mockCommandTextData} robotType={FLEX_ROBOT_TYPE} />, { @@ -759,7 +763,7 @@ describe('CommandText', () => { startedAt: null, completedAt: null, }} - robotSideAnalysis={mockRobotSideAnalysis} + commandTextData={mockCommandTextData} robotType={FLEX_ROBOT_TYPE} />, { @@ -786,7 +790,7 @@ describe('CommandText', () => { startedAt: null, completedAt: null, }} - robotSideAnalysis={mockRobotSideAnalysis} + commandTextData={mockCommandTextData} robotType={FLEX_ROBOT_TYPE} />, { @@ -817,7 +821,7 @@ describe('CommandText', () => { startedAt: null, completedAt: null, }} - robotSideAnalysis={mockRobotSideAnalysis} + commandTextData={mockCommandTextData} robotType={FLEX_ROBOT_TYPE} isOnDevice={true} />, @@ -847,7 +851,7 @@ describe('CommandText', () => { startedAt: null, completedAt: null, }} - robotSideAnalysis={mockRobotSideAnalysis} + commandTextData={mockCommandTextData} robotType={FLEX_ROBOT_TYPE} />, { @@ -872,7 +876,7 @@ describe('CommandText', () => { startedAt: null, completedAt: null, }} - robotSideAnalysis={mockRobotSideAnalysis} + commandTextData={mockCommandTextData} robotType={FLEX_ROBOT_TYPE} />, { @@ -895,7 +899,7 @@ describe('CommandText', () => { startedAt: null, completedAt: null, }} - robotSideAnalysis={mockRobotSideAnalysis} + commandTextData={mockCommandTextData} robotType={FLEX_ROBOT_TYPE} />, { @@ -918,7 +922,7 @@ describe('CommandText', () => { startedAt: null, completedAt: null, }} - robotSideAnalysis={mockRobotSideAnalysis} + commandTextData={mockCommandTextData} robotType={FLEX_ROBOT_TYPE} />, { @@ -971,7 +975,7 @@ describe('CommandText', () => { completedAt: null, } as RunTimeCommand } - robotSideAnalysis={mockRobotSideAnalysis} + commandTextData={mockCommandTextData} robotType={FLEX_ROBOT_TYPE} />, { @@ -997,7 +1001,7 @@ describe('CommandText', () => { startedAt: null, completedAt: null, }} - robotSideAnalysis={mockRobotSideAnalysis} + commandTextData={mockCommandTextData} robotType={FLEX_ROBOT_TYPE} />, { @@ -1020,7 +1024,7 @@ describe('CommandText', () => { startedAt: null, completedAt: null, }} - robotSideAnalysis={mockRobotSideAnalysis} + commandTextData={mockCommandTextData} robotType={FLEX_ROBOT_TYPE} />, { @@ -1043,7 +1047,7 @@ describe('CommandText', () => { startedAt: null, completedAt: null, }} - robotSideAnalysis={mockRobotSideAnalysis} + commandTextData={mockCommandTextData} robotType={FLEX_ROBOT_TYPE} />, { @@ -1066,7 +1070,7 @@ describe('CommandText', () => { startedAt: null, completedAt: null, }} - robotSideAnalysis={mockRobotSideAnalysis} + commandTextData={mockCommandTextData} robotType={FLEX_ROBOT_TYPE} />, { @@ -1089,7 +1093,7 @@ describe('CommandText', () => { startedAt: null, completedAt: null, }} - robotSideAnalysis={mockRobotSideAnalysis} + commandTextData={mockCommandTextData} robotType={FLEX_ROBOT_TYPE} />, { @@ -1112,7 +1116,7 @@ describe('CommandText', () => { startedAt: null, completedAt: null, }} - robotSideAnalysis={mockRobotSideAnalysis} + commandTextData={mockCommandTextData} robotType={FLEX_ROBOT_TYPE} />, { @@ -1135,7 +1139,7 @@ describe('CommandText', () => { startedAt: null, completedAt: null, }} - robotSideAnalysis={mockRobotSideAnalysis} + commandTextData={mockCommandTextData} robotType={FLEX_ROBOT_TYPE} />, { @@ -1158,7 +1162,7 @@ describe('CommandText', () => { startedAt: null, completedAt: null, }} - robotSideAnalysis={mockRobotSideAnalysis} + commandTextData={mockCommandTextData} robotType={FLEX_ROBOT_TYPE} />, { @@ -1181,7 +1185,7 @@ describe('CommandText', () => { startedAt: null, completedAt: null, }} - robotSideAnalysis={mockRobotSideAnalysis} + commandTextData={mockCommandTextData} robotType={FLEX_ROBOT_TYPE} />, { @@ -1208,7 +1212,7 @@ describe('CommandText', () => { startedAt: null, completedAt: null, }} - robotSideAnalysis={mockRobotSideAnalysis} + commandTextData={mockCommandTextData} robotType={FLEX_ROBOT_TYPE} />, { @@ -1226,7 +1230,7 @@ describe('CommandText', () => { commandType: 'moveLabware', params: { strategy: 'manualMoveWithPause', - labwareId: mockRobotSideAnalysis.labware[2].id, + labwareId: mockCommandTextData.labware[2].id, newLocation: 'offDeck', }, id: 'def456', @@ -1237,7 +1241,7 @@ describe('CommandText', () => { startedAt: null, completedAt: null, }} - robotSideAnalysis={mockRobotSideAnalysis} + commandTextData={mockCommandTextData} robotType={FLEX_ROBOT_TYPE} />, { @@ -1255,7 +1259,7 @@ describe('CommandText', () => { commandType: 'moveLabware', params: { strategy: 'manualMoveWithPause', - labwareId: mockRobotSideAnalysis.labware[3].id, + labwareId: mockCommandTextData.labware[3].id, newLocation: { slotName: 'A3' }, }, id: 'def456', @@ -1266,7 +1270,7 @@ describe('CommandText', () => { startedAt: null, completedAt: null, }} - robotSideAnalysis={mockRobotSideAnalysis} + commandTextData={mockCommandTextData} robotType={FLEX_ROBOT_TYPE} />, { @@ -1284,7 +1288,7 @@ describe('CommandText', () => { commandType: 'moveLabware', params: { strategy: 'usingGripper', - labwareId: mockRobotSideAnalysis.labware[2].id, + labwareId: mockCommandTextData.labware[2].id, newLocation: 'offDeck', }, id: 'def456', @@ -1295,7 +1299,7 @@ describe('CommandText', () => { startedAt: null, completedAt: null, }} - robotSideAnalysis={mockRobotSideAnalysis} + commandTextData={mockCommandTextData} robotType={FLEX_ROBOT_TYPE} />, { @@ -1313,7 +1317,7 @@ describe('CommandText', () => { commandType: 'moveLabware', params: { strategy: 'usingGripper', - labwareId: mockRobotSideAnalysis.labware[2].id, + labwareId: mockCommandTextData.labware[2].id, newLocation: { addressableAreaName: GRIPPER_WASTE_CHUTE_ADDRESSABLE_AREA, }, @@ -1326,7 +1330,7 @@ describe('CommandText', () => { startedAt: null, completedAt: null, }} - robotSideAnalysis={mockRobotSideAnalysis} + commandTextData={mockCommandTextData} robotType={FLEX_ROBOT_TYPE} />, { @@ -1344,8 +1348,8 @@ describe('CommandText', () => { commandType: 'moveLabware', params: { strategy: 'usingGripper', - labwareId: mockRobotSideAnalysis.labware[3].id, - newLocation: { moduleId: mockRobotSideAnalysis.modules[0].id }, + labwareId: mockCommandTextData.labware[3].id, + newLocation: { moduleId: mockCommandTextData.modules[0].id }, }, id: 'def456', result: { offsetId: 'fake_offset_id' }, @@ -1355,7 +1359,7 @@ describe('CommandText', () => { startedAt: null, completedAt: null, }} - robotSideAnalysis={mockRobotSideAnalysis} + commandTextData={mockCommandTextData} robotType={FLEX_ROBOT_TYPE} />, { diff --git a/app/src/organisms/CommandText/index.tsx b/app/src/organisms/CommandText/index.tsx index 47c54140149..74f133ddbb6 100644 --- a/app/src/organisms/CommandText/index.tsx +++ b/app/src/organisms/CommandText/index.tsx @@ -20,12 +20,9 @@ import { PipettingCommandText } from './PipettingCommandText' import { TemperatureCommandText } from './TemperatureCommandText' import { MoveLabwareCommandText } from './MoveLabwareCommandText' -import type { - CompletedProtocolAnalysis, - RobotType, - RunTimeCommand, -} from '@opentrons/shared-data' +import type { RobotType, RunTimeCommand } from '@opentrons/shared-data' import type { StyleProps } from '@opentrons/components' +import type { CommandTextData } from './types' const SIMPLE_TRANSLATION_KEY_BY_COMMAND_TYPE: { [commandType in RunTimeCommand['commandType']]?: string @@ -52,14 +49,14 @@ const SIMPLE_TRANSLATION_KEY_BY_COMMAND_TYPE: { interface Props extends StyleProps { command: RunTimeCommand - robotSideAnalysis: CompletedProtocolAnalysis + commandTextData: CommandTextData robotType: RobotType isOnDevice?: boolean } export function CommandText(props: Props): JSX.Element | null { const { command, - robotSideAnalysis, + commandTextData, robotType, isOnDevice = false, ...styleProps @@ -78,9 +75,7 @@ export function CommandText(props: Props): JSX.Element | null { case 'pickUpTip': { return ( - + ) } @@ -90,7 +85,7 @@ export function CommandText(props: Props): JSX.Element | null { case 'loadLiquid': { return ( - + ) } @@ -173,9 +168,9 @@ export function CommandText(props: Props): JSX.Element | null { } case 'moveToWell': { const { wellName, labwareId } = command.params - const allPreviousCommands = robotSideAnalysis.commands.slice( + const allPreviousCommands = commandTextData.commands.slice( 0, - robotSideAnalysis.commands.findIndex(c => c.id === command.id) + commandTextData.commands.findIndex(c => c.id === command.id) ) const labwareLocation = getFinalLabwareLocation( labwareId, @@ -184,7 +179,7 @@ export function CommandText(props: Props): JSX.Element | null { const displayLocation = labwareLocation != null ? getLabwareDisplayLocation( - robotSideAnalysis, + commandTextData, labwareLocation, t, robotType @@ -194,7 +189,7 @@ export function CommandText(props: Props): JSX.Element | null { {t('move_to_well', { well_name: wellName, - labware: getLabwareName(robotSideAnalysis, labwareId), + labware: getLabwareName(commandTextData, labwareId), labware_location: displayLocation, })} @@ -204,14 +199,14 @@ export function CommandText(props: Props): JSX.Element | null { return ( ) } case 'configureForVolume': { const { volume, pipetteId } = command.params - const pipetteName = robotSideAnalysis.pipettes.find( + const pipetteName = commandTextData.pipettes.find( pip => pip.id === pipetteId )?.pipetteName @@ -229,7 +224,7 @@ export function CommandText(props: Props): JSX.Element | null { } case 'configureNozzleLayout': { const { configurationParams, pipetteId } = command.params - const pipetteName = robotSideAnalysis.pipettes.find( + const pipetteName = commandTextData.pipettes.find( pip => pip.id === pipetteId )?.pipetteName @@ -248,7 +243,7 @@ export function CommandText(props: Props): JSX.Element | null { } case 'prepareToAspirate': { const { pipetteId } = command.params - const pipetteName = robotSideAnalysis.pipettes.find( + const pipetteName = commandTextData.pipettes.find( pip => pip.id === pipetteId )?.pipetteName @@ -265,7 +260,7 @@ export function CommandText(props: Props): JSX.Element | null { } case 'moveToAddressableArea': { const addressableAreaDisplayName = getAddressableAreaDisplayName( - robotSideAnalysis, + commandTextData, command.id, t ) @@ -280,7 +275,7 @@ export function CommandText(props: Props): JSX.Element | null { } case 'moveToAddressableAreaForDropTip': { const addressableAreaDisplayName = getAddressableAreaDisplayName( - robotSideAnalysis, + commandTextData, command.id, t ) diff --git a/app/src/organisms/CommandText/types.ts b/app/src/organisms/CommandText/types.ts new file mode 100644 index 00000000000..e89d088a9d3 --- /dev/null +++ b/app/src/organisms/CommandText/types.ts @@ -0,0 +1,6 @@ +import type { CompletedProtocolAnalysis } from '@opentrons/shared-data' + +export type CommandTextData = Pick< + CompletedProtocolAnalysis, + 'pipettes' | 'labware' | 'modules' | 'liquids' | 'commands' +> diff --git a/app/src/organisms/CommandText/utils/accessors.ts b/app/src/organisms/CommandText/utils/accessors.ts index 444f102d828..2ca6fda7efb 100644 --- a/app/src/organisms/CommandText/utils/accessors.ts +++ b/app/src/organisms/CommandText/utils/accessors.ts @@ -5,31 +5,32 @@ import type { LoadedModule, LoadedPipette, } from '@opentrons/shared-data' +import type { CommandTextData } from '../types' export function getLoadedLabware( - protocolData: CompletedProtocolAnalysis | RunData, + commandTextData: CompletedProtocolAnalysis | RunData | CommandTextData, labwareId: string ): LoadedLabware | undefined { // NOTE: old analysis contains a object dictionary of labware entities by id, this case is supported for backwards compatibility purposes - return Array.isArray(protocolData.labware) - ? protocolData.labware.find(l => l.id === labwareId) - : protocolData.labware[labwareId] + return Array.isArray(commandTextData.labware) + ? commandTextData.labware.find(l => l.id === labwareId) + : commandTextData.labware[labwareId] } export function getLoadedPipette( - analysis: CompletedProtocolAnalysis, + commandTextData: CommandTextData, mount: string ): LoadedPipette | undefined { // NOTE: old analysis contains a object dictionary of pipette entities by id, this case is supported for backwards compatibility purposes - return Array.isArray(analysis.pipettes) - ? analysis.pipettes.find(l => l.mount === mount) - : analysis.pipettes[mount] + return Array.isArray(commandTextData.pipettes) + ? commandTextData.pipettes.find(l => l.mount === mount) + : commandTextData.pipettes[mount] } export function getLoadedModule( - protocolData: CompletedProtocolAnalysis | RunData, + commandTextData: CompletedProtocolAnalysis | RunData | CommandTextData, moduleId: string ): LoadedModule | undefined { // NOTE: old analysis contains a object dictionary of module entities by id, this case is supported for backwards compatibility purposes - return Array.isArray(protocolData.modules) - ? protocolData.modules.find(l => l.id === moduleId) - : protocolData.modules[moduleId] + return Array.isArray(commandTextData.modules) + ? commandTextData.modules.find(l => l.id === moduleId) + : commandTextData.modules[moduleId] } diff --git a/app/src/organisms/CommandText/utils/getAddressableAreaDisplayName.ts b/app/src/organisms/CommandText/utils/getAddressableAreaDisplayName.ts index cba0f3ca2cd..6bfdd2fc850 100644 --- a/app/src/organisms/CommandText/utils/getAddressableAreaDisplayName.ts +++ b/app/src/organisms/CommandText/utils/getAddressableAreaDisplayName.ts @@ -1,16 +1,16 @@ import type { AddressableAreaName, - CompletedProtocolAnalysis, MoveToAddressableAreaParams, } from '@opentrons/shared-data' import type { TFunction } from 'i18next' +import type { CommandTextData } from '../types' export function getAddressableAreaDisplayName( - analysis: CompletedProtocolAnalysis, + commandTextData: CommandTextData, commandId: string, t: TFunction ): string { - const addressableAreaCommand = (analysis?.commands ?? []).find( + const addressableAreaCommand = (commandTextData?.commands ?? []).find( command => command.id === commandId ) diff --git a/app/src/organisms/CommandText/utils/getCommandTextData.ts b/app/src/organisms/CommandText/utils/getCommandTextData.ts new file mode 100644 index 00000000000..bf1a5a07f2e --- /dev/null +++ b/app/src/organisms/CommandText/utils/getCommandTextData.ts @@ -0,0 +1,16 @@ +import type { LegacyGoodRunData } from '@opentrons/api-client' +import type { + CompletedProtocolAnalysis, + RunTimeCommand, +} from '@opentrons/shared-data' +import type { CommandTextData } from '../types' + +export function getCommandTextData( + protocolData: CompletedProtocolAnalysis | LegacyGoodRunData, + protocolCommands?: RunTimeCommand[] +): CommandTextData { + const { pipettes, labware, modules, liquids } = protocolData + const commands = + 'commands' in protocolData ? protocolData.commands : protocolCommands ?? [] + return { commands, pipettes, labware, modules, liquids } +} diff --git a/app/src/organisms/CommandText/utils/getLabwareDisplayLocation.ts b/app/src/organisms/CommandText/utils/getLabwareDisplayLocation.ts index 67128059463..1af68d1a8d4 100644 --- a/app/src/organisms/CommandText/utils/getLabwareDisplayLocation.ts +++ b/app/src/organisms/CommandText/utils/getLabwareDisplayLocation.ts @@ -9,14 +9,12 @@ import { import { getModuleDisplayLocation } from './getModuleDisplayLocation' import { getModuleModel } from './getModuleModel' import { getLabwareDefinitionsFromCommands } from '../../LabwarePositionCheck/utils/labware' -import type { - CompletedProtocolAnalysis, - RobotType, -} from '@opentrons/shared-data/' +import type { RobotType } from '@opentrons/shared-data' import type { TFunction } from 'i18next' +import type { CommandTextData } from '../types' export function getLabwareDisplayLocation( - robotSideAnalysis: CompletedProtocolAnalysis, + commandTextData: CommandTextData, location: LabwareLocation, t: TFunction, robotType: RobotType, @@ -33,13 +31,13 @@ export function getLabwareDisplayLocation( ? location.addressableAreaName : t('slot', { slot_name: location.addressableAreaName }) } else if ('moduleId' in location) { - const moduleModel = getModuleModel(robotSideAnalysis, location.moduleId) + const moduleModel = getModuleModel(commandTextData, location.moduleId) if (moduleModel == null) { console.warn('labware is located on an unknown module model') return '' } else { const slotName = getModuleDisplayLocation( - robotSideAnalysis, + commandTextData, location.moduleId ) return isOnDevice @@ -54,12 +52,10 @@ export function getLabwareDisplayLocation( }) } } else if ('labwareId' in location) { - const adapter = robotSideAnalysis.labware.find( + const adapter = commandTextData.labware.find( lw => lw.id === location.labwareId ) - const allDefs = getLabwareDefinitionsFromCommands( - robotSideAnalysis.commands - ) + const allDefs = getLabwareDefinitionsFromCommands(commandTextData.commands) const adapterDef = allDefs.find( def => getLabwareDefURI(def) === adapter?.definitionUri ) @@ -83,7 +79,7 @@ export function getLabwareDisplayLocation( }) } else if ('moduleId' in adapter.location) { const moduleIdUnderAdapter = adapter.location.moduleId - const moduleModel = robotSideAnalysis.modules.find( + const moduleModel = commandTextData.modules.find( module => module.id === moduleIdUnderAdapter )?.model if (moduleModel == null) { @@ -91,7 +87,7 @@ export function getLabwareDisplayLocation( return '' } const slotName = getModuleDisplayLocation( - robotSideAnalysis, + commandTextData, adapter.location.moduleId ) return t('adapter_in_mod_in_slot', { diff --git a/app/src/organisms/CommandText/utils/getLabwareName.ts b/app/src/organisms/CommandText/utils/getLabwareName.ts index 61d7020e054..e81505e470e 100644 --- a/app/src/organisms/CommandText/utils/getLabwareName.ts +++ b/app/src/organisms/CommandText/utils/getLabwareName.ts @@ -1,11 +1,8 @@ import { getLoadedLabware } from './accessors' -import { - CompletedProtocolAnalysis, - getLabwareDefURI, - getLabwareDisplayName, -} from '@opentrons/shared-data' +import { getLabwareDefURI, getLabwareDisplayName } from '@opentrons/shared-data' import { getLabwareDefinitionsFromCommands } from '../../LabwarePositionCheck/utils/labware' +import type { CommandTextData } from '../types' const FIXED_TRASH_DEF_URIS = [ 'opentrons/opentrons_1_trash_850ml_fixed/1', @@ -13,10 +10,10 @@ const FIXED_TRASH_DEF_URIS = [ 'opentrons/opentrons_1_trash_3200ml_fixed/1', ] export function getLabwareName( - analysis: CompletedProtocolAnalysis, + commandTextData: CommandTextData, labwareId: string ): string { - const loadedLabware = getLoadedLabware(analysis, labwareId) + const loadedLabware = getLoadedLabware(commandTextData, labwareId) if (loadedLabware == null) { return '' } else if (FIXED_TRASH_DEF_URIS.includes(loadedLabware.definitionUri)) { @@ -25,7 +22,7 @@ export function getLabwareName( return loadedLabware.displayName } else { const labwareDef = getLabwareDefinitionsFromCommands( - analysis.commands + commandTextData.commands ).find(def => getLabwareDefURI(def) === loadedLabware.definitionUri) return labwareDef != null ? getLabwareDisplayName(labwareDef) : '' } diff --git a/app/src/organisms/CommandText/utils/getLiquidDisplayName.ts b/app/src/organisms/CommandText/utils/getLiquidDisplayName.ts index a471f066419..1b4b15a854b 100644 --- a/app/src/organisms/CommandText/utils/getLiquidDisplayName.ts +++ b/app/src/organisms/CommandText/utils/getLiquidDisplayName.ts @@ -1,10 +1,10 @@ -import type { CompletedProtocolAnalysis } from '@opentrons/shared-data' +import type { CommandTextData } from '../types' export function getLiquidDisplayName( - analysis: CompletedProtocolAnalysis, + commandTextData: CommandTextData, liquidId: string -): CompletedProtocolAnalysis['liquids'][number]['displayName'] { - const liquidDisplayName = (analysis?.liquids ?? []).find( +): CommandTextData['liquids'][number]['displayName'] { + const liquidDisplayName = (commandTextData?.liquids ?? []).find( liquid => liquid.id === liquidId )?.displayName return liquidDisplayName ?? '' diff --git a/app/src/organisms/CommandText/utils/getModuleDisplayLocation.ts b/app/src/organisms/CommandText/utils/getModuleDisplayLocation.ts index 2b18e46dad1..c71c74c4c86 100644 --- a/app/src/organisms/CommandText/utils/getModuleDisplayLocation.ts +++ b/app/src/organisms/CommandText/utils/getModuleDisplayLocation.ts @@ -1,11 +1,11 @@ import { getLoadedModule } from './accessors' -import type { CompletedProtocolAnalysis } from '@opentrons/shared-data' +import type { CommandTextData } from '../types' export function getModuleDisplayLocation( - analysis: CompletedProtocolAnalysis, + commandTextData: CommandTextData, moduleId: string ): string { - const loadedModule = getLoadedModule(analysis, moduleId) + const loadedModule = getLoadedModule(commandTextData, moduleId) return loadedModule != null ? loadedModule.location.slotName : '' } diff --git a/app/src/organisms/CommandText/utils/getModuleModel.ts b/app/src/organisms/CommandText/utils/getModuleModel.ts index 37031b964ce..3e95e05ebeb 100644 --- a/app/src/organisms/CommandText/utils/getModuleModel.ts +++ b/app/src/organisms/CommandText/utils/getModuleModel.ts @@ -1,14 +1,12 @@ import { getLoadedModule } from './accessors' -import type { - ModuleModel, - CompletedProtocolAnalysis, -} from '@opentrons/shared-data' +import type { ModuleModel } from '@opentrons/shared-data' +import type { CommandTextData } from '../types' export function getModuleModel( - analysis: CompletedProtocolAnalysis, + commandTextData: CommandTextData, moduleId: string ): ModuleModel | null { - const loadedModule = getLoadedModule(analysis, moduleId) + const loadedModule = getLoadedModule(commandTextData, moduleId) return loadedModule != null ? loadedModule.model : null } diff --git a/app/src/organisms/CommandText/utils/getPipetteNameOnMount.ts b/app/src/organisms/CommandText/utils/getPipetteNameOnMount.ts index 07751dd855b..f1c09d73caf 100644 --- a/app/src/organisms/CommandText/utils/getPipetteNameOnMount.ts +++ b/app/src/organisms/CommandText/utils/getPipetteNameOnMount.ts @@ -1,14 +1,12 @@ import { getLoadedPipette } from './accessors' -import type { - CompletedProtocolAnalysis, - PipetteName, -} from '@opentrons/shared-data' +import type { PipetteName } from '@opentrons/shared-data' +import type { CommandTextData } from '../types' export function getPipetteNameOnMount( - analysis: CompletedProtocolAnalysis, + commandTextData: CommandTextData, mount: string ): PipetteName | null { - const loadedPipette = getLoadedPipette(analysis, mount) + const loadedPipette = getLoadedPipette(commandTextData, mount) return loadedPipette != null ? loadedPipette.pipetteName : null } diff --git a/app/src/organisms/InterventionModal/__fixtures__/index.ts b/app/src/organisms/InterventionModal/__fixtures__/index.ts index 2611fe19b03..de2ae730f89 100644 --- a/app/src/organisms/InterventionModal/__fixtures__/index.ts +++ b/app/src/organisms/InterventionModal/__fixtures__/index.ts @@ -8,6 +8,7 @@ import { import type { RunData } from '@opentrons/api-client' import type { LabwareDefinitionsByUri, + Liquid, LoadedLabware, LoadedModule, } from '@opentrons/shared-data' @@ -176,6 +177,12 @@ export const mockThermocyclerModule: LoadedModule = { serialNumber: 'dummySerialTC', } +export const mockLiquid: Liquid = { + id: 'mockLiquid', + displayName: 'mock liquid', + description: 'this is my mock liquid', +} + export const mockRunData: RunData = { id: 'mockRunData', createdAt: '', @@ -188,6 +195,7 @@ export const mockRunData: RunData = { pipettes: [], labware: [mockLabwareOnModule, mockLabwareOnSlot, mockLabwareOffDeck], modules: [mockModule], + liquids: [mockLiquid], runTimeParameters: [], } diff --git a/app/src/organisms/OnDeviceDisplay/RunningProtocol/CurrentRunningProtocolCommand.tsx b/app/src/organisms/OnDeviceDisplay/RunningProtocol/CurrentRunningProtocolCommand.tsx index eeef83d83ab..095d3f1b99d 100644 --- a/app/src/organisms/OnDeviceDisplay/RunningProtocol/CurrentRunningProtocolCommand.tsx +++ b/app/src/organisms/OnDeviceDisplay/RunningProtocol/CurrentRunningProtocolCommand.tsx @@ -21,6 +21,7 @@ import { RUN_STATUS_RUNNING, RUN_STATUS_IDLE } from '@opentrons/api-client' import { CommandText } from '../../CommandText' import { RunTimer } from '../../Devices/ProtocolRun/RunTimer' +import { getCommandTextData } from '../../CommandText/utils/getCommandTextData' import { PlayPauseButton } from './PlayPauseButton' import { StopButton } from './StopButton' import { ANALYTICS_PROTOCOL_RUN_ACTION } from '../../../redux/analytics' @@ -233,7 +234,7 @@ export function CurrentRunningProtocolCommand({ {robotSideAnalysis != null && currentCommand != null ? ( diff --git a/app/src/organisms/OnDeviceDisplay/RunningProtocol/RunningProtocolCommandList.tsx b/app/src/organisms/OnDeviceDisplay/RunningProtocol/RunningProtocolCommandList.tsx index c59fedd338f..442cf903914 100644 --- a/app/src/organisms/OnDeviceDisplay/RunningProtocol/RunningProtocolCommandList.tsx +++ b/app/src/organisms/OnDeviceDisplay/RunningProtocol/RunningProtocolCommandList.tsx @@ -23,6 +23,7 @@ import { RUN_STATUS_RUNNING, RUN_STATUS_IDLE } from '@opentrons/api-client' import { CommandText } from '../../CommandText' import { CommandIcon } from '../../RunPreview/CommandIcon' +import { getCommandTextData } from '../../CommandText/utils/getCommandTextData' import { PlayPauseButton } from './PlayPauseButton' import { StopButton } from './StopButton' import { ANALYTICS_PROTOCOL_RUN_ACTION } from '../../../redux/analytics' @@ -234,7 +235,7 @@ export function RunningProtocolCommandList({ c.key === currentRunCommandKey ) @@ -173,7 +165,7 @@ export const RunPreviewComponent = ( diff --git a/app/src/organisms/RunProgressMeter/index.tsx b/app/src/organisms/RunProgressMeter/index.tsx index 4c7c92f5bd8..f747de4f9b6 100644 --- a/app/src/organisms/RunProgressMeter/index.tsx +++ b/app/src/organisms/RunProgressMeter/index.tsx @@ -43,6 +43,7 @@ import { useDownloadRunLog, useRobotType } from '../Devices/hooks' import { InterventionTicks } from './InterventionTicks' import { isInterventionCommand } from '../InterventionModal/utils' import { useNotifyRunQuery } from '../../resources/runs' +import { getCommandTextData } from '../CommandText/utils/getCommandTextData' import type { RunStatus } from '@opentrons/api-client' @@ -138,7 +139,7 @@ export function RunProgressMeter(props: RunProgressMeterProps): JSX.Element { ) { currentStepContents = ( @@ -150,7 +151,7 @@ export function RunProgressMeter(props: RunProgressMeterProps): JSX.Element { ) { currentStepContents = ( diff --git a/app/src/organisms/RunTimeControl/__fixtures__/index.ts b/app/src/organisms/RunTimeControl/__fixtures__/index.ts index 33f2e0c4393..bb4b45a61f3 100644 --- a/app/src/organisms/RunTimeControl/__fixtures__/index.ts +++ b/app/src/organisms/RunTimeControl/__fixtures__/index.ts @@ -41,6 +41,7 @@ export const mockPausedRun: RunData = { pipettes: [], labware: [], modules: [], + liquids: [], runTimeParameters: [], } @@ -66,6 +67,7 @@ export const mockPauseRequestedRun: RunData = { pipettes: [], labware: [], modules: [], + liquids: [], runTimeParameters: [], } @@ -96,6 +98,7 @@ export const mockRunningRun: RunData = { pipettes: [], labware: [], modules: [], + liquids: [], runTimeParameters: [], } @@ -136,6 +139,7 @@ export const mockFailedRun: RunData = { pipettes: [], labware: [], modules: [], + liquids: [], runTimeParameters: [], } @@ -171,6 +175,7 @@ export const mockStopRequestedRun: RunData = { pipettes: [], labware: [], modules: [], + liquids: [], runTimeParameters: [], } @@ -206,6 +211,7 @@ export const mockStoppedRun: RunData = { pipettes: [], labware: [], modules: [], + liquids: [], runTimeParameters: [], } @@ -236,6 +242,7 @@ export const mockSucceededRun: RunData = { pipettes: [], labware: [], modules: [], + liquids: [], runTimeParameters: [], } @@ -250,6 +257,7 @@ export const mockIdleUnstartedRun: RunData = { pipettes: [], labware: [], modules: [], + liquids: [], runTimeParameters: [], } @@ -280,6 +288,7 @@ export const mockIdleStartedRun: RunData = { pipettes: [], labware: [], modules: [], + liquids: [], runTimeParameters: [], } diff --git a/react-api-client/src/runs/__fixtures__/runs.ts b/react-api-client/src/runs/__fixtures__/runs.ts index 9320df9fbea..47a432f5a5f 100644 --- a/react-api-client/src/runs/__fixtures__/runs.ts +++ b/react-api-client/src/runs/__fixtures__/runs.ts @@ -32,6 +32,7 @@ export const mockPausedRun: RunData = { pipettes: [], labware: [], modules: [], + liquids: [], runTimeParameters: [], } @@ -62,6 +63,7 @@ export const mockRunningRun: RunData = { pipettes: [], labware: [], modules: [], + liquids: [], runTimeParameters: [], }