Skip to content

Commit

Permalink
Adds Physical Chassis List & Details pages
Browse files Browse the repository at this point in the history
  • Loading branch information
caiocmpaes committed Jul 17, 2018
1 parent e6d193c commit 3e34c9f
Show file tree
Hide file tree
Showing 19 changed files with 688 additions and 5 deletions.
1 change: 1 addition & 0 deletions app/controllers/ems_common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ def display_methods
persistent_volumes
physical_servers
physical_racks
physical_chassis
physical_servers_with_host
physical_switches
security_groups
Expand Down
32 changes: 32 additions & 0 deletions app/controllers/physical_chassis_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
class PhysicalChassisController < ApplicationController
include Mixins::GenericListMixin
include Mixins::GenericShowMixin
include Mixins::GenericSessionMixin
include Mixins::MoreShowActions

before_action :check_privileges
before_action :get_session_data
after_action :cleanup_action
after_action :set_session_data

def self.table_name
@table_name ||= "physical_chassis"
end

def show_list
disable_client_cache
process_show_list
end

def textual_group_list
[
%i(properties relationships),
%i(management_network slots)
]
end
helper_method(:textual_group_list)

def self.display_methods
%w(physical_chassis)
end
end
20 changes: 20 additions & 0 deletions app/decorators/physical_chassis_decorator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
class PhysicalChassisDecorator < MiqDecorator
def self.fonticon
'pficon pficon-cluster'
end

def quadicon
{
:top_left => {
:text => t = physical_servers.count,
:tooltip => n_("%{number} Physical Server", "%{number} Physical Servers", t) % {:number => t}
},
:top_right => {},
:bottom_left => {
:fonticon => fonticon,
:tooltip => ui_lookup(:model => type),
},
:bottom_right => QuadiconHelper.health_state(health_state)
}
end
end
1 change: 1 addition & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1156,6 +1156,7 @@ def pdf_page_size_style
orchestration_stack
physical_infra_topology
physical_rack
physical_chassis
physical_switch
physical_server
persistent_volume
Expand Down
1 change: 1 addition & 0 deletions app/helpers/application_helper/listnav.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def render_listnav_filename
orchestration_stack
persistent_volume
physical_rack
physical_chassis
physical_server
physical_switch
resource_pool
Expand Down
6 changes: 5 additions & 1 deletion app/helpers/ems_physical_infra_helper/textual_summary.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def textual_group_properties
def textual_group_relationships
TextualGroup.new(
_("Relationships"),
%i(physical_racks physical_switches physical_servers datastores vms physical_servers_with_host)
%i(physical_racks physical_chassis physical_switches physical_servers datastores vms physical_servers_with_host)
)
end

Expand Down Expand Up @@ -53,6 +53,10 @@ def textual_physical_racks
textual_link(@record.physical_racks)
end

def textual_physical_chassis
textual_link(@record.physical_chassis)
end

def textual_physical_switches
textual_link(@record.physical_switches, :as => PhysicalSwitch)
end
Expand Down
3 changes: 3 additions & 0 deletions app/helpers/physical_chassis_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module PhysicalChassisHelper
include_concern 'TextualSummary'
end
113 changes: 113 additions & 0 deletions app/helpers/physical_chassis_helper/textual_summary.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
module PhysicalChassisHelper::TextualSummary
#
# Textual Groups
# Properties, Relationships, Management Network, Slots
#
def textual_group_properties
TextualGroup.new(
_("Properties"),
%i(name product_name manufacturer serial_number part_number health_state uid_ems description)
)
end

def textual_group_relationships
TextualGroup.new(
_("Relationships"),
%i(ext_management_system physical_rack physical_servers)
)
end

def textual_group_management_network
TextualGroup.new(
_("Management Network"),
%i(ipaddress)
)
end

def textual_group_slots
TextualGroup.new(
_("Chassis Slots"),
%i(mm_slot_count switch_slot_count fan_slot_count blade_slot_count powersupply_slot_count)
)
end

#
# Properties
#
def textual_name
{:label => _("Chassis name"), :value => @record.name }
end

def textual_product_name
{:label => _("Product Name"), :value => @record.asset_detail["product_name"] }
end

def textual_manufacturer
{:label => _("Manufacturer"), :value => @record.asset_detail["manufacturer"] }
end

def textual_serial_number
{:label => _("Serial Number"), :value => @record.asset_detail["serial_number"] }
end

def textual_part_number
{:label => _("Part Number"), :value => @record.asset_detail["part_number"] }
end

def textual_health_state
{:label => _("Health State"), :value => @record.health_state}
end

def textual_uid_ems
{:label => _("UUID"), :value => @record.uid_ems }
end

def textual_description
{:label => _("Description"), :value => @record.asset_detail["description"]}
end

#
# Relashionships
#
def textual_ext_management_system
textual_link(ExtManagementSystem.find(@record.ems_id))
end

def textual_physical_rack
textual_link(@record.physical_rack)
end

def textual_physical_servers
textual_link(@record.physical_servers)
end

#
# Management Network
#
def textual_ipaddress
{:label => _("IP"), :value => (@record.guest_devices.detect { |device| device.device_type == "management" })&.network&.ipaddress}
end

#
# Chassis Slots
#
def textual_mm_slot_count
{:label => _("Management Module Slot Count"), :value => @record.management_module_slot_count}
end

def textual_switch_slot_count
{:label => _("Switch Slot Count"), :value => @record.switch_slot_count}
end

def textual_fan_slot_count
{:label => _("Fan Slot Count"), :value => @record.fan_slot_count}
end

def textual_blade_slot_count
{:label => _("Blade Slot Count"), :value => @record.blade_slot_count}
end

def textual_powersupply_slot_count
{:label => _("Power Supply Slot Count"), :value => @record.powersupply_slot_count}
end
end
6 changes: 5 additions & 1 deletion app/helpers/physical_rack_helper/textual_summary.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def textual_group_properties
def textual_group_relationships
TextualGroup.new(
_("Relationships"),
%i(ext_management_system physical_servers)
%i(ext_management_system physical_chassis physical_servers)
)
end

Expand All @@ -25,6 +25,10 @@ def textual_ems_ref
{:label => _("UUID"), :value => @record.ems_ref }
end

def textual_physical_chassis
textual_link(@record.physical_chassis)
end

def textual_physical_servers
textual_link(@record.physical_servers)
end
Expand Down
8 changes: 7 additions & 1 deletion app/helpers/physical_server_helper/textual_summary.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def textual_group_properties
def textual_group_relationships
TextualGroup.new(
_("Relationships"),
%i(host ext_management_system physical_rack)
%i(host ext_management_system physical_rack physical_chassis)
)
end

Expand Down Expand Up @@ -66,6 +66,12 @@ def textual_physical_rack
textual_link(PhysicalRack.find(rack_id))
end

def textual_physical_chassis
chassis_id = @record.physical_chassis_id
return nil if chassis_id.nil?
textual_link(PhysicalChassis.find(chassis_id))
end

def textual_name
{:label => _("Server name"), :value => @record.name }
end
Expand Down
3 changes: 2 additions & 1 deletion app/presenters/menu/default_menu.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,10 @@ def infrastructure_menu_section
def physical_infrastructure_menu_section
Menu::Section.new(:phy, N_("Physical Infrastructure"), 'fa fa-plus fa-2x', [
Menu::Item.new('ems_physical_infra', N_('Providers'), 'ems_physical_infra', {:feature => 'ems_physical_infra_show_list'}, '/ems_physical_infra'),
Menu::Item.new('physical_chassis', N_('Chassis'), 'physical_chassis', {:feature => 'physical_chassis_show_list'}, '/physical_chassis'),
Menu::Item.new('physical_rack', N_('Racks'), 'physical_rack', {:feature => 'physical_rack_show_list'}, '/physical_rack'),
Menu::Item.new('physical_switch', N_('Switches'), 'physical_switch', {:feature => 'physical_switch_show_list'}, '/physical_switch'),
Menu::Item.new('physical_server', N_('Servers'), 'physical_server', {:feature => 'physical_server_show_list'}, '/physical_server'),
Menu::Item.new('physical_switch', N_('Switches'), 'physical_switch', {:feature => 'physical_switch_show_list'}, '/physical_switch'),
Menu::Item.new('physical_infra_topology', N_('Topology'), 'physical_infra_topology', {:feature => 'physical_infra_topology', :any => true}, '/physical_infra_topology'),
])
end
Expand Down
17 changes: 17 additions & 0 deletions app/views/layouts/listnav/_physical_chassis.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
- if @record.try(:name)
#accordion.panel-group
= miq_accordion_panel(truncate(@record.name, :length => truncate_length), true, "icon") do
= render :partial => 'shared/quadicon', :locals => {:record => @record}

= miq_accordion_panel(_("Properties"), false, "ems_prop") do
%ul.nav.nav-pills.nav-stacked
%li
= link_to(_('Summary'), {:action => 'show', :id => @record, :display => 'main'}, {:title => _("Show Summary")})

= miq_accordion_panel(_("Relationships"), false, "ems_rel") do
%ul.nav.nav-pills.nav-stacked
- if @record.ext_management_system
%li
= link_to(_("Provider: %{name}") % {:name => @record.ext_management_system.name},
ems_physical_infra_path(@record.ext_management_system.id),
:title => _("Show this parent Provider"))
13 changes: 13 additions & 0 deletions app/views/physical_chassis/show.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#main_div
- if %w(physical_rack physical_servers).include?(@display)
= render :partial => "layouts/gtl", :locals => {:action_url => "show/#{@record.id}"}
- if %w(physical_servers).include?(@display)
%physical-server-toolbar#ems_physical_infra_show_list_form
:javascript
miq_bootstrap('#ems_physical_infra_show_list_form')
- else
- case @showtype
- when "main"
= render :partial => 'layouts/textual_groups_generic'
- when "timeline"
= render :partial => "layouts/tl_show_async"
2 changes: 2 additions & 0 deletions app/views/physical_chassis/show_list.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#main_div
= render :partial => 'layouts/gtl'
2 changes: 1 addition & 1 deletion app/views/physical_rack/show.html.haml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#main_div
- if %w(physical_racks physical_servers).include?(@display)
- if %w(physical_chassis physical_servers).include?(@display)
= render :partial => "layouts/gtl", :locals => {:action_url => "show/#{@record.id}"}
- else
- case @showtype
Expand Down
16 changes: 16 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1392,6 +1392,22 @@
)
},

:physical_chassis => {
:get => %w(
download_data
perf_top_chart
protect
show_list
show
),

:post => %w(
button
show_list
quick_search
)
},

:guest_device => {
:get => %w(
show_list
Expand Down
63 changes: 63 additions & 0 deletions product/views/PhysicalChassis.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#Report title
title: Physical Chassis

#Menu name
name: Physical Chassis


db: PhysicalChassis


# Columns to fetch from main table
cols:
- name
- type
- health_state
- asset_detail.product_name
- asset_detail.manufacturer


include:


include_for_find:
:ext_management_system: {}
:compliances: {}
:tags: {}


col_order:
- name
- type
- health_state
- asset_detail.product_name
- asset_detail.manufacturer

col_formats:
-
- :model_name

headers:
- Name
- Type
- Health State
- Product Name
- Manufacturer


conditions:


order: Ascending


sortby:
- name

group: n


graph:


dims:
Loading

0 comments on commit 3e34c9f

Please sign in to comment.