-
Notifications
You must be signed in to change notification settings - Fork 356
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
Make Save button respond properly on changes in User's Available Groups #6369
Make Save button respond properly on changes in User's Available Groups #6369
Conversation
01fdd94
to
f78f323
Compare
@hstastna The issue with Save button is still present in this PR. PR is fixing Ordering. |
f78f323
to
827a121
Compare
Moving this PR to WIP as it fixes the issue only for some situations, not always. |
d0d4801
to
f0cdb80
Compare
@miq-bot add_reviewer @ZitaNemeckova |
Tested in UI. LGTM 👍 |
Also remove unnecessary code from _rbac_group_selected.html.haml.
f0cdb80
to
4ada34d
Compare
Checked commits hstastna/manageiq-ui-classic@2003cd8~...4ada34d with ruby 2.5.5, rubocop 0.69.0, haml-lint 0.20.0, and yamllint 1.10.0 |
Re-tested. LGTM 👍 |
Thank you both! |
Issue: #6364
In User's editing screen, Save button wasn't responding properly on changes in Available Groups section, especially if there were more groups selected in the drop down.
Another issue was improper order of groups in Selected Groups section while adding/editing User. It was inconsistent with the User's details screen where the Groups are properly ordered (by description).
This PR fixes both issues, together with fixing two improper comments in the code.
Details:
The improper response of Save butto on changes in User's Available Groups was caused by sorting the Groups' ids represented by array of strings. We need to put the ids from strings to integers AND THEN to sort the array of ids. We need to have ids in both
@edit[:new][:group]
and@edit[:current][:group]
sorted to be able to compare them and then to setchanged
variable properly, for proper response of Save button.The second issue is fixed simply by adding
.sort
to the array of descriptions of selected groups. I've also removed unnecessary code in the same haml, as@edit[:new][:group]
is already edited here before it is used in the haml, so no need to do the same stuff again in the haml, I mean splitting the string (@edit[:new][:group]
is already an array of integers in the haml, not string!), and checking for'null'
.User's details screen, check the Groups and their order - groups are alphabetically orderd:
![users_detail](https://user-images.githubusercontent.com/13417815/68034232-9b8b5c00-fcc1-11e9-8973-eed007962d55.png)
Before: bad response of Save button and bad order of Selected Groups
![user_before](https://user-images.githubusercontent.com/13417815/68034215-96c6a800-fcc1-11e9-990c-88d33510515e.png)
After:
![user_after](https://user-images.githubusercontent.com/13417815/68031578-413bcc80-fcbc-11e9-8c9b-4e8454a60e59.png)