forked from ManageIQ/manageiq-ui-classic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtextual_summary.rb
47 lines (40 loc) · 1.33 KB
/
textual_summary.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
module InfraNetworkingHelper::TextualSummary
#
# Groups
#
def textual_group_properties
TextualGroup.new(_('UNUSED?'), %i[switch_type])
end
def textual_group_relationships
TextualGroup.new(_("Relationships"), %i[hosts custom_button_events lans])
end
def textual_group_smart_management
TextualTags.new(_("Smart Management"), %i[tags])
end
#
# Items
#
def textual_hosts
num = @record.number_of(:hosts)
h = {:label => _("Hosts"), :icon => "pficon pficon-container-node", :value => num}
if num.positive? && role_allows?(:feature => "host_show_list")
h[:explorer] = true
h[:link] = url_for_only_path(:action => 'hosts', :id => @record, :db => 'switch')
end
h
end
def textual_lans
portgroups = @record.lans.map(&:name)
{:label => _("Portgroup"), :icon => "pficon pficon-network", :value => portgroups.join(', ')}
end
def textual_custom_button_events
return nil unless User.current_user.super_admin_user? || User.current_user.admin?
{
:label => _('Custom Button Events'),
:value => num = @record.number_of(:custom_button_events),
:link => num.positive? ? url_for_only_path(:action => 'custom_button_events', :id => @record, :db => 'switch') : nil,
:icon => CustomButtonEvent.decorate.fonticon,
:explorer => true
}
end
end