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: 237e1187fd250aedb5db2a901227e9a757ef16de
4
- data.tar.gz: 1407ecbf059c7999b2d37683285a6dbc876927d3
3
+ metadata.gz: 2108d9581ec9752d0696faabf33613b579e9faa0
4
+ data.tar.gz: 25490c98b0b06de2838a19d8e7a8c076e39b835f
5
5
  SHA512:
6
- metadata.gz: 99207133a189b7b02cd1b76cf8aa14544488721827d8b708b0d9658c577ef7a974d3a3cc1c1ca8390fc7cc779a9c323cb4379ec447f3c510f3212e08e20ecd20
7
- data.tar.gz: 059d935882e4df99db85195e1f42d10c02bb610314be4af9b9e561689c657cc7e32cdec0f06c55d728b8cf70a016e26dd57c1f936a50cb61ec7abf15fc620db1
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
- _('Edit'),
5
- hash_for_edit_rack_path(:id => @rack).merge(:auth_object => @rack, :authorizer => authorizer),
6
- :class => 'btn btn-warning'
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
- 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'
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="col-md-6">
17
- <!-- Rack details -->
18
- <div class="panel panel-default">
19
- <div class="panel-heading">
20
- <strong>Rack</strong>
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
- <!-- Comments -->
63
- <div class="panel panel-default">
64
- <div class="panel-heading"><strong>Comments</strong></div>
65
- <div class="panel-body"><%= simple_format @rack.comments %></div>
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>
@@ -1,3 +1,3 @@
1
1
  module ForemanDatacenter
2
- VERSION = '0.1.2'.freeze
2
+ VERSION = '0.1.3'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_datacenter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Ivanov