foreman_datacenter 1.20.0 → 1.20.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/foreman_datacenter/datacenter.css +3 -0
- data/app/assets/stylesheets/foreman_datacenter/device_roles.css +32 -0
- data/app/controllers/api/v2/foreman_datacenter/device_interfaces_controller.rb +1 -0
- data/app/controllers/api/v2/foreman_datacenter/devices_controller.rb +1 -1
- data/app/controllers/concerns/foreman_datacenter/controller/parameters/comment.rb +1 -1
- data/app/controllers/concerns/foreman_datacenter/controller/parameters/console_port.rb +1 -1
- data/app/controllers/concerns/foreman_datacenter/controller/parameters/console_port_template.rb +1 -1
- data/app/controllers/concerns/foreman_datacenter/controller/parameters/console_server_port.rb +1 -1
- data/app/controllers/concerns/foreman_datacenter/controller/parameters/console_server_port_template.rb +1 -1
- data/app/controllers/concerns/foreman_datacenter/controller/parameters/device_bay.rb +1 -1
- data/app/controllers/concerns/foreman_datacenter/controller/parameters/device_bay_template.rb +1 -1
- data/app/controllers/concerns/foreman_datacenter/controller/parameters/device_interface.rb +1 -1
- data/app/controllers/concerns/foreman_datacenter/controller/parameters/device_interface_connection.rb +1 -1
- data/app/controllers/concerns/foreman_datacenter/controller/parameters/device_module.rb +1 -1
- data/app/controllers/concerns/foreman_datacenter/controller/parameters/device_role.rb +1 -1
- data/app/controllers/concerns/foreman_datacenter/controller/parameters/device_type.rb +1 -1
- data/app/controllers/concerns/foreman_datacenter/controller/racks.rb +10 -0
- data/app/controllers/foreman_datacenter/application_controller.rb +2 -0
- data/app/controllers/foreman_datacenter/sites_controller.rb +6 -1
- data/app/models/foreman_datacenter/device.rb +1 -0
- data/app/models/foreman_datacenter/site.rb +1 -0
- data/app/views/foreman_datacenter/devices/show.html.erb +4 -1
- data/app/views/foreman_datacenter/racks/_device_position.html.erb +21 -3
- data/app/views/foreman_datacenter/racks/_dp.html.erb +46 -0
- data/app/views/foreman_datacenter/racks/_unpositioned_devices.html.erb +1 -1
- data/app/views/foreman_datacenter/sites/racks.html.erb +17 -0
- data/app/views/foreman_datacenter/sites/show.html.erb +4 -1
- data/config/routes.rb +1 -0
- data/db/migrate/20180725201545_add_location_id_and_organization_id_columns_to_devices.rb +1 -1
- data/lib/foreman_datacenter/engine.rb +2 -2
- data/lib/foreman_datacenter/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6dee4917059af9a4715bd20e3e1acb21ac54330f769ef91d81e9b7511ba526b
|
4
|
+
data.tar.gz: 4c366cc1ae027b415f0458c87de49698d28d3d335297338e2bdc37c9e3038fa9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8218406d02bd9fd1926e688ceebf4f2596c1da6495b434650fe930e753157c006ab0ac1508530ae00d0f958b4527c0842e608ce27ba410c71369fbd4cc3a5c1e
|
7
|
+
data.tar.gz: 621fc9445b9481ab5e5b6efe233bba3ff93c8ab08c9c694cadd1ce30892507a6b7a7118dc95f05442308b6a776f79653c16542a3c539031909cab9bff0fd25f3
|
@@ -28,3 +28,35 @@ span.mediumgray {
|
|
28
28
|
span.darkgray {
|
29
29
|
background-color: #171515;
|
30
30
|
}
|
31
|
+
|
32
|
+
|
33
|
+
.teal {
|
34
|
+
background-color: #06a79f;
|
35
|
+
}
|
36
|
+
.green {
|
37
|
+
background-color: #89A54E;
|
38
|
+
}
|
39
|
+
.blue {
|
40
|
+
background-color: #3D96AE;
|
41
|
+
}
|
42
|
+
.purple {
|
43
|
+
background-color: #D882d8;
|
44
|
+
}
|
45
|
+
.yellow {
|
46
|
+
background-color: #ecec61;
|
47
|
+
}
|
48
|
+
.orange {
|
49
|
+
background-color: #f37676;
|
50
|
+
}
|
51
|
+
.red {
|
52
|
+
background-color: #AA4643;
|
53
|
+
}
|
54
|
+
.lightgray {
|
55
|
+
background-color: gray;
|
56
|
+
}
|
57
|
+
.mediumgray {
|
58
|
+
background-color: #403e3e;
|
59
|
+
}
|
60
|
+
.darkgray {
|
61
|
+
background-color: #171515;
|
62
|
+
}
|
@@ -39,6 +39,7 @@ module Api
|
|
39
39
|
def create
|
40
40
|
@device_interface = ::ForemanDatacenter::DeviceInterface.new(device_interface_params)
|
41
41
|
@device_interface.save
|
42
|
+
process_response @device_interface.save
|
42
43
|
end
|
43
44
|
|
44
45
|
api :PUT, "/foreman_datacenter/device_interfaces/:id/", N_("Update a DeviceInterface")
|
@@ -47,7 +47,7 @@ module Api
|
|
47
47
|
param_group :device, :as => :create
|
48
48
|
|
49
49
|
def create
|
50
|
-
@device = ::ForemanDatacenter::Device.new(device_params.merge(
|
50
|
+
@device = ::ForemanDatacenter::Device.new(device_params.merge(host_id: params[:host_id]))
|
51
51
|
process_response @device.save
|
52
52
|
end
|
53
53
|
|
@@ -0,0 +1,10 @@
|
|
1
|
+
module ForemanDatacenter::Controller::Racks
|
2
|
+
extend ActiveSupport::Concern
|
3
|
+
|
4
|
+
def move
|
5
|
+
@rack_groups = resource_base_search_and_page
|
6
|
+
@racks = @rack_group.racks
|
7
|
+
process_error object: @rack_group, error_msg: 'Current Rack Group haven\'t any Racks.' if @racks.empty?
|
8
|
+
end
|
9
|
+
|
10
|
+
end
|
@@ -3,7 +3,7 @@ module ForemanDatacenter
|
|
3
3
|
include Foreman::Controller::AutoCompleteSearch
|
4
4
|
include ForemanDatacenter::Controller::Parameters::Site
|
5
5
|
|
6
|
-
before_action :find_resource, only: [:show, :edit, :update, :destroy, :move]
|
6
|
+
before_action :find_resource, only: [:show, :edit, :update, :destroy, :move, :racks]
|
7
7
|
|
8
8
|
def index
|
9
9
|
@sites = resource_base_search_and_page
|
@@ -50,6 +50,11 @@ module ForemanDatacenter
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
+
def racks
|
54
|
+
@racks = @site.racks.includes(:devices)
|
55
|
+
process_error redirect: site_path(@site), error_msg: 'Current site haven\'t any Racks.' if @racks.empty?
|
56
|
+
end
|
57
|
+
|
53
58
|
def move
|
54
59
|
@sites = resource_base_search_and_page
|
55
60
|
@rack_groups = @site.rack_groups
|
@@ -51,6 +51,7 @@ module ForemanDatacenter
|
|
51
51
|
scoped_search in: :device_role, on: :name, complete_value: true, rename: :role
|
52
52
|
scoped_search in: :device_type, on: :model, complete_value: true, rename: :type
|
53
53
|
scoped_search in: :platform, on: :name, complete_value: true, rename: :platform
|
54
|
+
scoped_search in: :comments, on: :content, complete_value: true, rename: :comments
|
54
55
|
|
55
56
|
delegate :site_id, to: :rack, allow_nil: true
|
56
57
|
delegate :manufacturer_id, :is_console_server, :is_pdu, :is_network_device,
|
@@ -20,6 +20,7 @@ module ForemanDatacenter
|
|
20
20
|
scoped_search on: :shipping_address, complete_value: true, default_order: true
|
21
21
|
scoped_search on: :created_at, complete_value: true, default_order: true
|
22
22
|
scoped_search on: :updated_at, complete_value: true, default_order: true
|
23
|
+
scoped_search on: :comments, complete_value: true, default_order: true
|
23
24
|
|
24
25
|
def racks_count
|
25
26
|
@racks_count ||= racks.count
|
@@ -256,7 +256,10 @@
|
|
256
256
|
<% if @device.management_device %>
|
257
257
|
<tr>
|
258
258
|
<td><%= _("Console URL") %></td>
|
259
|
-
<td
|
259
|
+
<td>
|
260
|
+
<%= link_to @device.console_url, "http://#{@device.console_url}", target: "_blank" %>
|
261
|
+
</td>
|
262
|
+
|
260
263
|
</tr>
|
261
264
|
<tr>
|
262
265
|
<td><%= _("Login") %></td>
|
@@ -1,15 +1,15 @@
|
|
1
1
|
<div class="panel panel-default">
|
2
|
-
<div class="panel-heading"><strong><%= _("
|
2
|
+
<div class="panel-heading text-center"><h4 class="nonmargintop nonmarginbottom"><strong><%= link_to _("#{rack.name}"), rack_path(rack) %></strong></h4></div>
|
3
3
|
<table class="<%= table_css_classes 'table-hover panel-body nonmarginbottom' %>">
|
4
4
|
<tbody>
|
5
|
-
<%
|
5
|
+
<% rack.positioned_devices.each do |positions, devices| %>
|
6
6
|
<tr>
|
7
7
|
<td class="col-md-1"><%= raw(positions.map{|p| "#{p}U"}.join("<br />")) %></td>
|
8
8
|
<td class="col-md-4">
|
9
9
|
<% unless devices.empty? %>
|
10
10
|
<% devices.each do |d| %>
|
11
11
|
<div class="<%= "text-" + ((d.side == "full" or d.side.nil?) ? "center" : "right") + " pull-" + ((d.side == "full" or d.side.nil?) ? "center" : d.side) %>">
|
12
|
-
|
12
|
+
<div class="<%= "label " + d.device_role.color.downcase.gsub(" ","") %>" style="border-radius:40px;border:0px;"> </div>
|
13
13
|
<%= link_to d.name, device_path(d) %>
|
14
14
|
<% if d.side.nil? %>
|
15
15
|
*
|
@@ -23,6 +23,24 @@
|
|
23
23
|
</td>
|
24
24
|
</tr>
|
25
25
|
<% end %>
|
26
|
+
<% unless rack.unpositioned_devices.empty? %>
|
27
|
+
<tr>
|
28
|
+
<td class="col-md-1">Unpositioned Devices</td>
|
29
|
+
<td class="col-md-4" style="text-align:center">
|
30
|
+
<% rack.unpositioned_devices.each do |d| %>
|
31
|
+
<div class="<%= "label " + d.device_role.color.downcase.gsub(" ","") %>" style="border-radius:40px;border:0px;"> </div>
|
32
|
+
<%= link_to d.name, device_path(d) %>
|
33
|
+
<% if d.side.nil? %>
|
34
|
+
*
|
35
|
+
<% end %>
|
36
|
+
<% if d.size.nil? %>
|
37
|
+
**
|
38
|
+
<% end %>
|
39
|
+
</br>
|
40
|
+
<% end %>
|
41
|
+
</td>
|
42
|
+
</tr>
|
43
|
+
<% end %>
|
26
44
|
</tbody>
|
27
45
|
</table>
|
28
46
|
</div>
|
@@ -0,0 +1,46 @@
|
|
1
|
+
<div class="panel panel-default">
|
2
|
+
<div class="panel-heading text-center"><h4 class="nonmargintop nonmarginbottom"><strong><%= _("#{rack.name}") %></strong></h4></div>
|
3
|
+
<table class="<%= table_css_classes 'table-hover panel-body nonmarginbottom' %>">
|
4
|
+
<tbody>
|
5
|
+
<% rack.positioned_devices.each do |positions, devices| %>
|
6
|
+
<tr>
|
7
|
+
<td class="col-md-1"><%= raw(positions.map{|p| "#{p}U"}.join("<br />")) %></td>
|
8
|
+
<td class="col-md-4">
|
9
|
+
<% unless devices.empty? %>
|
10
|
+
<% devices.each do |d| %>
|
11
|
+
<div class="<%= "text-" + ((d.side == "full" or d.side.nil?) ? "center" : "right") + " pull-" + ((d.side == "full" or d.side.nil?) ? "center" : d.side) %>">
|
12
|
+
<span class="<%= "label " + d.device_role.color.downcase.gsub(" ","") %>"> </span>
|
13
|
+
<%= link_to d.name, device_path(d) %>
|
14
|
+
<% if d.side.nil? %>
|
15
|
+
*
|
16
|
+
<% end %>
|
17
|
+
<% if d.size.nil? %>
|
18
|
+
**
|
19
|
+
<% end %>
|
20
|
+
</div>
|
21
|
+
<% end %>
|
22
|
+
<% end %>
|
23
|
+
</td>
|
24
|
+
</tr>
|
25
|
+
<% end %>
|
26
|
+
<% unless rack.unpositioned_devices.empty? %>
|
27
|
+
<tr>
|
28
|
+
<td class="col-md-1">Unpositioned Devices</td>
|
29
|
+
<td class="col-md-4">
|
30
|
+
<% rack.unpositioned_devices.each do |d| %>
|
31
|
+
<div class="<%= "label " + d.device_role.color.downcase.gsub(" ","") %>" style="border-radius:40px;border:0px;"> </div>
|
32
|
+
<%= link_to d.name, device_path(d) %>
|
33
|
+
<% if d.side.nil? %>
|
34
|
+
*
|
35
|
+
<% end %>
|
36
|
+
<% if d.size.nil? %>
|
37
|
+
**
|
38
|
+
<% end %>
|
39
|
+
</br>
|
40
|
+
<% end %>
|
41
|
+
</td>
|
42
|
+
</tr>
|
43
|
+
<% end %>
|
44
|
+
</tbody>
|
45
|
+
</table>
|
46
|
+
</div>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<div class="panel-heading"><strong><%= _("Unpositioned Devices") %></strong></div>
|
3
3
|
<table class="table table-hover panel-body nonmarginbottom">
|
4
4
|
<tbody>
|
5
|
-
<%
|
5
|
+
<% rack.unpositioned_devices.each do |d| %>
|
6
6
|
<tr>
|
7
7
|
<td class="col-md-4">
|
8
8
|
<div class="<%= "text-" + ((d.side == "full" or d.side.nil?) ? "center" : "right") + " pull-" + ((d.side == "full" or d.side.nil?) ? "center" : d.side) %>">
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<% stylesheet 'foreman_datacenter/datacenter' %>
|
2
|
+
<% stylesheet 'foreman_datacenter/device_roles' %>
|
3
|
+
|
4
|
+
<% title h(@site.name) %>
|
5
|
+
|
6
|
+
<% @racks.in_groups_of(3).each do |g| %>
|
7
|
+
<div class="row">
|
8
|
+
<% g.compact.each do |rack| %>
|
9
|
+
<div class="col-md-4">
|
10
|
+
<!-- Devices -->
|
11
|
+
<%= render "foreman_datacenter/racks/device_position", rack: rack %>
|
12
|
+
</div>
|
13
|
+
<% end %>
|
14
|
+
</div>
|
15
|
+
<% end %>
|
16
|
+
<div><h6 class="text-right"><%= _("* side is not defined") %></h6></div>
|
17
|
+
<div><h6 class="text-right"><%= _("** size is not defined") %></h6></div>
|
@@ -96,7 +96,10 @@
|
|
96
96
|
</tr>
|
97
97
|
<tr>
|
98
98
|
<td><%= _("Racks") %></td>
|
99
|
-
<td
|
99
|
+
<td>
|
100
|
+
<%= link_to @site.racks_count, racks_path(search: "site=#{@site.name}") %>
|
101
|
+
<%= link_to 'Overview', racks_site_path(@site), class: "btn btn-primary btn-xs pull-right" unless @site.racks.empty? %>
|
102
|
+
</td>
|
100
103
|
</tr>
|
101
104
|
<tr>
|
102
105
|
<td><%= _("Devices") %></td>
|
data/config/routes.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
class AddLocationIdAndOrganizationIdColumnsToDevices < ActiveRecord::Migration
|
1
|
+
class AddLocationIdAndOrganizationIdColumnsToDevices < ActiveRecord::Migration
|
2
2
|
def change
|
3
3
|
add_column :devices, :organization_id, :integer
|
4
4
|
add_column :devices, :location_id, :integer
|
@@ -28,7 +28,7 @@ module ForemanDatacenter
|
|
28
28
|
requires_foreman '>= 1.12'
|
29
29
|
|
30
30
|
security_block :datacenter do
|
31
|
-
|
31
|
+
# Hosts
|
32
32
|
permission :import_to_device, {
|
33
33
|
:'hosts' => [:import_to_device]},
|
34
34
|
:resource_type => "ForemanDatacenter::HostExtensions"
|
@@ -315,7 +315,7 @@ module ForemanDatacenter
|
|
315
315
|
:resource_type => "ForemanDatacenter::Rack"
|
316
316
|
# Sites
|
317
317
|
permission :view_sites, {
|
318
|
-
:'foreman_datacenter/sites' => [:show, :index]},
|
318
|
+
:'foreman_datacenter/sites' => [:show, :index, :racks]},
|
319
319
|
:resource_type => "ForemanDatacenter::Site"
|
320
320
|
permission :create_sites, {
|
321
321
|
:'foreman_datacenter/sites' => [:new, :create]},
|
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: 1.20.
|
4
|
+
version: 1.20.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Ivanov
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-
|
12
|
+
date: 2019-05-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: prawn
|
@@ -140,6 +140,7 @@ files:
|
|
140
140
|
- app/controllers/concerns/foreman_datacenter/controller/parameters/rack.rb
|
141
141
|
- app/controllers/concerns/foreman_datacenter/controller/parameters/rack_group.rb
|
142
142
|
- app/controllers/concerns/foreman_datacenter/controller/parameters/site.rb
|
143
|
+
- app/controllers/concerns/foreman_datacenter/controller/racks.rb
|
143
144
|
- app/controllers/concerns/foreman_datacenter/hosts_controller_extensions.rb
|
144
145
|
- app/controllers/foreman_datacenter/application_controller.rb
|
145
146
|
- app/controllers/foreman_datacenter/comments_controller.rb
|
@@ -461,6 +462,7 @@ files:
|
|
461
462
|
- app/views/foreman_datacenter/rack_groups/welcome.html.erb
|
462
463
|
- app/views/foreman_datacenter/racks/_device_position.html.erb
|
463
464
|
- app/views/foreman_datacenter/racks/_device_position.html.erb.back
|
465
|
+
- app/views/foreman_datacenter/racks/_dp.html.erb
|
464
466
|
- app/views/foreman_datacenter/racks/_form.html.erb
|
465
467
|
- app/views/foreman_datacenter/racks/_rack_groups.html.erb
|
466
468
|
- app/views/foreman_datacenter/racks/_unpositioned_devices.html.erb
|
@@ -478,6 +480,7 @@ files:
|
|
478
480
|
- app/views/foreman_datacenter/sites/index.html.erb
|
479
481
|
- app/views/foreman_datacenter/sites/move.html.erb
|
480
482
|
- app/views/foreman_datacenter/sites/new.html.erb
|
483
|
+
- app/views/foreman_datacenter/sites/racks.html.erb
|
481
484
|
- app/views/foreman_datacenter/sites/show.html.erb
|
482
485
|
- app/views/foreman_datacenter/sites/welcome.html.erb
|
483
486
|
- app/views/hosts/import_to_device.html.erb
|