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

refactor(protocol-designer): change tiprack default slot and copy upd… #14028

Merged
merged 1 commit into from
Nov 20, 2023
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export function FirstPipetteTypeTile(
mount={mount}
allowNoPipette={false}
display96Channel={allow96Channel}
tileHeader={i18n.t('modal.create_file_wizard.choose_first_pipette')}
tileHeader={i18n.t('modal.create_file_wizard.choose_left_pipette')}
/>
)
}
Expand All @@ -66,7 +66,7 @@ export function SecondPipetteTypeTile(
mount={RIGHT}
allowNoPipette
display96Channel={false}
tileHeader={i18n.t('modal.create_file_wizard.choose_second_pipette')}
tileHeader={i18n.t('modal.create_file_wizard.choose_right_pipette')}
/>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,15 @@ export function CreateFileWizard(): JSX.Element | null {
const newTiprackModels: string[] = uniq(
pipettes.map(pipette => pipette.tiprackDefURI)
)
newTiprackModels.forEach(tiprackDefURI => {
newTiprackModels.forEach((tiprackDefURI, index) => {
const ot2Slots = index === 0 ? '2' : '5'
const flexSlots = index === 0 ? 'C2' : 'B2'
Comment on lines +267 to +268
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any suggestions for a more elegant way to accomplish this? It works but idk if it could be cleaner.

Copy link
Contributor

@mjhuff mjhuff Nov 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Off the top of my head, I can't think of anything clearer than this.

The only thing slightly confusing IMO is variable assignment above the dispatch and then property assignment within the dispatch. Maybe something like this? Again, just my opinion - this is definitely nit territory.

const ot2Slots = index === 0 ? '2' : '5'
        const flexSlots = index === 0 ? 'C2' : 'B2'
        const slot =
          values.fields.robotType === FLEX_ROBOT_TYPE ? flexSlots : ot2Slots
        const adapterUnderLabwareDefURI =
          values.pipettesByMount.left.pipetteName === 'p1000_96'
            ? adapter96ChannelDefUri
            : undefined
    dispatch(
      labwareIngredActions.createContainer({
        slot,
        labwareDefURI: tiprackDefURI,
        adapterUnderLabwareDefURI,
      })
    )`

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think L267-268 is clear enough.
I think Jamey's suggestion makes the code more readable and easier to debug.

dispatch(
labwareIngredActions.createContainer({
slot:
values.fields.robotType === FLEX_ROBOT_TYPE
? flexSlots
: ot2Slots,
labwareDefURI: tiprackDefURI,
adapterUnderLabwareDefURI:
values.pipettesByMount.left.pipetteName === 'p1000_96'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ describe('Edit Modules Modal', () => {
getLabwareIsCompatibleMock.mockReturnValue(false)
const wrapper = render(props)
expect(wrapper.find(SlotDropdown).childAt(0).prop('error')).toMatch(
'Slot 1 is occupied. Clear the slot to continue.'
'Slot 1 is occupied. Navigate to the design tab and remove the labware or remove the additional item to continue.'
)
})

Expand All @@ -171,7 +171,7 @@ describe('Edit Modules Modal', () => {
getSlotIdsBlockedBySpanningMock.mockReturnValue(['1']) // 1 is default slot
const wrapper = render(props)
expect(wrapper.find(SlotDropdown).childAt(0).prop('error')).toMatch(
'Slot 1 is occupied. Clear the slot to continue.'
'Slot 1 is occupied. Navigate to the design tab and remove the labware or remove the additional item to continue.'
)
})

Expand Down
2 changes: 1 addition & 1 deletion protocol-designer/src/localization/en/alert.json
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@
"module_placement": {
"SLOT_OCCUPIED": {
"title": "Cannot place module",
"body": "Slot {{selectedSlot}} is occupied. Clear the slot to continue."
"body": "Slot {{selectedSlot}} is occupied. Navigate to the design tab and remove the labware or remove the additional item to continue."
},
"HEATER_SHAKER_ADJACENT_LABWARE_TOO_TALL": {
"title": "Cannot place module",
Expand Down
14 changes: 7 additions & 7 deletions protocol-designer/src/localization/en/modal.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,26 +70,26 @@
}
},
"create_file_wizard": {
"choose_additional_items": "Choose additional items",
"add_optional_info": "Add more information, if you like (you can change this later).",
"choose_additional_items": "Choose additional items",
"choose_at_least_one_tip_rack": "Choose at least one tiprack for this pipette",
"choose_first_pipette": "Choose first pipette",
"choose_second_pipette": "Choose second pipette",
"choose_left_pipette": "Choose left pipette",
"choose_right_pipette": "Choose right pipette",
"choose_robot_type": "Choose robot type",
"choose_tips_for_pipette": "Choose tips for {{pipetteName}}",
"create_new_protocol": "Create New Protocol",
"custom_tiprack": "Custom tips",
"name_your_protocol": "Name your protocol.",
"description": "Description",
"name_your_protocol": "Name your protocol.",
"organization_or_author": "Organization/Author",
"pipette_type": "Pipette Type",
"protocol_name": "Protocol Name",
"protocol_name_and_description": "Protocol name and description",
"protocol_name": "Protocol Name",
"review_file_details": "Review file details",
"robot_type": "Robot Type",
"staging_areas": "Staging area slots",
"upload_tiprack": "Upload a custom tiprack to select its definition",
"upload": "Upload",
"staging_areas": "Staging area slots"
"upload": "Upload"
},
"well_order": {
"title": "Well Order",
Expand Down
Loading