Make filters saved in Workloads displayed in accordion #3435
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1536625
Make filters saved in Advanced Search in Workloads displayed in accordion right after creating them. Make filters saved in Adv Search displayed also in another screens like My Services, Datastores, VMS, Images, etc.
Before:
![workloads_before](https://user-images.githubusercontent.com/13417815/36436206-efcced10-1663-11e8-8bef-e019e72c3850.png)
After:
![workloads_after](https://user-images.githubusercontent.com/13417815/36434788-2e38bdbc-1660-11e8-8df0-9224c9fa2fcd.png)
Details:
Actually,
build_accordions_and_trees
andadv_search_redraw_listnav_and_main
methods inadv_search_redraw_left_div
https://github.com/ManageIQ/manageiq-ui-classic/blob/master/app/controllers/application_controller/advanced_search.rb#L187 do what we need to properly display the tree and the filters, after saving a new filter (see the changes of this PR). I've tested many screens, fixed all of the screens withx_active_tree
like https://github.com/ManageIQ/manageiq-ui-classic/compare/master...hstastna:Filters_Workloads_display_until_refresh?expand=1#diff-3bd60fe6d117a9261fe45876c3ba51c9R213. Anyway, I think that maybe we could removeadv_search_redraw_tree_and_main(tree)
method fromadv_search_redraw_left_div
and so from advanced_search.rb (I mean, the whole "else" part of if/else block https://github.com/ManageIQ/manageiq-ui-classic/compare/master...hstastna:Filters_Workloads_display_until_refresh?expand=1#diff-3bd60fe6d117a9261fe45876c3ba51c9R199) because I have not found any situation when it would enter the "else" part of the block; I just kept it there for now, to be sure that nothing else breaks. I think that we don't need that method, it never worked as expected, as I remember.I also removed "storage" from
render_listnav_filename
, because this method is called only from https://github.com/ManageIQ/manageiq-ui-classic/blob/master/app/views/layouts/_listnav.html.haml#L2, and for Datastores this place is accessed only when saving/deleting some filter and it does not work, of course, because we need "explorer" asfilename
in that haml, not "show_list" (as a result ofrender_listnav_filename
method) to make everything displayed properly (normally, it is "explorer", if we are in the page for the first time or if we reload the page).Btw, when we refresh the pages with the issue (BZ), filters are properly displayed and
build_accordions_and_trees
andadv_search_redraw_listnav_and_main
methods are normally called so why to call different methods when saving/deleting filters? This is the idea which lead to my fix. Yes, the fix also works well if we delete some filter: the filter immediately disappears from accordion, and that is right behavior (this also did not work). Maybe this fix is not the best, but it works well and I haven't found any simpler solution which wouldn't affect other screens/situations in a negative way.