From 32e3d36c136b3420f5bb23537b60d4a820f62342 Mon Sep 17 00:00:00 2001 From: Maysa Macedo Date: Tue, 30 May 2017 08:32:56 -0300 Subject: [PATCH 1/2] Displayed number of relationships between Hosts and Physical Server --- app/helpers/ems_physical_infra_helper/textual_summary.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/helpers/ems_physical_infra_helper/textual_summary.rb b/app/helpers/ems_physical_infra_helper/textual_summary.rb index dc4fc470148..1ed6ae3d943 100644 --- a/app/helpers/ems_physical_infra_helper/textual_summary.rb +++ b/app/helpers/ems_physical_infra_helper/textual_summary.rb @@ -14,7 +14,7 @@ def textual_group_properties def textual_group_relationships TextualGroup.new( _("Relationships"), - %i(physical_servers datastores vms) + %i(physical_servers datastores vms hosts) ) end @@ -62,6 +62,11 @@ def textual_physical_servers h end + def textual_hosts + count_of_host_relationships = (@record.physical_servers.select{|server| server.host != nil}).length + h = {:label => _("Hosts"), :icon => "pficon pficon-screen", :value => count_of_host_relationships} + end + def textual_guid {:label => _("Management Engine GUID"), :value => @record.guid} end From 8dc7b29f7698cad2343a8f63aa8c19ea240f43e0 Mon Sep 17 00:00:00 2001 From: Maysa Macedo Date: Tue, 30 May 2017 08:57:42 -0300 Subject: [PATCH 2/2] removed rubocop issues --- app/helpers/ems_physical_infra_helper/textual_summary.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/helpers/ems_physical_infra_helper/textual_summary.rb b/app/helpers/ems_physical_infra_helper/textual_summary.rb index 1ed6ae3d943..6c125cf4e03 100644 --- a/app/helpers/ems_physical_infra_helper/textual_summary.rb +++ b/app/helpers/ems_physical_infra_helper/textual_summary.rb @@ -63,8 +63,8 @@ def textual_physical_servers end def textual_hosts - count_of_host_relationships = (@record.physical_servers.select{|server| server.host != nil}).length - h = {:label => _("Hosts"), :icon => "pficon pficon-screen", :value => count_of_host_relationships} + count_of_host_relationships = (@record.physical_servers.select { |server| !server.host.nil? }).length + {:label => _("Hosts"), :icon => "pficon pficon-screen", :value => count_of_host_relationships} end def textual_guid