foreman_datacenter 0.1.37 → 0.1.38
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/foreman_datacenter/devices.js +17 -0
- data/app/controllers/foreman_datacenter/devices_controller.rb +5 -0
- data/app/helpers/foreman_datacenter/devices_helper.rb +15 -2
- data/app/views/foreman_datacenter/devices/_form.html.erb +4 -2
- data/config/routes.rb +1 -1
- data/lib/foreman_datacenter/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f50da38ff54df5eb9e31605246b6fd62cf15520
|
4
|
+
data.tar.gz: 29a39738d7bcd6c5a3dd439a49eb3e7799ad30da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c2407376388b1a70e6ac5aef59341e8212c90517ca7cdbccf25d6452f5fdc2f076d2096be3cd06d371a1b2337dd8df2fc8d5063dbea185a437c7498990834bb
|
7
|
+
data.tar.gz: bf0545dde92e7babf6a89ee942469415718d20fadb92141430fc957468aadf09846ef404c0b599d2d01d4384ecb08db3cbcb7a95d83d880d4169db8a704e646d
|
@@ -31,3 +31,20 @@ function devicesNewSiteSelected(item) {
|
|
31
31
|
});
|
32
32
|
}
|
33
33
|
}
|
34
|
+
|
35
|
+
function devicesNewDeviceTypeSelected(item) {
|
36
|
+
var $item = $(item);
|
37
|
+
var type = $item.val();
|
38
|
+
if (type === '') {
|
39
|
+
return false;
|
40
|
+
} else {
|
41
|
+
tfm.tools.showSpinner();
|
42
|
+
var url = $item.data('url');
|
43
|
+
var params = $.param({ device_type_id: type });
|
44
|
+
var $container = $('#device-type-size-container');
|
45
|
+
$container.load(url + ' #device-type-size', params, function () {
|
46
|
+
$container.find('select').select2({allowClear: true});
|
47
|
+
tfm.tools.hideSpinner();
|
48
|
+
});
|
49
|
+
}
|
50
|
+
}
|
@@ -79,6 +79,11 @@ module ForemanDatacenter
|
|
79
79
|
render partial: 'device_types'
|
80
80
|
end
|
81
81
|
|
82
|
+
def device_type_size
|
83
|
+
@device_type_id = params[:device_type_id]
|
84
|
+
render partial: 'device_type_size'
|
85
|
+
end
|
86
|
+
|
82
87
|
def racks
|
83
88
|
@site_id = params[:site_id]
|
84
89
|
render partial: 'racks'
|
@@ -18,8 +18,21 @@ module ForemanDatacenter
|
|
18
18
|
end
|
19
19
|
selectable_f f, :device_type_id,
|
20
20
|
options_from_collection_for_select(collection, 'id', 'model', device_type_id),
|
21
|
-
{ include_blank: 'Choose a device type'
|
22
|
-
{ required: true, label: 'Device Type'
|
21
|
+
{ include_blank: 'Choose a device type'},
|
22
|
+
{ required: true, label: 'Device Type',
|
23
|
+
:onchange => 'devicesNewDeviceTypeSelected(this)',
|
24
|
+
:'data-url' => device_type_size_devices_path }
|
25
|
+
end
|
26
|
+
|
27
|
+
def device_type_size_for_device_form(f, device_type_id)
|
28
|
+
if device_type_id
|
29
|
+
device_type = DeviceType.find(device_type_id)
|
30
|
+
height = device_type.u_height
|
31
|
+
else
|
32
|
+
height = 1
|
33
|
+
end
|
34
|
+
text_f f, :size, type: 'number', min: 0, value: height, id: 'device_type_size', label: 'Size',
|
35
|
+
help_inline: 'For multi-U devices, how many rack units occupied be device.'
|
23
36
|
end
|
24
37
|
|
25
38
|
def racks_for_device_form(f, site_id, rack_id = nil)
|
@@ -58,8 +58,10 @@
|
|
58
58
|
{ include_blank: 'Choose a rack side', label: 'Rack side' } %>
|
59
59
|
<%= text_f f, :position, type: 'number', min: 0,
|
60
60
|
help_inline: 'For multi-U devices, this is the lowest occupied rack unit.' %>
|
61
|
-
|
62
|
-
|
61
|
+
<div id="device-type-size-container">
|
62
|
+
<%= text_f f, :size, type: 'number', min: 0,
|
63
|
+
help_inline: 'For multi-U devices, how many rack units occupied by device.' %>
|
64
|
+
</div>
|
63
65
|
</div>
|
64
66
|
</div>
|
65
67
|
|
data/config/routes.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_datacenter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.38
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Ivanov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: deface
|