Skip to content

Commit

Permalink
Refactoring code of x_get_tree_custom_kids method
Browse files Browse the repository at this point in the history
depends on ManageIQ#98

Refactoring code of x_get_tree_custom_kids method as the
same code needs to be in the method in tree_builder_vms_filter.rb
and in tree_builder_storage.rb;
moving the code to new methods in miq_search.rb.
  • Loading branch information
Hilda Stastna committed Feb 21, 2017
1 parent 772caa6 commit 33910f8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
10 changes: 2 additions & 8 deletions app/presenters/tree_builder_storage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,7 @@ def x_get_tree_roots(count_only, _options)
end

def x_get_tree_custom_kids(object, count_only, options)
objects = MiqSearch.where(:db => options[:leaf])
objects = case object[:id]
when "global" # Global filters
objects.visible_to_all
when "my" # My filters
objects.where(:search_type => "user", :search_key => User.current_user.userid)
end
count_only_or_objects(count_only, objects, "description")
objects = MiqSearch.where(:db => options[:leaf]).filters_by_type(object[:id])
count_only_or_objects(count_only, objects, 'description')
end
end
8 changes: 1 addition & 7 deletions app/presenters/tree_builder_vms_filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,7 @@ def x_get_tree_roots(count_only, _options)
end

def x_get_tree_custom_kids(object, count_only, options)
objects = MiqSearch.where(:db => options[:leaf])
objects = case object[:id]
when "global" # Global filters
objects.visible_to_all
when "my" # My filters
objects.where(:search_type => "user", :search_key => User.current_user.userid)
end
objects = MiqSearch.where(:db => options[:leaf]).filters_by_type(object[:id])
count_only_or_objects(count_only, objects, 'description')
end
end

0 comments on commit 33910f8

Please sign in to comment.