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

[pending]feat(protocol-designer): introduce alias to avoid using ../../../ #17539

Draft
wants to merge 7 commits into
base: edge
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 4 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,10 @@
},
},
{
files: ['./app/src/**/*.@(ts|tsx)'],
files: [
'./app/src/**/*.@(ts|tsx)',
'./protocol-designer/src/**/*.@(ts|tsx)',
],

Check warning on line 126 in .eslintrc.js

View check run for this annotation

Codecov / codecov/patch

.eslintrc.js#L123-L126

Added lines #L123 - L126 were not covered by tests
rules: {
'import/no-absolute-path': 'off',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const getSchemaDefForProtocol = (protocol: any): any => {
describe('Protocol fixtures should validate under their JSON schemas', () => {
const fixtureDirsGlobPath = path.join(
__dirname,
'../../fixtures/protocol/**/*.json'
'/protocol-designer/fixtures/protocol/**/*.json'
)
const fixturePaths = glob.sync(fixtureDirsGlobPath)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ import { reduxActionToAnalyticsEvent } from '../middleware'
import {
getFileMetadata,
getRobotStateTimeline,
} from '../../file-data/selectors'
} from '/protocol-designer/file-data/selectors'
import {
getArgsAndErrorsByStepId,
getPipetteEntities,
getSavedStepForms,
} from '../../step-forms/selectors'
import type { SaveStepFormsMultiAction } from '../../step-forms/actions'
} from '/protocol-designer/step-forms/selectors'
import type { SaveStepFormsMultiAction } from '/protocol-designer/step-forms/actions'

vi.mock('../../file-data/selectors')
vi.mock('../../step-forms/selectors')
vi.mock('/protocol-designer/file-data/selectors')
vi.mock('/protocol-designer/step-forms/selectors')

describe('reduxActionToAnalyticsEvent', () => {
let fooState: any
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import type {
LabwareEntities,
PipetteEntities,
} from '@opentrons/step-generation'
import type { DismissedWarningState } from '../../../dismiss/reducers'
import type { IngredientsState } from '../../../labware-ingred/reducers'
import type { LabwareDefByDefURI } from '../../../labware-defs'
import type { FileMetadataFields } from '../../types'
import type { DismissedWarningState } from '/protocol-designer/dismiss/reducers'
import type { IngredientsState } from '/protocol-designer/labware-ingred/reducers'
import type { LabwareDefByDefURI } from '/protocol-designer/labware-defs'
import type { FileMetadataFields } from '/protocol-designer/file-data/types'

const fixture96Plate = fixture_96_plate as LabwareDefinition2
const fixtureTiprack10ul = fixture_tiprack_10_ul as LabwareDefinition2
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
// Named arguments to createFile selector. This data would be the result of several selectors.
import type { RobotState, Timeline } from '@opentrons/step-generation'
import type { SavedStepFormState, ModuleEntities } from '../../../step-forms'
import type { StepIdType } from '../../../form-types'
import type {
SavedStepFormState,
ModuleEntities,
} from '/protocol-designer/step-forms'
import type { StepIdType } from '/protocol-designer/form-types'
export const initialRobotState: RobotState = {
labware: {
fixedTrash: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
// Named arguments to createFile selector. This data would be the result of several selectors.
import type { RobotState, Timeline } from '@opentrons/step-generation'
import type { SavedStepFormState, ModuleEntities } from '../../../step-forms'
import type { StepIdType } from '../../../form-types'
import type {
SavedStepFormState,
ModuleEntities,
} from '/protocol-designer/step-forms'
import type { StepIdType } from '/protocol-designer/form-types'
export const initialRobotState: RobotState = {
labware: {
fixedTrash: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
// Named arguments to createFile selector. This data would be the result of several selectors.
import type { RobotState, Timeline } from '@opentrons/step-generation'
import type { SavedStepFormState, ModuleEntities } from '../../../step-forms'
import type { StepIdType } from '../../../form-types'
import type {
SavedStepFormState,
ModuleEntities,
} from '/protocol-designer/step-forms'
import type { StepIdType } from '/protocol-designer/form-types'
export const initialRobotState: RobotState = {
labware: {
fixedTrash: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
// Named arguments to createFile selector. This data would be the result of several selectors.
import type { RobotState, Timeline } from '@opentrons/step-generation'
import type { SavedStepFormState, ModuleEntities } from '../../../step-forms'
import type { StepIdType } from '../../../form-types'
import type {
SavedStepFormState,
ModuleEntities,
} from '/protocol-designer/step-forms'
import type { StepIdType } from '/protocol-designer/form-types'
export const initialRobotState: RobotState = {
labware: {
fixedTrash: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {

import { getLabwareLiquidState } from '../selectors'

vi.mock('../../labware-defs/utils')
vi.mock('/protocol-designer/labware-defs/utils')

let labwareEntities: any
let ingredLocs: any
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
fixture_tiprack_10_ul,
fixture_tiprack_300_ul,
} from '@opentrons/shared-data/labware/fixtures/2'
import { getLoadLiquidCommands } from '../../load-file/migration/utils/getLoadLiquidCommands'
import { getLoadLiquidCommands } from '/protocol-designer/load-file/migration/utils/getLoadLiquidCommands'
import {
createFile,
createPythonFile,
Expand All @@ -31,14 +31,15 @@ import {
pipetteEntities,
} from '../__fixtures__/createFile/commonFields'
import * as v7Fixture from '../__fixtures__/createFile/v7Fixture'

import type { LabwareDefinition2 } from '@opentrons/shared-data'
import type {
LabwareEntities,
PipetteEntities,
} from '../../../../step-generation/src/types'
import type { LabwareDefByDefURI } from '../../labware-defs'
} from '@opentrons/step-generation'
import type { LabwareDefByDefURI } from '/protocol-designer/labware-defs'

vi.mock('../../load-file/migration/utils/getLoadLiquidCommands')
vi.mock('/protocol-designer/load-file/migration/utils/getLoadLiquidCommands')

const ajv = new Ajv({
allErrors: true,
Expand Down
9 changes: 6 additions & 3 deletions protocol-designer/src/file-data/reducers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ import { OT2_ROBOT_TYPE } from '@opentrons/shared-data'
import type { Reducer } from 'redux'
import type { Timeline } from '@opentrons/step-generation'
import type { RobotType } from '@opentrons/shared-data'
import type { Action } from '../../types'
import type { LoadFileAction, NewProtocolFields } from '../../load-file'
import type { Substeps } from '../../steplist/types'
import type { Action } from '/protocol-designer/types'
import type {
LoadFileAction,
NewProtocolFields,
} from '/protocol-designer/load-file'
import type { Substeps } from '/protocol-designer/steplist/types'
import type {
ComputeRobotStateTimelineSuccessAction,
DesignerTabPayload,
Expand Down
14 changes: 7 additions & 7 deletions protocol-designer/src/file-data/selectors/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@
import omit from 'lodash/omit'
import uniqBy from 'lodash/uniqBy'
import * as StepGeneration from '@opentrons/step-generation'
import { getAllWellsForLabware } from '../../constants'
import { selectors as labwareIngredSelectors } from '../../labware-ingred/selectors'
import { selectors as stepFormSelectors } from '../../step-forms'
import { getAllWellsForLabware } from '/protocol-designer/constants'
import { selectors as labwareIngredSelectors } from '/protocol-designer/labware-ingred/selectors'
import { selectors as stepFormSelectors } from '/protocol-designer/step-forms'
import type {
LabwareOnDeck,
LabwareTemporalProperties,
ModuleOnDeck,
ModuleTemporalProperties,
PipetteOnDeck,
PipetteTemporalProperties,
} from '../../step-forms'
import type { Substeps } from '../../steplist/types'
import type { BaseState, Selector } from '../../types'
import type { StepIdType } from '../../form-types'
} from '/protocol-designer/step-forms'
import type { Substeps } from '/protocol-designer/steplist/types'
import type { BaseState, Selector } from '/protocol-designer/types'
import type { StepIdType } from '/protocol-designer/form-types'

// NOTE this just adds missing well keys to the labware-ingred 'deck setup' liquid state
export const getLabwareLiquidState: Selector<StepGeneration.LabwareLiquidState> = createSelector(
labwareIngredSelectors.getLiquidsByLabwareId,

Check failure on line 24 in protocol-designer/src/file-data/selectors/commands.ts

View workflow job for this annotation

GitHub Actions / js checks

Unsafe argument of type `any` assigned to a parameter of type `Selector<unknown, unknown>`

Check failure on line 24 in protocol-designer/src/file-data/selectors/commands.ts

View workflow job for this annotation

GitHub Actions / js checks

Unsafe argument of type `any` assigned to a parameter of type `Selector<unknown, unknown>`
stepFormSelectors.getLabwareEntities,

Check failure on line 25 in protocol-designer/src/file-data/selectors/commands.ts

View workflow job for this annotation

GitHub Actions / js checks

Unsafe argument of type `any` assigned to a parameter of type `Selector<unknown, unknown>`

Check failure on line 25 in protocol-designer/src/file-data/selectors/commands.ts

View workflow job for this annotation

GitHub Actions / js checks

Unsafe argument of type `any` assigned to a parameter of type `Selector<unknown, unknown>`
(ingredLocations, labwareEntities) => {
const allLabwareIds: string[] = Object.keys(labwareEntities)
return allLabwareIds.reduce(
Expand Down Expand Up @@ -51,7 +51,7 @@
export const getInitialRobotState: (
arg0: BaseState
) => StepGeneration.RobotState = createSelector(
stepFormSelectors.getInitialDeckSetup,

Check failure on line 54 in protocol-designer/src/file-data/selectors/commands.ts

View workflow job for this annotation

GitHub Actions / js checks

Unsafe argument of type `any` assigned to a parameter of type `Selector<any, unknown>`

Check failure on line 54 in protocol-designer/src/file-data/selectors/commands.ts

View workflow job for this annotation

GitHub Actions / js checks

Unsafe argument of type `any` assigned to a parameter of type `Selector<any, unknown>`
stepFormSelectors.getInvariantContext,
getLabwareLiquidState,
(initialDeckSetup, invariantContext, labwareLiquidState) => {
Expand Down
20 changes: 10 additions & 10 deletions protocol-designer/src/file-data/selectors/fileCreator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ import {
FLEX_STANDARD_DECKID,
} from '@opentrons/shared-data'

import { selectors as dismissSelectors } from '../../dismiss'
import { selectors as labwareDefSelectors } from '../../labware-defs'
import { selectors as ingredSelectors } from '../../labware-ingred/selectors'
import { selectors as stepFormSelectors } from '../../step-forms'
import { selectors as uiLabwareSelectors } from '../../ui/labware'
import { swatchColors } from '../../organisms/DefineLiquidsModal/swatchColors'
import { getStepGroups } from '../../step-forms/selectors'
import { selectors as dismissSelectors } from '/protocol-designer/dismiss'
import { selectors as labwareDefSelectors } from '/protocol-designer/labware-defs'
import { selectors as ingredSelectors } from '/protocol-designer/labware-ingred/selectors'
import { selectors as stepFormSelectors } from '/protocol-designer/step-forms'
import { selectors as uiLabwareSelectors } from '/protocol-designer/ui/labware'
import { swatchColors } from '/protocol-designer/organisms/DefineLiquidsModal/swatchColors'
import { getStepGroups } from '/protocol-designer/step-forms/selectors'
import { getFileMetadata, getRobotType } from './fileFields'
import { getInitialRobotState, getRobotStateTimeline } from './commands'
import {
Expand Down Expand Up @@ -51,9 +51,9 @@ import type {
ProtocolBase,
ProtocolFile,
} from '@opentrons/shared-data'
import type { LabwareDefByDefURI } from '../../labware-defs'
import type { Selector } from '../../types'
import type { PDMetadata } from '../../file-types'
import type { LabwareDefByDefURI } from '/protocol-designer/labware-defs'
import type { Selector } from '/protocol-designer/types'
import type { PDMetadata } from '/protocol-designer/file-types'

// TODO: BC: 2018-02-21 uncomment this assert, causes test failures
// console.assert(!isEmpty(process.env.OT_PD_VERSION), 'Could not find application version!')
Expand Down
2 changes: 1 addition & 1 deletion protocol-designer/src/file-data/selectors/fileFields.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createSelector } from 'reselect'
import type { BaseState, Selector } from '../../types'
import type { BaseState, Selector } from '/protocol-designer/types'
import type { RootState } from '../reducers'
import type { FileMetadataFields } from '../types'
import type { RobotType } from '@opentrons/shared-data'
Expand Down
4 changes: 2 additions & 2 deletions protocol-designer/src/file-data/selectors/utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import mapValues from 'lodash/mapValues'
import map from 'lodash/map'
import reduce from 'lodash/reduce'
import { getLoadLiquidCommands } from '../../load-file/migration/utils/getLoadLiquidCommands'
import { getLoadLiquidCommands } from '/protocol-designer/load-file/migration/utils/getLoadLiquidCommands'
import { COLUMN_4_SLOTS, uuid } from '@opentrons/step-generation'
import type {
AddressableAreaName,
Expand All @@ -25,7 +25,7 @@ import type {
ModuleEntity,
LabwareEntity,
} from '@opentrons/step-generation'
import type { Labware, Modules, Pipettes } from '../../file-types'
import type { Labware, Modules, Pipettes } from '/protocol-designer/file-types'

interface MappedPipettes {
[pipetteId: string]: { name: PipetteName }
Expand Down
4 changes: 2 additions & 2 deletions protocol-designer/src/labware-defs/__mocks__/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

const LABWARE_FIXTURE_PATTERN = path.join(
__dirname,
'../../../../shared-data/labware/fixtures/2/*.json'
'/protocol-designer/shared-data/labware/fixtures/2/*.json'

Check warning on line 12 in protocol-designer/src/labware-defs/__mocks__/utils.ts

View check run for this annotation

Codecov / codecov/patch

protocol-designer/src/labware-defs/__mocks__/utils.ts#L12

Added line #L12 was not covered by tests
)
const allLabware: LabwareDefByDefURI = glob
.sync(LABWARE_FIXTURE_PATTERN)
Expand All @@ -28,7 +28,7 @@

const LEGACY_LABWARE_FIXTURE_PATTERN = path.join(
__dirname,
'../../../../shared-data/labware/fixtures/1/*.json'
'/protocol-designer/shared-data/labware/fixtures/1/*.json'

Check warning on line 31 in protocol-designer/src/labware-defs/__mocks__/utils.ts

View check run for this annotation

Codecov / codecov/patch

protocol-designer/src/labware-defs/__mocks__/utils.ts#L31

Added line #L31 was not covered by tests
)
const legacyLabwareDefs: LabwareDefinition1[] = glob
.sync(LEGACY_LABWARE_FIXTURE_PATTERN)
Expand Down
20 changes: 10 additions & 10 deletions protocol-designer/src/labware-ingred/__tests__/actions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ import {
fixture_96_plate,
fixture_tiprack_10_ul,
} from '@opentrons/shared-data/labware/fixtures/2'
import { getLabwareDefsByURI } from '../../labware-defs/selectors'
import { getInitialDeckSetup } from '../../step-forms/selectors'
import { getLabwareNicknamesById } from '../../ui/labware/selectors'
import { uuid } from '../../utils'
import { getRobotType } from '../../file-data/selectors'
import { getLabwareDefsByURI } from '/protocol-designer/labware-defs/selectors'
import { getInitialDeckSetup } from '/protocol-designer/step-forms/selectors'
import { getLabwareNicknamesById } from '/protocol-designer/ui/labware/selectors'
import { uuid } from '/protocol-designer/utils'
import { getRobotType } from '/protocol-designer/file-data/selectors'
import { renameLabware, createContainer } from '../actions'
import { getNextAvailableDeckSlot, getNextNickname } from '../utils'
import type { LabwareDefinition2 } from '@opentrons/shared-data'

vi.mock('../../labware-defs/selectors')
vi.mock('../../step-forms/selectors')
vi.mock('../../ui/labware/selectors')
vi.mock('../../file-data/selectors')
vi.mock('../../utils')
vi.mock('/protocol-designer/labware-defs/selectors')
vi.mock('/protocol-designer/step-forms/selectors')
vi.mock('/protocol-designer/ui/labware/selectors')
vi.mock('/protocol-designer/file-data/selectors')
vi.mock('/protocol-designer/utils')
vi.mock('../utils')

const middlewares = [thunk]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, it, expect, vi } from 'vitest'
import { containers } from '../reducers'
vi.mock('../../labware-defs/utils')
vi.mock('/protocol-designer/labware-defs/utils')

const containersInitialState = {}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, it, expect, vi } from 'vitest'
import { ingredients, ingredLocations } from '../reducers'
import type { LiquidEntities } from '@opentrons/step-generation'
vi.mock('../../labware-defs/utils')
vi.mock('/protocol-designer/labware-defs/utils')

describe('DUPLICATE_LABWARE action', () => {
it('duplicate ingredient locations from cloned container', () => {
Expand Down
6 changes: 3 additions & 3 deletions protocol-designer/src/labware-ingred/actions/actions.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { createAction } from 'redux-actions'
import { getLiquidEntities } from '../../step-forms/selectors'
import { getLiquidEntities } from '/protocol-designer/step-forms/selectors'
import { selectors } from '../selectors'
import type { StepFieldName } from '../../form-types'
import type { DeckSlot, ThunkAction } from '../../types'
import type { StepFieldName } from '/protocol-designer/form-types'
import type { DeckSlot, ThunkAction } from '/protocol-designer/types'
import type { Fixture, IngredInputs } from '../types'
import type {
CutoutId,
Expand Down
16 changes: 8 additions & 8 deletions protocol-designer/src/labware-ingred/actions/thunks.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { getIsTiprack } from '@opentrons/shared-data'
import { getLabwarePythonName, uuid } from '../../utils'
import { getLabwareEntities } from '../../step-forms/selectors'
import { selectors as labwareDefSelectors } from '../../labware-defs'
import { selectors as stepFormSelectors } from '../../step-forms'
import { selectors as uiLabwareSelectors } from '../../ui/labware'
import { getLabwarePythonName, uuid } from '/protocol-designer/utils'
import { getLabwareEntities } from '/protocol-designer/step-forms/selectors'
import { selectors as labwareDefSelectors } from '/protocol-designer/labware-defs'
import { selectors as stepFormSelectors } from '/protocol-designer/step-forms'
import { selectors as uiLabwareSelectors } from '/protocol-designer/ui/labware'
import { getNextAvailableDeckSlot, getNextNickname } from '../utils'
import { getRobotType } from '../../file-data/selectors'
import { getRobotType } from '/protocol-designer/file-data/selectors'
import type { LabwareEntities } from '@opentrons/step-generation'
import {
selectNestedLabware,
Expand All @@ -18,7 +18,7 @@ import type {
ModuleOnDeck,
NormalizedLabware,
NormalizedLabwareById,
} from '../../step-forms'
} from '/protocol-designer/step-forms'
import type {
CreateContainerArgs,
CreateContainerAction,
Expand All @@ -29,7 +29,7 @@ import type {
SelectFixtureAction,
DeleteContainerAction,
} from './actions'
import type { ThunkAction } from '../../types'
import type { ThunkAction } from '/protocol-designer/types'
import type { Fixture } from '../types'

export interface RenameLabwareAction {
Expand Down
6 changes: 3 additions & 3 deletions protocol-designer/src/labware-ingred/reducers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { handleActions } from 'redux-actions'
import omit from 'lodash/omit'
import mapValues from 'lodash/mapValues'
import pickBy from 'lodash/pickBy'
import { getPDMetadata } from '../../file-types'
import { getPDMetadata } from '/protocol-designer/file-types'
import type { Reducer } from 'redux'
import type {
SingleLabwareLiquidState,
Expand All @@ -13,13 +13,13 @@ import type {
LiquidEntity,
} from '@opentrons/step-generation'
import type { LoadLabwareCreateCommand } from '@opentrons/shared-data'
import type { Action, DeckSlot } from '../../types'
import type { Action, DeckSlot } from '/protocol-designer/types'
import type {
DisplayLabware,
ZoomedIntoSlotInfoState,
GenerateNewProtocolState,
} from '../types'
import type { LoadFileAction } from '../../load-file'
import type { LoadFileAction } from '/protocol-designer/load-file'
import type {
RemoveWellsContentsAction,
CreateContainerAction,
Expand Down
Loading
Loading