-
Notifications
You must be signed in to change notification settings - Fork 43
manager: smoother reports filter type form (fixes #9504) #9506
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
base: master
Are you sure you want to change the base?
manager: smoother reports filter type form (fixes #9504) #9506
Conversation
uj-sxn
left a comment
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.
The migration to typed forms in this component is a great improvement for long-term maintainability. It makes the expected data structure for the date filters much more explicit and helps prevent runtime errors.
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.
Pull request overview
This PR enhances type safety in the reports filter form by migrating from untyped Angular forms to strongly typed form controls. The change ensures compile-time type checking for the date filter form and correctly applies end-date validation at the form group level rather than as a control validator.
Changes:
- Replaced
UntypedFormGroup/UntypedFormBuilderwith typedFormGroup/NonNullableFormBuilderand related imports - Introduced
DateFilterForminterface to define the structure of form controls - Refactored
initDateFilterForm()to use typed form controls with explicit validators and moved group-level validation to the correct position
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Motivation
FormGroup/FormControl/FormBuilderusages.Description
UntypedFormGroup/UntypedFormBuilderimports with typedFormBuilder,FormControl, andFormGroupimports and usages.DateFilterFormtype alias describingstartDateandendDateasFormControl<Date | '' | null>and updateddateFilterFormtoFormGroup<DateFilterForm>.initDateFilterForm()to build the group with typed controls usingthis.fb.control<...>(...)and movedCustomValidators.endDateValidator()into the group options ({ validators: ... }).valueChangeshandling to explicitly treatvalue.startDate/value.endDateasDateinstances (instanceof Date) and otherwise usenull, and ensured existingsetValue/patchValueinteractions reference the typed controls.Testing
./gradlew testwas not executed).Codex Task