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

Update reactstrap and edit/create modal validation #958

Merged
merged 18 commits into from
Jul 27, 2023

Conversation

spearec
Copy link
Contributor

@spearec spearec commented Jun 23, 2023

Description

The main scope of this PR is to remove the uses of react-bootstrap and replace them with reactstrap.
The react-bootstrap package was used in the header buttons component and in edit/create modal components.

In the process of updating these components, I changed their UI significantly. The header buttons are now a navbar, which supports multiple compact dropdowns and menus.
Edit/create modals now include in-form validation and are displayed in two columns on larger screens. This allows OED to give instant feedback to admins, as well as prevent them from trying to submit an invalid meter in most cases. In the process of adding validation, I also prevented meter units from being displayable. The two-column layout allows for more information to be displayed at once and will revert to the old one-column layout on small screens.

Also fixes the issue that the admin and local language preferences were the same, so an admin could not change their display language without potentially affecting the site default. In doing so, a new state section (state.options) and options dropdown in the navbar were created, which can be used to add similar user-specific settings in the future.

Fixes #903
Fixes #907
Partially Addresses #726 (Header & Language containers removed)

Type of change

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

Checklist

(Note what you have done by placing an "x" instead of the space in the [ ] so it becomes [x]. It is hoped you do all of them.)

  • I have followed the OED pull request ideas
  • I have removed text in ( ) from the issue request

spearec added 8 commits May 23, 2023 21:32
- upgrade to bootstrap v5 and reactstrap v9
- uses of react-bootstrap (modals and buttons) now use reactstrap
- convert HeaderButtonsComponent to a NavBar
- preliminary work with adding in-form feedback for validation
- Adding instant validation and feedback to the modal create/edit forms
- some design discussions are needed before the final layout can be done
- Edit/Create modals now use 100% reactstrap components
- Added defined autocomplete behavior
- Changed the way labels are defined to comply with HTML standards
- Added clear lists of what is validated for each modal
- Rearrange the navbar header
Reactstrap's default color is "secondary", and many buttons relied on this.
To make the expected behavior more clear, every button now has a color defined.
- Moved around some logic to make the component tree more linear
- Simplified optionsVisibility state
- Convert HeaderButtonsComponent and MenuModalComponent to use react hooks
- Show navbar on all non-graph pages even when optionsVisibility is false
@huss
Copy link
Member

huss commented Jun 25, 2023

Thanks to @spearec for taking this on. Overall, this looks good. I have not yet reviewed the code but did try using it. Here are some thoughts:

  • The message for the sec in rate says greater than the min in unit create/edit (1 in this case) but 1 is allowed. Either the message or value should be changed to include 1.
  • There are merge conflicts (sigh).
  • As we have discussed (just documenting), we might reduce the number of dropdown choices in the navbar if horizontal space becomes an issue.

Once you feel this is ready then formally submit and it will have all the code reviewed.

spearec added 2 commits June 29, 2023 13:54
- Increased modal width to match
- Modals will switch back to one column at the lg breakpoint
- Non-admin group view is always one column
- Component hasn't been used in ~5 years
- Also fix formatting for EditMeterModalComponent
@huss huss mentioned this pull request Jul 1, 2023
@spearec
Copy link
Contributor Author

spearec commented Jul 4, 2023

With the latest commits, this PR should be ready. I have no done much testing yet, so I would not deem it ready to merge until it gets tested more.

- fix default language not being set properly
- fix a couple jsdoc comments
- add validation for groups to not allow submission without child meters
@spearec spearec marked this pull request as ready for review July 13, 2023 12:51
- some tooltips and text entries were removed by this pr but still in data.js
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 @spearec for more very good work. It has taken too long to get this review done so I'm posting my comments from reading the code. I still need to carefully test it running. There are a few thoughts but nothing significant.

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.

Testing only found one small issue and double quotes. This seems to work very well. Thanks to @spearec for the careful work and very nice changes.

spearec and others added 4 commits July 24, 2023 17:22
- move help URL to a single exported constant
- fix uses of double quotes
- require conversion slope and intercept inputs to always have values
- Various help tooltips move to be inline
- Fixed OpenEnergyDashboard#907, preventing admins from setting meter units to be displayable
@huss
Copy link
Member

huss commented Jul 27, 2023

Thanks to @spearec for addressing all the comments and even fixing some other issues they found. Everything looks good. I changed the wording on one message but that was minor. This is ready to merge and will be included in v1.0.0.

@huss huss merged commit a4add6e into OpenEnergyDashboard:development Jul 27, 2023
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.

meter units should have displayable of none Use reactstrap consistently and update bootstrap
2 participants