-
Notifications
You must be signed in to change notification settings - Fork 9
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
Morecast: Validation on editable fields #3919
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3919 +/- ##
==========================================
+ Coverage 81.31% 81.35% +0.04%
==========================================
Files 294 298 +4
Lines 11362 11421 +59
Branches 526 546 +20
==========================================
+ Hits 9239 9292 +53
- Misses 2089 2094 +5
- Partials 34 35 +1 ☔ View full report in Codecov by Sentry. |
Co-authored-by: dgboss <darren.boss@gov.bc.ca>
It's looking really good! |
Oh, should we add validation for the grass curing fields as well? |
Nice catch! I adjusted the code to share the validation logic between edit and view mode cells: 59a301e |
Looks great, nice work! Only comment would be same as Darren's
|
Just noticed there's a number of code smells. Unused imports in a few cases, otherwise just complaining about using optional chain expressions. I'm fine either way |
Thanks fixed, part of it was a bunch of duplicated code between forecast and grass cure cells that I deduped in a shared |
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 great to me! Nice work!
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.
This is great! Only one tiny nit that could be addressed in a followup PR. The tooltip position becomes a little wonky when toggling between the Forecast Summary tab and the other tabs. Definitely not worth holding up the PR for.
Quality Gate passedIssues Measures |
Adds an optional
validator
function forIndeterminateField
that gets called inpreProcessEditCellProps
callback for cells in edit mode to set the error prop if validation doesn't pass for the forecast parameter. The samevalidator
function is passed down to cells in view mode to do the same thing.Adds the
EditInputCell
component as the render component for cells in edit mode that gets rendered by therenderEditCell
callback on theGridColDef
.EditInputCell
props include an empty or non-emptyerror
string that drives the visibility of the tooltip and red border.Similar behaviour for the
renderCell
callback for cells in view mode, except it doesn't receive theerror
string in props so it callsvalidator
itself. This is to keep the same behaviour whether the user is actively editing or not and the current value is invalid.Opted to prevent edits from committing locally when invalid so that invalid values aren't stored in drafts.
Closes #3571
Test Links:
Landing Page
MoreCast
Percentile Calculator
C-Haines
FireBat
FireBat bookmark
Auto Spatial Advisory (ASA)
HFI Calculator