Skip to content

Commit

Permalink
Merge pull request #1232 from Ladas/floating_ip_related_crosslinks_fo…
Browse files Browse the repository at this point in the history
…r_load_balancers

Floating IP related crosslinks for load balancers
(cherry picked from commit faa2eb5)

https://bugzilla.redhat.com/show_bug.cgi?id=1458943
  • Loading branch information
Martin Povolny authored and simaishi committed Jun 6, 2017
1 parent a316463 commit e157c36
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 16 deletions.
2 changes: 1 addition & 1 deletion app/controllers/load_balancer_controller.rb
Expand Up @@ -10,7 +10,7 @@ class LoadBalancerController < ApplicationController
include Mixins::GenericShowMixin

def self.display_methods
%w(instances)
%w(instances network_ports floating_ips security_groups)
end

private
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/network_port_controller.rb
Expand Up @@ -15,7 +15,7 @@ def textual_group_list
helper_method :textual_group_list

def self.display_methods
%w(cloud_subnets floating_ips)
%w(cloud_subnets floating_ips security_groups)
end

menu_section :net
Expand Down
2 changes: 2 additions & 0 deletions app/helpers/floating_ip_helper/textual_summary.rb
Expand Up @@ -38,6 +38,8 @@ def textual_parent_ems_cloud
end

def textual_instance
return unless @record.vm

label = ui_lookup(:table => "vm_cloud")
instance = @record.vm
h = {:label => label, :icon => "pficon pficon-virtual-machine"}
Expand Down
17 changes: 16 additions & 1 deletion app/helpers/load_balancer_helper/textual_summary.rb
Expand Up @@ -11,7 +11,10 @@ def textual_group_properties
end

def textual_group_relationships
TextualGroup.new(_("Relationships"), %i(parent_ems_cloud ems_network cloud_tenant instances))
TextualGroup.new(
_("Relationships"),
%i(parent_ems_cloud ems_network cloud_tenant instances network_ports floating_ips security_groups)
)
end

#
Expand Down Expand Up @@ -59,4 +62,16 @@ def textual_instances
end
h
end

def textual_network_ports
@record.network_ports
end

def textual_floating_ips
@record.floating_ips
end

def textual_security_groups
@record.security_groups
end
end
31 changes: 20 additions & 11 deletions app/helpers/network_port_helper/textual_summary.rb
Expand Up @@ -16,7 +16,7 @@ def textual_group_properties
def textual_group_relationships
TextualGroup.new(
_("Relationships"),
%i(parent_ems_cloud ems_network cloud_tenant instance cloud_subnets floating_ips host)
%i(parent_ems_cloud ems_network cloud_tenant device cloud_subnets floating_ips security_groups host)
)
end

Expand Down Expand Up @@ -47,17 +47,22 @@ def textual_parent_ems_cloud
@record.ext_management_system.try(:parent_manager)
end

def textual_instance
label = ui_lookup(:table => "vm_cloud")
instance = @record.device
h = nil
if instance && role_allows?(:feature => "vm_show")
h = {:label => label, :icon => "pficon pficon-virtual-machine"}
h[:value] = instance.name
h[:link] = url_for_only_path(:controller => 'vm_cloud', :action => 'show', :id => instance.id)
h[:title] = _("Show %{label}") % {:label => label}
def textual_device
device = @record.device
if device.kind_of?(VmOrTemplate)
label = ui_lookup(:table => "vm_cloud")
instance = @record.device
h = nil
if instance && role_allows?(:feature => "vm_show")
h = {:label => label, :icon => "pficon pficon-virtual-machine"}
h[:value] = instance.name
h[:link] = url_for_only_path(:controller => 'vm_cloud', :action => 'show', :id => instance.id)
h[:title] = _("Show %{label}") % {:label => label}
end
h
else
device
end
h
end

def textual_cloud_tenant
Expand All @@ -72,6 +77,10 @@ def textual_floating_ips
@record.floating_ips
end

def textual_security_groups
@record.security_groups
end

def textual_host
return nil unless @record.device_type == "Host"
{
Expand Down
2 changes: 1 addition & 1 deletion app/views/load_balancer/show.html.haml
@@ -1,5 +1,5 @@
#main_div
- if ["instances"].include?(@display) && @showtype != "compare"
- if %w(instances network_ports floating_ips security_groups).include?(@display) && @showtype != "compare"
= render :partial => "layouts/gtl", :locals => {:action_url => "show/#{@record.id}"}
- elsif @showtype == 'main'
= render :partial => "layouts/textual_groups_generic"
2 changes: 1 addition & 1 deletion app/views/network_port/show.html.haml
@@ -1,5 +1,5 @@
#main_div
- if ["instances", "cloud_subnets", "floating_ips"].include?(@display) && @showtype != "compare"
- if %w(instances cloud_subnets floating_ips security_groups).include?(@display) && @showtype != "compare"
= render :partial => "layouts/gtl", :locals => {:action_url => "show/#{@record.id}"}
- elsif @showtype == 'main'
= render :partial => "layouts/textual_groups_generic"

0 comments on commit e157c36

Please sign in to comment.