foreman_fog_proxmox 0.13.1 → 0.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/foreman_fog_proxmox/proxmox_compute_resource.js +6 -6
- data/app/assets/javascripts/foreman_fog_proxmox/proxmox_vm.js +53 -53
- data/app/assets/javascripts/foreman_fog_proxmox/proxmox_vm_server.js +2 -2
- data/app/assets/javascripts/foreman_fog_proxmox/proxmox_volume.js +10 -10
- data/lib/foreman_fog_proxmox/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f47c6b4425f06c4b7b7547bf71e3e985c66d660bdb54328370a6c196135c9791
|
4
|
+
data.tar.gz: 902aa40b81589de604ae8cf3670c1af7762e8700b11eb3065b649c38ae6b2e36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3fe6bd7f8ba0c72d7bf04348d7463dd5611465b77fbd6de93258d10433e4736eb20f89b97cf9f2842069fd69e0ec5928124b5598cdbcd72aefa0dfa9b1c80bcb
|
7
|
+
data.tar.gz: 9d341aa011e5b5a3f1738e05ff72d02c0caa97149c57fa1918506c8051524304ccbe87a76ec6e07d26444a7f4fc2f2fdd8a0e2a119224fc58f13acaad6e32c94
|
@@ -36,14 +36,14 @@ function sslVerifyPeerSelected() {
|
|
36
36
|
}
|
37
37
|
}
|
38
38
|
|
39
|
-
function enableField(
|
40
|
-
$(
|
41
|
-
$(
|
39
|
+
function enableField(item) {
|
40
|
+
$(item).show();
|
41
|
+
$(item).removeAttr('disabled');
|
42
42
|
}
|
43
43
|
|
44
|
-
function disableField(
|
45
|
-
$(
|
46
|
-
$(
|
44
|
+
function disableField(item) {
|
45
|
+
$(item).hide();
|
46
|
+
$(item).attr('disabled','disabled');
|
47
47
|
}
|
48
48
|
|
49
49
|
function toggleFieldset(method, selected){
|
@@ -39,17 +39,17 @@ function vmTypeSelected() {
|
|
39
39
|
return false;
|
40
40
|
}
|
41
41
|
|
42
|
-
function volumeButtonAddId(
|
43
|
-
return $("a[data-association='" +
|
42
|
+
function volumeButtonAddId(item){
|
43
|
+
return $("a[data-association='" + item + "_volumes']");
|
44
44
|
}
|
45
45
|
|
46
|
-
function volumeFieldsetId(
|
47
|
-
return $("fieldset[id^='" + type + "_volume_"+
|
46
|
+
function volumeFieldsetId(item, type){
|
47
|
+
return $("fieldset[id^='" + type + "_volume_"+ item +"']").not("fieldset[id$='_new_" + item +"_volumes']");
|
48
48
|
}
|
49
49
|
|
50
|
-
function indexByIdAndType(
|
50
|
+
function indexByIdAndType(item, storage_type, vm_type){
|
51
51
|
let regex = new RegExp(`${vm_type}_volume_${storage_type}_(\\d+)`);
|
52
|
-
return
|
52
|
+
return item.match(regex)[1];
|
53
53
|
}
|
54
54
|
|
55
55
|
function volidByIndexAndTag(index, tag){
|
@@ -58,9 +58,9 @@ function volidByIndexAndTag(index, tag){
|
|
58
58
|
|
59
59
|
function hasCloudinit(){
|
60
60
|
result = false;
|
61
|
-
let
|
62
|
-
if (
|
63
|
-
let index = indexByIdAndType(
|
61
|
+
let volume_id = volumeFieldsetId('cloud_init', 'server').attr('id');
|
62
|
+
if (volume_id !== undefined){
|
63
|
+
let index = indexByIdAndType(volume_id, 'cloud_init', 'server');
|
64
64
|
let volid = volidByIndexAndTag(index, 'input');
|
65
65
|
result = volid.includes("cloudinit");
|
66
66
|
}
|
@@ -69,9 +69,9 @@ function hasCloudinit(){
|
|
69
69
|
|
70
70
|
function hasCdrom(){
|
71
71
|
result = false;
|
72
|
-
let
|
73
|
-
if (
|
74
|
-
let index = indexByIdAndType(
|
72
|
+
let volume_id = volumeFieldsetId('cdrom', 'server').attr('id');
|
73
|
+
if (volume_id !== undefined){
|
74
|
+
let index = indexByIdAndType(volume_id, 'cdrom', 'server');
|
75
75
|
let checked = $("input[id^='host_compute_attributes_volumes_attributes_" + index + "_cdrom']:checked").val();
|
76
76
|
let isCdrom = checked === 'cdrom';
|
77
77
|
result = isCdrom;
|
@@ -84,27 +84,27 @@ function hasCdrom(){
|
|
84
84
|
return result;
|
85
85
|
}
|
86
86
|
|
87
|
-
function cloudinit(
|
88
|
-
return
|
87
|
+
function cloudinit(item){
|
88
|
+
return item === 'cloud_init' && hasCloudinit();
|
89
89
|
}
|
90
90
|
|
91
|
-
function cdrom(
|
92
|
-
return
|
91
|
+
function cdrom(item){
|
92
|
+
return item === 'cdrom' && hasCdrom();
|
93
93
|
}
|
94
94
|
|
95
|
-
function enableVolume(
|
96
|
-
volumeFieldsetId(
|
97
|
-
volumeButtonAddId(
|
98
|
-
if (cloudinit(
|
99
|
-
volumeButtonAddId(
|
95
|
+
function enableVolume(volume_id, type){
|
96
|
+
volumeFieldsetId(volume_id, type).show();
|
97
|
+
volumeButtonAddId(volume_id).show();
|
98
|
+
if (cloudinit(volume_id) || cdrom(volume_id)){
|
99
|
+
volumeButtonAddId(volume_id).hide();
|
100
100
|
}
|
101
|
-
volumeFieldsetId(
|
101
|
+
volumeFieldsetId(volume_id, type).removeAttr('disabled');
|
102
102
|
}
|
103
103
|
|
104
|
-
function disableVolume(
|
105
|
-
volumeFieldsetId(
|
106
|
-
volumeButtonAddId(
|
107
|
-
volumeFieldsetId(
|
104
|
+
function disableVolume(volume_id, type){
|
105
|
+
volumeFieldsetId(volume_id, type).hide();
|
106
|
+
volumeButtonAddId(volume_id).hide();
|
107
|
+
volumeFieldsetId(volume_id, type).attr('disabled','disabled');
|
108
108
|
}
|
109
109
|
|
110
110
|
function volumes(type){
|
@@ -115,44 +115,44 @@ function volume(type){
|
|
115
115
|
return type === 'qemu' ? 'server' : 'container';
|
116
116
|
}
|
117
117
|
|
118
|
-
function toggleVolume(
|
119
|
-
type1 === type2 ? enableVolume(
|
118
|
+
function toggleVolume(volume_id, type1, type2){
|
119
|
+
type1 === type2 ? enableVolume(volume_id, volume(type1)) : disableVolume(volume_id, volume(type1));
|
120
120
|
}
|
121
121
|
|
122
122
|
function toggleVolumes(selected){
|
123
123
|
['qemu', 'lxc'].forEach(function(type){
|
124
|
-
volumes(type).forEach(function(
|
125
|
-
toggleVolume(
|
124
|
+
volumes(type).forEach(function(volume_id){
|
125
|
+
toggleVolume(volume_id, selected, type);
|
126
126
|
});
|
127
127
|
});
|
128
128
|
}
|
129
129
|
|
130
|
-
function enableFieldset(
|
130
|
+
function enableFieldset(fieldsetId, fieldset) {
|
131
131
|
if (fieldset.toggle && fieldset.new_vm){
|
132
|
-
fieldset_id(
|
132
|
+
fieldset_id(fieldsetId, fieldset).show();
|
133
133
|
}
|
134
|
-
fieldset_id(
|
135
|
-
input_hidden_id(
|
134
|
+
fieldset_id(fieldsetId, fieldset).removeAttr('disabled');
|
135
|
+
input_hidden_id(fieldsetId).removeAttr('disabled');
|
136
136
|
}
|
137
137
|
|
138
|
-
function disableFieldset(
|
138
|
+
function disableFieldset(fieldsetId, fieldset) {
|
139
139
|
if (fieldset.toggle && fieldset.new_vm){
|
140
|
-
fieldset_id(
|
140
|
+
fieldset_id(fieldsetId, fieldset).hide();
|
141
141
|
}
|
142
|
-
fieldset_id(
|
143
|
-
input_hidden_id(
|
142
|
+
fieldset_id(fieldsetId, fieldset).attr('disabled','disabled');
|
143
|
+
input_hidden_id(fieldsetId).attr('disabled','disabled');
|
144
144
|
}
|
145
145
|
|
146
|
-
function toggleFieldset(
|
147
|
-
type1 === type2 ? enableFieldset(
|
146
|
+
function toggleFieldset(fieldsetId, fieldset, type1, type2) {
|
147
|
+
type1 === type2 ? enableFieldset(fieldsetId, fieldset) : disableFieldset(fieldsetId, fieldset);
|
148
148
|
}
|
149
149
|
|
150
|
-
function input_hidden_id(
|
151
|
-
return $("div[id^='"+
|
150
|
+
function input_hidden_id(volume_id){
|
151
|
+
return $("div[id^='"+ volume_id +"_volumes']" + " + input:hidden");
|
152
152
|
}
|
153
153
|
|
154
|
-
function fieldset_id(
|
155
|
-
return $("fieldset[id^='" +
|
154
|
+
function fieldset_id(fieldsetId, fieldset){
|
155
|
+
return $("fieldset[id^='" + fieldsetId + "_"+fieldset.id+"']");
|
156
156
|
}
|
157
157
|
|
158
158
|
function fieldsets(type){
|
@@ -163,8 +163,8 @@ function toggleFieldsets(fieldset){
|
|
163
163
|
var removable_input_hidden = $("div.removable-item[style='display: none;']" + " + input:hidden");
|
164
164
|
removable_input_hidden.attr('disabled','disabled');
|
165
165
|
['qemu', 'lxc'].forEach(function(type){
|
166
|
-
fieldsets(type).forEach(function(
|
167
|
-
toggleFieldset(
|
166
|
+
fieldsets(type).forEach(function(fieldsetId){
|
167
|
+
toggleFieldset(fieldsetId, fieldset, fieldset.selected, type);
|
168
168
|
});
|
169
169
|
});
|
170
170
|
}
|
@@ -190,18 +190,18 @@ function nodeSelected(item) {
|
|
190
190
|
}
|
191
191
|
}
|
192
192
|
|
193
|
-
function emptySelect(
|
194
|
-
$(
|
195
|
-
$(
|
196
|
-
$(
|
193
|
+
function emptySelect(select_id){
|
194
|
+
$(select_id).empty();
|
195
|
+
$(select_id).append($("<option></option>").val('').text(''));
|
196
|
+
$(select_id).val('');
|
197
197
|
}
|
198
198
|
|
199
199
|
function initOptions(select_ids){
|
200
200
|
console.log('initOptions(' + select_ids[0] + ')');
|
201
201
|
select_ids.forEach(emptySelect);
|
202
|
-
select_ids.forEach(function(
|
203
|
-
$(
|
204
|
-
$(
|
202
|
+
select_ids.forEach(function(select_id){
|
203
|
+
$(select_id + ' option:selected').prop('selected',false);
|
204
|
+
$(select_id).val('');
|
205
205
|
});
|
206
206
|
}
|
207
207
|
|
@@ -24,9 +24,9 @@ function volumesAttributesSelector(profile,index,selector) {
|
|
24
24
|
}
|
25
25
|
|
26
26
|
function getIndex(item) {
|
27
|
-
var
|
27
|
+
var index_id = $(item).attr('id');
|
28
28
|
var pattern = /(host_compute_attributes_volumes_attributes_||compute_attribute_vm_attrs_volumes_attributes_)(\d+)[_](.*)/i;
|
29
|
-
pattern_a = pattern.exec(
|
29
|
+
pattern_a = pattern.exec(index_id);
|
30
30
|
var index = pattern_a[2];
|
31
31
|
return index;
|
32
32
|
}
|
@@ -16,24 +16,24 @@
|
|
16
16
|
// along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>.
|
17
17
|
|
18
18
|
function getIndex(item) {
|
19
|
-
var
|
19
|
+
var index_id = $(item).attr('id');
|
20
20
|
var pattern = /(host_compute_attributes_volumes_attributes_||compute_attribute_vm_attrs_volumes_attributes_)(\d+)[_](.*)/i;
|
21
|
-
pattern_a = pattern.exec(
|
21
|
+
pattern_a = pattern.exec(index_id);
|
22
22
|
var index = pattern_a[2];
|
23
23
|
return index;
|
24
24
|
}
|
25
25
|
|
26
26
|
function volumeId(type,index){
|
27
|
-
let
|
28
|
-
return
|
27
|
+
let volume_id = '#volume_' + type + '_' + index;
|
28
|
+
return volume_id;
|
29
29
|
}
|
30
30
|
|
31
|
-
function enableField(
|
32
|
-
$(
|
33
|
-
$(
|
31
|
+
function enableField(item) {
|
32
|
+
$(item).show();
|
33
|
+
$(item).removeAttr('disabled');
|
34
34
|
}
|
35
35
|
|
36
|
-
function disableField(
|
37
|
-
$(
|
38
|
-
$(
|
36
|
+
function disableField(item) {
|
37
|
+
$(item).hide();
|
38
|
+
$(item).attr('disabled','disabled');
|
39
39
|
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_fog_proxmox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.13.
|
4
|
+
version: 0.13.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tristan Robert
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-03-
|
12
|
+
date: 2021-03-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: deface
|