Skip to content

Commit f334ed0

Browse files
authored
refactor(app, shared-data, api-client, react-api-client): cleanup LPC flows (#17879)
Closes EXEC-1359
1 parent d24ab3b commit f334ed0

File tree

33 files changed

+173
-425
lines changed

33 files changed

+173
-425
lines changed

api-client/src/protocols/createProtocolAnalysis.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,30 @@ import type {
88
RunTimeParameterValuesCreateData,
99
} from '../runs'
1010

11-
interface CreateProtocolAnalysisData {
11+
export interface CreateProtocolAnalysisData {
1212
runTimeParameterValues: RunTimeParameterValuesCreateData
1313
runTimeParameterFiles: RunTimeParameterFilesCreateData
1414
forceReAnalyze: boolean
1515
}
1616

17+
export interface ProtocolAnalysisSummaryResult {
18+
data: ProtocolAnalysisSummary[]
19+
}
20+
1721
export function createProtocolAnalysis(
1822
config: HostConfig,
1923
protocolKey: string,
2024
runTimeParameterValues?: RunTimeParameterValuesCreateData,
2125
runTimeParameterFiles?: RunTimeParameterFilesCreateData,
2226
forceReAnalyze?: boolean
23-
): ResponsePromise<ProtocolAnalysisSummary[]> {
27+
): ResponsePromise<ProtocolAnalysisSummaryResult> {
2428
const data = {
2529
runTimeParameterValues: runTimeParameterValues ?? {},
2630
runTimeParameterFiles: runTimeParameterFiles ?? {},
2731
forceReAnalyze: forceReAnalyze ?? false,
2832
}
2933
const response = request<
30-
ProtocolAnalysisSummary[],
34+
ProtocolAnalysisSummaryResult,
3135
{ data: CreateProtocolAnalysisData }
3236
>(POST, `/protocols/${protocolKey}/analyses`, { data }, config)
3337
return response

api-client/src/protocols/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export { createProtocol } from './createProtocol'
2-
export { createProtocolAnalysis } from './createProtocolAnalysis'
2+
export * from './createProtocolAnalysis'
33
export { deleteProtocol } from './deleteProtocol'
44
export { getCsvFiles } from './getCsvFiles'
55
export { getProtocol } from './getProtocol'

app/src/molecules/OffsetVector/__tests__/OffsetVector.test.tsx renamed to app/src/molecules/LegacyOffsetVector/__tests__/LegacyOffsetVector.test.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ import { describe, it, expect, beforeEach } from 'vitest'
44
import { SPACING, TYPOGRAPHY } from '@opentrons/components'
55
import { renderWithProviders } from '/app/__testing-utils__'
66

7-
import { OffsetVector } from '../'
7+
import { LegacyOffsetVector } from '../'
88

99
import type { ComponentProps } from 'react'
1010

11-
const render = (props: ComponentProps<typeof OffsetVector>) => {
12-
return renderWithProviders(<OffsetVector {...props} />)[0]
11+
const render = (props: ComponentProps<typeof LegacyOffsetVector>) => {
12+
return renderWithProviders(<LegacyOffsetVector {...props} />)[0]
1313
}
1414

1515
describe('OffsetVector', () => {
16-
let props: ComponentProps<typeof OffsetVector>
16+
let props: ComponentProps<typeof LegacyOffsetVector>
1717

1818
beforeEach(() => {
1919
props = {

app/src/molecules/OffsetVector/index.tsx renamed to app/src/molecules/LegacyOffsetVector/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,16 @@ import {
88
import type { ComponentProps } from 'react'
99
import type { StyleProps } from '@opentrons/components'
1010

11-
interface OffsetVectorProps extends StyleProps {
11+
interface LegacyOffsetVectorProps extends StyleProps {
1212
x: number
1313
y: number
1414
z: number
1515
as?: ComponentProps<typeof LegacyStyledText>['as']
1616
}
1717

18-
export function OffsetVector(props: OffsetVectorProps): JSX.Element {
18+
export function LegacyOffsetVector(
19+
props: LegacyOffsetVectorProps
20+
): JSX.Element {
1921
const { x, y, z, as = 'h6', ...styleProps } = props
2022
return (
2123
<Flex {...styleProps}>

app/src/organisms/Desktop/Devices/HistoricalProtocolRunDrawer.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import { useCsvFileQuery } from '@opentrons/react-api-client'
3131
import { DownloadCsvFileLink } from './DownloadCsvFileLink'
3232
import { useMostRecentCompletedAnalysis } from '/app/resources/runs'
3333
import { useDeckCalibrationData } from './hooks'
34-
import { OffsetVector } from '/app/molecules/OffsetVector'
34+
import { LegacyOffsetVector } from '/app/molecules/LegacyOffsetVector'
3535
import type { LabwareOffset, RunData } from '@opentrons/api-client'
3636

3737
interface HistoricalProtocolRunDrawerProps {
@@ -261,7 +261,7 @@ export function HistoricalProtocolRunDrawer(
261261
</LegacyStyledText>
262262
</Box>
263263
<Box width="34%">
264-
<OffsetVector
264+
<LegacyOffsetVector
265265
{...offset.vector}
266266
fontSize={TYPOGRAPHY.fontSizeLabel}
267267
as="p"

app/src/organisms/Desktop/Devices/ProtocolRun/LabwareInfoOverlay.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
LegacyStyledText,
1818
TYPOGRAPHY,
1919
} from '@opentrons/components'
20-
import { OffsetVector } from '/app/molecules/OffsetVector'
20+
import { LegacyOffsetVector } from '/app/molecules/LegacyOffsetVector'
2121

2222
import type { LabwareDefinition2 } from '@opentrons/shared-data'
2323
import { useLabwareOffsetForLabware } from './useLabwareOffsetForLabware'
@@ -79,7 +79,7 @@ const LabwareInfo = (props: LabwareInfoProps): JSX.Element | null => {
7979
>
8080
{t('offset_data')}
8181
</LegacyStyledText>
82-
<OffsetVector {...vector} />
82+
<LegacyOffsetVector {...vector} />
8383
</>
8484
)}
8585
</Box>

app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabware/__tests__/SetupLabware.test.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { useHoverTooltip } from '@opentrons/components'
77

88
import { renderWithProviders } from '/app/__testing-utils__'
99
import { i18n } from '/app/i18n'
10-
import { LegacyLabwarePositionCheck } from '/app/organisms/LegacyLabwarePositionCheck'
1110
import { getModuleTypesThatRequireExtraAttention } from '../../utils/getModuleTypesThatRequireExtraAttention'
1211
import { getIsLabwareOffsetCodeSnippetsOn } from '/app/redux/config'
1312
import { SetupLabwareList } from '../SetupLabwareList'
@@ -66,9 +65,6 @@ describe('SetupLabware', () => {
6665
.calledWith(expect.anything())
6766
.thenReturn([])
6867

69-
vi.mocked(LegacyLabwarePositionCheck).mockReturnValue(
70-
<div>mock Labware Position Check</div>
71-
)
7268
when(vi.mocked(useUnmatchedModulesForProtocol))
7369
.calledWith(ROBOT_NAME, RUN_ID)
7470
.thenReturn({

app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabwarePositionCheck/CurrentOffsetsTable.tsx renamed to app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabwarePositionCheck/OT2SetupLPC/LegacyCurrentOffsetsTable.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ import {
2121
} from '@opentrons/components'
2222

2323
import { getIsLabwareOffsetCodeSnippetsOn } from '/app/redux/config'
24-
import { LabwareOffsetTabs } from '/app/organisms/LabwareOffsetTabs'
25-
import { OffsetVector } from '/app/molecules/OffsetVector'
24+
import { LegacyLabwareOffsetTabs } from '/app/organisms/LegacyLabwareOffsetTabs'
25+
import { LegacyOffsetVector } from '/app/molecules/LegacyOffsetVector'
2626
import { LabwareOffsetSnippet } from '/app/molecules/LabwareOffsetSnippet'
2727
import { getDisplayLocation } from '/app/organisms/LegacyLabwarePositionCheck/utils/getDisplayLocation'
2828
import type { LabwareOffset } from '@opentrons/api-client'
@@ -57,14 +57,14 @@ const OffsetTableDatum = styled('td')`
5757
text-overflow: wrap;
5858
`
5959

60-
interface CurrentOffsetsTableProps {
60+
interface LegacyCurrentOffsetsTableProps {
6161
currentOffsets: LabwareOffset[]
6262
commands: RunTimeCommand[]
6363
labware: LoadedLabware[]
6464
modules: LoadedModule[]
6565
}
66-
export function CurrentOffsetsTable(
67-
props: CurrentOffsetsTableProps
66+
export function LegacyCurrentOffsetsTable(
67+
props: LegacyCurrentOffsetsTableProps
6868
): JSX.Element {
6969
const { currentOffsets, commands, labware, modules } = props
7070
const { t, i18n } = useTranslation(['labware_position_check', 'shared'])
@@ -112,7 +112,7 @@ export function CurrentOffsetsTable(
112112
${BORDERS.borderRadius8} 0;
113113
`}
114114
>
115-
<OffsetVector {...offset.vector} />
115+
<LegacyOffsetVector {...offset.vector} />
116116
</OffsetTableDatum>
117117
</OffsetTableRow>
118118
)
@@ -154,7 +154,7 @@ export function CurrentOffsetsTable(
154154
{i18n.format(t('applied_offset_data'), 'upperCase')}
155155
</LegacyStyledText>
156156
{isLabwareOffsetCodeSnippetsOn ? (
157-
<LabwareOffsetTabs
157+
<LegacyLabwareOffsetTabs
158158
TableComponent={TableComponent}
159159
JupyterComponent={JupyterSnippet}
160160
CommandLineComponent={CommandLineSnippet}

app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabwarePositionCheck/OT2SetupLPC.tsx renamed to app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabwarePositionCheck/OT2SetupLPC/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919
import { useProtocolQuery } from '@opentrons/react-api-client'
2020

2121
import { useStoredProtocolAnalysis } from '/app/resources/analysis'
22-
import { CurrentOffsetsTable } from './CurrentOffsetsTable'
22+
import { LegacyCurrentOffsetsTable } from './LegacyCurrentOffsetsTable'
2323
import { getLatestCurrentOffsets } from '/app/transformations/runs'
2424
import {
2525
useNotifyRunQuery,
@@ -29,7 +29,7 @@ import {
2929
import { useRobotType } from '/app/redux-resources/robots'
3030
import { useLPCFlows, LPCFlows } from '/app/organisms/LabwarePositionCheck'
3131

32-
import type { SetupLabwarePositionCheckProps } from '.'
32+
import type { SetupLabwarePositionCheckProps } from '..'
3333
import type { LabwareOffset } from '@opentrons/api-client'
3434

3535
export function OT2SetupLPC(
@@ -95,7 +95,7 @@ export function OT2SetupLPC(
9595
gridGap={SPACING.spacing16}
9696
>
9797
{nonIdentityOffsets.length > 0 ? (
98-
<CurrentOffsetsTable
98+
<LegacyCurrentOffsetsTable
9999
currentOffsets={nonIdentityOffsets}
100100
commands={protocolData?.commands ?? []}
101101
labware={protocolData?.labware ?? []}

app/src/organisms/LabwarePositionCheck/LPCContentContainer.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import {
2323
} from '@opentrons/components'
2424

2525
import { StepMeter } from '/app/atoms/StepMeter'
26-
// TODO(jh, 02-05-25): Move ChildNavigation to molecules.
2726
// eslint-disable-next-line opentrons/no-imports-across-applications
2827
import { ChildNavigation } from '/app/organisms/ODD/ChildNavigation'
2928
import {
@@ -181,7 +180,6 @@ function DesktopFooterContent({
181180
)
182181
}
183182

184-
// TODO(jh, 03-11-25): Update the link/styling after Product/Design provide input.
185183
function NeedHelpLink(): JSX.Element {
186184
const { t } = useTranslation('labware_position_check')
187185

0 commit comments

Comments
 (0)