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

refactor: provide reusable formly configs #1017

Merged
merged 2 commits into from
Mar 31, 2022

Conversation

MaxKless
Copy link
Collaborator

@MaxKless MaxKless commented Feb 15, 2022

PR Type

[ ] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[x] Refactoring (no functional changes, no API changes)
[ ] Build-related changes
[ ] CI-related changes
[ ] Documentation content changes
[ ] Application / infrastructure changes
[ ] Other:

What Is the Current Behavior?

Currently, the PWA code contains many repetitions of the same formly field configurations. For example, the firstName field is present in the registration page, each address form and the account page. This can lead to some inconsistencies (see #997) and to lots of repetition when adjusting a field configuration.

What Is the New Behavior?

This PR attempts to solve this problem by introducing a central point of contact for interacting with reusable field configurations, the aptly named reusable-formly-field-configurations.service.ts (name WIP 😸).
It can read a list of predefined configurations and then lets you retrieve a field configuration service by id (for example firstName) anywhere you inject the service. This leads to less repetition.

ToDo

  • How to handle minor changes to a field? Maybe an override argument that performs a deep merge for the selected properties (like ngrx entity partial updates)
  • How to integrate with address form configurations
  • Central point of customization via transform method in service or extension that does the same?
  • let field configuration overwrite key or let user overwrite key?
  • write schematic for adding a new shortcut
  • write documentation
  • automatic documentation from folder
  • check correct documentation in pipeline
  • helper eslint rules? (sorting module entries, key not included in configuration, ...)
  • EXTENSION FOR COMPLETE AUTOMATION?!
  • adjust project structure rule configuration for .configuration.ts files
  • check override functionality on arrays
  • write tests
  • Decide on naming & folder structure -> adapt docs in case of name changes
  • extension for field groups?
  • add project structure tests for new functionality
  • write schematic for adding a new form config

Does this PR Introduce a Breaking Change?

[x] Yes
[ ] No

Other Information

AB#74369

@MaxKless MaxKless added enhancement Enhancement to an existing feature refactoring Refactoring of current code labels Feb 15, 2022
@MaxKless MaxKless self-assigned this Feb 15, 2022
@MaxKless MaxKless added this to the 2.1 milestone Feb 16, 2022
@MaxKless MaxKless force-pushed the refactor/reusable-formly-configs branch 3 times, most recently from 41d1051 to 4cfd1eb Compare February 22, 2022 10:08
@MaxKless MaxKless force-pushed the refactor/reusable-formly-configs branch 3 times, most recently from ede45f5 to f1108e5 Compare February 24, 2022 10:07
@MaxKless MaxKless marked this pull request as ready for review February 24, 2022 10:16
@MaxKless MaxKless requested a review from SGrueber February 24, 2022 11:20
@MaxKless MaxKless force-pushed the refactor/reusable-formly-configs branch from f1108e5 to 021dc92 Compare February 25, 2022 13:04
docs/README.md Outdated Show resolved Hide resolved
docs/guides/forms.md Outdated Show resolved Hide resolved
docs/guides/reusable-forms.md Outdated Show resolved Hide resolved
docs/guides/reusable-forms.md Outdated Show resolved Hide resolved
docs/guides/reusable-forms.md Outdated Show resolved Hide resolved
docs/guides/reusable-forms.md Outdated Show resolved Hide resolved
docs/guides/reusable-forms.md Outdated Show resolved Hide resolved
docs/guides/reusable-forms.md Outdated Show resolved Hide resolved
docs/sync-formly-docs.ts Outdated Show resolved Hide resolved
schematics/src/collection.json Outdated Show resolved Hide resolved
@MaxKless MaxKless force-pushed the refactor/reusable-formly-configs branch from 7d6174a to f7fb0a7 Compare March 2, 2022 17:08
@SGrueber SGrueber modified the milestones: 2.1, 2.2 Mar 4, 2022
@SGrueber SGrueber force-pushed the refactor/reusable-formly-configs branch 4 times, most recently from f61350b to 11b7239 Compare March 30, 2022 13:15
@MaxKless MaxKless force-pushed the refactor/reusable-formly-configs branch from 11b7239 to f036f9f Compare March 30, 2022 15:05
@SGrueber SGrueber force-pushed the refactor/reusable-formly-configs branch from f036f9f to e2204ce Compare March 31, 2022 11:08
SGrueber
SGrueber previously approved these changes Mar 31, 2022
@MaxKless MaxKless force-pushed the refactor/reusable-formly-configs branch from e2204ce to f657de7 Compare March 31, 2022 11:20
@MaxKless MaxKless force-pushed the refactor/reusable-formly-configs branch from f657de7 to 35723fd Compare March 31, 2022 11:29
@MaxKless MaxKless requested a review from SGrueber March 31, 2022 12:27
@MaxKless MaxKless merged commit 93b6cfd into develop Mar 31, 2022
@MaxKless MaxKless deleted the refactor/reusable-formly-configs branch March 31, 2022 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement to an existing feature refactoring Refactoring of current code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants