Skip to content

Commit 10f63d8

Browse files
author
skovic
committed
Create network device summary page
1 parent b5466d2 commit 10f63d8

File tree

4 files changed

+64
-0
lines changed

4 files changed

+64
-0
lines changed

app/controllers/guest_device_controller.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,11 @@ def show_list
4040
options = {:model => "GuestDevice", :named_scope => [:with_ethernet_type]}
4141
process_show_list(options)
4242
end
43+
44+
def textual_group_list
45+
[
46+
%i(properties ports firmware),
47+
]
48+
end
49+
helper_method(:textual_group_list)
4350
end

app/helpers/guest_device_helper.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module GuestDeviceHelper
2+
include_concern 'TextualSummary'
3+
end
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
module GuestDeviceHelper::TextualSummary
2+
def textual_group_properties
3+
TextualGroup.new(
4+
_("Properties"),
5+
%i(device_name location manufacturer field_replaceable_unit)
6+
)
7+
end
8+
9+
def textual_group_ports
10+
ports = {:labels => [_("Name"), _("MAC Address")]}
11+
ports[:values] = @record.child_devices.collect do |port|
12+
[
13+
port.name,
14+
port.address
15+
]
16+
end
17+
18+
TextualMultilabel.new(
19+
_("Ports"),
20+
ports
21+
)
22+
end
23+
24+
def textual_group_firmware
25+
firmware = {:labels => [_("Name"), _("Version")]}
26+
firmware[:values] = @record.firmwares.collect do |fw|
27+
[
28+
fw.name,
29+
fw.version
30+
]
31+
end
32+
33+
TextualMultilabel.new(
34+
_("Firmware"),
35+
firmware
36+
)
37+
end
38+
39+
def textual_device_name
40+
{:label => _("Name"), :value => @record.device_name}
41+
end
42+
43+
def textual_manufacturer
44+
{:label => _("Manufacturer"), :value => @record.manufacturer}
45+
end
46+
47+
def textual_location
48+
{:label => _("Location"), :value => @record.location}
49+
end
50+
51+
def textual_field_replaceable_unit
52+
{:label => _("FRU"), :value => @record.field_replaceable_unit}
53+
end
54+
end

app/views/layouts/listnav/_guest_device.html.haml

Whitespace-only changes.

0 commit comments

Comments
 (0)