foreman_datacenter 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2108d9581ec9752d0696faabf33613b579e9faa0
|
4
|
+
data.tar.gz: 25490c98b0b06de2838a19d8e7a8c076e39b835f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2ec3cf2a97a1311eb105ed8a3bb96270999fd2fefe718799ea6843990e0a333e62376b32baa85e9b80a7954d0a544e9b1f292f3e16047f492e868d2255e3b71
|
7
|
+
data.tar.gz: 137c7d222f9103b094ed052384a312ff4a686b9997a65a468e7384a571eb6e619d227cef413664ad619f36977b7a38bf936e157fceb274e5909eb0f78cfa0576
|
@@ -9,5 +9,13 @@ module ForemanDatacenter
|
|
9
9
|
validates :facility_id, length: { maximum: 30 }
|
10
10
|
validates :height, presence: true
|
11
11
|
validates_numericality_of :height, only_integer: true
|
12
|
+
|
13
|
+
def device_at(position)
|
14
|
+
devices.find { |d| d.position == position }
|
15
|
+
end
|
16
|
+
|
17
|
+
def positioned_devices
|
18
|
+
height.downto(1).map { |position| [position, device_at(position)] }
|
19
|
+
end
|
12
20
|
end
|
13
21
|
end
|
@@ -1,67 +1,89 @@
|
|
1
1
|
<% title h("Rack #{@rack.name}") %>
|
2
2
|
|
3
3
|
<% title_actions display_link_if_authorized(
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
_('Edit'),
|
5
|
+
hash_for_edit_rack_path(:id => @rack).merge(:auth_object => @rack, :authorizer => authorizer),
|
6
|
+
:class => 'btn btn-warning'
|
7
7
|
),
|
8
8
|
display_delete_if_authorized(
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
hash_for_rack_path(:id => @rack).merge(:auth_object => @rack, :authorizer => authorizer),
|
10
|
+
:data => { :confirm => 'Are you sure?' },
|
11
|
+
:action => :destroy,
|
12
|
+
:class => 'btn btn-danger'
|
13
13
|
)
|
14
14
|
help_path %>
|
15
15
|
|
16
|
-
<div class="
|
17
|
-
|
18
|
-
|
19
|
-
<div class="panel-
|
20
|
-
<
|
16
|
+
<div class="row">
|
17
|
+
<div class="col-md-4">
|
18
|
+
<!-- Rack details -->
|
19
|
+
<div class="panel panel-default">
|
20
|
+
<div class="panel-heading">
|
21
|
+
<strong>Rack</strong>
|
22
|
+
</div>
|
23
|
+
<table class="table table-hover panel-body">
|
24
|
+
<tbody>
|
25
|
+
<tr>
|
26
|
+
<td>Site</td>
|
27
|
+
<td><%= link_to @rack.site.name, site_path(@rack.site) %></td>
|
28
|
+
</tr>
|
29
|
+
<tr>
|
30
|
+
<td>Group</td>
|
31
|
+
<td>
|
32
|
+
<% if @rack.rack_group %>
|
33
|
+
<%= link_to @rack.rack_group.name, rack_group_path(@rack.rack_group) %>
|
34
|
+
<% else %>
|
35
|
+
—
|
36
|
+
<% end %>
|
37
|
+
</td>
|
38
|
+
</tr>
|
39
|
+
<tr>
|
40
|
+
<td>Facility ID</td>
|
41
|
+
<td><%= h(@rack.facility_id || '—') %></td>
|
42
|
+
</tr>
|
43
|
+
<tr>
|
44
|
+
<td>Height</td>
|
45
|
+
<td><%= @rack.height %>U</td>
|
46
|
+
</tr>
|
47
|
+
<tr>
|
48
|
+
<td>Devices</td>
|
49
|
+
<td><%= @rack.devices.length %></td>
|
50
|
+
</tr>
|
51
|
+
<tr>
|
52
|
+
<td>Created</td>
|
53
|
+
<td><%= @rack.created_at.to_s(:long) %></td>
|
54
|
+
</tr>
|
55
|
+
<tr>
|
56
|
+
<td>Last Updated</td>
|
57
|
+
<td><%= @rack.updated_at.to_s(:long) %></td>
|
58
|
+
</tr>
|
59
|
+
</tbody>
|
60
|
+
</table>
|
61
|
+
</div>
|
62
|
+
|
63
|
+
<!-- Comments -->
|
64
|
+
<div class="panel panel-default">
|
65
|
+
<div class="panel-heading"><strong>Comments</strong></div>
|
66
|
+
<div class="panel-body"><%= simple_format @rack.comments %></div>
|
21
67
|
</div>
|
22
|
-
<table class="table table-hover panel-body">
|
23
|
-
<tbody>
|
24
|
-
<tr>
|
25
|
-
<td>Site</td>
|
26
|
-
<td><%= link_to @rack.site.name, site_path(@rack.site) %></td>
|
27
|
-
</tr>
|
28
|
-
<tr>
|
29
|
-
<td>Group</td>
|
30
|
-
<td>
|
31
|
-
<% if @rack.rack_group %>
|
32
|
-
<%= link_to @rack.rack_group.name, rack_group_path(@rack.rack_group) %>
|
33
|
-
<% else %>
|
34
|
-
—
|
35
|
-
<% end %>
|
36
|
-
</td>
|
37
|
-
</tr>
|
38
|
-
<tr>
|
39
|
-
<td>Facility ID</td>
|
40
|
-
<td><%= h(@rack.facility_id || '—') %></td>
|
41
|
-
</tr>
|
42
|
-
<tr>
|
43
|
-
<td>Height</td>
|
44
|
-
<td><%= @rack.height %>U</td>
|
45
|
-
</tr>
|
46
|
-
<tr>
|
47
|
-
<td>Devices</td>
|
48
|
-
<td><%= @rack.devices.length %></td>
|
49
|
-
</tr>
|
50
|
-
<tr>
|
51
|
-
<td>Created</td>
|
52
|
-
<td><%= @rack.created_at.to_s(:long) %></td>
|
53
|
-
</tr>
|
54
|
-
<tr>
|
55
|
-
<td>Last Updated</td>
|
56
|
-
<td><%= @rack.updated_at.to_s(:long) %></td>
|
57
|
-
</tr>
|
58
|
-
</tbody>
|
59
|
-
</table>
|
60
68
|
</div>
|
61
69
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
70
|
+
<div class="col-md-4">
|
71
|
+
<div class="panel panel-default">
|
72
|
+
<div class="panel-heading"><strong>Devices</strong></div>
|
73
|
+
<table class="table table-hover panel-body">
|
74
|
+
<tbody>
|
75
|
+
<% @rack.positioned_devices.each do |position, device| %>
|
76
|
+
<tr>
|
77
|
+
<td><%= position %>U</td>
|
78
|
+
<td class="text-right">
|
79
|
+
<% if device %>
|
80
|
+
<%= link_to device.name, device_path(device) %>
|
81
|
+
<% end %>
|
82
|
+
</td>
|
83
|
+
</tr>
|
84
|
+
<% end %>
|
85
|
+
</tbody>
|
86
|
+
</table>
|
87
|
+
</div>
|
66
88
|
</div>
|
67
89
|
</div>
|