-
Notifications
You must be signed in to change notification settings - Fork 357
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
Fix mismatching categories with values when assigning tags #3644
Fix mismatching categories with values when assigning tags #3644
Conversation
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1556984 Fix sorting of categories by description for assigning tags so that downcase method is added, to sort items of the array properly.
Fix setting @edit[:cat] to first category when assigning tags so that 'min_by' method is replaced by 'first' method, to really get the first item of the categories' array.
Remove sorting of the array with categories for assigning tags from haml as it no longer makes sense to be there because proper sorting is already implemented in tag_edit_build_screen method.
@miq-bot add_label bug |
Checked commits hstastna/manageiq-ui-classic@02bc49c~...de0f009 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 |
@miq-bot remove_label wip |
Tested in UI. LGTM 👍Nice fix 👍 |
LGTM, hashes should follow insertion order in ruby 1.9+ so we can do this 👍 |
@miq-bot add_label gaprindashvili/yes |
Fix mismatching categories with values when assigning tags (cherry picked from commit 392d5f3) https://bugzilla.redhat.com/show_bug.cgi?id=1561096
Gaprindashvili backport details:
|
Fixes:
https://bugzilla.redhat.com/show_bug.cgi?id=1556984
Partially caused by:
[1] ManageIQ/manageiq#5598
[2] ManageIQ/manageiq#9234
Done:
:description
for assigning tags so thatdowncase
method is added, to sort items of the array properly (not sorting only right before displaying the categories like in [2] because for example@edit[:cat]
depends on what is in the first position of the array for categories, like here: https://github.com/ManageIQ/manageiq-ui-classic/pull/3644/files#diff-32a1920bfa43ecfb0853173babda0f8aL218)@edit[:cat]
to first category so thatmin_by
method is replaced byfirst
method, to really get the first item of the categories' array (see the comment: https://github.com/ManageIQ/manageiq-ui-classic/pull/3644/files#diff-32a1920bfa43ecfb0853173babda0f8aR217;min_by
does not always return what we expect, we simply need the first item of the array)tag_edit_build_screen
method (see https://github.com/ManageIQ/manageiq-ui-classic/pull/3644/files#diff-32a1920bfa43ecfb0853173babda0f8aR196)Notes:
Before:
After: