-
Notifications
You must be signed in to change notification settings - Fork 179
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
Conversation
Allows LC to have dynamic error labels via getLabel. Closes #8142
@@ -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') |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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)) { |
There was a problem hiding this comment.
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
There was a problem hiding this 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
Overview
Closes #8142
Changelog
Review requests
Risk assessment
Medium, messes with LC errors' data flow