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

refactor(app,components,shared-data): clean up deck config unused functions and types #14291

Merged
merged 19 commits into from
Jan 9, 2024
Merged
Changes from 18 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
562bad7
remove StyledDeck in favor of OT-2 DeckFromLayers
brenthagen Dec 18, 2023
d98cbcd
remove loadFixture command and references
brenthagen Dec 18, 2023
e9e750d
remove unused useLabwareRenderInfoForRunById
brenthagen Dec 18, 2023
42ba761
refactor(app,components,shared-data): clean up deck config unused fun…
brenthagen Dec 18, 2023
807cf39
adjust basedeck fixture filtering and config fixtures
brenthagen Dec 19, 2023
c98c1d1
Merge branch 'chore_release-7.1.0' into components_deck-config-cleanup
brenthagen Dec 19, 2023
851f2bc
Merge branch 'edge' into components_deck-config-cleanup
brenthagen Dec 19, 2023
33c8478
Merge branch 'edge' into components_deck-config-cleanup
brenthagen Jan 2, 2024
6456b63
delete useProtocolDetailsForRun references`
brenthagen Jan 2, 2024
83a3ef4
remove DeckFromLayers TODO
brenthagen Jan 2, 2024
1e2f918
add getSimplestDeckConfigForProtocol legacy trash test
brenthagen Jan 2, 2024
e7a5c12
type addressable area names as AddressableAreaName for commands
brenthagen Jan 2, 2024
26c8bbb
Merge branch 'edge' into components_deck-config-cleanup
brenthagen Jan 4, 2024
b8f5937
update some tests
brenthagen Jan 5, 2024
2f4eb4b
Merge branch 'edge' into components_deck-config-cleanup
brenthagen Jan 5, 2024
fc707ae
Merge branch 'edge' into components_deck-config-cleanup
brenthagen Jan 5, 2024
fd4b942
add more tests
brenthagen Jan 5, 2024
0394ce2
optional chain array access
brenthagen Jan 5, 2024
4f8c071
Merge branch 'edge' into components_deck-config-cleanup
brenthagen Jan 8, 2024
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
21 changes: 0 additions & 21 deletions api-client/src/protocols/utils.ts
Original file line number Diff line number Diff line change
@@ -8,7 +8,6 @@
LoadedLabware,
LoadedModule,
LoadedPipette,
LoadFixtureRunTimeCommand,
LoadLabwareRunTimeCommand,
LoadLiquidRunTimeCommand,
LoadModuleRunTimeCommand,
@@ -25,11 +24,11 @@
export function parseInitialPipetteNamesByMount(
commands: RunTimeCommand[]
): PipetteNamesByMount {
const rightPipetteName = commands.find(

Check warning on line 27 in api-client/src/protocols/utils.ts

GitHub Actions / js checks

This assertion is unnecessary since it does not change the type of the expression

Check warning on line 27 in api-client/src/protocols/utils.ts

GitHub Actions / js checks

This assertion is unnecessary since it does not change the type of the expression
(command): command is LoadPipetteRunTimeCommand =>
command.commandType === 'loadPipette' && command.params.mount === 'right'
)?.params.pipetteName as PipetteName | undefined
const leftPipetteName = commands.find(

Check warning on line 31 in api-client/src/protocols/utils.ts

GitHub Actions / js checks

This assertion is unnecessary since it does not change the type of the expression

Check warning on line 31 in api-client/src/protocols/utils.ts

GitHub Actions / js checks

This assertion is unnecessary since it does not change the type of the expression
(command): command is LoadPipetteRunTimeCommand =>
command.commandType === 'loadPipette' && command.params.mount === 'left'
)?.params.pipetteName as PipetteName | undefined
@@ -228,26 +227,6 @@
)
}

export interface LoadedFixturesBySlot {
[slotName: string]: LoadFixtureRunTimeCommand
}
// TODO(bh, 2023-11-09): remove this util, there will be no loadFixture command
export function parseInitialLoadedFixturesByCutout(
commands: RunTimeCommand[]
): LoadedFixturesBySlot {
const loadFixtureCommandsReversed = commands
.filter(
(command): command is LoadFixtureRunTimeCommand =>
command.commandType === 'loadFixture'
)
.reverse()
return reduce<LoadFixtureRunTimeCommand, LoadedFixturesBySlot>(
loadFixtureCommandsReversed,
(acc, command) => ({ ...acc, [command.params.location.cutout]: command }),
{}
)
}

export interface LiquidsById {
[liquidId: string]: {
displayName: string
Original file line number Diff line number Diff line change
@@ -5,10 +5,7 @@ import { fireEvent, screen } from '@testing-library/react'
import { when, resetAllWhenMocks } from 'jest-when'

import { i18n } from '../../../i18n'
import {
useProtocolDetailsForRun,
useTrackCreateProtocolRunEvent,
} from '../../../organisms/Devices/hooks'
import { useTrackCreateProtocolRunEvent } from '../../../organisms/Devices/hooks'
import {
useCloseCurrentRun,
useCurrentRunId,
@@ -33,7 +30,6 @@ import { useCreateRunFromProtocol } from '../useCreateRunFromProtocol'
import { useOffsetCandidatesForAnalysis } from '../../ApplyHistoricOffsets/hooks/useOffsetCandidatesForAnalysis'
import { ChooseRobotToRunProtocolSlideout } from '../'

import type { ProtocolDetails } from '../../../organisms/Devices/hooks'
import type { State } from '../../../redux/types'

jest.mock('../../../organisms/Devices/hooks')
@@ -77,9 +73,6 @@ const mockUseCurrentRunStatus = useCurrentRunStatus as jest.MockedFunction<
typeof useCurrentRunStatus
>

const mockUseProtocolDetailsForRun = useProtocolDetailsForRun as jest.MockedFunction<
typeof useProtocolDetailsForRun
>
const mockUseCreateRunFromProtocol = useCreateRunFromProtocol as jest.MockedFunction<
typeof useCreateRunFromProtocol
>
@@ -132,9 +125,6 @@ describe('ChooseRobotToRunProtocolSlideout', () => {
})
mockUseCurrentRunId.mockReturnValue(null)
mockUseCurrentRunStatus.mockReturnValue(null)
mockUseProtocolDetailsForRun.mockReturnValue({
displayName: 'A Protocol for Otie',
} as ProtocolDetails)
when(mockUseCreateRunFromProtocol)
.calledWith(
expect.any(Object),
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type {
AddressableAreaName,
CompletedProtocolAnalysis,
MoveToAddressableAreaParams,
} from '@opentrons/shared-data'
@@ -32,7 +33,9 @@ export function getAddressableAreaDisplayName(
else return addressableAreaName
}

const getMovableTrashSlot = (addressableAreaName: string): string => {
const getMovableTrashSlot = (
addressableAreaName: AddressableAreaName
): string => {
switch (addressableAreaName) {
case 'movableTrashA1':
return 'A1'
Original file line number Diff line number Diff line change
@@ -11,7 +11,6 @@ import { getModuleTypesThatRequireExtraAttention } from '../../utils/getModuleTy
import { getIsLabwareOffsetCodeSnippetsOn } from '../../../../../redux/config'
import {
useLPCDisabledReason,
useProtocolDetailsForRun,
useRunCalibrationStatus,
useRunHasStarted,
useUnmatchedModulesForProtocol,
@@ -38,9 +37,6 @@ const mockLabwarePostionCheck = LabwarePositionCheck as jest.MockedFunction<
const mockUseRunHasStarted = useRunHasStarted as jest.MockedFunction<
typeof useRunHasStarted
>
const mockUseProtocolDetailsForRun = useProtocolDetailsForRun as jest.MockedFunction<
typeof useProtocolDetailsForRun
>
const mockUseUnmatchedModulesForProtocol = useUnmatchedModulesForProtocol as jest.MockedFunction<
typeof useUnmatchedModulesForProtocol
>
@@ -64,28 +60,6 @@ const mockUseLPCDisabledReason = useLPCDisabledReason as jest.MockedFunction<
>
const ROBOT_NAME = 'otie'
const RUN_ID = '1'
const PICKUP_TIP_LABWARE_ID = 'PICKUP_TIP_LABWARE_ID'
const PRIMARY_PIPETTE_ID = 'PRIMARY_PIPETTE_ID'
const PRIMARY_PIPETTE_NAME = 'PRIMARY_PIPETTE_NAME'
const LABWARE_DEF_ID = 'LABWARE_DEF_ID'
const LABWARE_DEF = {
ordering: [['A1', 'A2']],
parameters: { isTiprack: true },
}
const mockLabwarePositionCheckStepTipRack = {
labwareId:
'1d57fc10-67ad-11ea-9f8b-3b50068bd62d:opentrons/opentrons_96_filtertiprack_200ul/1',
section: '',
commands: [
{
commandType: 'pickUpTip',
params: {
pipetteId: PRIMARY_PIPETTE_ID,
labwareId: PICKUP_TIP_LABWARE_ID,
},
},
],
} as any

const render = () => {
return renderWithProviders(
@@ -130,34 +104,6 @@ describe('SetupLabware', () => {
complete: true,
})
when(mockUseRunHasStarted).calledWith(RUN_ID).mockReturnValue(false)
when(mockUseProtocolDetailsForRun)
.calledWith(RUN_ID)
.mockReturnValue({
protocolData: {
labware: {
[mockLabwarePositionCheckStepTipRack.labwareId]: {
slot: '1',
displayName: 'someDisplayName',
definitionId: LABWARE_DEF_ID,
},
},
labwareDefinitions: {
[LABWARE_DEF_ID]: LABWARE_DEF,
},
pipettes: {
[PRIMARY_PIPETTE_ID]: {
name: PRIMARY_PIPETTE_NAME,
mount: 'left',
},
},
commands: [
{
commandType: 'pickUpTip',
params: { pipetteId: PRIMARY_PIPETTE_ID },
} as any,
],
},
} as any)
when(mockGetIsLabwareOffsetCodeSnippetsOn).mockReturnValue(false)
when(mockSetupLabwareMap).mockReturnValue(<div>mock setup labware map</div>)
when(mockSetupLabwareList).mockReturnValue(
Loading

Unchanged files with check annotations Beta

if (shouldUpdate(path, overrides())) {
const nextValue = getNextValue(
action as ConfigValueChangeAction,

Check warning on line 80 in app-shell-odd/src/config/index.ts

GitHub Actions / js checks

This assertion is unnecessary since it does not change the type of the expression

Check warning on line 80 in app-shell-odd/src/config/index.ts

GitHub Actions / js checks

This assertion is unnecessary since it does not change the type of the expression
getFullConfig()
)
return dialog
.showOpenDialog(browserWindow, openDialogOpts)
.then((result: OpenDialogReturnValue) => {
return result.canceled ? [] : (result.filePaths as string[])

Check warning on line 38 in app-shell-odd/src/dialogs/index.ts

GitHub Actions / js checks

This assertion is unnecessary since it does not change the type of the expression

Check warning on line 38 in app-shell-odd/src/dialogs/index.ts

GitHub Actions / js checks

This assertion is unnecessary since it does not change the type of the expression
})
}
return dialog
.showOpenDialog(browserWindow, openDialogOpts)
.then((result: OpenDialogReturnValue) => {
return result.canceled ? [] : (result.filePaths as string[])

Check warning on line 61 in app-shell-odd/src/dialogs/index.ts

GitHub Actions / js checks

This assertion is unnecessary since it does not change the type of the expression

Check warning on line 61 in app-shell-odd/src/dialogs/index.ts

GitHub Actions / js checks

This assertion is unnecessary since it does not change the type of the expression
})
}
): Promise<string> {
return fetch(input).then(response => {
let downloaded = 0
const size = Number(response.headers.get('Content-Length')) || null

Check warning on line 53 in app-shell-odd/src/http.ts

GitHub Actions / js checks

Unexpected number value in conditional. An explicit zero/NaN check is required

Check warning on line 53 in app-shell-odd/src/http.ts

GitHub Actions / js checks

Unexpected number value in conditional. An explicit zero/NaN check is required
// with node-fetch, response.body will be a Node.js readable stream
// rather than a browser-land ReadableStream
source: string
): Promise<Response> {
return new Promise<Response>((resolve, reject) => {
createReadStream(source, reject).then(readStream =>

Check warning on line 94 in app-shell-odd/src/http.ts

GitHub Actions / js checks

Promises must be handled appropriately or explicitly marked as ignored with the `void` operator

Check warning on line 94 in app-shell-odd/src/http.ts

GitHub Actions / js checks

Promises must be handled appropriately or explicitly marked as ignored with the `void` operator
new Promise<Response>(resolve => {
const body = new FormData()
body.append(name, readStream)
import type { BrowserWindow } from 'electron'
import type { Dispatch, Logger } from './types'
systemd.sendStatus('starting app')

Check warning on line 29 in app-shell-odd/src/main.ts

GitHub Actions / js checks

Promises must be handled appropriately or explicitly marked as ignored with the `void` operator

Check warning on line 29 in app-shell-odd/src/main.ts

GitHub Actions / js checks

Promises must be handled appropriately or explicitly marked as ignored with the `void` operator
const config = getConfig()
const log = createLogger('main')
overrides: getOverrides(),
})
systemd.setRemoteDevToolsEnabled(config.devtools)

Check warning on line 39 in app-shell-odd/src/main.ts

GitHub Actions / js checks

Promises must be handled appropriately or explicitly marked as ignored with the `void` operator

Check warning on line 39 in app-shell-odd/src/main.ts

GitHub Actions / js checks

Promises must be handled appropriately or explicitly marked as ignored with the `void` operator
// hold on to references so they don't get garbage collected
let mainWindow: BrowserWindow | null | undefined
resetStore()
fse.removeSync(path.join(ODD_DIR, `_CONFIG_TO_BE_DELETED_ON_REBOOT`))
}
systemd.sendStatus('loading app')

Check warning on line 66 in app-shell-odd/src/main.ts

GitHub Actions / js checks

Promises must be handled appropriately or explicitly marked as ignored with the `void` operator

Check warning on line 66 in app-shell-odd/src/main.ts

GitHub Actions / js checks

Promises must be handled appropriately or explicitly marked as ignored with the `void` operator
process.on('uncaughtException', error => log.error('Uncaught: ', { error }))
process.on('unhandledRejection', reason =>
log.error('Uncaught Promise rejection: ', { reason })