Skip to content

Commit

Permalink
remove old v1 def affordances
Browse files Browse the repository at this point in the history
  • Loading branch information
b-cooper committed Dec 5, 2023
1 parent 610c338 commit e5af569
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 160 deletions.
23 changes: 0 additions & 23 deletions components/src/legacy-hardware-sim/Labware.css

This file was deleted.

1 change: 1 addition & 0 deletions components/src/legacy-hardware-sim/LabwareNameOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export interface LabwareNameOverlayProps {
className?: string
}

/** @deprecated use LabwareDisplayName or custom RobotCoordsForeignDiv */
export function LabwareNameOverlay(
props: LabwareNameOverlayProps
): JSX.Element {
Expand Down
19 changes: 0 additions & 19 deletions components/src/legacy-hardware-sim/ModuleViz.css

This file was deleted.

43 changes: 0 additions & 43 deletions components/src/legacy-hardware-sim/ModuleViz.tsx

This file was deleted.

48 changes: 0 additions & 48 deletions components/src/legacy-hardware-sim/Well.css

This file was deleted.

15 changes: 0 additions & 15 deletions components/src/legacy-hardware-sim/constants.ts

This file was deleted.

1 change: 0 additions & 1 deletion components/src/legacy-hardware-sim/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from './constants'

Check failure on line 1 in components/src/legacy-hardware-sim/index.ts

View workflow job for this annotation

GitHub Actions / js checks

Cannot find module './constants' or its corresponding type declarations.

Check failure on line 1 in components/src/legacy-hardware-sim/index.ts

View workflow job for this annotation

GitHub Actions / js checks

Cannot find module './constants' or its corresponding type declarations.
export * from './LabwareNameOverlay'
export * from './ModuleViz' // legacy PD module rendering
export * from './ModuleItem' // legacy App module rendering
26 changes: 26 additions & 0 deletions protocol-designer/src/labware-defs/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,32 @@ import {
} from '@opentrons/shared-data'
import { LabwareDefByDefURI } from './types'


// require all definitions in the labware/definitions/1 directory
// require.context is webpack-specific method
const labwareSchemaV1DefsContext = require.context(
'@opentrons/shared-data/labware/definitions/1',
true, // traverse subdirectories
/\.json$/, // import filter
'sync' // load every definition into one synchronous chunk
)
let labwareSchemaV1Defs: Readonly<LabwareDefinition1[]> | null = null
function getLegacyLabwareDefs(): Readonly<LabwareDefinition1[]> {
if (!labwareSchemaV1Defs) {
labwareSchemaV1Defs = labwareSchemaV1DefsContext
.keys()
.map((name: string) => labwareSchemaV1DefsContext(name))
}

return labwareSchemaV1Defs as Readonly<LabwareDefinition1[]>
}
export function getLegacyLabwareDef(
loadName: string | null | undefined
): LabwareDefinition1 | null {
const def = getLegacyLabwareDefs().find(d => d.metadata.name === loadName)
return def || null
}

// TODO: Ian 2019-04-11 getAllDefinitions also exists (differently) in labware-library,
// should reconcile differences & make a general util fn imported from shared-data
// require all definitions in the labware/definitions/2 directory
Expand Down
5 changes: 3 additions & 2 deletions protocol-designer/src/load-file/migration/1_1_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import mapValues from 'lodash/mapValues'
import omit from 'lodash/omit'
import omitBy from 'lodash/omitBy'
import flow from 'lodash/flow'
import { getLabwareV1Def, getPipetteNameSpecs } from '@opentrons/shared-data'
import { getPipetteNameSpecs } from '@opentrons/shared-data'
import {
FileLabware,
FilePipette,
ProtocolFile,
} from '@opentrons/shared-data/protocol/types/schemaV1'
import { getLegacyLabwareDef } from '../../labware-defs/utils'
import { FormPatch } from '../../steplist/actions'
import { FormData } from '../../form-types'
export interface PDMetadata {
Expand Down Expand Up @@ -70,7 +71,7 @@ function getPipetteCapacityLegacy(
}
// @ts-expect-error unable to cast type string from manipulation above to type PipetteName
const specs = getPipetteNameSpecs(pipetteName)
const tiprackDef = getLabwareV1Def(pipette.tiprackModel)
const tiprackDef = getLegacyLabwareDef(pipette.tiprackModel)

if (specs && tiprackDef && tiprackDef.metadata.tipVolume) {
return Math.min(specs.maxVolume, tiprackDef.metadata.tipVolume)
Expand Down
9 changes: 0 additions & 9 deletions shared-data/js/getLabware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,6 @@ export const PD_DO_NOT_LIST = [
'opentrons_96_aluminumblock_nest_wellplate_100ul',
]

export function getLabwareV1Def(
labwareName: string
): LabwareDefinition1 | null | undefined {
const labware: LabwareDefinition1 | null | undefined =
// @ts-expect-error(mc, 2021-04-27): make lookup more strict or remove v1 defs entirely
definitions[labwareName]
return labware
}

export function getIsLabwareV1Tiprack(def: LabwareDefinition1): boolean {
return Boolean(def?.metadata?.isTiprack)
}
Expand Down

0 comments on commit e5af569

Please sign in to comment.