[frontend] Fix Add height / weight do not work (#7118)
Proposed changes
- Add a validator check to help the user knowing the field is mandatory
- On edit form, when pushes a new height or weight line, put a value instead of null to avoid errors
Related issues
- https://github.com/OpenCTI-Platform/opencti/issues/7118
Checklist
- [ ] I consider the submitted work as finished
- [ ] I tested the code for its functionality
- [ ] I wrote test cases for the relevant uses case (coverage and e2e)
- [ ] I added/update the relevant documentation (either on github or on notion)
- [ ] Where necessary I refactored code to improve the overall quality
Further comments
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 67.54%. Comparing base (
e9dbebf) to head (e677fc3).
Additional details and impacted files
@@ Coverage Diff @@
## master #7165 +/- ##
==========================================
- Coverage 67.54% 67.54% -0.01%
==========================================
Files 561 561
Lines 68727 68727
Branches 5835 5835
==========================================
- Hits 46425 46420 -5
- Misses 22302 22307 +5
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
If we enter something else than a date for the height/weight, the error is not well formatted:
You can include this part of code in your dateSeenValidator:
What is the meaning for the (') unit (simple curiosity)? (I know 'lb' for weight but I don't know (') )
@SarahBocognano : this is how we define height in America everytime you'll see a height, I will be like: 5'7" (172cm)
Usually when a required field is not specified, there is only a red message in the form :
But for height/weight date or measure, a second message appears at the top of the screen "Validation against the schema... " :
When adding a height, after delete the previous date, this date is reinitialized automatically.
@SarahBocognano : Yes I did that on purpose to avoid any error for the user and to show that this field is indeed mandatory and has no sense of use without the date