-
Notifications
You must be signed in to change notification settings - Fork 45
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
lmr: add mandatory fields and error messages to the form #10271
base: dev
Are you sure you want to change the base?
Conversation
Signed-off-by: Mathieu <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## dev #10271 +/- ##
=======================================
Coverage 81.48% 81.49%
=======================================
Files 1058 1058
Lines 104270 104319 +49
Branches 722 722
=======================================
+ Hits 84969 85013 +44
- Misses 19260 19265 +5
Partials 41 41
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
Several issues:
- message is not positionned correctly, it should be below the input
- message gets on top of other inputs and we can’t see or interact with them.
- towed field is required but doesn’t allow me to write anything
What prototype did you use?
We should be able to see the main information of the page, and see at first glance what fields failed validation
const isTotalMassEmpty = totalMass === undefined || totalMass === null; | ||
const isTotalLengthEmpty = totalLength === undefined || totalLength === null; | ||
const isMaxSpeedEmpty = maxSpeed === undefined || maxSpeed === null; |
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.
Can’t we use the same function for all number fields?
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.
Yes, you're right, it would be clearer. I will change this
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.
We could use isNil()
from lodash ?
This is because of overriding rules, we use in stdcm, we should get rid of these in another PR, it breaks all the osrd-ui styles... (the tooltip top position here)
This field shouldn't be required, it will be changed |
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.
Do we need to have the "missing value" field on the towed rolling stock ? As it isn't necessary to run a simulation ?
Indeed, towed rolling stock isn't required. I will remove it. thanks |
const isTractionEngineEmpty = !filters.text.trim(); | ||
const isTowedRollingStockEmpty = !towedRsFilters.text.trim(); | ||
const isTotalMassEmpty = totalMass === undefined || totalMass === null; | ||
const isTotalLengthEmpty = totalLength === undefined || totalLength === null; |
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.
Instead of that, I think you could use the same logic than @Wadjetz in his consist PR (in StdcmConfig). We could have one object having boolean properties for each required fields changing when these fields changes.
We should also setShowError(false)
as soon as the field changes.
close #9707