foreman_opennebula 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +619 -0
- data/README.md +26 -0
- data/Rakefile +47 -0
- data/app/assets/javascripts/foreman_opennebula/scheduler_hint_filter_selected.js +30 -0
- data/app/assets/javascripts/foreman_opennebula/vmgroup_selected.js +30 -0
- data/app/controllers/foreman_opennebula/hosts_controller.rb +21 -0
- data/app/helpers/concerns/foreman_opennebula/form_helper_extensions.rb +9 -0
- data/app/helpers/concerns/foreman_opennebula/hosts_helper_extensions.rb +20 -0
- data/app/models/concerns/fog_extensions/opennebula/flavor.rb +109 -0
- data/app/models/concerns/fog_extensions/opennebula/interface.rb +11 -0
- data/app/models/concerns/fog_extensions/opennebula/server.rb +135 -0
- data/app/models/concerns/foreman_opennebula/key_pair_compute_resource.rb +80 -0
- data/app/models/foreman_opennebula/opennebula.rb +221 -0
- data/app/views/api/v2/compute_resources/opennebula.json.rabl +1 -0
- data/app/views/compute_resources/form/_opennebula.html.erb +6 -0
- data/app/views/compute_resources/show/_opennebula.html.erb +4 -0
- data/app/views/compute_resources_vms/form/opennebula/_base.html.erb +85 -0
- data/app/views/compute_resources_vms/form/opennebula/_network.html.erb +2 -0
- data/app/views/compute_resources_vms/form/opennebula/_scheduler_hint_data.html.erb +13 -0
- data/app/views/compute_resources_vms/form/opennebula/_vmgroup_role.html.erb +6 -0
- data/app/views/compute_resources_vms/index/_opennebula.html.erb +26 -0
- data/app/views/compute_resources_vms/show/_opennebula.html.erb +47 -0
- data/app/views/images/form/_opennebula.html.erb +4 -0
- data/config/routes.rb +6 -0
- data/lib/foreman_opennebula/engine.rb +59 -0
- data/lib/foreman_opennebula/version.rb +3 -0
- data/lib/foreman_opennebula.rb +4 -0
- data/lib/tasks/foreman_opennebula_tasks.rake +48 -0
- data/locale/Makefile +60 -0
- data/locale/en/foreman_opennebula.po +19 -0
- data/locale/foreman_opennebula.pot +19 -0
- data/locale/gemspec.rb +2 -0
- data/package.json +22 -0
- data/test/factories/foreman_opennebula_factories.rb +5 -0
- data/test/test_plugin_helper.rb +6 -0
- data/test/unit/foreman_opennebula_test.rb +11 -0
- data/webpack/components/MemorySizeInput/MemorySizeInput.css +4 -0
- data/webpack/components/MemorySizeInput/MemorySizeInput.js +83 -0
- data/webpack/components/MemorySizeInput/index.js +3 -0
- data/webpack/global_index.js +4 -0
- data/webpack/index.js +6 -0
- metadata +145 -0
data/package.json
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
{
|
2
|
+
"name": "foreman_opennebula",
|
3
|
+
"version": "1.0.0",
|
4
|
+
"description": "JS bundle for foreman-opennebula plugin",
|
5
|
+
"main": "./webpack/index.js",
|
6
|
+
"scripts": {
|
7
|
+
"lint": "tfm-lint --plugin -d /webpack",
|
8
|
+
"test": "tfm-test --plugin",
|
9
|
+
"test:watch": "tfm-test --plugin --watchAll",
|
10
|
+
"test:current": "tfm-test --plugin --watch",
|
11
|
+
"publish-coverage": "tfm-publish-coverage"
|
12
|
+
},
|
13
|
+
"repository": {
|
14
|
+
"type": "git",
|
15
|
+
"url": "https://github.com/pyslarvt/foreman-opennebula.git"
|
16
|
+
},
|
17
|
+
"author": {
|
18
|
+
"name": "Vitaly Pyslar",
|
19
|
+
"email": "vpyslar@ivi.ru"
|
20
|
+
},
|
21
|
+
"license": "ISC"
|
22
|
+
}
|
@@ -0,0 +1,83 @@
|
|
1
|
+
import React, {useState} from 'react';
|
2
|
+
import RCInputNumber from 'rc-input-number';
|
3
|
+
import PropTypes from 'prop-types';
|
4
|
+
import { noop } from 'foremanReact/common/helpers';
|
5
|
+
import './MemorySizeInput.css';
|
6
|
+
|
7
|
+
const MemorySizeInput = ({ id, name, value, onChange }) => {
|
8
|
+
const [inputValue, setInputValue] = useState();
|
9
|
+
const [selectedUnit, setSelectedUnit] = useState('GB');
|
10
|
+
|
11
|
+
const units = {
|
12
|
+
TB: Math.pow(2, 20),
|
13
|
+
GB: Math.pow(2, 10),
|
14
|
+
MB: Math.pow(2, 0)
|
15
|
+
};
|
16
|
+
|
17
|
+
if (value && !inputValue) {
|
18
|
+
for (let u in units) {
|
19
|
+
if (value % units[u] === 0) {
|
20
|
+
setInputValue(value / units[u]);
|
21
|
+
setSelectedUnit(u);
|
22
|
+
break;
|
23
|
+
}
|
24
|
+
}
|
25
|
+
}
|
26
|
+
|
27
|
+
const handleInputChange = v => {
|
28
|
+
setInputValue(v);
|
29
|
+
onChange(v ? v * units[selectedUnit] : '');
|
30
|
+
};
|
31
|
+
|
32
|
+
const handleUnitChange = e => {
|
33
|
+
setSelectedUnit(e.target.value);
|
34
|
+
onChange(inputValue ? inputValue * units[e.target.value] : '');
|
35
|
+
};
|
36
|
+
|
37
|
+
return (
|
38
|
+
<div className='input-group'>
|
39
|
+
<RCInputNumber
|
40
|
+
id={id}
|
41
|
+
value={inputValue}
|
42
|
+
min={1}
|
43
|
+
precision={0}
|
44
|
+
onChange={handleInputChange}
|
45
|
+
prefixCls='foreman-numeric-input'
|
46
|
+
/>
|
47
|
+
<span className='input-group-btn'>
|
48
|
+
<select
|
49
|
+
value={selectedUnit}
|
50
|
+
onChange={handleUnitChange}
|
51
|
+
className='form-control btn btn-default without_select2 selected-unit'>
|
52
|
+
<option value='MB'>MB</option>
|
53
|
+
<option value='GB'>GB</option>
|
54
|
+
<option value='TB'>TB</option>
|
55
|
+
</select>
|
56
|
+
</span>
|
57
|
+
<input
|
58
|
+
type='hidden'
|
59
|
+
name={name}
|
60
|
+
value={inputValue ? inputValue * units[selectedUnit] : ''}
|
61
|
+
/>
|
62
|
+
</div>
|
63
|
+
);
|
64
|
+
};
|
65
|
+
|
66
|
+
MemorySizeInput.propTypes = {
|
67
|
+
id: PropTypes.string,
|
68
|
+
name: PropTypes.string,
|
69
|
+
value: PropTypes.oneOfType([
|
70
|
+
PropTypes.number,
|
71
|
+
PropTypes.string,
|
72
|
+
]),
|
73
|
+
onChange: PropTypes.func,
|
74
|
+
};
|
75
|
+
|
76
|
+
MemorySizeInput.defaultProps = {
|
77
|
+
id: '',
|
78
|
+
name: '',
|
79
|
+
value: '',
|
80
|
+
onChange: noop,
|
81
|
+
};
|
82
|
+
|
83
|
+
export default MemorySizeInput;
|
data/webpack/index.js
ADDED
metadata
ADDED
@@ -0,0 +1,145 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: foreman_opennebula
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.3.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Vitaly Pyslar
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-08-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '13.0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '13.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rdoc
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '6.4'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '6.4'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rubocop
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.36'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.36'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: fog-opennebula
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.0'
|
69
|
+
description: Provision and manage OpenNebula VMs from Foreman
|
70
|
+
email:
|
71
|
+
- ops@ivi.ru
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- LICENSE
|
77
|
+
- README.md
|
78
|
+
- Rakefile
|
79
|
+
- app/assets/javascripts/foreman_opennebula/scheduler_hint_filter_selected.js
|
80
|
+
- app/assets/javascripts/foreman_opennebula/vmgroup_selected.js
|
81
|
+
- app/controllers/foreman_opennebula/hosts_controller.rb
|
82
|
+
- app/helpers/concerns/foreman_opennebula/form_helper_extensions.rb
|
83
|
+
- app/helpers/concerns/foreman_opennebula/hosts_helper_extensions.rb
|
84
|
+
- app/models/concerns/fog_extensions/opennebula/flavor.rb
|
85
|
+
- app/models/concerns/fog_extensions/opennebula/interface.rb
|
86
|
+
- app/models/concerns/fog_extensions/opennebula/server.rb
|
87
|
+
- app/models/concerns/foreman_opennebula/key_pair_compute_resource.rb
|
88
|
+
- app/models/foreman_opennebula/opennebula.rb
|
89
|
+
- app/views/api/v2/compute_resources/opennebula.json.rabl
|
90
|
+
- app/views/compute_resources/form/_opennebula.html.erb
|
91
|
+
- app/views/compute_resources/show/_opennebula.html.erb
|
92
|
+
- app/views/compute_resources_vms/form/opennebula/_base.html.erb
|
93
|
+
- app/views/compute_resources_vms/form/opennebula/_network.html.erb
|
94
|
+
- app/views/compute_resources_vms/form/opennebula/_scheduler_hint_data.html.erb
|
95
|
+
- app/views/compute_resources_vms/form/opennebula/_vmgroup_role.html.erb
|
96
|
+
- app/views/compute_resources_vms/index/_opennebula.html.erb
|
97
|
+
- app/views/compute_resources_vms/show/_opennebula.html.erb
|
98
|
+
- app/views/images/form/_opennebula.html.erb
|
99
|
+
- config/routes.rb
|
100
|
+
- lib/foreman_opennebula.rb
|
101
|
+
- lib/foreman_opennebula/engine.rb
|
102
|
+
- lib/foreman_opennebula/version.rb
|
103
|
+
- lib/tasks/foreman_opennebula_tasks.rake
|
104
|
+
- locale/Makefile
|
105
|
+
- locale/en/foreman_opennebula.po
|
106
|
+
- locale/foreman_opennebula.pot
|
107
|
+
- locale/gemspec.rb
|
108
|
+
- package.json
|
109
|
+
- test/factories/foreman_opennebula_factories.rb
|
110
|
+
- test/test_plugin_helper.rb
|
111
|
+
- test/unit/foreman_opennebula_test.rb
|
112
|
+
- webpack/components/MemorySizeInput/MemorySizeInput.css
|
113
|
+
- webpack/components/MemorySizeInput/MemorySizeInput.js
|
114
|
+
- webpack/components/MemorySizeInput/index.js
|
115
|
+
- webpack/global_index.js
|
116
|
+
- webpack/index.js
|
117
|
+
homepage: https://github.com/theforeman/foreman_opennebula
|
118
|
+
licenses:
|
119
|
+
- GPL-3.0
|
120
|
+
metadata:
|
121
|
+
is_foreman_plugin: 'true'
|
122
|
+
post_install_message:
|
123
|
+
rdoc_options: []
|
124
|
+
require_paths:
|
125
|
+
- lib
|
126
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '2.7'
|
131
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
132
|
+
requirements:
|
133
|
+
- - ">="
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '0'
|
136
|
+
requirements: []
|
137
|
+
rubyforge_project:
|
138
|
+
rubygems_version: 2.7.6.3
|
139
|
+
signing_key:
|
140
|
+
specification_version: 4
|
141
|
+
summary: Foreman OpenNebula plugin
|
142
|
+
test_files:
|
143
|
+
- test/test_plugin_helper.rb
|
144
|
+
- test/unit/foreman_opennebula_test.rb
|
145
|
+
- test/factories/foreman_opennebula_factories.rb
|