Skip to content

Commit

Permalink
Merge branch 'edge' into rel_into_edge
Browse files Browse the repository at this point in the history
Resolve conflicts in:
  * app/src/organisms/Devices/PipetteCard/__tests__/PipetteOverflowMenu.test.tsx
  * app/src/organisms/Devices/PipetteCard/index.tsx
  • Loading branch information
SyntaxColoring committed Oct 3, 2023
2 parents c23b603 + 4db3068 commit 21aeb59
Show file tree
Hide file tree
Showing 430 changed files with 13,265 additions and 5,692 deletions.
23 changes: 11 additions & 12 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,17 @@
/webpack-config @Opentrons/js

# subprojects - those with clear team ownership should have appropriate notifications
/protocol-designer @Opentrons/spddrs
/labware-designer @Opentrons/spddrs
/labware-library @Opentrons/spddrs
/protocol-library-kludge @Opentrons/spddrs
/update-server @Opentrons/cpx
/api/src/opentrons @Opentrons/hmg
/discovery-client @Opentrons/cpx
/shared-data/pipette @Opentrons/hmg
/shared-data/protocol @Opentrons/spddrs
/shared-data/module @Opentrons/hmg
/shared-data/deck @Opentrons/hmg
/shared-data/labware @Opentrons/hmg
/protocol-designer @Opentrons/app-and-uis
/labware-designer @Opentrons/app-and-uis
/labware-library @Opentrons/app-and-uis
/protocol-library-kludge @Opentrons/app-and-uis
/update-server @Opentrons/robot-svcs
/discovery-client @Opentrons/robot-svcs @Opentrons/app-and-uis
/shared-data/pipette @Opentrons/embedded-sw
/shared-data/protocol @Opentrons/robot-svcs @Opentrons/app-and-uis
/shared-data/module @Opentrons/embedded-sw
/shared-data/deck @Opentrons/embedded-sw
/shared-data/labware @Opentrons/embedded-sw

# subprojects by language - some subprojects are shared by teams but united by a
# language community (including makefiles and config) so mark them appropriately
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,6 @@ opentrons-robot-app.tar.gz

# local VERSION.json file when pushing to Flex
*new_version_file.json

# ignore linux swap files
*.swp
6 changes: 6 additions & 0 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ export const customViewports = {
export const parameters = {
actions: { argTypesRegex: '^on[A-Z].*' },
viewport: { viewports: customViewports },
options: {
storySort: {
method: 'alphabetical',
order: ['Design Tokens', 'Library', 'App', 'ODD'],
},
},
}

// Global decorator to apply the styles to all stories
Expand Down
9 changes: 9 additions & 0 deletions api-client/src/deck_configuration/__stubs__/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { v4 as uuidv4 } from 'uuid'

import type { Fixture } from '../types'

export const DECK_CONFIG_STUB: { [fixtureLocation: string]: Fixture } = {
B3: { fixtureLocation: 'B3', loadName: 'standardSlot', fixtureId: uuidv4() },
C3: { fixtureLocation: 'C3', loadName: 'extensionSlot', fixtureId: uuidv4() },
D3: { fixtureLocation: 'D3', loadName: 'wasteChute', fixtureId: uuidv4() },
}
29 changes: 29 additions & 0 deletions api-client/src/deck_configuration/createDeckConfiguration.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// import { POST, request } from '../request'
import { DECK_CONFIG_STUB } from './__stubs__'

// import type { ResponsePromise } from '../request'
import type { HostConfig } from '../types'
import type { DeckConfiguration } from './types'

// TODO(bh, 2023-09-26): uncomment and remove deck config stub when backend api is ready
// export function createDeckConfiguration(
// config: HostConfig,
// data: DeckConfiguration
// ): ResponsePromise<DeckConfiguration> {
// return request<DeckConfiguration, { data: DeckConfiguration }>(
// POST,
// `/deck_configuration`,
// { data },
// config
// )
// }

export function createDeckConfiguration(
config: HostConfig,
data: DeckConfiguration
): Promise<{ data: DeckConfiguration }> {
data.forEach(fixture => {
DECK_CONFIG_STUB[fixture.fixtureLocation] = fixture
})
return Promise.resolve({ data: Object.values(DECK_CONFIG_STUB) })
}
30 changes: 30 additions & 0 deletions api-client/src/deck_configuration/deleteDeckConfiguration.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// import { DELETE, request } from '../request'
import { DECK_CONFIG_STUB } from './__stubs__'

// import type { ResponsePromise } from '../request'
import type { EmptyResponse, HostConfig } from '../types'
import type { Fixture } from './types'

// TODO(bh, 2023-09-26): uncomment and remove deck config stub when backend api is ready
// export function deleteDeckConfiguration(
// config: HostConfig,
// data: Fixture
// ): ResponsePromise<EmptyResponse> {
// const { fixtureLocation, ...rest } = data
// return request<EmptyResponse, { data: Omit<Fixture, 'fixtureLocation'> }>(
// DELETE,
// `/deck_configuration/${fixtureLocation}`,
// { data: rest },
// config
// )
// }

export function deleteDeckConfiguration(
config: HostConfig,
data: Fixture
): Promise<EmptyResponse> {
const { fixtureLocation } = data
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
delete DECK_CONFIG_STUB[fixtureLocation]
return Promise.resolve({ data: null })
}
19 changes: 19 additions & 0 deletions api-client/src/deck_configuration/getDeckConfiguration.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// import { GET, request } from '../request'
import { DECK_CONFIG_STUB } from './__stubs__'

// import type { ResponsePromise } from '../request'
import type { HostConfig } from '../types'
import type { DeckConfiguration } from './types'

// TODO(bh, 2023-09-26): uncomment and remove deck config stub when backend api is ready
// export function getDeckConfiguration(
// config: HostConfig
// ): ResponsePromise<DeckConfiguration> {
// return request<DeckConfiguration>(GET, `/deck_configuration`, null, config)
// }

export function getDeckConfiguration(
config: HostConfig
): Promise<{ data: DeckConfiguration }> {
return Promise.resolve({ data: Object.values(DECK_CONFIG_STUB) })
}
6 changes: 6 additions & 0 deletions api-client/src/deck_configuration/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export { createDeckConfiguration } from './createDeckConfiguration'
export { deleteDeckConfiguration } from './deleteDeckConfiguration'
export { getDeckConfiguration } from './getDeckConfiguration'
export { updateDeckConfiguration } from './updateDeckConfiguration'

export * from './types'
11 changes: 11 additions & 0 deletions api-client/src/deck_configuration/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// TODO(bh, 2023-09-26): refine types and move to shared data when settled
export type FixtureName = 'extensionSlot' | 'standardSlot' | 'wasteChute'
export type FixtureLocation = 'B3' | 'C3' | 'D3'

export interface Fixture {
fixtureId: string
fixtureLocation: FixtureLocation
loadName: FixtureName
}

export type DeckConfiguration = Fixture[]
32 changes: 32 additions & 0 deletions api-client/src/deck_configuration/updateDeckConfiguration.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { v4 as uuidv4 } from 'uuid'

// import { PATCH, request } from '../request'
import { DECK_CONFIG_STUB } from './__stubs__'

// import type { ResponsePromise } from '../request'
import type { HostConfig } from '../types'
import type { Fixture } from './types'

// TODO(bh, 2023-09-26): uncomment and remove deck config stub when backend api is ready
// export function updateDeckConfiguration(
// config: HostConfig,
// data: Omit<Fixture, 'fixtureId'>
// ): ResponsePromise<Fixture> {
// const { fixtureLocation, ...rest } = data
// return request<Fixture, { data: Omit<Fixture, 'fixtureLocation'> }>(
// PATCH,
// `/deck_configuration/${fixtureLocation}`,
// { data: rest },
// config
// )
// }

export function updateDeckConfiguration(
config: HostConfig,
data: Omit<Fixture, 'fixtureId'>
): Promise<{ data: Fixture }> {
const { fixtureLocation } = data
const fixtureId = uuidv4()
DECK_CONFIG_STUB[fixtureLocation] = { ...data, fixtureId }
return Promise.resolve({ data: DECK_CONFIG_STUB[fixtureLocation] })
}
1 change: 1 addition & 0 deletions api-client/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// api client entry point
export * from './calibration'
export * from './deck_configuration'
export * from './health'
export * from './instruments'
export * from './maintenance_runs'
Expand Down
56 changes: 55 additions & 1 deletion api-client/src/protocols/__tests__/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,17 @@ import {
parseLiquidsInLoadOrder,
parseLabwareInfoByLiquidId,
parseInitialLoadedLabwareByAdapter,
parseInitialLoadedFixturesByCutout,
} from '../utils'
import { simpleAnalysisFileFixture } from '../__fixtures__'

import type { RunTimeCommand } from '@opentrons/shared-data'
import {
LoadFixtureRunTimeCommand,
RunTimeCommand,
STAGING_AREA_LOAD_NAME,
STANDARD_SLOT_LOAD_NAME,
WASTE_CHUTE_LOAD_NAME,
} from '@opentrons/shared-data'

const mockRunTimeCommands: RunTimeCommand[] = simpleAnalysisFileFixture.commands as any
const mockLoadLiquidRunTimeCommands = [
Expand Down Expand Up @@ -359,6 +366,53 @@ describe('parseInitialLoadedModulesBySlot', () => {
)
})
})
describe('parseInitialLoadedFixturesByCutout', () => {
it('returns fixtures loaded in cutouts', () => {
const loadFixtureCommands: LoadFixtureRunTimeCommand[] = [
{
id: 'fakeId1',
commandType: 'loadFixture',
params: {
loadName: STAGING_AREA_LOAD_NAME,
location: { cutout: 'B3' },
},
createdAt: 'fake_timestamp',
startedAt: 'fake_timestamp',
completedAt: 'fake_timestamp',
status: 'succeeded',
},
{
id: 'fakeId2',
commandType: 'loadFixture',
params: { loadName: WASTE_CHUTE_LOAD_NAME, location: { cutout: 'D3' } },
createdAt: 'fake_timestamp',
startedAt: 'fake_timestamp',
completedAt: 'fake_timestamp',
status: 'succeeded',
},
{
id: 'fakeId3',
commandType: 'loadFixture',
params: {
loadName: STANDARD_SLOT_LOAD_NAME,
location: { cutout: 'C3' },
},
createdAt: 'fake_timestamp',
startedAt: 'fake_timestamp',
completedAt: 'fake_timestamp',
status: 'succeeded',
},
]
const expected = {
B3: loadFixtureCommands[0],
D3: loadFixtureCommands[1],
C3: loadFixtureCommands[2],
}
expect(parseInitialLoadedFixturesByCutout(loadFixtureCommands)).toEqual(
expected
)
})
})
describe('parseLiquidsInLoadOrder', () => {
it('returns liquids in loaded order', () => {
const expected = [
Expand Down
24 changes: 22 additions & 2 deletions api-client/src/protocols/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import type {
LoadModuleRunTimeCommand,
LoadPipetteRunTimeCommand,
LoadLiquidRunTimeCommand,
LoadFixtureRunTimeCommand,
} from '@opentrons/shared-data/protocol/types/schemaV7/command/setup'

interface PipetteNamesByMount {
Expand Down Expand Up @@ -210,14 +211,14 @@ interface LoadedModulesBySlot {
export function parseInitialLoadedModulesBySlot(
commands: RunTimeCommand[]
): LoadedModulesBySlot {
const loadLabwareCommandsReversed = commands
const loadModuleCommandsReversed = commands
.filter(
(command): command is LoadModuleRunTimeCommand =>
command.commandType === 'loadModule'
)
.reverse()
return reduce<LoadModuleRunTimeCommand, LoadedModulesBySlot>(
loadLabwareCommandsReversed,
loadModuleCommandsReversed,
(acc, command) =>
'slotName' in command.params.location
? { ...acc, [command.params.location.slotName]: command }
Expand All @@ -226,6 +227,25 @@ export function parseInitialLoadedModulesBySlot(
)
}

interface LoadedFixturesBySlot {
[slotName: string]: LoadFixtureRunTimeCommand
}
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
Expand Down
Loading

0 comments on commit 21aeb59

Please sign in to comment.