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

feat(labware-creator): use "tube" not "well" for x/y errors #8150

Merged
merged 1 commit into from
Jul 22, 2021

Conversation

IanLondon
Copy link
Contributor

Overview

Closes #8142

Changelog

  • Allows LC to have dynamic error labels via getLabel.

Review requests

  • Test various labware to make sure the "this field is required" error shows the correct word: well vs tube
  • Examine all the errors and look for anything weird (clicking export right away is a quick way to do this)

Risk assessment

Medium, messes with LC errors' data flow

Allows LC to have dynamic error labels via getLabel. Closes #8142
@IanLondon IanLondon requested review from smb2268, jerader, a team and shlokamin and removed request for a team July 22, 2021 17:59
@@ -212,9 +212,9 @@ context('Reservoirs', () => {
cy.contains('close').click({ force: true })

// Brand info
cy.contains('Brand is required').should('exist')
cy.contains('Brand is a required field').should('exist')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

IDK why before brand's error was "___ is required" and every other field's required error was "___ is a required field" 🤷


// sometimes fields have dynamic labels, and the "__ is a required field" error
// should use the dynamic label from getLabel.
if (error === MUST_BE_A_NUMBER_ERROR) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think we ever see the "must be a number" error anywhere, but just in case we do it in the future, I wanted it to follow the same pattern as the required field error.

@@ -82,7 +82,12 @@ export const CreateNewDefinition = (props: Props): JSX.Element | null => {
})}
>
<>
<FormAlerts touched={touched} errors={errors} fieldList={fieldList} />
<FormAlerts
Copy link
Contributor Author

Choose a reason for hiding this comment

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

in the future we might want to avoid prop drilling and just use Formik context in FormAlerts. The only prop it really needs is fieldList.

@@ -459,6 +462,12 @@ export const getLabel = (
if (name === 'wellShape') {
return `${capitalize(getLabwareName(values, false))} shape`
}
if (name === 'wellXDimension' && displayAsTube(values)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

nicely, this change to getLabel now changes both the label and the text in the error alert

Copy link
Collaborator

@jerader jerader left a comment

Choose a reason for hiding this comment

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

Looks good. tested:
well plates, tip rack, reservoir, tube+tube rack, 96 well aluminum block with pcr plate, pcr strips, and tube

@IanLondon IanLondon merged commit d9c7ed2 into edge Jul 22, 2021
@IanLondon IanLondon deleted the lc_change-well-xy-to-tube-8142 branch July 22, 2021 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LC: text well needs to be replaced with tubes
2 participants