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

Added warnings to admin preferences component #1393

Merged
merged 6 commits into from
Dec 10, 2024

Conversation

hinyan17
Copy link
Contributor

@hinyan17 hinyan17 commented Nov 26, 2024

Description

Added input validation and warnings for fields on the admin preferences form. Everything that wasn't multiple choice or drop down menu was checked. These fields are: meter reading frequency, min and max reading value, min and max date, reading gap, number of errors, warning file size, and file size limit.

Fixes the TODO associated with PreferencesComponent. (36 on the TODO list)

Type of change

  • Note merging this changes the database configuration.
  • This change requires a documentation update

Checklist

  • I have followed the OED pull request ideas
  • I have removed text in ( ) from the issue request
  • You acknowledge that every person contributing to this work has signed the OED Contributing License Agreement and each author is listed in the Description section.

Limitations

none

Copy link
Member

@huss huss left a comment

Choose a reason for hiding this comment

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

Thanks to @hinyan17 for doing this improvement. Review and testing found it works fine. I've made a couple of comment to consider.

src/client/app/components/admin/PreferencesComponent.tsx Outdated Show resolved Hide resolved
Copy link
Member

@huss huss left a comment

Choose a reason for hiding this comment

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

Thanks to @hinyan17 for addressing the comment. I'm sorry this sat so long - somehow I missed the update. I've made a couple of comments to consider.

@hinyan17
Copy link
Contributor Author

While I was going through CreateMeterModalComponent I noticed that all of the invalid functions are called anonymously and inline. Also, the final check if the whole form is valid is done with a redux selector, isValidCreateMeter. Should I implement something similar for PreferencesComponent? It looks a lot cleaner than my current solution and is probably better for consistency.

@hinyan17 hinyan17 requested a review from huss December 10, 2024 00:44
@huss
Copy link
Member

huss commented Dec 10, 2024

While I was going through CreateMeterModalComponent I noticed that all of the invalid functions are called anonymously and inline. Also, the final check if the whole form is valid is done with a redux selector, isValidCreateMeter. Should I implement something similar for PreferencesComponent? It looks a lot cleaner than my current solution and is probably better for consistency.

That seems fine if you want to do it.

Copy link
Member

@huss huss left a comment

Choose a reason for hiding this comment

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

Thanks to @hinyan17 for the quick update. I responded to your two questions and made one small comment.

src/client/app/components/admin/PreferencesComponent.tsx Outdated Show resolved Hide resolved
hinyan17 and others added 2 commits December 10, 2024 03:29
- Put braces around implicit functions as preferred by OED.
- Reorder two functions so same as shown to user.
- Add file size limit to check functions and form feedback.
- Minor formatting.
Copy link
Member

@huss huss left a comment

Choose a reason for hiding this comment

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

Everything now looks good. Thanks to @hinyan17 for another accepted contribution to OED.

@huss huss merged commit fee0dc1 into OpenEnergyDashboard:development Dec 10, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants