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

feat(app): Wire up lpc redesign #17850

Merged
merged 38 commits into from
Mar 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
3e85337
refactor(app): don't make users LPC if they have all LS offsets already
mjhuff Mar 17, 2025
06324f6
feat(app): add a hook for determining the timestamp of a run that mad…
mjhuff Mar 17, 2025
03707c7
feat(app): add LPC data layer support for run setup views
mjhuff Mar 17, 2025
0b2dd17
refactor(api-client, react-api-client): addLabwareOffset supports non…
mjhuff Mar 18, 2025
7267cce
feat(app): scaffold applyoffsetstorun functionality
mjhuff Mar 18, 2025
5eb830e
refactor(components): add ODD support for InfoScreen
mjhuff Mar 18, 2025
7288573
turns out we should extend some selectors
mjhuff Mar 18, 2025
04ef356
feat(app): update LPC store with previous run offsets
mjhuff Mar 18, 2025
ce9d8ad
feat(app): add LabwareOffsetsTable for run setup view
mjhuff Mar 19, 2025
b808153
feat(app): add an OffsetDeckInfoLabel
mjhuff Mar 19, 2025
49c18f7
feat(app): add source offsets redux state
mjhuff Mar 19, 2025
fe72471
feat(app): wire up redesigned LPC on odd run setup
mjhuff Mar 19, 2025
d227ee5
Revert "refactor(components): add ODD support for InfoScreen"
mjhuff Mar 19, 2025
788da8e
refactor(components): fix offset related styling issues
mjhuff Mar 19, 2025
01321e0
feat(app): wire up LPC to desktop run setup
mjhuff Mar 19, 2025
16d227c
refactor(api-client, app): use offsets from robot offset db
mjhuff Mar 19, 2025
b83257d
refactor(app): remove lpc redesign ff
mjhuff Mar 19, 2025
a0efcac
lots of test fixing
mjhuff Mar 19, 2025
d002c6b
refactor(app): unify offset conflict modals, improve copy and code cl…
mjhuff Mar 19, 2025
2427475
refactor(app): QT actually doesn't need to inject offsets at all
mjhuff Mar 20, 2025
7d198f6
fix(app): fix offset type counting selectors
mjhuff Mar 20, 2025
d37bd91
fix(app): make sure the OT-2 can start a run...and gets confirmation …
mjhuff Mar 20, 2025
50adb3e
refactor(app): "apply" offsets automatically if there is no LPC-able …
mjhuff Mar 20, 2025
e7c9fbe
refactor(app): don't show ODD setup until LPC has initialized
mjhuff Mar 20, 2025
6fc3ed7
refactor(app): refine conflict timestamp hook and modal implementation
mjhuff Mar 20, 2025
bd73279
fix(app): fix the offset filter logic so we don't show multiple of th…
mjhuff Mar 20, 2025
c372509
refactor(app): prettify the historical run log offsets accordion
mjhuff Mar 20, 2025
caf67dd
refactor(app): clean up deck config dispatching
mjhuff Mar 21, 2025
0f5ed78
refactor(app): don't pop the offset conflict modal if the run is hist…
mjhuff Mar 21, 2025
238228e
comment cleanup
mjhuff Mar 21, 2025
6c12f03
test cleanup round 2
mjhuff Mar 21, 2025
126f53a
refactor(app): prevent loading the wrong run record offsets by centra…
mjhuff Mar 21, 2025
742044f
fix(app): fix slot location display issues
mjhuff Mar 21, 2025
b243c2c
fix(app): fix incorrect total offset missing copy
mjhuff Mar 21, 2025
04152e6
fix(app): updating conflict timestamp should also update the offset s…
mjhuff Mar 21, 2025
592637d
fix(app): default missing only matters if all LS offsets are missing …
mjhuff Mar 21, 2025
9d1ae88
cleanup round 3
mjhuff Mar 21, 2025
b52ba45
fix(app): ensure the odd floating lpc button doesn't clip the table a…
mjhuff Mar 21, 2025
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
24 changes: 19 additions & 5 deletions api-client/src/runs/addLabwareOffsetToRun.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,39 @@ import { POST, request } from '../request'

import type { ResponsePromise } from '../request'
import type { HostConfig } from '../types'
import type { LabwareOffset, LegacyLabwareOffsetCreateData } from './types'
import type {
LabwareOffset,
LegacyLabwareOffsetCreateData,
LabwareOffsetCreateData,
} from './types'

export function addLabwareOffsetToRun(
config: HostConfig,
runId: string,
data: LegacyLabwareOffsetCreateData
data: LegacyLabwareOffsetCreateData | LabwareOffsetCreateData
): ResponsePromise<LabwareOffset>
export function addLabwareOffsetToRun(
config: HostConfig,
runId: string,
data: LegacyLabwareOffsetCreateData[]
data: LegacyLabwareOffsetCreateData[] | LabwareOffsetCreateData[]
): ResponsePromise<LabwareOffset[]>
export function addLabwareOffsetToRun(
config: HostConfig,
runId: string,
data: LegacyLabwareOffsetCreateData | LegacyLabwareOffsetCreateData[]
data:
| LegacyLabwareOffsetCreateData
| LegacyLabwareOffsetCreateData[]
| LabwareOffsetCreateData
| LabwareOffsetCreateData[]
): ResponsePromise<LabwareOffset | LabwareOffset[]> {
return request<
LabwareOffset | LabwareOffset[],
{ data: LegacyLabwareOffsetCreateData | LegacyLabwareOffsetCreateData[] }
{
data:
| LegacyLabwareOffsetCreateData
| LegacyLabwareOffsetCreateData[]
| LabwareOffsetCreateData
| LabwareOffsetCreateData[]
}
>(POST, `/runs/${runId}/labware_offsets`, { data }, config)
}
3 changes: 2 additions & 1 deletion api-client/src/runs/createRun.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ import type {
LegacyLabwareOffsetCreateData,
RunTimeParameterValuesCreateData,
RunTimeParameterFilesCreateData,
LabwareOffsetCreateData,
} from './types'

export interface CreateRunData {
protocolId?: string
labwareOffsets?: LegacyLabwareOffsetCreateData[]
labwareOffsets?: LegacyLabwareOffsetCreateData[] | LabwareOffsetCreateData[]
runTimeParameterValues?: RunTimeParameterValuesCreateData
runTimeParameterFiles?: RunTimeParameterFilesCreateData
}
Expand Down
1 change: 1 addition & 0 deletions app/src/assets/localization/en/anonymous.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"gripper_successfully_detached": "Gripper successfully detached",
"help_us_improve_send_error_report": "Help us improve your experience by sending an error report to support",
"ip_description_second": "Work with your network administrator to assign a static IP address to the robot.",
"labware_offsets_conflict_description": "Your robot's stored labware offsets were updated after the last protocol run on <strong>{{timestamp}}</strong>. Which offsets do you want to use to run this protocol again?",
"language_preference_description": "The app matches your system language unless you select another language below. You can change the language later in the app settings.",
"learn_uninstalling": "Learn more about uninstalling the app",
"loosen_screws_and_detach": "Loosen screws and detach gripper",
Expand Down
1 change: 1 addition & 0 deletions app/src/assets/localization/en/branded.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"gripper_successfully_detached": "Flex Gripper successfully detached",
"help_us_improve_send_error_report": "Help us improve your experience by sending an error report to {{support_email}}",
"ip_description_second": "Opentrons recommends working with your network administrator to assign a static IP address to the robot.",
"labware_offsets_conflict_description": "Your Flex's stored labware offsets were updated after the last protocol run on <strong>{{timestamp}}</strong>. Which offsets do you want to use to run this protocol again?",
"language_preference_description": "The Opentrons App matches your system language unless you select another language below. You can change the language later in the app settings.",
"learn_uninstalling": "Learn more about uninstalling the Opentrons App",
"loosen_screws_and_detach": "Loosen screws and detach Flex Gripper",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"confirm_position_and_return_tip": "Confirm position, return tip to Slot {{next_slot}} and home",
"confirm_removal": "Confirm removal",
"continue": "Continue",
"custom": "Custom",
"default": "Default",
"default_labware_offset": "Default Labware Offset",
"detach_probe": "Remove calibration probe",
Expand Down Expand Up @@ -119,10 +120,12 @@
"no_offset_data": "No offset data",
"no_offset_data_available": "No labware offset data available",
"no_offset_data_on_robot": "This robot has no useable labware offset data for this run.",
"not_applicable": "N/A",
"num_missing_offsets": "{{num}} missing offsets",
"num_offsets": "{{num}} offsets",
"offset_values": "X {{x}}, Y {{y}}, Z {{z}}",
"offsets": "Offsets",
"offsets_already_applied": "Labware offsets already applied",
"one_missing_offset": "1 missing offset",
"one_offset": "1 offset",
"pick_up_tip_from_rack_in_location": "Pick up tip from tip rack in {{location}}",
Expand All @@ -149,7 +152,6 @@
"robot_has_offsets_from_previous_runs": "This robot has offsets for labware used in this protocol. If you apply these offsets, you can still adjust them with Labware Position Check.",
"robot_in_motion": "Stand back, robot is in motion.",
"run": "Run",
"run_labware_position_check": "run labware position check",
"save": "Save",
"secondary_pipette_tipracks_section": "Check tip racks with {{secondary_mount}} Pipette",
"see_how_offsets_work": "See how labware offsets work",
Expand Down
35 changes: 26 additions & 9 deletions app/src/assets/localization/en/protocol_setup.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
"adapter_slot_location": "Slot {{slotName}}, {{adapterName}}",
"adapter_slot_location_module": "Slot {{slotName}}, {{adapterName}} on {{moduleName}}",
"add_fixture": "Add {{fixtureName}} to {{locationName}}",
"add_missing_labware_offsets": "Add missing labware offsets",
"add_this_deck_hardware": "Add this hardware to your deck configuration. It will be referenced during protocol analysis.",
"add_to_slot": "Add to slot {{slotName}}",
"additional_labware": "{{count}} additional labware",
"additional_off_deck_labware": "Additional Off-Deck Labware",
"all_files_associated": "All files associated with the protocol run are available on the robot detail screen.",
"applied_labware_offset_data": "Applied labware offset data",
"applied_labware_offsets": "applied labware offsets",
"apply_offsets": "Apply offsets",
"are_you_sure_you_want_to_proceed": "Are you sure you want to proceed to run?",
"attach": "attach",
"attach_gripper": "attach gripper",
Expand Down Expand Up @@ -53,7 +55,6 @@
"confirm_heater_shaker_module_modal_title": "Confirm Heater-Shaker Module is attached",
"confirm_liquids": "Confirm liquids",
"confirm_locations_and_volumes": "Confirm locations and volumes",
"confirm_offsets": "Confirm offsets",
"confirm_placements": "Confirm placements",
"confirm_selection": "Confirm selection",
"confirm_values": "Confirm values",
Expand All @@ -62,6 +63,7 @@
"connect_modules_for_controls": "Connect modules to see controls",
"connection_info_not_available": "Connection info not available once run has started",
"connection_status": "Connection Status",
"count_offsets_applied": "{{count}} offsets applied",
"csv_file": "CSV File",
"csv_files_on_robot": "CSV files on robot",
"csv_files_on_usb": "CSV files on USB",
Expand All @@ -85,6 +87,7 @@
"extension_mount": "extension mount",
"extra_attention_warning_title": "Secure labware and modules before proceeding to run",
"extra_module_attached": "Extra module attached",
"failed_to_apply_offsets": "Failed to apply offsets",
"feedback_form_link": "Let us know!",
"fixture": "Fixture",
"fixture_name": "fixture",
Expand Down Expand Up @@ -112,20 +115,23 @@
"labware_latch_instructions": "Use latch control for easy placement of labware.",
"labware_location": "Labware Location",
"labware_name": "Labware name",
"labware_offsets": "Labware Offsets",
"labware_offsets_conflict": "Labware offsets conflict",
"labware_placement": "labware placement",
"labware_position_check": "Labware Position Check",
"labware_position_check_not_available": "Labware Position Check is not available after run has started",
"labware_position_check_not_available_analyzing_on_robot": "Labware Position Check is not available while protocol is analyzing on robot",
"labware_position_check_not_available_empty_protocol": "Labware Position Check requires that the protocol loads labware and pipettes",
"labware_position_check_step_description": "Recommended workflow that helps you verify the position of each labware on the deck.",
"labware_position_check_step_title": "Labware Position Check",
"labware_position_check_text": "Labware Position Check is a recommended workflow that helps you verify the position of each labware on the deck. During this check, you can create Labware Offsets that adjust how the robot moves to each labware in the X, Y and Z directions.",
"labware_position_check_step_description": "Verify the position of each labware on the deck and apply offsets for greater precision in your protocol.",
"labware_position_check_step_title": "Labware Offsets",
"labware_quantity": "Quantity: {{quantity}}",
"labware_setup_step_description": "Gather the following labware and full tip racks. To run your protocol without Labware Position Check, place and secure labware in their initial locations.",
"labware_setup_step_title": "Labware",
"labware_type": "Labware Type",
"last_calibrated": "Last calibrated: {{date}}",
"learn_how_it_works": "Learn how it works",
"learn_more": "Learn more",
"learn_more_about_labware_offsets": "Learn more about labware offsets",
"learn_more_about_offset_data": "Learn more about Labware Offset Data",
"learn_more_about_robot_cal_link": "Learn more about robot calibration",
"liquid_information": "Liquid information",
Expand Down Expand Up @@ -189,10 +195,12 @@
"no_data": "no data",
"no_deck_hardware_specified": "No deck hardware are specified for this protocol.",
"no_files_found": "No files found",
"no_labware_offset_data": "no labware offset data yet",
"no_labware_offset_data": "No labware offsets used in run",
"no_modules_or_fixtures": "No modules or fixtures are specified for this protocol.",
"no_modules_specified": "no modules are specified for this protocol.",
"no_modules_used_in_this_protocol": "No hardware used in this protocol",
"no_offsets_found": "Run Labware Position Check to set missing offsets",
"no_offsets_in_run": "No labware offsets are required for this protocol.",
"no_parameters_specified": "No parameters specified",
"no_parameters_specified_in_protocol": "No parameters specified in this protocol",
"no_tiprack_loaded": "Protocol must load a tip rack",
Expand All @@ -202,11 +210,18 @@
"no_usb_required": "No USB required",
"not_calibrated": "Not calibrated yet",
"not_configured": "not configured",
"num_missing_offsets": "{{num}} missing offsets",
"num_offsets_applied": "{{num}} offsets applied",
"off": "Off",
"off_deck": "Off deck",
"offset": "Offset",
"offset_data": "Offset Data",
"offsets_applied": "{{count}} offsets applied",
"offsets_confirmed": "Offsets confirmed",
"offset_type": "Offset Type",
"offsets_already_applied": "Offsets already applied",
"offsets_applied": "Offsets applied",
"offsets_missing": "Offsets missing",
"offsets_not_applied": "Offsets not applied",
"offsets_not_required": "Offsets not required",
"offsets_ready": "Offsets ready",
"on": "On",
"on-deck_labware": "{{count}} on-deck labware",
Expand Down Expand Up @@ -271,7 +286,7 @@
"run_disabled_calibration_not_complete": "Make sure robot calibration is complete before proceeding to run",
"run_disabled_modules_and_calibration_not_complete": "Make sure robot calibration is complete and all modules are connected before proceeding to run",
"run_disabled_modules_not_connected": "Make sure all modules are connected before proceeding to run",
"run_labware_position_check": "run labware position check",
"run_labware_position_check": "Run Labware Position Check",
"run_labware_position_check_to_get_offsets": "Run Labware Position Check to get your labware offset data.",
"run_never_started": "Run was never started",
"secure": "Secure",
Expand All @@ -293,14 +308,16 @@
"tip_length_cal_title": "Tip Length Calibration",
"tip_length_calibration": "tip length calibration",
"total_liquid_volume": "Total volume",
"total_offsets": "Total Offsets",
"update_deck": "Update deck",
"update_deck_config": "Update deck configuration",
"update_offsets": "Update offsets",
"updated": "Updated",
"usb_connected_no_port_info": "USB Port Connected",
"usb_drive_notification": "Leave USB drive attached until run starts",
"usb_port_connected": "USB Port {{port}}",
"usb_port_number": "USB-{{port}}",
"use_previous_run_offsets": "Use previous run's offsets",
"use_updated_offsets": "Use updated offsets",
"value": "Value",
"value_out_of_range": "Value must be between {{min}}-{{max}}",
"value_out_of_range_generic": "Value must be in range",
Expand Down
2 changes: 2 additions & 0 deletions app/src/local-resources/offsets/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export const LPC_HREF =
'https://support.opentrons.com/s/article/How-positional-calibration-works-on-the-OT-2'

Check warning on line 2 in app/src/local-resources/offsets/constants.ts

View check run for this annotation

Codecov / codecov/patch

app/src/local-resources/offsets/constants.ts#L1-L2

Added lines #L1 - L2 were not covered by tests
1 change: 1 addition & 0 deletions app/src/local-resources/offsets/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './constants'

Check warning on line 1 in app/src/local-resources/offsets/index.ts

View check run for this annotation

Codecov / codecov/patch

app/src/local-resources/offsets/index.ts#L1

Added line #L1 was not covered by tests
4 changes: 2 additions & 2 deletions app/src/molecules/DeckInfoLabelTextTag/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
DISPLAY_GRID,
Flex,
FLEX_MAX_CONTENT,
JUSTIFY_END,
JUSTIFY_FLEX_START,
JUSTIFY_START,
RESPONSIVENESS,
SPACING,
StyledText,
Expand Down Expand Up @@ -74,7 +74,7 @@
`

const TAG_CONTAINER_STYLE = css`
justify-self: ${JUSTIFY_END};
justify-self: ${JUSTIFY_START};

Check warning on line 77 in app/src/molecules/DeckInfoLabelTextTag/index.tsx

View check run for this annotation

Codecov / codecov/patch

app/src/molecules/DeckInfoLabelTextTag/index.tsx#L77

Added line #L77 was not covered by tests

@media (max-width: 450px) {
justify-self: ${JUSTIFY_FLEX_START};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { MemoryRouter } from 'react-router-dom'
import { fireEvent, screen, waitFor } from '@testing-library/react'

import {
FLEX_ROBOT_TYPE,
OT2_ROBOT_TYPE,
simpleAnalysisFileFixture,
} from '@opentrons/shared-data'
Expand All @@ -18,6 +19,7 @@ import { useTrackCreateProtocolRunEvent } from '/app/organisms/Desktop/Devices/h
import { useCreateRunFromProtocol } from '/app/organisms/Desktop/ChooseRobotToRunProtocolSlideout/useCreateRunFromProtocol'
import { ChooseProtocolSlideout } from '../'
import { useNotifyDataReady } from '/app/resources/useNotifyDataReady'
import { useRobotType } from '/app/redux-resources/robots'

import type { ComponentProps } from 'react'
import type { ProtocolAnalysisOutput } from '@opentrons/shared-data'
Expand All @@ -29,6 +31,7 @@ vi.mock('/app/redux/protocol-storage')
vi.mock('/app/organisms/Desktop/Devices/hooks')
vi.mock('/app/redux/config')
vi.mock('/app/resources/useNotifyDataReady')
vi.mock('/app/redux-resources/robots')

const render = (props: ComponentProps<typeof ChooseProtocolSlideout>) => {
return renderWithProviders(
Expand Down Expand Up @@ -72,6 +75,7 @@ describe('ChooseProtocolSlideout', () => {
trackCreateProtocolRunEvent: mockTrackCreateProtocolRunEvent,
})
vi.mocked(useNotifyDataReady).mockReturnValue({} as any)
vi.mocked(useRobotType).mockReturnValue(FLEX_ROBOT_TYPE)
})

it('renders slideout if showSlideout true', () => {
Expand Down
11 changes: 6 additions & 5 deletions app/src/organisms/Desktop/ChooseProtocolSlideout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
ApiHostProvider,
useUploadCsvFileMutation,
} from '@opentrons/react-api-client'
import { sortRuntimeParameters } from '@opentrons/shared-data'
import { FLEX_ROBOT_TYPE, sortRuntimeParameters } from '@opentrons/shared-data'

import { useLogger } from '/app/logger'
import { OPENTRONS_USB } from '/app/redux/discovery'
Expand All @@ -61,14 +61,14 @@
getRunTimeParameterValuesForRun,
} from '/app/transformations/runs'
import { getAnalysisStatus } from '/app/organisms/Desktop/ProtocolsLanding/utils'
import { useRobotType } from '/app/redux-resources/robots'

import type { MouseEventHandler } from 'react'
import type { DropdownOption } from '@opentrons/components'
import type { RunTimeParameter } from '@opentrons/shared-data'
import type { Robot } from '/app/redux/discovery/types'
import type { StoredProtocolData } from '/app/redux/protocol-storage'
import type { State } from '/app/redux/types'
import { useFeatureFlag } from '/app/redux/config'

export const CARD_OUTLINE_BORDER_STYLE = css`
border-style: ${BORDERS.styleSolid};
Expand Down Expand Up @@ -106,8 +106,8 @@

const { robot, showSlideout, onCloseClick } = props
const { name } = robot

const isNewLPC = useFeatureFlag('lpcRedesign')
const robotType = useRobotType(name)
const isFlex = robotType === FLEX_ROBOT_TYPE

Check warning on line 110 in app/src/organisms/Desktop/ChooseProtocolSlideout/index.tsx

View check run for this annotation

Codecov / codecov/patch

app/src/organisms/Desktop/ChooseProtocolSlideout/index.tsx#L109-L110

Added lines #L109 - L110 were not covered by tests

const [
selectedProtocol,
Expand Down Expand Up @@ -156,6 +156,7 @@
const offsetCandidates = useOffsetCandidatesForAnalysis(
(!missingAnalysisData ? selectedProtocol?.mostRecentAnalysis : null) ??
null,
isFlex,

Check warning on line 159 in app/src/organisms/Desktop/ChooseProtocolSlideout/index.tsx

View check run for this annotation

Codecov / codecov/patch

app/src/organisms/Desktop/ChooseProtocolSlideout/index.tsx#L159

Added line #L159 was not covered by tests
robot.ip
)

Expand Down Expand Up @@ -655,7 +656,7 @@
}
>
{currentPage === 1
? !isNewLPC && (
? !isFlex && (

Check warning on line 659 in app/src/organisms/Desktop/ChooseProtocolSlideout/index.tsx

View check run for this annotation

Codecov / codecov/patch

app/src/organisms/Desktop/ChooseProtocolSlideout/index.tsx#L659

Added line #L659 was not covered by tests
<LegacyApplyHistoricOffsets
offsetCandidates={offsetCandidates}
shouldApplyOffsets={shouldApplyOffsets}
Expand Down
Loading
Loading