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

lmr: add mandatory fields and error messages to the form #10271

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

Caracol3
Copy link
Contributor

@Caracol3 Caracol3 commented Jan 7, 2025

close #9707

@Caracol3 Caracol3 added area:front Work on Standard OSRD Interface modules module:stdcm Short-Term DCM labels Jan 7, 2025
@Caracol3 Caracol3 requested a review from a team as a code owner January 7, 2025 15:16
@codecov-commenter
Copy link

codecov-commenter commented Jan 7, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.49%. Comparing base (a4190de) to head (bbbc7c1).

❗ 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           
Flag Coverage Δ
editoast 73.71% <ø> (-0.02%) ⬇️
front 89.21% <100.00%> (+<0.01%) ⬆️
gateway 2.18% <ø> (ø)
osrdyne 3.28% <ø> (ø)
railjson_generator 87.50% <ø> (ø)
tests 87.05% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@anisometropie anisometropie left a comment

Choose a reason for hiding this comment

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

Screenshot_20250107_175234

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

Comment on lines +70 to +72
const isTotalMassEmpty = totalMass === undefined || totalMass === null;
const isTotalLengthEmpty = totalLength === undefined || totalLength === null;
const isMaxSpeedEmpty = maxSpeed === undefined || maxSpeed === null;
Copy link
Contributor

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?

Copy link
Contributor Author

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

Copy link
Contributor

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 ?

@SharglutDev
Copy link
Contributor

SharglutDev commented Jan 8, 2025

* 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.

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)
There is one issue in osrd-ui for the left position which will be fixed later.
For now, I think we can fix these issues by changing the osrd-ui styles here directly with a TODO that we will remove later.
Fixing the top value of the tooltip will also fix your second point.

* towed field is required but doesn’t allow me to write anything

This field shouldn't be required, it will be changed

Copy link
Contributor

@RomainValls RomainValls left a 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 ?

@Caracol3
Copy link
Contributor Author

Caracol3 commented Jan 8, 2025

Indeed, towed rolling stock isn't required. I will remove it. thanks

Comment on lines +68 to +71
const isTractionEngineEmpty = !filters.text.trim();
const isTowedRollingStockEmpty = !towedRsFilters.text.trim();
const isTotalMassEmpty = totalMass === undefined || totalMass === null;
const isTotalLengthEmpty = totalLength === undefined || totalLength === null;
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:front Work on Standard OSRD Interface modules module:stdcm Short-Term DCM
Projects
None yet
Development

Successfully merging this pull request may close these issues.

lmr: front: catch missing fields and adapt warning message
5 participants