diff --git a/app/controllers/resource_pool_cloud_controller.rb b/app/controllers/resource_pool_cloud_controller.rb new file mode 100644 index 000000000000..1341b9c26768 --- /dev/null +++ b/app/controllers/resource_pool_cloud_controller.rb @@ -0,0 +1,28 @@ +class ResourcePoolCloudController < ResourcePoolController + def self.model + ResourcePool + end + + def self.table_name + @table_name ||= "resource_pool" + end + + def index + redirect_to(:action => 'show_list') + end + + private + + def breadcrumbs_options + { + :breadcrumbs => [ + {:title => _("Compute")}, + {:title => _("Clouds")}, + {:title => _("Resource Pools"), :url => controller_url}, + ], + } + end + + menu_section :clo + feature_for_actions "#{controller_name}_show_list", *ADV_SEARCH_ACTIONS +end diff --git a/app/controllers/resource_pool_controller.rb b/app/controllers/resource_pool_controller.rb index 49a9d7a86e25..9b2f2708e060 100644 --- a/app/controllers/resource_pool_controller.rb +++ b/app/controllers/resource_pool_controller.rb @@ -60,12 +60,8 @@ def breadcrumbs_options { :breadcrumbs => [ {:title => _("Compute")}, - {:title => _("Infrastructure")}, {:title => _("Resource Pools"), :url => controller_url}, ], } end - - menu_section :inf - feature_for_actions "#{controller_name}_show_list", *ADV_SEARCH_ACTIONS end diff --git a/app/controllers/resource_pool_infra_controller.rb b/app/controllers/resource_pool_infra_controller.rb new file mode 100644 index 000000000000..c9227a74c735 --- /dev/null +++ b/app/controllers/resource_pool_infra_controller.rb @@ -0,0 +1,28 @@ +class ResourcePoolInfraController < ResourcePoolController + def self.model + ResourcePool + end + + def self.table_name + @table_name ||= "resource_pool" + end + + def index + redirect_to(:action => 'show_list') + end + + private + + def breadcrumbs_options + { + :breadcrumbs => [ + {:title => _("Compute")}, + {:title => _("Infrastructure")}, + {:title => _("Resource Pools"), :url => controller_url}, + ], + } + end + + menu_section :inf + feature_for_actions "#{controller_name}_show_list", *ADV_SEARCH_ACTIONS +end diff --git a/app/helpers/resource_pool_helper/textual_summary.rb b/app/helpers/resource_pool_helper/textual_summary.rb index 39b38946d90f..4aba3cda4897 100644 --- a/app/helpers/resource_pool_helper/textual_summary.rb +++ b/app/helpers/resource_pool_helper/textual_summary.rb @@ -44,21 +44,25 @@ def textual_vapp def textual_aggregate_cpu_speed # TODO: Why aren't we using mhz_to_human_size here? + return nil if @record.aggregate_cpu_speed == 0 {:label => _("Total Host CPU Resources"), :value => "#{number_with_delimiter(@record.aggregate_cpu_speed)} MHz"} end def textual_aggregate_cpu_memory + return nil if @record.aggregate_memory == 0 {:label => _("Total Host Memory"), :value => number_to_human_size(@record.aggregate_memory.megabytes, :precision => 0)} end def textual_aggregate_physical_cpus + return nil if @record.aggregate_physical_cpus == 0 {:label => _("Total Host CPUs"), :value => number_with_delimiter(@record.aggregate_physical_cpus)} end def textual_aggregate_cpu_total_cores + return nil if @record.aggregate_cpu_total_cores == 0 {:label => _("Total Host CPU Cores"), :value => number_with_delimiter(@record.aggregate_cpu_total_cores)} end @@ -72,11 +76,13 @@ def textual_aggregate_vm_cpus end def textual_parent_datacenter + return nil if @record.v_parent_datacenter.nil? {:label => _("Parent Datacenter"), :icon => "fa fa-building-o", :value => @record.v_parent_datacenter || _("None")} end def textual_parent_cluster cluster = @record.parent_cluster + return nil if cluster.nil? h = {:label => _("Parent Cluster"), :icon => "pficon pficon-cluster", :value => (cluster.nil? ? _("None") : cluster.name)} @@ -89,6 +95,7 @@ def textual_parent_cluster def textual_parent_host host = @record.parent_host + return nil if host.nil? h = {:label => _("Parent Host"), :icon => "pficon pficon-container-node", :value => (host.nil? ? _("None") : host.name)} diff --git a/app/presenters/menu/default_menu.rb b/app/presenters/menu/default_menu.rb index cd47c6edddbc..0b8caba5bdd1 100644 --- a/app/presenters/menu/default_menu.rb +++ b/app/presenters/menu/default_menu.rb @@ -84,7 +84,7 @@ def clouds_menu_section Menu::Item.new('orchestration_stack', N_('Stacks'), 'orchestration_stack', {:feature => 'orchestration_stack_show_list'}, '/orchestration_stack/show_list'), Menu::Item.new('auth_key_pair_cloud', N_('Key Pairs'), 'auth_key_pair_cloud', {:feature => 'auth_key_pair_cloud_show_list'}, '/auth_key_pair_cloud/show_list'), Menu::Item.new('placement_group', N_('Placement Groups'), 'placement_group', {:feature => 'placement_group_show_list'}, '/placement_group/show_list'), - Menu::Item.new('resource_pool', N_('Resource Pools'), 'resource_pool', {:feature => 'resource_pool_show_list'}, '/resource_pool/show_list'), + Menu::Item.new('resource_pool', N_('Resource Pools'), 'resource_pool', {:feature => 'resource_pool_show_list'}, '/resource_pool_cloud/show_list'), Menu::Item.new('cloud_databases', N_('Databases'), 'cloud_database', {:feature => 'cloud_database'}, '/cloud_database/show_list'), ]) end @@ -95,7 +95,7 @@ def infrastructure_menu_section Menu::Item.new('ems_cluster', N_("Clusters"), 'ems_cluster', {:feature => 'ems_cluster_show_list'}, '/ems_cluster/show_list'), Menu::Item.new('host', N_("Hosts"), 'host', {:feature => 'host_show_list'}, '/host/show_list'), Menu::Item.new('vm_infra', N_('Virtual Machines'), 'vm_infra_explorer', {:feature => 'vm_infra_explorer', :any => true}, '/vm_infra/explorer'), - Menu::Item.new('resource_pool', N_('Resource Pools'), 'resource_pool', {:feature => 'resource_pool_show_list'}, '/resource_pool/show_list'), + Menu::Item.new('resource_pool', N_('Resource Pools'), 'resource_pool', {:feature => 'resource_pool_show_list'}, '/resource_pool_infra/show_list'), Menu::Item.new('storage', N_('Datastores'), 'storage', {:feature => 'storage_show_list'}, '/storage/explorer'), Menu::Item.new('pxe', N_('PXE'), 'pxe', {:feature => 'pxe', :any => true}, '/pxe/explorer'), Menu::Item.new('switch', N_('Networking'), 'infra_networking', {:feature => 'infra_networking', :any => true}, '/infra_networking/explorer'), diff --git a/app/views/resource_pool_cloud/_config.html.haml b/app/views/resource_pool_cloud/_config.html.haml new file mode 100644 index 000000000000..b84440bb0069 --- /dev/null +++ b/app/views/resource_pool_cloud/_config.html.haml @@ -0,0 +1,20 @@ +#maincontent + = render :partial => "layouts/flash_msg" + + - if @display == "config_info" + rp_config = calculate_rp_config(@record) + %fieldset + %h3= _('Info') + %table.table.table-bordered.table-striped + - if rp_config.blank? + %tr + %td{:width => "495"} + %strong= _('Not Available') + - else + - rp_config.each_slice(2) do |items| + %tr + - items.each do |item| + %td{:width => "495"} + %strong + = h(item[:field]) + = h(item[:description]) diff --git a/app/views/resource_pool_cloud/show.html.haml b/app/views/resource_pool_cloud/show.html.haml new file mode 100644 index 000000000000..60deaee2a60d --- /dev/null +++ b/app/views/resource_pool_cloud/show.html.haml @@ -0,0 +1,11 @@ +#main_div + - if %w(vms all_vms hosts clusters resource_pools).include?(@display) && @showtype != "compare" + = render :partial => "layouts/gtl", :locals => {:action_url => "show/#{@record.id}"} + - else + - case @showtype + - when "details" + = render :partial => "layouts/gtl", :locals => {:action_url => @lastaction} + - when 'main' + = render :partial => "layouts/textual_groups_generic" + - when 'config' + = render :partial => "config" diff --git a/app/views/resource_pool_cloud/show_list.html.haml b/app/views/resource_pool_cloud/show_list.html.haml new file mode 100644 index 000000000000..039604839f28 --- /dev/null +++ b/app/views/resource_pool_cloud/show_list.html.haml @@ -0,0 +1,2 @@ +#main_div + = render :partial => 'layouts/gtl' diff --git a/app/views/resource_pool_infra/_config.html.haml b/app/views/resource_pool_infra/_config.html.haml new file mode 100644 index 000000000000..b84440bb0069 --- /dev/null +++ b/app/views/resource_pool_infra/_config.html.haml @@ -0,0 +1,20 @@ +#maincontent + = render :partial => "layouts/flash_msg" + + - if @display == "config_info" + rp_config = calculate_rp_config(@record) + %fieldset + %h3= _('Info') + %table.table.table-bordered.table-striped + - if rp_config.blank? + %tr + %td{:width => "495"} + %strong= _('Not Available') + - else + - rp_config.each_slice(2) do |items| + %tr + - items.each do |item| + %td{:width => "495"} + %strong + = h(item[:field]) + = h(item[:description]) diff --git a/app/views/resource_pool_infra/show.html.haml b/app/views/resource_pool_infra/show.html.haml new file mode 100644 index 000000000000..60deaee2a60d --- /dev/null +++ b/app/views/resource_pool_infra/show.html.haml @@ -0,0 +1,11 @@ +#main_div + - if %w(vms all_vms hosts clusters resource_pools).include?(@display) && @showtype != "compare" + = render :partial => "layouts/gtl", :locals => {:action_url => "show/#{@record.id}"} + - else + - case @showtype + - when "details" + = render :partial => "layouts/gtl", :locals => {:action_url => @lastaction} + - when 'main' + = render :partial => "layouts/textual_groups_generic" + - when 'config' + = render :partial => "config" diff --git a/app/views/resource_pool_infra/show_list.html.haml b/app/views/resource_pool_infra/show_list.html.haml new file mode 100644 index 000000000000..039604839f28 --- /dev/null +++ b/app/views/resource_pool_infra/show_list.html.haml @@ -0,0 +1,2 @@ +#main_div + = render :partial => 'layouts/gtl' diff --git a/config/routes.rb b/config/routes.rb index 39d9e9a6fcb4..0294b6e9b7ec 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -2766,6 +2766,62 @@ save_post }, + :resource_pool_cloud => { + :get => %w[ + download_data + download_summary_pdf + index + protect + show + show_list + tagging_edit + ] + + compare_get, + :post => %w[ + button + listnav_search_selected + protect + sections_field_changed + show + show_list + tagging_edit + tree_autoload + quick_search + ] + + adv_search_post + + compare_post + + exp_post + + save_post + }, + + :resource_pool_infra => { + :get => %w[ + download_data + download_summary_pdf + index + protect + show + show_list + tagging_edit + ] + + compare_get, + :post => %w[ + button + listnav_search_selected + protect + sections_field_changed + show + show_list + tagging_edit + tree_autoload + quick_search + ] + + adv_search_post + + compare_post + + exp_post + + save_post + }, + :restful_redirect => { :get => %w[ index