diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index e9824de9a5e..ff695c4e932 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -141,8 +141,8 @@ def change_tab def build_targets_hash(items, typ = true) @targets_hash ||= {} - # if array of objects came in if typ + # if array of objects came in items.each do |item| @targets_hash[item.id.to_i] = item end diff --git a/app/models/miq_report/search.rb b/app/models/miq_report/search.rb index 4fee2328699..af8f678c5ce 100644 --- a/app/models/miq_report/search.rb +++ b/app/models/miq_report/search.rb @@ -100,6 +100,8 @@ def paged_view_search(options = {}) if options[:parent] targets = get_parent_targets(options[:parent], options[:association] || options[:parent_method]) + # filter out archived VMs + targets = targets.select { |target| !Vm.find_by(:id => target).archived? unless Vm.find_by(:id => target).nil? } if targets.empty? search_results, attrs = [targets, {:auth_count => 0, :total_count => 0}] else diff --git a/app/presenters/tree_builder.rb b/app/presenters/tree_builder.rb index 7fe4391988e..c4ee2757567 100644 --- a/app/presenters/tree_builder.rb +++ b/app/presenters/tree_builder.rb @@ -404,10 +404,6 @@ def x_build_node(object, pid, options) # Called with object, tree node parent ((object.kind_of?(MiqServer) && MiqServer.my_server(true).id == object.id) || (object.kind_of?(Zone) && MiqServer.my_server(true).my_zone == object.name)) - # # open nodes to show selected automate entry point - # x_tree[:open_nodes] = @temp[:open_nodes].dup if @temp && @temp[:open_nodes] - # x_tree[:open_nodes] = @open_nodes.dup if @open_nodes - node = x_build_single_node(object, pid, options) if [:policy_profile_tree, :policy_tree].include?(options[:tree]) diff --git a/app/presenters/tree_builder_instances.rb b/app/presenters/tree_builder_instances.rb index 288824069d1..dee1910c441 100644 --- a/app/presenters/tree_builder_instances.rb +++ b/app/presenters/tree_builder_instances.rb @@ -33,6 +33,7 @@ def x_get_tree_ems_kids(object, count_only) # Get AvailabilityZone children count/array def x_get_tree_az_kids(object, count_only) objects = rbac_filtered_objects(object.vms.order("name")) + objects = objects.select { |obj| !obj.archived? } count_only ? objects.length : objects end diff --git a/app/views/layouts/_x_gtl.html.haml b/app/views/layouts/_x_gtl.html.haml index 71d8a314a95..998a96ad584 100644 --- a/app/views/layouts/_x_gtl.html.haml +++ b/app/views/layouts/_x_gtl.html.haml @@ -5,7 +5,7 @@ #gtl_div - view ||= @view - - table = view.sub_table ? view.sub_table : view.table unless view.nil? + - table = view.sub_table ? view.sub_table : view.table unless view.nil? - action_url ||= "explorer" - @gtl_type = "grid" if @gtl_type.nil? - if view.nil? || table.data.length == 0 diff --git a/spec/models/miq_report_spec.rb b/spec/models/miq_report_spec.rb index 3e232218c60..ee7793a5f1a 100644 --- a/spec/models/miq_report_spec.rb +++ b/spec/models/miq_report_spec.rb @@ -191,7 +191,9 @@ def invoke_ae host2 = FactoryGirl.create(:host) vmb = FactoryGirl.create(:vm_vmware, :host => host2, :name => "b") + vmb.stub(:archived?) { false } vmc = FactoryGirl.create(:vm_vmware, :host => host2, :name => "c") + vmc.stub(:archived?) { false } report = MiqReport.new(:db => "Vm", :sortby => "name", :order => "Descending") results, = report.paged_view_search(