diff --git a/.codecov.yml b/.codecov.yml index 1ac3cc70a0d..4eb13688110 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -1,6 +1,5 @@ ignore: - '**/node_modules' - - 'protocol-library-kludge' - 'webpack-config' - 'hardware-testing' - '**/*.md' diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index f0ee1890dd2..28f0fb7d1f8 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -12,7 +12,6 @@ /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 @@ -24,6 +23,8 @@ # subprojects by language - some subprojects are shared by teams but united by a # language community (including makefiles and config) so mark them appropriately /app @Opentrons/js +/api-client @Opentrons/js +/react-api-client @Opentrons/js /app-shell @Opentrons/js /components @Opentrons/js /api @Opentrons/py diff --git a/package.json b/package.json index ec8e480cb65..e5086e5db1e 100755 --- a/package.json +++ b/package.json @@ -11,7 +11,6 @@ "labware-designer", "labware-library", "protocol-designer", - "protocol-library-kludge", "shared-data", "step-generation", "webpack-config", diff --git a/protocol-library-kludge/.gitignore b/protocol-library-kludge/.gitignore deleted file mode 100644 index 34100bf1852..00000000000 --- a/protocol-library-kludge/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# type caches -lib/ \ No newline at end of file diff --git a/protocol-library-kludge/Makefile b/protocol-library-kludge/Makefile deleted file mode 100644 index 3cf944cc962..00000000000 --- a/protocol-library-kludge/Makefile +++ /dev/null @@ -1,41 +0,0 @@ -# opentrons protocol-library-kludge makefile - -# using bash instead of /bin/bash in SHELL prevents macOS optimizing away our PATH update -SHELL := bash - -# add node_modules/.bin to PATH -PATH := $(shell cd .. && yarn bin):$(PATH) - -# standard targets -##################################################################### - -.PHONY: all -all: clean dist - -.PHONY: setup -setup: - yarn - -.PHONY: clean -clean: - shx rm -rf dist - -# artifacts -##################################################################### - -.PHONY: dist -dist: export NODE_ENV := production -dist: - webpack --profile - -# NOTE: Ian 2018-09-07 while this is a one-off OT2 deckmap iframe dealie, -# it should be deployed MANUALLY to protocol-library-kludge/production/ on S3 - -# development -##################################################################### - -.PHONY: dev -dev: export NODE_ENV := development -dev: export NODE_OPTIONS := --openssl-legacy-provider -dev: - webpack-dev-server --hot --host=:: diff --git a/protocol-library-kludge/README.md b/protocol-library-kludge/README.md deleted file mode 100644 index 73918af0af8..00000000000 --- a/protocol-library-kludge/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# Protocol Library Kludge - -This app provides an OT2 deck map component intended to be used in an iframe in Protocol Library. - -JSON data to set up labware and modules is passed in through the `data` URL param. - -# Example URL Params - -## Standard labware + magnetic module - -http://localhost:8080/?data=%7B%22labware%22:%7B%221%22:%7B%22labwareType%22:%22biorad_96_wellplate_200ul_pcr%22,%22name%22:%22Bio-Rad%2096%20Well%20Plate%20200%20%C2%B5L%20PCR%20on%20Magnetic%20Module%20on%201%22%7D,%222%22:%7B%22labwareType%22:%22biorad_96_wellplate_200ul_pcr%22,%22name%22:%22output%20plate%20on%202%22%7D,%223%22:%7B%22labwareType%22:%22opentrons_96_tiprack_1000ul%22,%22name%22:%22p1000%20tiprack%20on%203%22%7D,%225%22:%7B%22labwareType%22:%22opentrons_96_tiprack_1000ul%22,%22name%22:%22p1000%20tiprack%20on%205%22%7D,%227%22:%7B%22labwareType%22:%22usascientific_12_reservoir_22ml%22,%22name%22:%22reagent%20reservoir%20on%207%22%7D,%2212%22:%7B%22labwareType%22:%22opentrons_1_trash_1100ml_fixed%22,%22name%22:%22Opentrons%20Fixed%20Trash%20on%2012%22%7D%7D,%22modules%22%3A%7B%221%22%3A%20%22magneticModuleV1%22%7D%7D - -## Custom labware - -http://localhost:8080/?data=%7B%22labware%22:%7B%221%22:%7B%22labwareType%22:%22generic_96_tiprack_20ul%22,%22name%22:%22Custom%20200%C2%B5L%20Tiprack%20on%201%22%7D,%222%22:%7B%22labwareType%22:%22generic_96_tiprack_200ul%22,%22name%22:%22Custom%20200%C2%B5L%20Tiprack%20on%202%22%7D,%223%22:%7B%22labwareType%22:%22custom_96_tubeholder_500ul%22,%22name%22:%22Custom%20500ul%20Tube%20Holder%20on%203%22%7D,%2212%22:%7B%22labwareType%22:%22opentrons_1_trash_1100ml_fixed%22,%22name%22:%22Opentrons%20Fixed%20Trash%20on%2012%22%7D%7D,%22modules%22:%7B%7D%7D diff --git a/protocol-library-kludge/package.json b/protocol-library-kludge/package.json deleted file mode 100644 index db3c38648bd..00000000000 --- a/protocol-library-kludge/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "repository": { - "type": "git", - "url": "https://github.com/Opentrons/opentrons.git" - }, - "author": { - "name": "Opentrons Labworks", - "email": "engineering@opentrons.com" - }, - "name": "protocol-library-kludge", - "private": true, - "version": "0.0.0-dev", - "productName": "Opentrons Protocol Library", - "description": "Protocol library stuff (WIP)", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "bugs": { - "url": "https://github.com/Opentrons/opentrons/issues" - }, - "homepage": "https://github.com/Opentrons/opentrons", - "license": "Apache-2.0", - "dependencies": { - "@opentrons/components": "link:../components", - "@opentrons/shared-data": "link:../shared-data", - "classnames": "2.2.5", - "lodash": "4.17.21", - "react": "18.2.0", - "react-dom": "18.2.0" - } -} diff --git a/protocol-library-kludge/src/App.tsx b/protocol-library-kludge/src/App.tsx deleted file mode 100644 index 12f1d2dd806..00000000000 --- a/protocol-library-kludge/src/App.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import * as React from 'react' -import { URLDeck } from './URLDeck' -import './globals.css' - -export function App(): JSX.Element { - return -} diff --git a/protocol-library-kludge/src/URLDeck.css b/protocol-library-kludge/src/URLDeck.css deleted file mode 100644 index 05baa1a0aca..00000000000 --- a/protocol-library-kludge/src/URLDeck.css +++ /dev/null @@ -1,7 +0,0 @@ -.labware_name_overlay { - opacity: 0; - - &:hover { - opacity: 1; - } -} diff --git a/protocol-library-kludge/src/URLDeck.tsx b/protocol-library-kludge/src/URLDeck.tsx deleted file mode 100644 index dbfffaf34a7..00000000000 --- a/protocol-library-kludge/src/URLDeck.tsx +++ /dev/null @@ -1,134 +0,0 @@ -import * as React from 'react' -import styles from './URLDeck.css' - -import { - RobotWorkSpace, - LabwareNameOverlay, - LabwareRender, - ModuleItem, - RobotCoordsForeignDiv, -} from '@opentrons/components' -import { getLatestLabwareDef } from './getLabware' -import { getDeckDefinitions } from '@opentrons/components/src/hardware-sim/Deck/getDeckDefinitions' -import type { ModuleModel, DeckSlotId } from '@opentrons/shared-data' - -// URI-encoded JSON expected as URL param "data" (eg `?data=...`) - -interface UrlData { - labware: Record< - DeckSlotId, - { - labwareType: string - name: string | null | undefined - } - > - modules: Record -} - -const DECK_DEF = getDeckDefinitions().ot2_standard - -const DECK_LAYER_BLOCKLIST = [ - 'calibrationMarkings', - 'fixedBase', - 'doorStops', - 'metalFrame', - 'removalHandle', - 'removableDeckOutline', - 'screwHoles', -] - -function getDataFromUrl(): UrlData | null { - try { - const urlData = new URLSearchParams(window.location.search).get('data') - - if (!urlData) { - console.error('No "data" param in URL') - return null - } - - return JSON.parse(urlData) - } catch (e) { - console.error('Failed to parse "data" URL param.', e) - return null - } -} - -export class URLDeck extends React.Component<{}> { - urlData: UrlData | null - - constructor() { - // @ts-expect-error(sa, 2021-7-8): call super with props - super() - this.urlData = getDataFromUrl() - } - - render(): JSX.Element { - const labwareBySlot = this.urlData?.labware - const modulesBySlot = this.urlData?.modules - - return ( - - {({ deckSlotsById }): Array => - Object.keys(deckSlotsById).map((slotId): JSX.Element | null => { - const slot = deckSlotsById[slotId] - if (!slot.matingSurfaceUnitVector) return null // if slot has no mating surface, don't render anything in it - const moduleModel = modulesBySlot && modulesBySlot[slotId] - const labware = labwareBySlot && labwareBySlot[slotId] - const labwareDefV2 = - labware && getLatestLabwareDef(labware.labwareType) - let labwareDisplayType: string | null = null - if (labwareDefV2) { - labwareDisplayType = labwareDefV2.metadata.displayName - } else { - labwareDisplayType = labware?.labwareType || null - } - - return ( - - {moduleModel && ( - - - - )} - {labware && ( - - {labwareDefV2 ? ( - - ) : null} - - )} - {labware && ( - - - - )} - - ) - }) - } - - ) - } -} diff --git a/protocol-library-kludge/src/getLabware.ts b/protocol-library-kludge/src/getLabware.ts deleted file mode 100644 index 96f8e0d39e2..00000000000 --- a/protocol-library-kludge/src/getLabware.ts +++ /dev/null @@ -1,75 +0,0 @@ -// HACK: IL 2019-11-25 this file is copied from Run App -import groupBy from 'lodash/groupBy' -import type { - LabwareDefinition1, - LabwareDefinition2, -} from '@opentrons/shared-data' - -// require all definitions in the labware/definitions/1 directory -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 | null = null -function getLegacyLabwareDefs(): Readonly { - if (!labwareSchemaV1Defs) { - labwareSchemaV1Defs = labwareSchemaV1DefsContext - .keys() - .map(name => labwareSchemaV1DefsContext(name)) - } - - return labwareSchemaV1Defs -} - -export function getLegacyLabwareDef( - loadName: string | null | undefined -): LabwareDefinition1 | null { - const def = getLegacyLabwareDefs().find(d => d.metadata.name === loadName) - return def || null -} - -// require all definitions in the labware/definitions/2 directory -const labwareSchemaV2DefsContext = require.context( - '@opentrons/shared-data/labware/definitions/2', - true, // traverse subdirectories - /\.json$/, // import filter - 'sync' // load every definition into one synchronous chunk -) - -let labwareSchemaV2Defs: Readonly | null = null -function getLatestLabwareDefs(): Readonly { - // NOTE: unlike labware-library, no filtering out "do not list labware" - // also, more convenient & performant to make a map {loadName: def} not an array - if (!labwareSchemaV2Defs) { - const allDefs = labwareSchemaV2DefsContext - .keys() - .map(name => labwareSchemaV2DefsContext(name)) - // group by namespace + loadName - const labwareDefGroups: { - [groupKey: string]: LabwareDefinition2[] - } = groupBy(allDefs, d => `${d.namespace}/${d.parameters.loadName}`) - - labwareSchemaV2Defs = Object.keys(labwareDefGroups).map( - (groupKey: string) => { - const group = labwareDefGroups[groupKey] - const allVersions = group.map(d => d.version) - const highestVersionNum = Math.max(...allVersions) - const resultIdx = group.findIndex(d => d.version === highestVersionNum) - return group[resultIdx] - } - ) - } - - return labwareSchemaV2Defs -} - -export function getLatestLabwareDef( - loadName: string | null | undefined -): LabwareDefinition2 | null { - const def = getLatestLabwareDefs().find( - d => d.parameters.loadName === loadName - ) - return def || null -} diff --git a/protocol-library-kludge/src/globals.css b/protocol-library-kludge/src/globals.css deleted file mode 100644 index 6ada1dc286f..00000000000 --- a/protocol-library-kludge/src/globals.css +++ /dev/null @@ -1,3 +0,0 @@ -* { - font-family: 'Open Sans', sans-serif; -} diff --git a/protocol-library-kludge/src/index.hbs b/protocol-library-kludge/src/index.hbs deleted file mode 100644 index ab68be76554..00000000000 --- a/protocol-library-kludge/src/index.hbs +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - {{htmlWebpackPlugin.options.title}} - - - - -
- - diff --git a/protocol-library-kludge/src/index.tsx b/protocol-library-kludge/src/index.tsx deleted file mode 100644 index 25ccf009a68..00000000000 --- a/protocol-library-kludge/src/index.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import * as React from 'react' -import ReactDOM from 'react-dom/client' -import { App } from './App' - -const container = document.getElementById('root') - -if (container == null) throw new Error('Failed to find the root element') -const root = ReactDOM.createRoot(container) - -root.render() diff --git a/protocol-library-kludge/tsconfig.json b/protocol-library-kludge/tsconfig.json deleted file mode 100644 index cd8628020c7..00000000000 --- a/protocol-library-kludge/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../tsconfig-base.json", - "references": [ - { - "path": "../components" - }, - { - "path": "../shared-data" - } - ], - "compilerOptions": { - "composite": true, - "rootDir": "src", - "outDir": "lib" - }, - "include": ["typings", "src"] -} diff --git a/protocol-library-kludge/typings/css-modules.d.ts b/protocol-library-kludge/typings/css-modules.d.ts deleted file mode 100644 index 6f4c90dd90b..00000000000 --- a/protocol-library-kludge/typings/css-modules.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -declare module '*.css' { - const styles: { [key: string]: string } - // eslint-disable-next-line import/no-default-export - export default styles -} diff --git a/protocol-library-kludge/webpack.config.js b/protocol-library-kludge/webpack.config.js deleted file mode 100644 index 195a00cbc53..00000000000 --- a/protocol-library-kludge/webpack.config.js +++ /dev/null @@ -1,27 +0,0 @@ -'use strict' - -const path = require('path') -const webpackMerge = require('webpack-merge') -const HtmlWebpackPlugin = require('html-webpack-plugin') -const ScriptExtHtmlWebpackPlugin = require('script-ext-html-webpack-plugin') - -const { DEV_MODE, baseConfig } = require('@opentrons/webpack-config') -const { productName: title, description, author } = require('./package.json') - -const JS_BUNDLE_ENTRY = path.join(__dirname, 'src/index.tsx') -const HTML_ENTRY = path.join(__dirname, 'src/index.hbs') -const OUTPUT_PATH = path.join(__dirname, 'dist') - -module.exports = webpackMerge(baseConfig, { - entry: [JS_BUNDLE_ENTRY], - - output: { - path: OUTPUT_PATH, - publicPath: DEV_MODE ? '' : './', - }, - - plugins: [ - new HtmlWebpackPlugin({ title, description, author, template: HTML_ENTRY }), - new ScriptExtHtmlWebpackPlugin({ defaultAttribute: 'defer' }), - ], -}) diff --git a/tsconfig-eslint.json b/tsconfig-eslint.json index 11672e612c6..192a8669d51 100644 --- a/tsconfig-eslint.json +++ b/tsconfig-eslint.json @@ -29,8 +29,6 @@ "step-generation/typings", "protocol-designer/src", "protocol-designer/typings", - "protocol-library-kludge/src", - "protocol-library-kludge/typings", "api-client/src", "react-api-client/src", "usb-bridge/node-client/src" diff --git a/tsconfig.json b/tsconfig.json index f27d80b162c..86ef965328e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -31,9 +31,6 @@ { "path": "./protocol-designer" }, - { - "path": "./protocol-library-kludge" - }, { "path": "./api-client" },