diff --git a/protocol-designer/src/components/FileSidebar/ConnectedFileSidebar.js b/protocol-designer/src/components/FileSidebar/ConnectedFileSidebar.js index f24114a8718..a99d425eec7 100644 --- a/protocol-designer/src/components/FileSidebar/ConnectedFileSidebar.js +++ b/protocol-designer/src/components/FileSidebar/ConnectedFileSidebar.js @@ -24,7 +24,7 @@ export default connect(mapStateToProps, null, mergeProps)(FileSidebar) function mapStateToProps (state: BaseState): SP & MP { const protocolName = fileDataSelectors.getFileMetadata(state)['protocol-name'] || 'untitled' const fileData = fileDataSelectors.createFile(state) - const canDownload = selectors.currentPage(state) !== 'file-splash' + const canDownload = selectors.getCurrentPage(state) !== 'file-splash' return { downloadData: (canDownload) @@ -34,8 +34,8 @@ function mapStateToProps (state: BaseState): SP & MP { } : null, // Ignore clicking 'CREATE NEW' button in these cases - _canCreateNew: !selectors.newProtocolModal(state), - _hasUnsavedChanges: loadFileSelectors.hasUnsavedChanges(state), + _canCreateNew: !selectors.getNewProtocolModal(state), + _hasUnsavedChanges: loadFileSelectors.getHasUnsavedChanges(state), } } diff --git a/protocol-designer/src/components/IngredientsList/LabwareDetailsCard/index.js b/protocol-designer/src/components/IngredientsList/LabwareDetailsCard/index.js index 3055e8b7b45..7947ebc13c5 100644 --- a/protocol-designer/src/components/IngredientsList/LabwareDetailsCard/index.js +++ b/protocol-designer/src/components/IngredientsList/LabwareDetailsCard/index.js @@ -17,7 +17,7 @@ type DP = { type SP = $Diff & {_labwareId: ?string} function mapStateToProps (state: BaseState): SP { - const labwareData = labwareIngredSelectors.getSelectedContainer(state) + const labwareData = labwareIngredSelectors.getSelectedLabware(state) assert(labwareData, 'Expected labware data to exist in connected labware details card') const props = (labwareData) diff --git a/protocol-designer/src/components/LabwareSelectionModal/index.js b/protocol-designer/src/components/LabwareSelectionModal/index.js index f1b42dfd7e8..edd0261ea2b 100644 --- a/protocol-designer/src/components/LabwareSelectionModal/index.js +++ b/protocol-designer/src/components/LabwareSelectionModal/index.js @@ -18,7 +18,7 @@ type SP = { function mapStateToProps (state: BaseState): SP { return { slot: labwareIngredSelectors.selectedAddLabwareSlot(state) || null, - permittedTipracks: pipetteSelectors.permittedTipracks(state), + permittedTipracks: pipetteSelectors.getPermittedTipracks(state), } } diff --git a/protocol-designer/src/components/LiquidPlacementForm/index.js b/protocol-designer/src/components/LiquidPlacementForm/index.js index 040bc56ca40..b8e867f853e 100644 --- a/protocol-designer/src/components/LiquidPlacementForm/index.js +++ b/protocol-designer/src/components/LiquidPlacementForm/index.js @@ -32,8 +32,8 @@ type SP = $Diff & { function mapStateToProps (state: BaseState): SP { const selectedWells = Object.keys(wellSelectionSelectors.getSelectedWells(state)) - const _labwareId = labwareIngredSelectors.getSelectedContainerId(state) - const liquidLocations = labwareIngredSelectors.getIngredientLocations(state) + const _labwareId = labwareIngredSelectors.getSelectedLabwareId(state) + const liquidLocations = labwareIngredSelectors.getLiquidsByLabwareId(state) const _selectionHasLiquids = Boolean( _labwareId && liquidLocations[_labwareId] && @@ -45,7 +45,7 @@ function mapStateToProps (state: BaseState): SP { commonSelectedVolume: wellContentsSelectors.getSelectedWellsCommonVolume(state), liquidSelectionOptions: labwareIngredSelectors.getLiquidSelectionOptions(state), showForm: selectedWells.length > 0, - selectedWellsMaxVolume: wellContentsSelectors.selectedWellsMaxVolume(state), + selectedWellsMaxVolume: wellContentsSelectors.getSelectedWellsMaxVolume(state), _labwareId, _selectedWells: selectedWells, diff --git a/protocol-designer/src/components/LiquidPlacementModal.js b/protocol-designer/src/components/LiquidPlacementModal.js index 9155939d3c2..764c37d9a4c 100644 --- a/protocol-designer/src/components/LiquidPlacementModal.js +++ b/protocol-designer/src/components/LiquidPlacementModal.js @@ -71,7 +71,7 @@ class LiquidPlacementModal extends React.Component { } const mapStateToProps = (state: BaseState): SP => { - const containerId = selectors.getSelectedContainerId(state) + const containerId = selectors.getSelectedLabwareId(state) const selectedWells = wellSelectionSelectors.getSelectedWells(state) if (containerId === null) { console.error('LiquidPlacementModal: No labware is selected, and no labwareId was given to LiquidPlacementModal') @@ -83,11 +83,11 @@ const mapStateToProps = (state: BaseState): SP => { } } - const labware = selectors.getLabware(state)[containerId] + const labware = selectors.getLabwareById(state)[containerId] let wellContents: ContentsByWell = {} // selection for deck setup: shows initial state of liquids - wellContents = wellContentsSelectors.wellContentsAllLabware(state)[containerId] + wellContents = wellContentsSelectors.getWellContentsAllLabware(state)[containerId] return { selectedWells, diff --git a/protocol-designer/src/components/SettingsPage/SettingsSidebar.js b/protocol-designer/src/components/SettingsPage/SettingsSidebar.js index b17475b68b7..5e9e48a18b0 100644 --- a/protocol-designer/src/components/SettingsPage/SettingsSidebar.js +++ b/protocol-designer/src/components/SettingsPage/SettingsSidebar.js @@ -29,7 +29,7 @@ const SettingsSidebar = (props: SP & DP) => ( ) const STP = (state: BaseState): SP => ({ - currentPage: selectors.currentPage(state), + currentPage: selectors.getCurrentPage(state), }) const DTP = (dispatch: ThunkDispatch<*>): DP => ({ diff --git a/protocol-designer/src/components/SettingsPage/index.js b/protocol-designer/src/components/SettingsPage/index.js index d2b428272ce..3529ad977df 100644 --- a/protocol-designer/src/components/SettingsPage/index.js +++ b/protocol-designer/src/components/SettingsPage/index.js @@ -23,7 +23,7 @@ const SettingsPage = (props: SP) => { } const STP = (state: BaseState): SP => ({ - currentPage: selectors.currentPage(state), + currentPage: selectors.getCurrentPage(state), }) export default connect(STP)(SettingsPage) diff --git a/protocol-designer/src/components/StepEditForm/ButtonRow.js b/protocol-designer/src/components/StepEditForm/ButtonRow.js index 8fbf8c3bff8..6f266be07ac 100644 --- a/protocol-designer/src/components/StepEditForm/ButtonRow.js +++ b/protocol-designer/src/components/StepEditForm/ButtonRow.js @@ -29,7 +29,9 @@ const ButtonRow = (props: Props) => { ) } -const STP = (state: BaseState): SP => ({ canSave: selectors.currentFormCanBeSaved(state) }) +const STP = (state: BaseState): SP => ({ + canSave: selectors.getCurrentFormCanBeSaved(state), +}) const DTP = (dispatch: ThunkDispatch<*>): DP => ({ onCancel: () => dispatch(actions.cancelStepForm()), diff --git a/protocol-designer/src/components/StepEditForm/FlowRateField/index.js b/protocol-designer/src/components/StepEditForm/FlowRateField/index.js index 6aeae4b8bc5..143d4d09de9 100644 --- a/protocol-designer/src/components/StepEditForm/FlowRateField/index.js +++ b/protocol-designer/src/components/StepEditForm/FlowRateField/index.js @@ -40,7 +40,7 @@ function mapStateToProps (state: BaseState, ownProps: OP): SP { const formData = steplistSelectors.getUnsavedForm(state) const pipetteId = formData ? formData[pipetteFieldName] : null - const pipette = pipetteId && pipetteSelectors.pipettesById(state)[pipetteId] + const pipette = pipetteId && pipetteSelectors.getPipettesById(state)[pipetteId] const pipetteConfig = pipette && getPipetteNameSpecs(pipette.model) const pipetteDisplayName = pipetteConfig ? pipetteConfig.displayName : 'pipette' diff --git a/protocol-designer/src/components/StepEditForm/FormAlerts.js b/protocol-designer/src/components/StepEditForm/FormAlerts.js index 81debb2f1f0..5315b4b9ee8 100644 --- a/protocol-designer/src/components/StepEditForm/FormAlerts.js +++ b/protocol-designer/src/components/StepEditForm/FormAlerts.js @@ -69,7 +69,7 @@ const mapStateToProps = (state: BaseState, ownProps: OP): SP => { alerts: dismissSelectors.getFormWarningsForSelectedStep(state), }) - const errors = steplistSelectors.formLevelErrors(state) + const errors = steplistSelectors.getFormLevelErrors(state) const filteredErrors = getVisibleAlerts({ focusedField, dirtyFields, diff --git a/protocol-designer/src/components/StepEditForm/FormSection.js b/protocol-designer/src/components/StepEditForm/FormSection.js index 9997a165683..b23e1ba5545 100644 --- a/protocol-designer/src/components/StepEditForm/FormSection.js +++ b/protocol-designer/src/components/StepEditForm/FormSection.js @@ -46,7 +46,7 @@ const FormSection = (props: FormSectionProps) => { } const FormSectionSTP = (state: BaseState, ownProps: OP) => ({ - collapsed: steplistSelectors.formSectionCollapse(state)[ownProps.sectionName], + collapsed: steplistSelectors.getFormSectionCollapsed(state)[ownProps.sectionName], }) const FormSectionDTP = (dispatch: ThunkDispatch<*>, ownProps: OP) => ({ onCollapseToggle: () => dispatch(collapseFormSection(ownProps.sectionName)), diff --git a/protocol-designer/src/components/StepEditForm/TipPositionInput/index.js b/protocol-designer/src/components/StepEditForm/TipPositionInput/index.js index ee29a1d9dfc..0d48d56a349 100644 --- a/protocol-designer/src/components/StepEditForm/TipPositionInput/index.js +++ b/protocol-designer/src/components/StepEditForm/TipPositionInput/index.js @@ -99,7 +99,7 @@ const mapSTP = (state: BaseState, ownProps: OP): SP => { let wellHeightMM = null if (formData && formData[labwareFieldName]) { - const labwareById = labwareIngredsSelectors.getLabware(state) + const labwareById = labwareIngredsSelectors.getLabwareById(state) const labware = labwareById[formData[labwareFieldName]] const labwareDef = labware && labware.type && getLabware(labware.type) if (labwareDef) { diff --git a/protocol-designer/src/components/StepEditForm/WellSelectionInput/WellSelectionModal.js b/protocol-designer/src/components/StepEditForm/WellSelectionInput/WellSelectionModal.js index 98dc2ed1a2d..be17954ec62 100644 --- a/protocol-designer/src/components/StepEditForm/WellSelectionInput/WellSelectionModal.js +++ b/protocol-designer/src/components/StepEditForm/WellSelectionInput/WellSelectionModal.js @@ -115,13 +115,13 @@ class WellSelectionModal extends React.Component { function mapStateToProps (state: BaseState, ownProps: OP): SP { const {pipetteId, labwareId} = ownProps - const allLabware = selectors.getLabware(state) + const allLabware = selectors.getLabwareById(state) const labware = labwareId && allLabware && allLabware[labwareId] - const allWellContentsForSteps = wellContentsSelectors.allWellContentsForSteps(state) + const allWellContentsForSteps = wellContentsSelectors.getAllWellContentsForSteps(state) const stepId = steplistSelectors.getSelectedStepId(state) // TODO: Ian 2018-07-31 replace with util function, "findIndexOrNull"? - const orderedSteps = steplistSelectors.orderedSteps(state) + const orderedSteps = steplistSelectors.getOrderedSteps(state) const timelineIdx = orderedSteps.findIndex(id => id === stepId) const allWellContentsForStep = allWellContentsForSteps[timelineIdx] const formData = steplistSelectors.getUnsavedForm(state) @@ -129,7 +129,7 @@ function mapStateToProps (state: BaseState, ownProps: OP): SP { return { initialSelectedWells: formData ? formData[ownProps.name] : [], - pipette: pipetteId ? pipetteSelectors.equippedPipettes(state)[pipetteId] : null, + pipette: pipetteId ? pipetteSelectors.getEquippedPipettes(state)[pipetteId] : null, wellContents: labware && allWellContentsForStep ? allWellContentsForStep[labware.id] : {}, containerType: labware ? labware.type : 'missing labware', ingredNames, diff --git a/protocol-designer/src/components/StepEditForm/WellSelectionInput/index.js b/protocol-designer/src/components/StepEditForm/WellSelectionInput/index.js index dd524ac1212..3873bc171ee 100644 --- a/protocol-designer/src/components/StepEditForm/WellSelectionInput/index.js +++ b/protocol-designer/src/components/StepEditForm/WellSelectionInput/index.js @@ -34,7 +34,7 @@ const mapStateToProps = (state: BaseState, ownProps: OP): SP => { const formData = steplistSelectors.getUnsavedForm(state) const pipetteId = formData && formData[ownProps.pipetteFieldName] const selectedWells = formData ? formData[ownProps.name] : [] - const pipetteData = pipetteId && pipetteSelectors.pipettesById(state)[pipetteId] + const pipetteData = pipetteId && pipetteSelectors.getPipettesById(state)[pipetteId] const isMulti = pipetteData && (pipetteData.channels > 1) return { diff --git a/protocol-designer/src/components/StepEditForm/formFields.js b/protocol-designer/src/components/StepEditForm/formFields.js index ae473a63dbe..12d28e00d18 100644 --- a/protocol-designer/src/components/StepEditForm/formFields.js +++ b/protocol-designer/src/components/StepEditForm/formFields.js @@ -121,7 +121,7 @@ type PipetteFieldSP = {pipetteOptions: Options, getHydratedPipette: (string) => type PipetteFieldDP = {updateDisposalVolume: (?mixed) => void} type PipetteFieldProps = PipetteFieldOP & PipetteFieldSP & PipetteFieldDP const PipetteFieldSTP = (state: BaseState, ownProps: PipetteFieldOP): PipetteFieldSP => ({ - pipetteOptions: pipetteSelectors.equippedPipetteOptions(state), + pipetteOptions: pipetteSelectors.getEquippedPipetteOptions(state), getHydratedPipette: (value) => hydrateField(state, ownProps.name, value), }) const PipetteFieldDTP = (dispatch: ThunkDispatch<*>): PipetteFieldDP => ({ diff --git a/protocol-designer/src/components/StepEditForm/index.js b/protocol-designer/src/components/StepEditForm/index.js index 340836b98c1..6f531ee1cd2 100644 --- a/protocol-designer/src/components/StepEditForm/index.js +++ b/protocol-designer/src/components/StepEditForm/index.js @@ -122,8 +122,8 @@ class StepEditForm extends React.Component { } const mapStateToProps = (state: BaseState): SP => ({ - formData: selectors.formData(state), - isNewStep: selectors.isNewStepForm(state), + formData: selectors.getUnsavedForm(state), + isNewStep: selectors.getIsNewStepForm(state), }) const mapDispatchToProps = (dispatch: ThunkDispatch<*>): DP => ({ diff --git a/protocol-designer/src/components/alerts/TimelineAlerts.js b/protocol-designer/src/components/alerts/TimelineAlerts.js index 7279c0689fa..b5c5c163c7f 100644 --- a/protocol-designer/src/components/alerts/TimelineAlerts.js +++ b/protocol-designer/src/components/alerts/TimelineAlerts.js @@ -39,7 +39,7 @@ type MP = { */ function mapStateToProps (state: BaseState): SP { - const timeline = fileDataSelectors.robotStateTimeline(state) + const timeline = fileDataSelectors.getRobotStateTimeline(state) const errors = timeline.errors || [] const warnings = dismissSelectors.getTimelineWarningsForSelectedStep(state) const _stepId = steplistSelectors.getSelectedStepId(state) diff --git a/protocol-designer/src/components/labware/BrowseLabwareModal.js b/protocol-designer/src/components/labware/BrowseLabwareModal.js index bfcade9daa3..3deb3bff918 100644 --- a/protocol-designer/src/components/labware/BrowseLabwareModal.js +++ b/protocol-designer/src/components/labware/BrowseLabwareModal.js @@ -91,9 +91,9 @@ class BrowseLabwareModal extends React.Component { function mapStateToProps (state: BaseState): SP { const labwareId = selectors.getDrillDownLabwareId(state) - const allLabware = selectors.getLabware(state) + const allLabware = selectors.getLabwareById(state) const labware = labwareId && allLabware ? allLabware[labwareId] : null - const allWellContents = wellContentsSelectors.lastValidWellContents(state) + const allWellContents = wellContentsSelectors.getLastValidWellContents(state) const wellContents = labwareId && allWellContents ? allWellContents[labwareId] : {} const ingredNames = selectors.getLiquidNamesById(state) return { diff --git a/protocol-designer/src/components/modals/EditPipettesModal/index.js b/protocol-designer/src/components/modals/EditPipettesModal/index.js index 54b575145f4..c35dcde6e05 100644 --- a/protocol-designer/src/components/modals/EditPipettesModal/index.js +++ b/protocol-designer/src/components/modals/EditPipettesModal/index.js @@ -203,7 +203,7 @@ class EditPipettesModal extends React.Component { } const mapSTP = (state: BaseState): SP => { - const pipetteData = pipetteSelectors.pipettesForEditPipettes(state) + const pipetteData = pipetteSelectors.getPipettesForEditPipettes(state) return { initialLeft: pipetteData.find(i => i.mount === 'left'), initialRight: pipetteData.find(i => i.mount === 'right'), diff --git a/protocol-designer/src/components/steplist/StartingDeckStateTerminalItem.js b/protocol-designer/src/components/steplist/StartingDeckStateTerminalItem.js index 59497764664..8d110c2aec6 100644 --- a/protocol-designer/src/components/steplist/StartingDeckStateTerminalItem.js +++ b/protocol-designer/src/components/steplist/StartingDeckStateTerminalItem.js @@ -29,7 +29,7 @@ function StartingDeckStateTerminalItem (props: Props) { function mapStateToProps (state: BaseState): Props { // since default-trash counts as 1, labwareCount <= 1 means "user did not add labware" - const noLabware = Object.keys(labwareIngredsSelectors.getLabware(state)).length <= 1 + const noLabware = Object.keys(labwareIngredsSelectors.getLabwareById(state)).length <= 1 return {showHint: noLabware} } diff --git a/protocol-designer/src/containers/Alerts.js b/protocol-designer/src/containers/Alerts.js index 1538e167e94..6ffcefb18bc 100644 --- a/protocol-designer/src/containers/Alerts.js +++ b/protocol-designer/src/containers/Alerts.js @@ -64,7 +64,7 @@ function Alerts (props: Props) { } function mapStateToProps (state: BaseState): SP { - const timeline = fileDataSelectors.robotStateTimeline(state) + const timeline = fileDataSelectors.getRobotStateTimeline(state) const errors = timeline.errors || [] const warnings = dismissSelectors.getTimelineWarningsForSelectedStep(state) const _stepId = steplistSelectors.getSelectedStepId(state) diff --git a/protocol-designer/src/containers/ConnectedDeckSetup.js b/protocol-designer/src/containers/ConnectedDeckSetup.js index 27047d6098f..45ffd3b8bf0 100644 --- a/protocol-designer/src/containers/ConnectedDeckSetup.js +++ b/protocol-designer/src/containers/ConnectedDeckSetup.js @@ -40,9 +40,9 @@ type Props = { const mapStateToProps = (state: BaseState): StateProps => ({ selectedTerminalItemId: steplistSelectors.getSelectedTerminalItemId(state), - ingredSelectionMode: Boolean(selectors.getSelectedContainer(state)), + ingredSelectionMode: Boolean(selectors.getSelectedLabware(state)), drilledDown: !!selectors.getDrillDownLabwareId(state), - _moveLabwareMode: !!selectors.slotToMoveFrom(state), + _moveLabwareMode: !!selectors.getSlotToMoveFrom(state), }) const mapDispatchToProps = (dispatch: ThunkDispatch<*>): DispatchProps => ({ diff --git a/protocol-designer/src/containers/ConnectedFilePage.js b/protocol-designer/src/containers/ConnectedFilePage.js index 62af0282102..7fe1545a37d 100644 --- a/protocol-designer/src/containers/ConnectedFilePage.js +++ b/protocol-designer/src/containers/ConnectedFilePage.js @@ -23,7 +23,7 @@ type DP = { } const mapStateToProps = (state: BaseState): SP => { - const pipetteData = pipetteSelectors.pipettesForInstrumentGroup(state) + const pipetteData = pipetteSelectors.getPipettesForInstrumentGroup(state) return { _values: fileSelectors.fileFormValues(state), isFormAltered: fileSelectors.isUnsavedMetadatFormAltered(state), diff --git a/protocol-designer/src/containers/ConnectedMainPanel.js b/protocol-designer/src/containers/ConnectedMainPanel.js index a1adc5bdf2c..261b8758b91 100644 --- a/protocol-designer/src/containers/ConnectedMainPanel.js +++ b/protocol-designer/src/containers/ConnectedMainPanel.js @@ -33,6 +33,6 @@ function MainPanel (props: Props) { function mapStateToProps (state: BaseState): Props { return { - page: selectors.currentPage(state), + page: selectors.getCurrentPage(state), } } diff --git a/protocol-designer/src/containers/ConnectedMoreOptionsModal.js b/protocol-designer/src/containers/ConnectedMoreOptionsModal.js index b3cfd3011b8..9fd5b4c2745 100644 --- a/protocol-designer/src/containers/ConnectedMoreOptionsModal.js +++ b/protocol-designer/src/containers/ConnectedMoreOptionsModal.js @@ -14,7 +14,7 @@ import { import type {BaseState, ThunkDispatch} from '../types' function mapStateToProps (state: BaseState) { - const formModalData = selectors.formModalData(state) + const formModalData = selectors.getFormModalData(state) return { hideModal: formModalData === null, formData: formModalData, diff --git a/protocol-designer/src/containers/ConnectedNav.js b/protocol-designer/src/containers/ConnectedNav.js index af3cd07b2ad..48bb0f6b8e0 100644 --- a/protocol-designer/src/containers/ConnectedNav.js +++ b/protocol-designer/src/containers/ConnectedNav.js @@ -59,7 +59,7 @@ function Nav (props: Props) { function mapStateToProps (state: BaseState) { return { - currentPage: selectors.currentPage(state), + currentPage: selectors.getCurrentPage(state), currentProtocolExists: fileSelectors.getCurrentProtocolExists(state), } } diff --git a/protocol-designer/src/containers/ConnectedNewFileModal.js b/protocol-designer/src/containers/ConnectedNewFileModal.js index 5737202eaa8..5330e652b94 100644 --- a/protocol-designer/src/containers/ConnectedNewFileModal.js +++ b/protocol-designer/src/containers/ConnectedNewFileModal.js @@ -25,8 +25,8 @@ type DP = { function mapStateToProps (state: BaseState): SP { return { - hideModal: !selectors.newProtocolModal(state), - _hasUnsavedChanges: loadFileSelectors.hasUnsavedChanges(state), + hideModal: !selectors.getNewProtocolModal(state), + _hasUnsavedChanges: loadFileSelectors.getHasUnsavedChanges(state), } } diff --git a/protocol-designer/src/containers/ConnectedSidebar.js b/protocol-designer/src/containers/ConnectedSidebar.js index 2ce921cc322..a52f2007be8 100644 --- a/protocol-designer/src/containers/ConnectedSidebar.js +++ b/protocol-designer/src/containers/ConnectedSidebar.js @@ -35,8 +35,8 @@ function Sidebar (props: Props) { } function mapStateToProps (state: BaseState): Props { - const page = selectors.currentPage(state) - const liquidPlacementMode = !!labwareIngredSelectors.getSelectedContainer(state) + const page = selectors.getCurrentPage(state) + const liquidPlacementMode = !!labwareIngredSelectors.getSelectedLabware(state) return { page, diff --git a/protocol-designer/src/containers/ConnectedStepItem.js b/protocol-designer/src/containers/ConnectedStepItem.js index b0332967704..e18581a3865 100644 --- a/protocol-designer/src/containers/ConnectedStepItem.js +++ b/protocol-designer/src/containers/ConnectedStepItem.js @@ -35,7 +35,7 @@ type DP = $Diff<$Diff, OP> function mapStateToProps (state: BaseState, ownProps: OP): SP { const {stepId} = ownProps - const allSteps = steplistSelectors.allSteps(state) + const allSteps = steplistSelectors.getAllSteps(state) const hoveredSubstep = steplistSelectors.getHoveredSubstep(state) const hoveredStep = steplistSelectors.getHoveredStepId(state) @@ -62,7 +62,7 @@ function mapStateToProps (state: BaseState, ownProps: OP): SP { // user is not hovering on substep. hovered: (hoveredStep === stepId) && !hoveredSubstep, - getLabware: (labwareId: ?string) => labwareId ? labwareIngredSelectors.getLabware(state)[labwareId] : null, + getLabware: (labwareId: ?string) => labwareId ? labwareIngredSelectors.getLabwareById(state)[labwareId] : null, ingredNames: labwareIngredSelectors.getLiquidNamesById(state), } } diff --git a/protocol-designer/src/containers/ConnectedStepList.js b/protocol-designer/src/containers/ConnectedStepList.js index d12eccabdf0..4f244d9f55b 100644 --- a/protocol-designer/src/containers/ConnectedStepList.js +++ b/protocol-designer/src/containers/ConnectedStepList.js @@ -19,7 +19,7 @@ type DP = $Diff function mapStateToProps (state: BaseState): SP { return { - orderedSteps: steplistSelectors.orderedSteps(state), + orderedSteps: steplistSelectors.getOrderedSteps(state), } } diff --git a/protocol-designer/src/containers/ConnectedTitleBar.js b/protocol-designer/src/containers/ConnectedTitleBar.js index 8d1cc50a680..e43d777fba5 100644 --- a/protocol-designer/src/containers/ConnectedTitleBar.js +++ b/protocol-designer/src/containers/ConnectedTitleBar.js @@ -46,15 +46,15 @@ function TitleWithIcon (props: TitleWithIconProps) { } function mapStateToProps (state: BaseState): SP { - const _page = selectors.currentPage(state) + const _page = selectors.getCurrentPage(state) const fileName = fileDataSelectors.protocolName(state) const selectedStep = steplistSelectors.getSelectedStep(state) const selectedTerminalId = steplistSelectors.getSelectedTerminalItemId(state) - const labware = labwareIngredSelectors.getSelectedContainer(state) + const labware = labwareIngredSelectors.getSelectedLabware(state) const labwareNames = labwareIngredSelectors.getLabwareNames(state) const labwareNickname = labware && labware.id && labwareNames[labware.id] const drilledDownLabwareId = labwareIngredSelectors.getDrillDownLabwareId(state) - const liquidPlacementMode = !!labwareIngredSelectors.getSelectedContainer(state) + const liquidPlacementMode = !!labwareIngredSelectors.getSelectedLabware(state) const wellSelectionLabwareKey = steplistSelectors.getWellSelectionLabwareKey(state) switch (_page) { @@ -90,7 +90,7 @@ function mapStateToProps (state: BaseState): SP { subtitle = END_TERMINAL_TITLE if (drilledDownLabwareId) { backButtonLabel = 'Deck' - const drilledDownLabware = labwareIngredSelectors.getLabware(state)[drilledDownLabwareId] + const drilledDownLabware = labwareIngredSelectors.getLabwareById(state)[drilledDownLabwareId] title = drilledDownLabware && drilledDownLabware.name subtitle = drilledDownLabware && humanizeLabwareType(drilledDownLabware.type) } diff --git a/protocol-designer/src/containers/HighlightableLabware.js b/protocol-designer/src/containers/HighlightableLabware.js index dfb511663a3..396cb7c42e7 100644 --- a/protocol-designer/src/containers/HighlightableLabware.js +++ b/protocol-designer/src/containers/HighlightableLabware.js @@ -29,7 +29,7 @@ type OP = { type SP = $Diff function mapStateToProps (state: BaseState, ownProps: OP): SP { - const selectedContainerId = selectors.getSelectedContainerId(state) + const selectedContainerId = selectors.getSelectedLabwareId(state) const containerId = ownProps.containerId || selectedContainerId if (containerId === null) { @@ -41,8 +41,8 @@ function mapStateToProps (state: BaseState, ownProps: OP): SP { } } - const labware = selectors.getLabware(state)[containerId] - const allWellContentsForSteps = wellContentsSelectors.allWellContentsForSteps(state) + const labware = selectors.getLabwareById(state)[containerId] + const allWellContentsForSteps = wellContentsSelectors.getAllWellContentsForSteps(state) const wellSelectionModeForLabware = selectedContainerId === containerId let wellContents: ContentsByWell = {} @@ -51,18 +51,18 @@ function mapStateToProps (state: BaseState, ownProps: OP): SP { !activeItem.isStep && activeItem.id === START_TERMINAL_ITEM_ID ) { // selection for deck setup: shows initial state of liquids - wellContents = wellContentsSelectors.wellContentsAllLabware(state)[containerId] + wellContents = wellContentsSelectors.getWellContentsAllLabware(state)[containerId] } else if ( !activeItem.isStep && activeItem.id === END_TERMINAL_ITEM_ID ) { // "end" terminal - wellContents = wellContentsSelectors.lastValidWellContents(state)[containerId] + wellContents = wellContentsSelectors.getLastValidWellContents(state)[containerId] } else if (!activeItem.isStep) { console.warn(`HighlightableLabware got unhandled terminal id: "${activeItem.id}"`) } else { const stepId = activeItem.id // TODO: Ian 2018-07-31 replace with util function, "findIndexOrNull"? - const orderedSteps = steplistSelectors.orderedSteps(state) + const orderedSteps = steplistSelectors.getOrderedSteps(state) const timelineIdx = orderedSteps.includes(stepId) ? orderedSteps.findIndex(id => id === stepId) : null @@ -77,7 +77,7 @@ function mapStateToProps (state: BaseState, ownProps: OP): SP { // Valid non-end step ? allWellContentsForSteps[timelineIdx][containerId] // Erroring step: show last valid well contents in timeline - : wellContentsSelectors.lastValidWellContents(state)[containerId] + : wellContentsSelectors.getLastValidWellContents(state)[containerId] } if (wellSelectionModeForLabware) { diff --git a/protocol-designer/src/containers/IngredientsList.js b/protocol-designer/src/containers/IngredientsList.js index b3255d5ed8d..8e7b32c7e0c 100644 --- a/protocol-designer/src/containers/IngredientsList.js +++ b/protocol-designer/src/containers/IngredientsList.js @@ -18,12 +18,12 @@ type DP = { type SP = $Diff & {_labwareId: ?string} function mapStateToProps (state: BaseState): SP { - const container = selectors.getSelectedContainer(state) + const container = selectors.getSelectedLabware(state) const _labwareId = container && container.id return { liquidGroupsById: selectors.getLiquidGroupsById(state), - labwareWellContents: (container && selectors.getIngredientLocations(state)[container.id]) || {}, + labwareWellContents: (container && selectors.getLiquidsByLabwareId(state)[container.id]) || {}, selectedIngredientGroupId: wellSelectionSelectors.getSelectedWellsCommonIngredId(state), selected: false, _labwareId, diff --git a/protocol-designer/src/containers/LabwareContainer.js b/protocol-designer/src/containers/LabwareContainer.js index 9afce02676e..ea829271487 100644 --- a/protocol-designer/src/containers/LabwareContainer.js +++ b/protocol-designer/src/containers/LabwareContainer.js @@ -58,7 +58,7 @@ function mapStateToProps (state: BaseState, ownProps: OP): SP { const containerId = container && container.id const containerName = containerId && labwareNames[containerId] - const selectedContainer = selectors.getSelectedContainer(state) + const selectedContainer = selectors.getSelectedLabware(state) const isSelectedSlot = !!(selectedContainer && selectedContainer.slot === slot) const selectedTerminalItem = steplistSelectors.getSelectedTerminalItemId(state) @@ -66,7 +66,7 @@ function mapStateToProps (state: BaseState, ownProps: OP): SP { const isTiprack = getIsTiprack(containerType) const showNameOverlay = container && !isTiprack && !labwareHasName - const slotToMoveFrom = selectors.slotToMoveFrom(state) + const slotToMoveFrom = selectors.getSlotToMoveFrom(state) const slotHasLabware = !!containerType const addLabwareMode = selectors.getLabwareSelectionMode(state) @@ -101,7 +101,7 @@ function mapStateToProps (state: BaseState, ownProps: OP): SP { // or when targeted by an open "Add Labware" modal ? (isSelectedSlot || selectors.selectedAddLabwareSlot(state) === slot) // outside of deckSetupMode, labware is highlighted when step/substep is hovered - : steplistSelectors.hoveredStepLabware(state).includes(containerId), + : steplistSelectors.getHoveredStepLabware(state).includes(containerId), selectedTerminalItem, slot, diff --git a/protocol-designer/src/containers/StepCreationButton.js b/protocol-designer/src/containers/StepCreationButton.js index 37c96e99fad..9c50f5adb2a 100644 --- a/protocol-designer/src/containers/StepCreationButton.js +++ b/protocol-designer/src/containers/StepCreationButton.js @@ -18,7 +18,7 @@ type DispatchProps = $Diff function mapStateToProps (state: BaseState): StateProps { return ({ - expanded: selectors.stepCreationButtonExpanded(state), + expanded: selectors.getStepCreationButtonExpanded(state), }) } diff --git a/protocol-designer/src/dismiss/selectors.js b/protocol-designer/src/dismiss/selectors.js index 8a9cd0a426a..6d2890d5220 100644 --- a/protocol-designer/src/dismiss/selectors.js +++ b/protocol-designer/src/dismiss/selectors.js @@ -30,7 +30,7 @@ export const getDismissedTimelineWarnings: Selector> = createSelector( getDismissedTimelineWarnings, timelineWarningsPerStep, - steplistSelectors.orderedSteps, + steplistSelectors.getOrderedSteps, (dismissedWarnings, warningsPerStep, orderedSteps) => { return orderedSteps.reduce( (stepAcc: DismissedWarningsAllSteps, stepId) => { @@ -69,7 +69,7 @@ export const getDismissedFormWarningsForSelectedStep: Selector> = createSelector( - steplistSelectors.formLevelWarnings, + steplistSelectors.getFormLevelWarnings, getDismissedFormWarningsForSelectedStep, (warnings, dismissedWarnings) => { const dismissedTypesForStep = dismissedWarnings.map(dw => dw.type) diff --git a/protocol-designer/src/file-data/selectors/commands.js b/protocol-designer/src/file-data/selectors/commands.js index e30fd34bd1a..ee39e8ada2d 100644 --- a/protocol-designer/src/file-data/selectors/commands.js +++ b/protocol-designer/src/file-data/selectors/commands.js @@ -23,8 +23,8 @@ const all96Tips = reduce( // NOTE this just adds missing well keys to the labware-ingred 'deck setup' liquid state export const getLabwareLiquidState: Selector = createSelector( - labwareIngredSelectors.getIngredientLocations, - labwareIngredSelectors.getLabware, + labwareIngredSelectors.getLiquidsByLabwareId, + labwareIngredSelectors.getLabwareById, (ingredLocations, allLabware) => { const allLabwareIds: Array = Object.keys(allLabware) return allLabwareIds.reduce(( @@ -59,8 +59,8 @@ function labwareConverter (labwareAppState: {[labwareId: string]: ?Labware}): {[ } export const getInitialRobotState: BaseState => StepGeneration.RobotState = createSelector( - pipetteSelectors.equippedPipettes, - labwareIngredSelectors.getLabware, + pipetteSelectors.getEquippedPipettes, + labwareIngredSelectors.getLabwareById, getLabwareLiquidState, (pipettes, labwareAppState, labwareLiquidState) => { type TipState = $PropertyType @@ -133,9 +133,9 @@ function compoundCommandCreatorFromStepArgs (stepArgs: StepGeneration.CommandCre } // exposes errors and last valid robotState -export const robotStateTimeline: Selector = createSelector( +export const getRobotStateTimeline: Selector = createSelector( steplistSelectors.getArgsAndErrorsByStepId, - steplistSelectors.orderedSteps, + steplistSelectors.getOrderedSteps, getInitialRobotState, (allStepArgsAndErrors, orderedSteps, initialRobotState) => { const allStepArgs: Array = orderedSteps.map(stepId => { @@ -198,8 +198,8 @@ export const robotStateTimeline: Selector = createSelec type WarningsPerStep = {[stepId: number | string]: ?Array} export const timelineWarningsPerStep: Selector = createSelector( - steplistSelectors.orderedSteps, - robotStateTimeline, + steplistSelectors.getOrderedSteps, + getRobotStateTimeline, (orderedSteps, timeline) => timeline.timeline.reduce((acc: WarningsPerStep, frame, timelineIndex) => { const stepId = orderedSteps[timelineIndex] @@ -212,8 +212,8 @@ export const timelineWarningsPerStep: Selector = createSelector ) export const getErrorStepId: Selector = createSelector( - steplistSelectors.orderedSteps, - robotStateTimeline, + steplistSelectors.getOrderedSteps, + getRobotStateTimeline, (orderedSteps, timeline) => { const hasErrors = timeline.errors && timeline.errors.length > 0 if (hasErrors) { @@ -227,7 +227,7 @@ export const getErrorStepId: Selector = createSelector( ) export const lastValidRobotState: Selector = createSelector( - robotStateTimeline, + getRobotStateTimeline, getInitialRobotState, (timeline, initialRobotState) => { const lastTimelineFrame = last(timeline.timeline) diff --git a/protocol-designer/src/file-data/selectors/fileCreator.js b/protocol-designer/src/file-data/selectors/fileCreator.js index 8fab818552f..dfa07739b65 100644 --- a/protocol-designer/src/file-data/selectors/fileCreator.js +++ b/protocol-designer/src/file-data/selectors/fileCreator.js @@ -3,7 +3,7 @@ import {createSelector} from 'reselect' import mapValues from 'lodash/mapValues' import {getPropertyAllPipettes} from '@opentrons/shared-data' import {getFileMetadata} from './fileFields' -import {getInitialRobotState, robotStateTimeline} from './commands' +import {getInitialRobotState, getRobotStateTimeline} from './commands' import {selectors as dismissSelectors} from '../../dismiss' import {selectors as ingredSelectors} from '../../labware-ingred/reducers' import {selectors as steplistSelectors} from '../../steplist' @@ -36,16 +36,16 @@ const executionDefaults = { export const createFile: BaseState => ProtocolFile = createSelector( getFileMetadata, getInitialRobotState, - robotStateTimeline, + getRobotStateTimeline, dismissSelectors.getAllDismissedWarnings, ingredSelectors.getLiquidGroupsById, - ingredSelectors.getIngredientLocations, + ingredSelectors.getLiquidsByLabwareId, steplistSelectors.getSavedForms, - steplistSelectors.orderedSteps, + steplistSelectors.getOrderedSteps, ( fileMetadata, initialRobotState, - _robotStateTimeline, + robotStateTimeline, dismissedWarnings, ingredients, ingredLocations, @@ -124,7 +124,7 @@ export const createFile: BaseState => ProtocolFile = createSelector( pipettes: instruments, labware, - procedure: _robotStateTimeline.timeline.map((timelineItem, i) => ({ + procedure: robotStateTimeline.timeline.map((timelineItem, i) => ({ annotation: { name: `TODO Name ${i}`, description: 'todo description', diff --git a/protocol-designer/src/labware-ingred/actions.js b/protocol-designer/src/labware-ingred/actions.js index c790242acfa..f6ae8667f26 100644 --- a/protocol-designer/src/labware-ingred/actions.js +++ b/protocol-designer/src/labware-ingred/actions.js @@ -101,7 +101,7 @@ export type MoveLabware = { export const moveLabware = (toSlot: DeckSlot) => (dispatch: Dispatch, getState: GetState) => { const state = getState() - const fromSlot = selectors.slotToMoveFrom(state) + const fromSlot = selectors.getSlotToMoveFrom(state) if (fromSlot) { return dispatch({ type: 'MOVE_LABWARE', diff --git a/protocol-designer/src/labware-ingred/reducers/index.js b/protocol-designer/src/labware-ingred/reducers/index.js index 1abf9d3c58f..d007711d47c 100644 --- a/protocol-designer/src/labware-ingred/reducers/index.js +++ b/protocol-designer/src/labware-ingred/reducers/index.js @@ -298,33 +298,33 @@ type Selector = (RootSlice) => T // SELECTORS const rootSelector = (state: RootSlice): RootState => state.labwareIngred -const getLabware: Selector<{[labwareId: string]: ?Labware}> = createSelector( +const getLabwareById: Selector<{[labwareId: string]: ?Labware}> = createSelector( rootSelector, rootState => rootState.containers ) const getLabwareNames: Selector<{[labwareId: string]: string}> = createSelector( - getLabware, - (_labware) => mapValues( - _labware, + getLabwareById, + (labwareById) => mapValues( + labwareById, labwareToDisplayName, ) ) const getLabwareTypes: Selector = createSelector( - getLabware, - (_labware) => mapValues( - _labware, - (l: Labware) => l.type + getLabwareById, + (labwareById) => mapValues( + labwareById, + (labware: Labware) => labware.type ) ) const getLiquidGroupsById = (state: RootSlice) => rootSelector(state).ingredients -const getIngredientLocations = (state: RootSlice) => rootSelector(state).ingredLocations +const getLiquidsByLabwareId = (state: RootSlice) => rootSelector(state).ingredLocations const getNextLiquidGroupId: Selector = createSelector( getLiquidGroupsById, - (_ingredGroups) => ((max(Object.keys(_ingredGroups).map(id => parseInt(id))) + 1) || 0).toString() + (ingredGroups) => ((max(Object.keys(ingredGroups).map(id => parseInt(id))) + 1) || 0).toString() ) const getLiquidNamesById: Selector<{[ingredId: string]: string}> = createSelector( @@ -352,15 +352,15 @@ const _loadedContainersBySlot = (containers: ContainersState) => , {}) const loadedContainersBySlot = createSelector( - getLabware, + getLabwareById, containers => _loadedContainersBySlot(containers) ) /** Returns options for dropdowns, excluding tiprack labware */ const labwareOptions: Selector = createSelector( - getLabware, + getLabwareById, getLabwareNames, - (_labware, names) => reduce(_labware, (acc: Options, labware: Labware, labwareId): Options => { + (labwareById, names) => reduce(labwareById, (acc: Options, labware: Labware, labwareId): Options => { const isTiprack = getIsTiprack(labware.type) if (!labware.type || isTiprack) { return acc @@ -378,9 +378,9 @@ const labwareOptions: Selector = createSelector( const DISPOSAL_LABWARE_TYPES = ['trash-box', 'fixed-trash'] /** Returns options for disposal (e.g. fixed trash and trash box) */ const disposalLabwareOptions: Selector = createSelector( - getLabware, + getLabwareById, getLabwareNames, - (_labware, names) => reduce(_labware, (acc: Options, labware: Labware, labwareId): Options => { + (labwareById, names) => reduce(labwareById, (acc: Options, labware: Labware, labwareId): Options => { if (!labware.type || !DISPOSAL_LABWARE_TYPES.includes(labware.type)) { return acc } @@ -399,7 +399,7 @@ const selectedAddLabwareSlot = (state: BaseState) => rootSelector(state).modeLab const getSavedLabware = (state: BaseState) => rootSelector(state).savedLabware -const getSelectedContainerId: Selector = createSelector( +const getSelectedLabwareId: Selector = createSelector( rootSelector, rootState => rootState.selectedContainerId ) @@ -409,10 +409,11 @@ const getSelectedLiquidGroupState: Selector = createSe rootState => rootState.selectedLiquidGroup ) -const getSelectedContainer: Selector = createSelector( - getSelectedContainerId, - getLabware, - (_selectedId, _labware) => (_selectedId && _labware[_selectedId]) || null +const getSelectedLabware: Selector = createSelector( + getSelectedLabwareId, + getLabwareById, + (selectedLabwareId, labware) => + (selectedLabwareId && labware[selectedLabwareId]) || null ) const getDrillDownLabwareId: Selector = createSelector( @@ -423,7 +424,7 @@ const getDrillDownLabwareId: Selector = createSelector( type ContainersBySlot = { [DeckSlot]: {...Labware, containerId: string} } const containersBySlot: Selector = createSelector( - getLabware, + getLabwareById, containers => reduce( containers, (acc: ContainersBySlot, containerObj: Labware, containerId: string) => ({ @@ -464,12 +465,12 @@ const getLabwareSelectionMode: Selector = createSelector( } ) -const slotToMoveFrom = (state: BaseState) => rootSelector(state).moveLabwareMode +const getSlotToMoveFrom = (state: BaseState) => rootSelector(state).moveLabwareMode -const hasLiquid = (state: BaseState) => !isEmpty(getLiquidGroupsById(state)) +const getDeckHasLiquid = (state: BaseState) => !isEmpty(getLiquidGroupsById(state)) const getLiquidGroupsOnDeck: Selector> = createSelector( - getIngredientLocations, + getLiquidsByLabwareId, (ingredLocationsByLabware) => { let liquidGroups: Set = new Set() forEach(ingredLocationsByLabware, (byWell: $Values) => @@ -490,9 +491,9 @@ export const selectors = { rootSelector, getLiquidGroupsById, - getIngredientLocations, + getLiquidsByLabwareId, getLiquidNamesById, - getLabware, + getLabwareById, getLabwareNames, getLabwareSelectionMode, getLabwareTypes, @@ -500,12 +501,12 @@ export const selectors = { getLiquidGroupsOnDeck, getNextLiquidGroupId, getSavedLabware, - getSelectedContainer, - getSelectedContainerId, + getSelectedLabware, + getSelectedLabwareId, getSelectedLiquidGroupState, getDrillDownLabwareId, - slotToMoveFrom, + getSlotToMoveFrom, allIngredientGroupFields, allIngredientNamesIds, @@ -514,7 +515,7 @@ export const selectors = { selectedAddLabwareSlot, disposalLabwareOptions, labwareOptions, - hasLiquid, + getDeckHasLiquid, } export default rootReducer diff --git a/protocol-designer/src/load-file/selectors.js b/protocol-designer/src/load-file/selectors.js index 435ec3c0636..b29dd478e67 100644 --- a/protocol-designer/src/load-file/selectors.js +++ b/protocol-designer/src/load-file/selectors.js @@ -10,7 +10,7 @@ export const getFileLoadErrors: Selector<$PropertyType> s => s.fileErrors ) -export const hasUnsavedChanges: Selector<$PropertyType> = createSelector( +export const getHasUnsavedChanges: Selector<$PropertyType> = createSelector( rootSelector, s => s.unsavedChanges ) diff --git a/protocol-designer/src/navigation/selectors.js b/protocol-designer/src/navigation/selectors.js index d42b2f2dcb2..fe644d072dd 100644 --- a/protocol-designer/src/navigation/selectors.js +++ b/protocol-designer/src/navigation/selectors.js @@ -4,10 +4,10 @@ import {rootSelector as navigationRootSelector} from './reducers' import type {Page} from './types' -export const newProtocolModal = (state: BaseState) => +export const getNewProtocolModal = (state: BaseState) => navigationRootSelector(state).newProtocolModal -export const currentPage: Selector = (state: BaseState) => { +export const getCurrentPage: Selector = (state: BaseState) => { let page = navigationRootSelector(state).page return page diff --git a/protocol-designer/src/pipettes/selectors.js b/protocol-designer/src/pipettes/selectors.js index 92957a54e30..afb8c55b2d8 100644 --- a/protocol-designer/src/pipettes/selectors.js +++ b/protocol-designer/src/pipettes/selectors.js @@ -19,17 +19,17 @@ type Selector = (RootSlice) => T export const rootSelector = (state: {pipettes: RootState}) => state.pipettes -export const pipettesById: Selector = createSelector( +export const getPipettesById: Selector = createSelector( rootSelector, pipettes => pipettes.byId ) -export const pipetteIdsByMount: Selector<*> = createSelector( +export const getPipetteIdsByMount: Selector<*> = createSelector( rootSelector, pipettes => pipettes.byMount ) -export const pipettesByMount: Selector<*> = createSelector( +export const getPipettesByMount: Selector<*> = createSelector( rootSelector, pipettes => mapValues(pipettes.byMount, id => pipettes.byId[id]) ) @@ -51,7 +51,7 @@ function _getPipetteName (pipetteData): string { } // Shows equipped (left & right) pipettes by ID, not mount -export const equippedPipettes: Selector = createSelector( +export const getEquippedPipettes: Selector = createSelector( rootSelector, pipettes => reduce(pipettes.byMount, (acc: PipettesById, pipetteId: string): PipettesById => { const pipetteData = pipettes.byId[pipetteId] @@ -63,8 +63,8 @@ export const equippedPipettes: Selector = createSelector( }, {}) ) -export const equippedPipetteOptions: Selector> = createSelector( - equippedPipettes, +export const getEquippedPipetteOptions: Selector> = createSelector( + getEquippedPipettes, (pipettesById: PipettesById) => { const pipetteIds = Object.keys(pipettesById) const pipetteNamesById = pipetteIds.reduce((acc: {[string]: string}, pipetteId: string) => { @@ -99,7 +99,7 @@ export const equippedPipetteOptions: Selector> = createSel ) // Formats pipette data specifically for edit pipette -export const pipettesForInstrumentGroup: Selector<*> = createSelector( +export const getPipettesForInstrumentGroup: Selector<*> = createSelector( rootSelector, pipettes => [pipettes.byMount.left, pipettes.byMount.right].reduce((acc, pipetteId) => { if (!pipetteId) return acc @@ -123,7 +123,7 @@ export const pipettesForInstrumentGroup: Selector<*> = createSelector( ) // Formats pipette data specifically for edit pipette -export const pipettesForEditPipettes: Selector> = createSelector( +export const getPipettesForEditPipettes: Selector> = createSelector( rootSelector, pipettes => [pipettes.byMount.left, pipettes.byMount.right].reduce((acc, pipetteId) => { if (!pipetteId) return acc @@ -146,10 +146,10 @@ export const pipettesForEditPipettes: Selector> = create }, []) ) -export const permittedTipracks: Selector> = createSelector( - equippedPipettes, - (_equippedPipettes) => - reduce(_equippedPipettes, (acc: Array, pipette: PipetteData) => { +export const getPermittedTipracks: Selector> = createSelector( + getEquippedPipettes, + (equippedPipettes) => + reduce(equippedPipettes, (acc: Array, pipette: PipetteData) => { return (pipette.tiprackModel) ? [...acc, pipette.tiprackModel] : acc diff --git a/protocol-designer/src/pipettes/thunks.js b/protocol-designer/src/pipettes/thunks.js index 34e8e81392f..fc0f6814174 100644 --- a/protocol-designer/src/pipettes/thunks.js +++ b/protocol-designer/src/pipettes/thunks.js @@ -23,7 +23,7 @@ import {createPipette} from './utils' export const editPipettes = (payload: EditPipettesFields) => (dispatch: ThunkDispatch<*>, getState: GetState) => { const state = getState() - const prevPipettesByMount = pipetteSelectors.pipettesByMount(state) + const prevPipettesByMount = pipetteSelectors.getPipettesByMount(state) const savedForms = steplistSelectors.getSavedForms(state) const nextPipettesByMount: PipettesByMount = Object.keys(payload).reduce( diff --git a/protocol-designer/src/steplist/actions/actions.js b/protocol-designer/src/steplist/actions/actions.js index d101c24edf6..9b5d037fc28 100644 --- a/protocol-designer/src/steplist/actions/actions.js +++ b/protocol-designer/src/steplist/actions/actions.js @@ -123,10 +123,10 @@ export const saveStepForm = () => (dispatch: Dispatch<*>, getState: GetState) => { const state = getState() - if (selectors.currentFormCanBeSaved(state)) { + if (selectors.getCurrentFormCanBeSaved(state)) { dispatch({ type: 'SAVE_STEP_FORM', - payload: selectors.formData(state), + payload: selectors.getUnsavedForm(state), }) } } @@ -157,7 +157,7 @@ export type OpenMoreOptionsModal = { export const openMoreOptionsModal = () => (dispatch: Dispatch<*>, getState: GetState) => { dispatch({ type: 'OPEN_MORE_OPTIONS_MODAL', - payload: selectors.formData(getState()), // TODO only pull in relevant fields? + payload: selectors.getUnsavedForm(getState()), // TODO only pull in relevant fields? }) } @@ -184,7 +184,7 @@ export type SaveMoreOptionsModal = { export const saveMoreOptionsModal = () => (dispatch: Dispatch<*>, getState: GetState) => { dispatch({ type: 'SAVE_MORE_OPTIONS_MODAL', - payload: selectors.formModalData(getState()), + payload: selectors.getFormModalData(getState()), }) } diff --git a/protocol-designer/src/steplist/actions/handleFormChange.js b/protocol-designer/src/steplist/actions/handleFormChange.js index 56d38a2732c..232613c1e6d 100644 --- a/protocol-designer/src/steplist/actions/handleFormChange.js +++ b/protocol-designer/src/steplist/actions/handleFormChange.js @@ -34,7 +34,7 @@ function _getAllWells ( // maybe remove channels from pipette state and use shared-data? // or if not, make this its own selector in pipettes/ atom const getChannels = (pipetteId: string, state: BaseState): PipetteChannels => { - const pipettes = pipetteSelectors.pipettesById(state) + const pipettes = pipetteSelectors.getPipettesById(state) const pipette = pipettes[pipetteId] if (!pipette) { console.error(`${pipetteId} not found in pipettes, cannot handleFormChange properly`) @@ -154,7 +154,7 @@ export const reconcileFormPipette = (formData: FormData, baseState: BaseState, n } else if (multiToSingle) { // multi-channel to single-channel: convert primary wells to all wells const labwareId = formData.labware - const labware = labwareId && labwareIngredSelectors.getLabware(baseState)[labwareId] + const labware = labwareId && labwareIngredSelectors.getLabwareById(baseState)[labwareId] const labwareType = labware && labware.type updateOverrides = { @@ -171,9 +171,9 @@ export const reconcileFormPipette = (formData: FormData, baseState: BaseState, n const sourceLabwareId = formData['aspirate_labware'] const destLabwareId = formData['dispense_labware'] - const sourceLabware = sourceLabwareId && labwareIngredSelectors.getLabware(baseState)[sourceLabwareId] + const sourceLabware = sourceLabwareId && labwareIngredSelectors.getLabwareById(baseState)[sourceLabwareId] const sourceLabwareType = sourceLabware && sourceLabware.type - const destLabware = destLabwareId && labwareIngredSelectors.getLabware(baseState)[destLabwareId] + const destLabware = destLabwareId && labwareIngredSelectors.getLabwareById(baseState)[destLabwareId] const destLabwareType = destLabware && destLabware.type updateOverrides = { diff --git a/protocol-designer/src/steplist/actions/thunks.js b/protocol-designer/src/steplist/actions/thunks.js index 3cc97f3be91..12d16e86897 100644 --- a/protocol-designer/src/steplist/actions/thunks.js +++ b/protocol-designer/src/steplist/actions/thunks.js @@ -24,8 +24,8 @@ function getStepFormData (state: BaseState, stepId: StepIdType, newStepType?: St const defaultNextPipette = getNextDefaultPipetteId( selectors.getSavedForms(state), - selectors.orderedSteps(state), - pipetteSelectors.pipetteIdsByMount(state) + selectors.getOrderedSteps(state), + pipetteSelectors.getPipetteIdsByMount(state) ) // TODO: Ian 2018-09-19 sunset 'steps' reducer. Right now, it's needed here to get stepType @@ -78,7 +78,7 @@ export const addStep = (payload: {stepType: StepType}) => id: stepId, }, }) - const deckHasLiquid = labwareIngredsSelectors.hasLiquid(state) + const deckHasLiquid = labwareIngredsSelectors.getDeckHasLiquid(state) const stepNeedsLiquid = ['transfer', 'distribute', 'consolidate', 'mix'].includes(payload.stepType) if (stepNeedsLiquid && !deckHasLiquid) { dispatch(tutorialActions.addHint('add_liquids_and_labware')) diff --git a/protocol-designer/src/steplist/fieldLevel/index.js b/protocol-designer/src/steplist/fieldLevel/index.js index c0c763fc6cd..f9506c6d31d 100644 --- a/protocol-designer/src/steplist/fieldLevel/index.js +++ b/protocol-designer/src/steplist/fieldLevel/index.js @@ -24,10 +24,10 @@ export type { } const hydrateLabware = (state: StepFormContextualState, id: string) => ( - labwareIngredSelectors.getLabware(state)[id] + labwareIngredSelectors.getLabwareById(state)[id] ) const hydratePipette = (state: StepFormContextualState, id: string) => ( - pipetteSelectors.pipettesById(state)[id] + pipetteSelectors.getPipettesById(state)[id] ) type StepFieldHelpers = { diff --git a/protocol-designer/src/steplist/selectors.js b/protocol-designer/src/steplist/selectors.js index 0ce067aed78..d980b1b7aea 100644 --- a/protocol-designer/src/steplist/selectors.js +++ b/protocol-designer/src/steplist/selectors.js @@ -53,27 +53,23 @@ const getUnsavedForm: Selector = createSelector( const getStepFormContextualState: Selector = createSelector( labwareIngredSelectors.rootSelector, pipetteSelectors.rootSelector, - (labwareIngred, _pipettes) => ({ - labwareIngred: labwareIngred, - pipettes: _pipettes, + (labwareIngred, pipettes) => ({ + labwareIngred, + pipettes, }) ) const getHydratedUnsavedForm: Selector = createSelector( getUnsavedForm, getStepFormContextualState, - (_unsavedForm, _contextualState) => ( - _unsavedForm && mapValues(_unsavedForm, (value, name) => ( - hydrateField(_contextualState, name, value) + (unsavedForm, contextualState) => ( + unsavedForm && mapValues(unsavedForm, (value, name) => ( + hydrateField(contextualState, name, value) )) ) ) -// TODO Ian 2018-02-08 rename formData to something like getUnsavedForm or unsavedFormFields -// NOTE: DEPRECATED use getUnsavedForm instead -const formData = getUnsavedForm - -const formModalData = createSelector( +const getFormModalData = createSelector( rootSelector, (state: RootState) => state.unsavedFormModal ) @@ -138,7 +134,7 @@ const getCollapsedSteps = createSelector( (state: RootState) => state.collapsedSteps ) -const orderedStepsSelector: Selector = createSelector( +const getOrderedSteps: Selector = createSelector( rootSelector, (state: RootState) => state.orderedSteps ) @@ -146,7 +142,7 @@ const orderedStepsSelector: Selector = createSelector( /** This is just a simple selector, but has some debugging logic. TODO Ian 2018-03-20: use assert here */ const getSavedForms: Selector<{[StepIdType]: FormData}> = createSelector( getSteps, - orderedStepsSelector, + getOrderedSteps, (state: BaseState) => rootSelector(state).savedStepForms, (steps, orderedSteps, savedStepForms) => { orderedSteps.forEach(stepId => { @@ -199,7 +195,7 @@ const getAllErrorsFromHydratedForm = (hydratedForm: FormData): StepFormAndFieldE const getArgsAndErrorsByStepId: Selector<{[StepIdType]: StepArgsAndErrors}> = createSelector( getSteps, getHydratedSavedForms, - orderedStepsSelector, + getOrderedSteps, (steps, savedStepForms, orderedSteps) => { return reduce(orderedSteps, (acc, stepId) => { let nextStepData @@ -241,14 +237,14 @@ const getFormAndFieldErrorsByStepId: Selector<{[StepIdType]: StepFormAndFieldErr ) ) -const isNewStepForm = createSelector( +const getIsNewStepForm = createSelector( getUnsavedForm, getSavedForms, (formData, savedForms) => !!(formData && formData.id != null && !savedForms[formData.id]) ) /** Array of labware (labwareId's) involved in hovered Step, or [] */ -const hoveredStepLabware: Selector> = createSelector( +const getHoveredStepLabware: Selector> = createSelector( getArgsAndErrorsByStepId, getHoveredStepId, (allStepArgsAndErrors, hoveredStep) => { @@ -283,19 +279,19 @@ const hoveredStepLabware: Selector> = createSelector( // step types that have no labware that gets highlighted if (!(stepForm.stepType === 'pause')) { // TODO Ian 2018-05-08 use assert here - console.warn(`hoveredStepLabware does not support step type "${stepForm.stepType}"`) + console.warn(`getHoveredStepLabware does not support step type "${stepForm.stepType}"`) } return blank } ) -const stepCreationButtonExpandedSelector: Selector = createSelector( +const getStepCreationButtonExpanded: Selector = createSelector( rootSelector, (state: RootState) => state.stepCreationButtonExpanded ) -const formLevelWarnings: Selector> = createSelector( +const getFormLevelWarnings: Selector> = createSelector( getUnsavedForm, getStepFormContextualState, (unsavedFormData, contextualState) => { @@ -306,7 +302,7 @@ const formLevelWarnings: Selector> = createSelector( } ) -const formLevelErrors: Selector> = createSelector( +const getFormLevelErrors: Selector> = createSelector( getUnsavedForm, getStepFormContextualState, (unsavedFormData, contextualState) => { @@ -317,16 +313,16 @@ const formLevelErrors: Selector> = createSelector( } ) -const formSectionCollapseSelector: Selector = createSelector( +const getFormSectionCollapsed: Selector = createSelector( rootSelector, s => s.formSectionCollapse ) -export const allSteps: Selector<{[stepId: StepIdType]: StepItemData}> = createSelector( +export const getAllSteps: Selector<{[stepId: StepIdType]: StepItemData}> = createSelector( getSteps, getCollapsedSteps, getSavedForms, - labwareIngredSelectors.getLabware, + labwareIngredSelectors.getLabwareById, (steps, collapsedSteps, savedForms, labware) => { return mapValues( steps, @@ -354,26 +350,26 @@ export const allSteps: Selector<{[stepId: StepIdType]: StepItemData}> = createSe ) const getSelectedStep = createSelector( - allSteps, + getAllSteps, getSelectedStepId, - (_allSteps, selectedStepId) => { + (allSteps, selectedStepId) => { const stepId = selectedStepId - if (!_allSteps || stepId == null) { + if (!allSteps || stepId == null) { return null } - return _allSteps[stepId] + return allSteps[stepId] } ) // TODO: BC: 2018-10-26 remove this when we decide to not block save -export const currentFormCanBeSaved: Selector = createSelector( +export const getCurrentFormCanBeSaved: Selector = createSelector( getHydratedUnsavedForm, getSelectedStepId, - allSteps, - (hydratedForm, selectedStepId, _allSteps) => { - if (selectedStepId == null || !_allSteps[selectedStepId] || !hydratedForm) return null + getAllSteps, + (hydratedForm, selectedStepId, allSteps) => { + if (selectedStepId == null || !allSteps[selectedStepId] || !hydratedForm) return null return isEmpty(getAllErrorsFromHydratedForm(hydratedForm)) } ) @@ -386,13 +382,13 @@ export const getWellSelectionLabwareKey: Selector = createSelector( export default { rootSelector, - allSteps, + getAllSteps, getFormAndFieldErrorsByStepId, - currentFormCanBeSaved, + getCurrentFormCanBeSaved, getSelectedStep, - stepCreationButtonExpanded: stepCreationButtonExpandedSelector, - orderedSteps: orderedStepsSelector, + getStepCreationButtonExpanded, + getOrderedSteps, getSelectedStepId, getSelectedTerminalItemId, getHoveredTerminalItemId, @@ -401,19 +397,17 @@ export default { getHoveredSubstep, getUnsavedForm, getHydratedUnsavedForm, - formData, // TODO: remove after sunset - formModalData, + getFormModalData, getArgsAndErrorsByStepId, - isNewStepForm, - formLevelWarnings, - formLevelErrors, - formSectionCollapse: formSectionCollapseSelector, - hoveredStepLabware, + getIsNewStepForm, + getFormLevelWarnings, + getFormLevelErrors, + getFormSectionCollapsed, + getHoveredStepLabware, getWellSelectionLabwareKey, // NOTE: these are exposed only for substeps/selectors.js getSteps, - orderedStepsSelector, getCollapsedSteps, getSavedForms, } diff --git a/protocol-designer/src/top-selectors/substep-highlight.js b/protocol-designer/src/top-selectors/substep-highlight.js index 0abf2ecc22f..1ccce981cb1 100644 --- a/protocol-designer/src/top-selectors/substep-highlight.js +++ b/protocol-designer/src/top-selectors/substep-highlight.js @@ -135,12 +135,12 @@ function _getSelectedWellsForSubstep ( } export const wellHighlightsByLabwareId: Selector = createSelector( - fileDataSelectors.robotStateTimeline, + fileDataSelectors.getRobotStateTimeline, steplistSelectors.getArgsAndErrorsByStepId, steplistSelectors.getHoveredStepId, steplistSelectors.getHoveredSubstep, allSubsteps, - steplistSelectors.orderedSteps, + steplistSelectors.getOrderedSteps, (robotStateTimeline, allStepArgsAndErrors, hoveredStepId, hoveredSubstep, allSubsteps, orderedSteps) => { const timeline = robotStateTimeline.timeline const stepId = hoveredStepId diff --git a/protocol-designer/src/top-selectors/substeps.js b/protocol-designer/src/top-selectors/substeps.js index 48dddb81986..aa6773d5147 100644 --- a/protocol-designer/src/top-selectors/substeps.js +++ b/protocol-designer/src/top-selectors/substeps.js @@ -17,10 +17,10 @@ import type {SubstepItemData} from '../steplist/types' type AllSubsteps = {[StepIdType]: ?SubstepItemData} export const allSubsteps: Selector = createSelector( steplistSelectors.getArgsAndErrorsByStepId, - pipetteSelectors.equippedPipettes, + pipetteSelectors.getEquippedPipettes, labwareIngredSelectors.getLabwareTypes, - steplistSelectors.orderedSteps, - fileDataSelectors.robotStateTimeline, + steplistSelectors.getOrderedSteps, + fileDataSelectors.getRobotStateTimeline, fileDataSelectors.getInitialRobotState, ( allStepArgsAndErrors, diff --git a/protocol-designer/src/top-selectors/tip-contents/index.js b/protocol-designer/src/top-selectors/tip-contents/index.js index a131261c814..63bae4ad463 100644 --- a/protocol-designer/src/top-selectors/tip-contents/index.js +++ b/protocol-designer/src/top-selectors/tip-contents/index.js @@ -86,8 +86,8 @@ const getLastValidTips: GetTipSelector = createSelector( ) export const getTipsForCurrentStep: GetTipSelector = createSelector( - steplistSelectors.orderedSteps, - fileDataSelectors.robotStateTimeline, + steplistSelectors.getOrderedSteps, + fileDataSelectors.getRobotStateTimeline, steplistSelectors.getHoveredStepId, steplistSelectors.getActiveItem, getInitialTips, diff --git a/protocol-designer/src/top-selectors/well-contents/__tests__/wellContentsAllLabware.test.js b/protocol-designer/src/top-selectors/well-contents/__tests__/getWellContentsAllLabware.test.js similarity index 89% rename from protocol-designer/src/top-selectors/well-contents/__tests__/wellContentsAllLabware.test.js rename to protocol-designer/src/top-selectors/well-contents/__tests__/getWellContentsAllLabware.test.js index a7a54fa4fae..18d2a2cd280 100644 --- a/protocol-designer/src/top-selectors/well-contents/__tests__/wellContentsAllLabware.test.js +++ b/protocol-designer/src/top-selectors/well-contents/__tests__/getWellContentsAllLabware.test.js @@ -1,4 +1,4 @@ -import wellContentsAllLabware from '../wellContentsAllLabware' +import getWellContentsAllLabware from '../getWellContentsAllLabware' // FIXTURES const baseIngredFields = { @@ -53,8 +53,8 @@ const defaultWellContents = { const container1MaxVolume = 400 -describe('wellContentsAllLabware', () => { - const singleIngredResult = wellContentsAllLabware.resultFunc( +describe('getWellContentsAllLabware', () => { + const singleIngredResult = getWellContentsAllLabware.resultFunc( containerState, // all labware ingredsByLabwareXXSingleIngred, {id: 'container1Id'}, // selected labware @@ -63,7 +63,7 @@ describe('wellContentsAllLabware', () => { ) // TODO: 2nd test case - // const twoIngredResult = selectors.wellContentsAllLabware.resultFunc( + // const twoIngredResult = selectors.getWellContentsAllLabware.resultFunc( // containerState, // all labware // ingredsByLabwareXXTwoIngred, // containerState.container2Id, // selected labware diff --git a/protocol-designer/src/top-selectors/well-contents/wellContentsAllLabware.js b/protocol-designer/src/top-selectors/well-contents/getWellContentsAllLabware.js similarity index 71% rename from protocol-designer/src/top-selectors/well-contents/wellContentsAllLabware.js rename to protocol-designer/src/top-selectors/well-contents/getWellContentsAllLabware.js index 829c7f5507a..6e5448828a6 100644 --- a/protocol-designer/src/top-selectors/well-contents/wellContentsAllLabware.js +++ b/protocol-designer/src/top-selectors/well-contents/getWellContentsAllLabware.js @@ -54,32 +54,32 @@ const _getWellContents = ( }, {}) } -const wellContentsAllLabware: Selector = createSelector( - labwareIngredSelectors.getLabware, - labwareIngredSelectors.getIngredientLocations, - labwareIngredSelectors.getSelectedContainer, +const getWellContentsAllLabware: Selector = createSelector( + labwareIngredSelectors.getLabwareById, + labwareIngredSelectors.getLiquidsByLabwareId, + labwareIngredSelectors.getSelectedLabware, wellSelectionSelectors.getSelectedWells, wellSelectionSelectors.getHighlightedWells, - (_labware, _ingredsByLabware, _selectedLabware, _selectedWells, _highlightedWells) => { - const allLabwareIds: Array = Object.keys(_labware) // TODO Ian 2018-05-29 weird flow error w/o annotation + (labwareById, liquidsByLabware, selectedLabware, selectedWells, highlightedWells) => { + const allLabwareIds: Array = Object.keys(labwareById) // TODO Ian 2018-05-29 weird flow error w/o annotation return allLabwareIds.reduce((acc: {[labwareId: string]: ContentsByWell | null}, labwareId: string) => { - const ingredsForLabware = _ingredsByLabware[labwareId] - const isSelectedLabware = _selectedLabware && (_selectedLabware.id === labwareId) + const liquidsForLabware = liquidsByLabware[labwareId] + const isSelectedLabware = selectedLabware && (selectedLabware.id === labwareId) - // Skip labware ids with no ingreds + // Skip labware ids with no liquids return { ...acc, [labwareId]: _getWellContents( - _labware[labwareId] && _labware[labwareId].type, - ingredsForLabware, + labwareById[labwareId] && labwareById[labwareId].type, + liquidsForLabware, // Only give _getWellContents the selection data if it's a selected container - isSelectedLabware ? _selectedWells : null, - isSelectedLabware ? _highlightedWells : null + isSelectedLabware ? selectedWells : null, + isSelectedLabware ? highlightedWells : null ), } }, {}) } ) -export default wellContentsAllLabware +export default getWellContentsAllLabware diff --git a/protocol-designer/src/top-selectors/well-contents/index.js b/protocol-designer/src/top-selectors/well-contents/index.js index 56b277b8247..f8aefba994a 100644 --- a/protocol-designer/src/top-selectors/well-contents/index.js +++ b/protocol-designer/src/top-selectors/well-contents/index.js @@ -22,8 +22,8 @@ import type { // TODO Ian 2018-04-19: factor out all these selectors to their own files, // and make this index.js just imports and exports. -import wellContentsAllLabwareExport from './wellContentsAllLabware' -export const wellContentsAllLabware = wellContentsAllLabwareExport +import getWellContentsAllLabware from './getWellContentsAllLabware' +export {getWellContentsAllLabware} export type {WellContentsByLabware} function _wellContentsForWell ( @@ -68,11 +68,11 @@ export function _wellContentsForLabware ( ) } -export const allWellContentsForSteps: Selector> = createSelector( +export const getAllWellContentsForSteps: Selector> = createSelector( fileDataSelectors.getInitialRobotState, - fileDataSelectors.robotStateTimeline, - (_initialRobotState, _robotStateTimeline) => { - const timeline = [{robotState: _initialRobotState}, ..._robotStateTimeline.timeline] + fileDataSelectors.getRobotStateTimeline, + (initialRobotState, robotStateTimeline) => { + const timeline = [{robotState: initialRobotState}, ...robotStateTimeline.timeline] return timeline.map((timelineStep, timelineIndex) => { const liquidState = timelineStep.robotState.liquidState.labware @@ -93,7 +93,7 @@ export const allWellContentsForSteps: Selector> = c } ) -export const lastValidWellContents: Selector = createSelector( +export const getLastValidWellContents: Selector = createSelector( fileDataSelectors.lastValidRobotState, (robotState) => { return mapValues( @@ -109,9 +109,9 @@ export const lastValidWellContents: Selector = createSele } ) -export const selectedWellsMaxVolume: Selector = createSelector( +export const getSelectedWellsMaxVolume: Selector = createSelector( wellSelectionSelectors.getSelectedWells, - labwareIngredSelectors.getSelectedContainer, + labwareIngredSelectors.getSelectedLabware, (selectedWells, selectedContainer) => { const selectedWellNames = Object.keys(selectedWells) const selectedContainerType = selectedContainer && selectedContainer.type @@ -135,8 +135,8 @@ type CommonWellValues = {ingredientId: ?string, volume: ?number} * or null if there is not a single common ingredient group */ export const getSelectedWellsCommonValues: Selector = createSelector( wellSelectionSelectors.getSelectedWells, - labwareIngredSelectors.getSelectedContainerId, - labwareIngredSelectors.getIngredientLocations, + labwareIngredSelectors.getSelectedLabwareId, + labwareIngredSelectors.getLiquidsByLabwareId, (selectedWellsObj, labwareId, allIngreds) => { if (!labwareId) return {ingredientId: null, volume: null} const ingredsInLabware = allIngreds[labwareId] diff --git a/protocol-designer/src/well-selection/actions.js b/protocol-designer/src/well-selection/actions.js index a0976021958..5fa4285a9fa 100644 --- a/protocol-designer/src/well-selection/actions.js +++ b/protocol-designer/src/well-selection/actions.js @@ -59,7 +59,7 @@ export const openWellSelectionModal = (payload: OpenWellSelectionModalPayload) = (dispatch: ThunkDispatch<*>, getState: GetState) => { const state = getState() const accessor = payload.formFieldAccessor - const formData = steplistSelectors.formData(state) + const formData = steplistSelectors.getUnsavedForm(state) const wells: Wells = (accessor && formData && formData[accessor] && _wellArrayToObj(formData[accessor])) || {} @@ -67,8 +67,8 @@ export const openWellSelectionModal = (payload: OpenWellSelectionModalPayload) = // initially selected wells in form get selected in state before modal opens dispatch(selectWells(wells)) - const pipettes = pipetteSelectors.equippedPipettes(state) - const labware = labwareIngredSelectors.getLabware(state) + const pipettes = pipetteSelectors.getEquippedPipettes(state) + const labware = labwareIngredSelectors.getLabwareById(state) // TODO type this action, make an underline fn action creator dispatch({ @@ -89,13 +89,13 @@ export const closeWellSelectionModal = (): * => ({ export const saveWellSelectionModal = () => (dispatch: ThunkDispatch<*>, getState: GetState) => { const state = getState() - const wellSelectionModalData = selectors.wellSelectionModalData(state) + const wellSelectionModalData = selectors.getWellSelectionModalData(state) // this if-else is mostly for Flow if (wellSelectionModalData) { dispatch(changeFormInput({ update: { - [wellSelectionModalData.formFieldAccessor]: selectors.selectedWellNames(state), + [wellSelectionModalData.formFieldAccessor]: selectors.getSelectedWellNames(state), }, })) } else { diff --git a/protocol-designer/src/well-selection/selectors.js b/protocol-designer/src/well-selection/selectors.js index a350521d2fd..caeb8889399 100644 --- a/protocol-designer/src/well-selection/selectors.js +++ b/protocol-designer/src/well-selection/selectors.js @@ -9,7 +9,7 @@ import type {OpenWellSelectionModalPayload} from './actions' const rootSelector = (state: BaseState) => state.wellSelection -const wellSelectionModalData: Selector = createSelector( +const getWellSelectionModalData: Selector = createSelector( rootSelector, s => s.wellSelectionModal ) @@ -47,24 +47,24 @@ function _primaryToAllWells ( const getSelectedWells: Selector = createSelector( getSelectedPrimaryWells, - wellSelectionModalData, + getWellSelectionModalData, _primaryToAllWells ) const getHighlightedWells: Selector = createSelector( getHighlightedPrimaryWells, - wellSelectionModalData, + getWellSelectionModalData, _primaryToAllWells ) -const selectedWellNames: Selector> = createSelector( +const getSelectedWellNames: Selector> = createSelector( (state: BaseState) => rootSelector(state).selectedWells.selected, selectedWells => Object.keys(selectedWells).sort(sortWells) ) export default { - selectedWellNames, + getSelectedWellNames, getSelectedWells, getHighlightedWells, - wellSelectionModalData, + getWellSelectionModalData, }