Skip to content

Commit

Permalink
Adding connected physical servers to physical switches page
Browse files Browse the repository at this point in the history
  • Loading branch information
douglasgabriel committed Aug 6, 2018
1 parent 511868a commit 44d07d1
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
4 changes: 2 additions & 2 deletions app/controllers/physical_switch_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ def show_list
def textual_group_list
[
%i(properties management_networks relationships),
%i(power_management firmware_details),
%i(power_management firmware_details connected_components),
]
end
helper_method(:textual_group_list)

def self.display_methods
%w(physical_switches physical_network_ports)
%w(physical_switches physical_network_ports physical_servers)
end

def display_physical_network_ports
Expand Down
20 changes: 18 additions & 2 deletions app/helpers/physical_switch_helper/textual_summary.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,18 @@ def textual_group_firmware_details
TextualTable.new(_("Firmwares"), firmware_details, [_("Name"), _("Version")])
end

def textual_group_connected_components
TextualGroup.new(
_("Connected Components"),
%i(connected_physical_servers)
)
end

def textual_ports
ports_count = @record.physical_network_ports.count
ports = {:label => _("Ports"), :value => ports_count, :icon => "ff ff-network-port"}
ports = {:label => _("Ports"), :value => ports_count, :icon => PhysicalNetworkPortDecorator.fonticon}
if ports_count.positive?
ports[:link] = "/physical_switch/show/#{@record.id}?display=physical_network_ports"
ports[:link] = url_for_only_path(:action => 'show', :id => @record, :display => 'physical_network_ports')
end
ports
end
Expand All @@ -43,6 +50,15 @@ def textual_ext_management_system
textual_link(ExtManagementSystem.find(@record.ems_id))
end

def textual_connected_physical_servers
physical_servers_count = @record.physical_servers.count
physical_servers = {:label => _("Physical Servers"), :value => physical_servers_count, :icon => PhysicalServerDecorator.fonticon}
if physical_servers_count.positive?
physical_servers[:link] = url_for_only_path(:action => 'show', :id => @record, :display => 'physical_servers')
end
physical_servers
end

def textual_name
{:label => _("Name"), :value => @record.name }
end
Expand Down
2 changes: 1 addition & 1 deletion app/views/physical_switch/show.html.haml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#main_div
- if %w(physical_switches physical_network_ports).include?(@display)
- if %w(physical_switches physical_network_ports physical_servers).include?(@display)
= render :partial => "layouts/gtl", :locals => {:action_url => "show/#{@record.id}"}
- else
- case @showtype
Expand Down
2 changes: 2 additions & 0 deletions spec/helpers/physical_switch_helper/textual_summary_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@
include_examples "textual_group", "Relationships", %i(ext_management_system)

include_examples "textual_group", "Power Management", %i(power_state), "power_management"

include_examples "textual_group", "Connected Components", %i(connected_physical_servers), "connected_components"
end

0 comments on commit 44d07d1

Please sign in to comment.