foreman_fog_proxmox 0.17.1 → 0.19.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5b4d4330c4fcf2a9c34654f0eb6fd815ff594e92c89cf3087668593c34eb5163
4
- data.tar.gz: 299d35d38bc7acc751bcc6029ae81668c77885e008c2f05c44d821b3fc9b41b0
3
+ metadata.gz: 706caedbf4e2d8ec401c6c5257594cf35633bba111437ed7c6d00b2470f17fdb
4
+ data.tar.gz: a5849ac10f319cd6c0b3d35188f8cba52d0e35f55765db2b8301e6d9f2141725
5
5
  SHA512:
6
- metadata.gz: a73e32847f12af16d70796f3d197126b4a0ade07d79ba8b5ced0d0c9663131af88d3ddaf21b1feef5dfe9209f066eae59cf0aab54c52ea7053a077bd85dbba13
7
- data.tar.gz: bb05744d447e8dddcc864aaa44439cae3d6793f6d7d24b637ba627443cd1d0964c39c63e7adb72fc157284c36b0be9630a82e722765782b17d716a95040a8cc7
6
+ metadata.gz: 821257efc8242ee2b7322fb438f9a4bed9c1520e7e01f8a8e21314c2b0d5b47df14f1d3bbaca87f41f29ca95c61d1e5bf417d32c1c0b9956b8d3e4914429d6ef
7
+ data.tar.gz: 2211366e977d013664d358760e10a61888cda03dd6f16a077486443d759b276e55c29f49038a1aa6f284702a5053d13864c99c2b964a380dfe0e5618cee515ab
data/README.md CHANGED
@@ -34,7 +34,7 @@ You can support the plugin development via the following methods:
34
34
  |>=0.12 |>=6.1|>=0.11|>=2.0|>=2.5|
35
35
  |>=0.14 |>=6.2|=0.13.0|>=2.4|>=2.7|
36
36
  |>=0.14 |>=6.2|>=0.13.1|>=2.3|>=2.5|
37
- |>=0.14 |>=6.2|>=0.14.0|>=2.5|>=2.5|
37
+ |>=0.14 |>=6.2,<8.0|>=0.14.0|>=2.5|>=2.5|
38
38
 
39
39
  ## Installation
40
40
 
@@ -62,7 +62,7 @@ module ProxmoxVMAttrsHelper
62
62
  keys = ['id', 'volid', 'storage', 'size', 'storage_type']
63
63
  type = 'rootfs'
64
64
  elsif vol.hard_disk?
65
- keys = ['id', 'volid', 'storage_type', 'storage', 'controller', 'device', 'cache', 'size']
65
+ keys = ['id', 'volid', 'storage_type', 'storage', 'controller', 'device', 'cache', 'size', '_delete']
66
66
  type = 'hard_disk'
67
67
  elsif vol.cdrom?
68
68
  keys = ['id', 'storage_type', 'cdrom', 'storage', 'volid']
@@ -82,7 +82,7 @@ module ProxmoxVMAttrsHelper
82
82
  def vol_keys(param_scope, keys, vol, id)
83
83
  attrs = ActiveSupport::HashWithIndifferentAccess.new
84
84
  keys.each do |key|
85
- camel_key = key.to_s.include?('_') ? snake_to_camel(key.to_s).to_sym : key
85
+ camel_key = key.to_s.include?('_') && key.to_s != '_delete' ? snake_to_camel(key.to_s).to_sym : key
86
86
  attrs[camel_key] = { :name => "#{param_scope}[volumes_attributes][#{id}][#{key}]", :value => vol.public_send(key) }
87
87
  end
88
88
  attrs
@@ -151,7 +151,7 @@ module ForemanFogProxmox
151
151
  def client
152
152
  @client ||= ::Fog::Proxmox::Compute.new(fog_credentials)
153
153
  rescue Excon::Errors::Unauthorized => e
154
- raise ::Foreman::Exception, 'User token expired' if token_expired?(e)
154
+ raise ::Foreman::Exception, token_expired?(e) ? 'User token expired' : "Authentication Failure: #{error_message(e)}"
155
155
  rescue StandardError => e
156
156
  logger.warn("failed to create compute client: #{e}")
157
157
  raise ::Foreman::Exception, error_message(e)
@@ -160,7 +160,7 @@ module ForemanFogProxmox
160
160
  def identity_client
161
161
  @identity_client ||= ::Fog::Proxmox::Identity.new(fog_credentials)
162
162
  rescue Excon::Errors::Unauthorized => e
163
- raise ::Foreman::Exception, 'User token expired' if token_expired?(e)
163
+ raise ::Foreman::Exception, token_expired?(e) ? 'User token expired' : "Authentication Failure: #{error_message(e)}"
164
164
  rescue StandardError => e
165
165
  logger.warn("failed to create identity client: #{e}")
166
166
  raise ::Foreman::Exception, error_message(e)
@@ -169,14 +169,14 @@ module ForemanFogProxmox
169
169
  def network_client
170
170
  @network_client ||= ::Fog::Proxmox::Network.new(fog_credentials)
171
171
  rescue Excon::Errors::Unauthorized => e
172
- raise ::Foreman::Exception, 'User token expired' if token_expired?(e)
172
+ raise ::Foreman::Exception, token_expired?(e) ? 'User token expired' : "Authentication Failure: #{error_message(e)}"
173
173
  rescue StandardError => e
174
174
  logger.warn("failed to create network client: #{e}")
175
175
  raise ::Foreman::Exception, error_message(e)
176
176
  end
177
177
 
178
178
  def error_message(e)
179
- "Failed to create Proxmox compute resource: #{e.message}.
179
+ "Failed to create Proxmox compute resource: #{e.response.reason_phrase}.
180
180
  Either provided credentials or FQDN is wrong or
181
181
  your server cannot connect to Proxmox due to network issues."
182
182
  end
@@ -56,11 +56,11 @@ module ForemanFogProxmox
56
56
  identity_client
57
57
  version_suitable?
58
58
  rescue StandardError => e
59
- errors[:base] << e.message
59
+ errors.add(:base, e.message)
60
60
  if e.message.include?('SSL')
61
- errors[:ssl_certs] << e.message
61
+ errors.add(:ssl_certs, e.message)
62
62
  else
63
- errors[:url] << e.message
63
+ errors.add(:url, e.message)
64
64
  end
65
65
  end
66
66
 
@@ -18,7 +18,6 @@
18
18
  # along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>.
19
19
 
20
20
  require 'fog/proxmox/helpers/ip_helper'
21
- require 'net/validations'
22
21
 
23
22
  module ForemanFogProxmox
24
23
  module ProxmoxInterfaces
@@ -36,6 +36,7 @@ module ForemanFogProxmox
36
36
  v = identity_client.read_version if identity_client
37
37
  v ? v['version'] : 'Unknown'
38
38
  rescue ::Foreman::Exception => e
39
+ logger.warn("Foreman::Exception => failed to fetch identity client version: #{e}")
39
40
  'Unkown' if e.message == 'User token expired'
40
41
  rescue StandardError => e
41
42
  logger.warn("failed to get identity client version: #{e}")
@@ -24,7 +24,7 @@ along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>. %>
24
24
  <%= select_f f, :image_id, images, :uuid, :name, { :include_blank => true },
25
25
  :disabled => true,
26
26
  :help_inline => :indicator,
27
- :class => ('hide' if from_profile),
27
+ :class => ("without_select2 #{'hide' if from_profile}"),
28
28
  :label => _('Image'),
29
29
  :no_label => from_profile,
30
30
  :label_size => "col-md-2" %>
@@ -110,7 +110,7 @@ ethernets:
110
110
  addresses:
111
111
  - <%= @host.ip %>/<%= @host.subnet.cidr %>
112
112
  routes:
113
- - to: 0.0.0.0
113
+ - to: 0.0.0.0/0
114
114
  via: <%= @host.subnet.gateway %>
115
115
  nameservers:
116
116
  addresses:
@@ -33,7 +33,7 @@ module ForemanFogProxmox
33
33
  initializer 'foreman_fog_proxmox.register_plugin', :before => :finisher_hook do |app|
34
34
  app.reloader.to_prepare do
35
35
  Foreman::Plugin.register :foreman_fog_proxmox do
36
- requires_foreman '>= 1.22.0'
36
+ requires_foreman '>= 3.15'
37
37
  # Add Global files for extending foreman-core components and routes
38
38
  register_global_js_file 'global'
39
39
  # Register Proxmox VE compute resource in foreman
@@ -18,5 +18,5 @@
18
18
  # along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>.
19
19
 
20
20
  module ForemanFogProxmox
21
- VERSION = '0.17.1'
21
+ VERSION = '0.19.0'
22
22
  end
data/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "lint": "tfm-lint --plugin -d webpack",
8
- "test": "tfm-test --config jest.config.js",
8
+ "test": "tfm-test --plugin --passWithNoTests",
9
9
  "test:watch": "tfm-test --plugin --watchAll",
10
10
  "test:current": "tfm-test --plugin --watch",
11
11
  "publish-coverage": "tfm-publish-coverage",
@@ -21,18 +21,18 @@
21
21
  "url": "http://projects.theforeman.org/projects/foreman_fog_proxmox/issues"
22
22
  },
23
23
  "peerDependencies": {
24
- "@theforeman/vendor": "^12.0.1"
24
+ "@theforeman/vendor": "^15.0.1"
25
25
  },
26
26
  "dependencies": {
27
27
  "react-intl": "^2.8.0"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@babel/core": "^7.7.0",
31
- "@theforeman/builder": ">= 12.0.1",
32
- "@theforeman/eslint-plugin-foreman": ">= 12.0.1",
33
- "@theforeman/find-foreman": ">= 12.0.1",
34
- "@theforeman/test": ">= 12.0.1",
35
- "@theforeman/vendor-dev": ">= 12.0.1",
31
+ "@theforeman/builder": ">= 15.0.1",
32
+ "@theforeman/eslint-plugin-foreman": ">= 15.0.1",
33
+ "@theforeman/find-foreman": ">= 15.0.1",
34
+ "@theforeman/test": ">= 15.0.1",
35
+ "@theforeman/vendor-dev": ">= 15.0.1",
36
36
  "babel-eslint": "^10.0.3",
37
37
  "eslint": "^6.7.2",
38
38
  "prettier": "^1.19.1",
@@ -53,7 +53,7 @@ const MountPoint = ({ id, data, storagesMap }) => {
53
53
  <InputField
54
54
  label={__('Device')}
55
55
  name={mp?.device?.name}
56
- disabled
56
+ readOnly
57
57
  value={mp?.device?.value}
58
58
  onChange={handleChange}
59
59
  tooltip={__('Device value is set automatically.')}
@@ -20,7 +20,9 @@ const ProxmoxContainerHardware = ({ hardware }) => {
20
20
  return (
21
21
  <div>
22
22
  <PageSection padding={{ default: 'noPadding' }}>
23
- <Title headingLevel="h3">{__('CPU')}</Title>
23
+ <Title ouiaId="proxmox-container-hardware-cpu" headingLevel="h3">
24
+ {__('CPU')}
25
+ </Title>
24
26
  <Divider component="li" style={{ marginBottom: '2rem' }} />
25
27
  <InputField
26
28
  name={hw?.arch?.name}
@@ -53,7 +55,9 @@ const ProxmoxContainerHardware = ({ hardware }) => {
53
55
  />
54
56
  </PageSection>
55
57
  <PageSection padding={{ default: 'noPadding' }}>
56
- <Title headingLevel="h3">{__('Memory')}</Title>
58
+ <Title ouiaId="proxmox-container-hardware-memory" headingLevel="h3">
59
+ {__('Memory')}
60
+ </Title>
57
61
  <Divider component="li" style={{ marginBottom: '2rem' }} />
58
62
  <InputField
59
63
  name={hw?.memory?.name}
@@ -129,7 +129,11 @@ const ProxmoxContainerNetwork = ({ network, bridges, paramScope }) => {
129
129
  return (
130
130
  <div>
131
131
  <PageSection padding={{ default: 'noPadding' }}>
132
- <Button onClick={addInterface} variant="secondary">
132
+ <Button
133
+ ouiaId="proxmox-container-network-interface"
134
+ onClick={addInterface}
135
+ variant="secondary"
136
+ >
133
137
  {__('Add Interface')}
134
138
  </Button>
135
139
  {interfaces.map(nic => (
@@ -142,7 +146,7 @@ const ProxmoxContainerNetwork = ({ network, bridges, paramScope }) => {
142
146
  alignItems: 'center',
143
147
  }}
144
148
  >
145
- <Title headingLevel="h4">
149
+ <Title ouiaId="proxmox-container-network-nic" headingLevel="h4">
146
150
  {sprintf(__('Nic %(nicId)s'), { nicId: nic.id })}
147
151
  </Title>
148
152
  <button onClick={() => removeInterface(nic.id)} type="button">
@@ -112,7 +112,9 @@ const ProxmoxContainerStorage = ({ storage, storages, nodeId, paramScope }) => {
112
112
  return (
113
113
  <div>
114
114
  <PageSection padding={{ default: 'noPadding' }}>
115
- <Title headingLevel="h3">{__('Rootfs')}</Title>
115
+ <Title ouiaId="proxmox-container-storage-rootfs" headingLevel="h3">
116
+ {__('Rootfs')}
117
+ </Title>
116
118
  <Divider component="li" style={{ marginBottom: '2rem' }} />
117
119
  <InputField
118
120
  name={rootfs?.storage?.name}
@@ -142,9 +144,15 @@ const ProxmoxContainerStorage = ({ storage, storages, nodeId, paramScope }) => {
142
144
  />
143
145
  </PageSection>
144
146
  <PageSection padding={{ default: 'noPadding' }}>
145
- <Title headingLevel="h3">Storage</Title>
147
+ <Title ouiaId="proxmox-container-storage-title" headingLevel="h3">
148
+ Storage
149
+ </Title>
146
150
  <Divider component="li" style={{ marginBottom: '2rem' }} />
147
- <Button onClick={addMountPoint} variant="secondary">
151
+ <Button
152
+ ouiaId="proxmox-container-storage-mountpoint-button"
153
+ onClick={addMountPoint}
154
+ variant="secondary"
155
+ >
148
156
  {__('Add MountPoint')}
149
157
  </Button>
150
158
  {mountPoints.map(mountPoint => (
@@ -157,7 +165,10 @@ const ProxmoxContainerStorage = ({ storage, storages, nodeId, paramScope }) => {
157
165
  alignItems: 'center',
158
166
  }}
159
167
  >
160
- <Title headingLevel="h4">
168
+ <Title
169
+ ouiaId="proxmox-container-storage-mountpoint-title"
170
+ headingLevel="h4"
171
+ >
161
172
  {sprintf(__('Mount Point %(mp)s'), { mp: mountPoint.id })}
162
173
  </Title>
163
174
  <button onClick={() => removeMountPoint(mountPoint.id)}>
@@ -91,7 +91,9 @@ const ProxmoxServerHardware = ({ hardware }) => {
91
91
  return (
92
92
  <div>
93
93
  <PageSection padding={{ default: 'noPadding' }}>
94
- <Title headingLevel="h3">{__('CPU')}</Title>
94
+ <Title ouiaId="proxmox-server-hardware-cpu" headingLevel="h3">
95
+ {__('CPU')}
96
+ </Title>
95
97
  <Divider component="li" style={{ marginBottom: '2rem' }} />
96
98
  <InputField
97
99
  name={hw?.cpuType?.name}
@@ -145,7 +147,11 @@ const ProxmoxServerHardware = ({ hardware }) => {
145
147
  onChange={handleChange}
146
148
  />
147
149
  <div style={{ marginLeft: '5%', display: 'inline-block' }}>
148
- <Button variant="link" onClick={handleModalToggle}>
150
+ <Button
151
+ ouiaId="proxmox-server-hardware-cpu-flags"
152
+ variant="link"
153
+ onClick={handleModalToggle}
154
+ >
149
155
  {__('Extra CPU Flags')}
150
156
  </Button>
151
157
  </div>
@@ -165,7 +171,9 @@ const ProxmoxServerHardware = ({ hardware }) => {
165
171
  ))}
166
172
  </PageSection>
167
173
  <PageSection padding={{ default: 'noPadding' }}>
168
- <Title headingLevel="h3">{__('Memory')}</Title>
174
+ <Title ouiaId="proxmox-server-hardware-memory" headingLevel="h3">
175
+ {__('Memory')}
176
+ </Title>
169
177
  <Divider component="li" style={{ marginBottom: '2rem' }} />
170
178
  <InputField
171
179
  name={hw?.memory?.name}
@@ -111,7 +111,11 @@ const ProxmoxServerNetwork = ({ network, bridges, paramScope }) => {
111
111
  return (
112
112
  <div>
113
113
  <PageSection padding={{ default: 'noPadding' }}>
114
- <Button onClick={addInterface} variant="secondary">
114
+ <Button
115
+ ouiaId="proxmox-server-network-interface"
116
+ onClick={addInterface}
117
+ variant="secondary"
118
+ >
115
119
  {__('Add Interface')}
116
120
  </Button>
117
121
  {interfaces.map(nic => (
@@ -124,7 +128,7 @@ const ProxmoxServerNetwork = ({ network, bridges, paramScope }) => {
124
128
  alignItems: 'center',
125
129
  }}
126
130
  >
127
- <Title headingLevel="h4">
131
+ <Title ouiaId="proxmox-server-network-nic" headingLevel="h4">
128
132
  {sprintf(__('Nic %(nicId)s'), { nicId: nic.id })}
129
133
  </Title>
130
134
  <button onClick={() => removeInterface(nic.id)} type="button">
@@ -140,6 +140,7 @@ const ProxmoxServerStorage = ({ storage, storages, paramScope, nodeId }) => {
140
140
  storages,
141
141
  data: initHdd,
142
142
  disks: storage,
143
+ isNew: !isPreExisting,
143
144
  };
144
145
  setHardDisks(prevHardDisks => [...prevHardDisks, newHardDisk]);
145
146
  return newNextId;
@@ -149,9 +150,11 @@ const ProxmoxServerStorage = ({ storage, storages, paramScope, nodeId }) => {
149
150
  );
150
151
 
151
152
  const removeHardDisk = idToRemove => {
152
- const newHardDisks = hardDisks.filter(
153
- hardDisk => hardDisk.id !== idToRemove
154
- );
153
+ const newHardDisks = hardDisks
154
+ .filter(hardDisk => !(hardDisk.id === idToRemove && hardDisk.isNew))
155
+ .map(hardDisk =>
156
+ hardDisk.id === idToRemove ? { ...hardDisk, hidden: true } : hardDisk
157
+ );
155
158
  setHardDisks(newHardDisks);
156
159
  };
157
160
 
@@ -207,12 +210,21 @@ const ProxmoxServerStorage = ({ storage, storages, paramScope, nodeId }) => {
207
210
  return (
208
211
  <div>
209
212
  <PageSection padding={{ default: 'noPadding' }}>
210
- <Button onClick={addCDRom} variant="secondary" isDisabled={cdRom}>
213
+ <Button
214
+ ouiaId="proxmox-server-storage-cdrom"
215
+ onClick={addCDRom}
216
+ variant="secondary"
217
+ isDisabled={cdRom}
218
+ >
211
219
  {' '}
212
220
  {__('Add CD-ROM')}
213
221
  </Button>
214
222
  {' '}
215
- <Button onClick={addHardDisk} variant="secondary">
223
+ <Button
224
+ ouiaId="proxmox-server-storage-harddisk"
225
+ onClick={addHardDisk}
226
+ variant="secondary"
227
+ >
216
228
  {__('Add HardDisk')}
217
229
  </Button>
218
230
  {cdRom && cdRomData && (
@@ -224,7 +236,13 @@ const ProxmoxServerStorage = ({ storage, storages, paramScope, nodeId }) => {
224
236
  />
225
237
  )}
226
238
  {hardDisks.map(hardDisk => (
227
- <div style={{ position: 'relative' }}>
239
+ <div
240
+ key={hardDisk.id}
241
+ style={{
242
+ position: 'relative',
243
+ display: hardDisk.hidden ? 'none' : 'block',
244
+ }}
245
+ >
228
246
  <div
229
247
  style={{
230
248
  marginTop: '10px',
@@ -233,7 +251,7 @@ const ProxmoxServerStorage = ({ storage, storages, paramScope, nodeId }) => {
233
251
  alignItems: 'center',
234
252
  }}
235
253
  >
236
- <Title headingLevel="h4">
254
+ <Title ouiaId="proxmox-server-storage-harddisk" headingLevel="h4">
237
255
  {sprintf(__('Hard Disk %(hddId)s'), { hddId: hardDisk.id })}
238
256
  </Title>
239
257
  <button onClick={() => removeHardDisk(hardDisk.id)} type="button">
@@ -247,6 +265,7 @@ const ProxmoxServerStorage = ({ storage, storages, paramScope, nodeId }) => {
247
265
  disks={hardDisk.disks}
248
266
  updateHardDiskData={updateHardDiskData}
249
267
  createUniqueDevice={createUniqueDevice}
268
+ hidden={hardDisk.hidden ? true : ''}
250
269
  />
251
270
  </div>
252
271
  ))}
@@ -51,7 +51,9 @@ const CDRom = ({ onRemove, data, storages, nodeId }) => {
51
51
  alignItems: 'center',
52
52
  }}
53
53
  >
54
- <Title headingLevel="h4">{__('CD-ROM')}</Title>
54
+ <Title ouiaId="proxmox-server-cdrom-title" headingLevel="h4">
55
+ {__('CD-ROM')}
56
+ </Title>
55
57
  <button onClick={onRemove}>
56
58
  <TimesIcon />
57
59
  </button>
@@ -64,38 +66,45 @@ const CDRom = ({ onRemove, data, storages, nodeId }) => {
64
66
  alignItems: 'center',
65
67
  }}
66
68
  >
67
- <Title headingLevel="h5">{__('Media')}</Title>
69
+ <Title ouiaId="proxmox-server-cdrom-media-title" headingLevel="h5">
70
+ {__('Media')}
71
+ </Title>
68
72
  </div>
69
73
  <Divider component="li" style={{ marginBottom: '1rem' }} />
70
74
  <div style={{ display: 'flex', gap: '1rem' }}>
71
75
  <Radio
76
+ ouiaId="proxmox-server-cdrom-media-none"
72
77
  id="radio-none"
73
78
  name={cdrom?.cdrom?.name}
74
79
  label={__('None')}
75
80
  value="none"
76
81
  isChecked={cdrom?.cdrom?.value === 'none'}
77
- onChange={handleMediaChange}
82
+ onChange={(e, _) => handleMediaChange(_, e)}
78
83
  />
79
84
  <Radio
85
+ ouiaId="proxmox-server-cdrom-media-physical"
80
86
  id="radio-physical"
81
87
  name={cdrom?.cdrom?.name}
82
88
  label={__('Physical')}
83
89
  value="physical"
84
90
  isChecked={cdrom?.cdrom?.value === 'physical'}
85
- onChange={handleMediaChange}
91
+ onChange={(e, _) => handleMediaChange(_, e)}
86
92
  />
87
93
  <Radio
94
+ ouiaId="proxmox-server-cdrom-media-image"
88
95
  id="radio-image"
89
96
  name={cdrom?.cdrom?.name}
90
97
  label={__('Image')}
91
98
  value="image"
92
99
  isChecked={cdrom?.cdrom?.value === 'image'}
93
- onChange={handleMediaChange}
100
+ onChange={(e, _) => handleMediaChange(_, e)}
94
101
  />
95
102
  </div>
96
103
  {cdrom?.cdrom?.value === 'image' && (
97
104
  <PageSection padding={{ default: 'noPadding' }}>
98
- <Title headingLevel="h5">{__('Image')}</Title>
105
+ <Title ouiaId="proxmox-server-cdrom-image-title" headingLevel="h5">
106
+ {__('Image')}
107
+ </Title>
99
108
  <Divider component="li" style={{ marginBottom: '2rem' }} />
100
109
  <InputField
101
110
  label={__('Storage')}
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { Modal, Button } from '@patternfly/react-core';
3
3
  import { translate as __ } from 'foremanReact/common/I18n';
4
- import { Table, Thead, Tr, Th, Tbody, Td } from '@patternfly/react-table';
4
+ import { Thead, Tr, Th, Tbody, Td, Table } from '@patternfly/react-table';
5
5
  import PropTypes from 'prop-types';
6
6
  import ProxmoxComputeSelectors from '../../ProxmoxComputeSelectors';
7
7
 
@@ -20,6 +20,7 @@ const CPUFlagsModal = ({ isOpen, onClose, flags, handleChange }) => {
20
20
  return (
21
21
  <div>
22
22
  <Modal
23
+ ouiaId="proxmox-server-cpu-flags"
23
24
  bodyAriaLabel="Scrollable modal content"
24
25
  width="60%"
25
26
  tabIndex={0}
@@ -27,17 +28,31 @@ const CPUFlagsModal = ({ isOpen, onClose, flags, handleChange }) => {
27
28
  isOpen={isOpen}
28
29
  onClose={onClose}
29
30
  actions={[
30
- <Button key="confirm" variant="primary" onClick={onClose}>
31
+ <Button
32
+ ouiaId="proxmox-server-cpu-flags-confirm"
33
+ key="confirm"
34
+ variant="primary"
35
+ onClick={onClose}
36
+ >
31
37
  {__('Confirm')}
32
38
  </Button>,
33
- <Button key="reset" variant="secondary" onClick={resetFlags}>
39
+ <Button
40
+ ouiaId="proxmox-server-cpu-flags-reset"
41
+ key="reset"
42
+ variant="secondary"
43
+ onClick={resetFlags}
44
+ >
34
45
  {__('Reset')}
35
46
  </Button>,
36
47
  ]}
37
48
  >
38
- <Table aria-label="Simple table" variant="compact">
49
+ <Table
50
+ ouiaId="proxmox-server-cpu-flags-table"
51
+ aria-label="Simple table"
52
+ variant="compact"
53
+ >
39
54
  <Thead>
40
- <Tr>
55
+ <Tr ouiaId="proxmox-server-cpu-flags-tr1">
41
56
  <Th>Name</Th>
42
57
  <Th />
43
58
  <Th>Description</Th>
@@ -47,7 +62,7 @@ const CPUFlagsModal = ({ isOpen, onClose, flags, handleChange }) => {
47
62
  {Object.keys(flags).map(key => {
48
63
  const item = flags[key];
49
64
  return (
50
- <Tr key={item.label}>
65
+ <Tr ouiaId="proxmox-server-cpu-flags-tr2" key={item.label}>
51
66
  <Td>{item.label}</Td>
52
67
  <Td>
53
68
  <select
@@ -13,6 +13,7 @@ const HardDisk = ({
13
13
  disks,
14
14
  updateHardDiskData,
15
15
  createUniqueDevice,
16
+ hidden,
16
17
  nodeId,
17
18
  }) => {
18
19
  const [hdd, setHdd] = useState(data);
@@ -107,7 +108,7 @@ const HardDisk = ({
107
108
  name={hdd?.device?.name}
108
109
  value={hdd?.device?.value}
109
110
  onChange={handleChange}
110
- disabled
111
+ readOnly
111
112
  tooltip={__('Device value is set automatically.')}
112
113
  />
113
114
  <InputField
@@ -125,6 +126,7 @@ const HardDisk = ({
125
126
  value={hdd?.size?.value}
126
127
  onChange={handleChange}
127
128
  />
129
+ <input name={hdd?._delete?.name} type="hidden" value={hidden} />
128
130
  </div>
129
131
  );
130
132
  };
@@ -134,6 +136,7 @@ HardDisk.propTypes = {
134
136
  data: PropTypes.object,
135
137
  storages: PropTypes.array,
136
138
  disks: PropTypes.array,
139
+ hidden: PropTypes.bool,
137
140
  updateHardDiskData: PropTypes.func,
138
141
  createUniqueDevice: PropTypes.func,
139
142
  nodeId: PropTypes.string,
@@ -144,6 +147,7 @@ HardDisk.defaultProps = {
144
147
  storages: [],
145
148
  disks: [],
146
149
  nodeId: '',
150
+ hidden: 'false',
147
151
  updateHardDiskData: Function.prototype,
148
152
  createUniqueDevice: Function.prototype,
149
153
  };
@@ -162,12 +162,14 @@ const ProxmoxVmType = ({
162
162
  type="select"
163
163
  />
164
164
  <Tabs
165
+ ouiaId="proxmox-vm-type-tabs-options"
165
166
  activeKey={activeTabKey}
166
167
  onSelect={handleTabClick}
167
168
  aria-label="Options tabs"
168
169
  role="region"
169
170
  >
170
171
  <Tab
172
+ ouiaId="proxmox-vm-type-tab-general"
171
173
  eventKey={0}
172
174
  title={<TabTitleText>{__('General')}</TabTitleText>}
173
175
  aria-label="Default content - general"
@@ -184,6 +186,7 @@ const ProxmoxVmType = ({
184
186
  />
185
187
  </Tab>
186
188
  <Tab
189
+ ouiaId="proxmox-vm-type-tab-advanced"
187
190
  eventKey={1}
188
191
  title={<TabTitleText>{__('Advanced Options')}</TabTitleText>}
189
192
  aria-label="advanced options"
@@ -194,6 +197,7 @@ const ProxmoxVmType = ({
194
197
  </PageSection>
195
198
  </Tab>
196
199
  <Tab
200
+ ouiaId="proxmox-vm-type-tab-hardware"
197
201
  eventKey={2}
198
202
  title={<TabTitleText>{__('Hardware')}</TabTitleText>}
199
203
  aria-label="hardware"
@@ -205,6 +209,7 @@ const ProxmoxVmType = ({
205
209
  </Tab>
206
210
  {fromProfile && (
207
211
  <Tab
212
+ ouiaId="proxmox-vm-type-tab-network"
208
213
  eventKey={3}
209
214
  title={<TabTitleText>{__('Network Interfaces')}</TabTitleText>}
210
215
  aria-label="Network interface"
@@ -216,6 +221,7 @@ const ProxmoxVmType = ({
216
221
  </Tab>
217
222
  )}
218
223
  <Tab
224
+ ouiaId="proxmox-vm-type-tab-storage"
219
225
  eventKey={4}
220
226
  title={<TabTitleText>{__('Storage')}</TabTitleText>}
221
227
  aria-label="storage"
@@ -13,6 +13,7 @@ const InputField = ({
13
13
  required,
14
14
  type,
15
15
  disabled,
16
+ readOnly,
16
17
  options,
17
18
  checked,
18
19
  error,
@@ -40,6 +41,7 @@ const InputField = ({
40
41
  renderComponent = (
41
42
  <select
42
43
  disabled={disabled}
44
+ readOnly={readOnly}
43
45
  name={name}
44
46
  className="without_select2 form-control"
45
47
  value={value}
@@ -59,6 +61,7 @@ const InputField = ({
59
61
  checked={checked}
60
62
  onChange={onChange}
61
63
  disabled={disabled}
64
+ readOnly={readOnly}
62
65
  />
63
66
  );
64
67
  break;
@@ -71,6 +74,7 @@ const InputField = ({
71
74
  value={value}
72
75
  onChange={onChange}
73
76
  disabled={disabled}
77
+ readOnly={readOnly}
74
78
  />
75
79
  );
76
80
  break;
@@ -122,6 +126,7 @@ InputField.propTypes = {
122
126
  'checkbox',
123
127
  ]),
124
128
  disabled: PropTypes.bool,
129
+ readOnly: PropTypes.bool,
125
130
  checked: PropTypes.bool,
126
131
  options: PropTypes.arrayOf(
127
132
  PropTypes.shape({
@@ -142,6 +147,7 @@ InputField.defaultProps = {
142
147
  required: false,
143
148
  type: 'text',
144
149
  disabled: false,
150
+ readOnly: false,
145
151
  checked: false,
146
152
  options: [],
147
153
  error: '',
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_fog_proxmox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.1
4
+ version: 0.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tristan Robert
8
8
  - The Foreman Team
9
- autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2024-11-07 00:00:00.000000000 Z
11
+ date: 1980-01-02 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: deface
@@ -31,14 +30,14 @@ dependencies:
31
30
  requirements:
32
31
  - - "~>"
33
32
  - !ruby/object:Gem::Version
34
- version: '0.15'
33
+ version: 0.15.1
35
34
  type: :runtime
36
35
  prerelease: false
37
36
  version_requirements: !ruby/object:Gem::Requirement
38
37
  requirements:
39
38
  - - "~>"
40
39
  - !ruby/object:Gem::Version
41
- version: '0.15'
40
+ version: 0.15.1
42
41
  - !ruby/object:Gem::Dependency
43
42
  name: rdoc
44
43
  requirement: !ruby/object:Gem::Requirement
@@ -273,7 +272,6 @@ homepage: https://github.com/theforeman/foreman_fog_proxmox
273
272
  licenses:
274
273
  - GPL-3.0
275
274
  metadata: {}
276
- post_install_message:
277
275
  rdoc_options: []
278
276
  require_paths:
279
277
  - lib
@@ -288,34 +286,33 @@ required_rubygems_version: !ruby/object:Gem::Requirement
288
286
  - !ruby/object:Gem::Version
289
287
  version: '0'
290
288
  requirements: []
291
- rubygems_version: 3.1.6
292
- signing_key:
289
+ rubygems_version: 3.6.9
293
290
  specification_version: 4
294
291
  summary: Foreman plugin that adds Proxmox VE compute resource using fog-proxmox
295
292
  test_files:
293
+ - test/factories/foreman_fog_proxmox/proxmox_container_mock_factory.rb
294
+ - test/factories/foreman_fog_proxmox/proxmox_node_mock_factory.rb
295
+ - test/factories/foreman_fog_proxmox/proxmox_server_mock_factory.rb
296
+ - test/factories/proxmox_factory.rb
297
+ - test/functional/compute_resources_controller_test.rb
296
298
  - test/test_plugin_helper.rb
297
- - test/unit/foreman_fog_proxmox/proxmox_test.rb
298
- - test/unit/foreman_fog_proxmox/proxmox_vm_queries_test.rb
299
- - test/unit/foreman_fog_proxmox/proxmox_vm_commands_server_update_cloudinit_test.rb
300
- - test/unit/foreman_fog_proxmox/proxmox_vm_new_test.rb
301
- - test/unit/foreman_fog_proxmox/proxmox_vm_commands_test.rb
299
+ - test/unit/foreman_fog_proxmox/helpers/proxmox_container_helper_test.rb
300
+ - test/unit/foreman_fog_proxmox/helpers/proxmox_server_helper_test.rb
301
+ - test/unit/foreman_fog_proxmox/helpers/proxmox_vm_helper_test.rb
302
+ - test/unit/foreman_fog_proxmox/helpers/proxmox_vm_uuid_helper_test.rb
303
+ - test/unit/foreman_fog_proxmox/helpers/proxmox_vm_volumes_helper_test.rb
302
304
  - test/unit/foreman_fog_proxmox/proxmox_compute_attributes_test.rb
305
+ - test/unit/foreman_fog_proxmox/proxmox_images_test.rb
303
306
  - test/unit/foreman_fog_proxmox/proxmox_interfaces_test.rb
307
+ - test/unit/foreman_fog_proxmox/proxmox_test.rb
308
+ - test/unit/foreman_fog_proxmox/proxmox_version_test.rb
304
309
  - test/unit/foreman_fog_proxmox/proxmox_vm_commands_container_test.rb
305
- - test/unit/foreman_fog_proxmox/semver_test.rb
306
310
  - test/unit/foreman_fog_proxmox/proxmox_vm_commands_server_create_test.rb
307
311
  - test/unit/foreman_fog_proxmox/proxmox_vm_commands_server_update_cdrom_test.rb
308
- - test/unit/foreman_fog_proxmox/proxmox_version_test.rb
312
+ - test/unit/foreman_fog_proxmox/proxmox_vm_commands_server_update_cloudinit_test.rb
309
313
  - test/unit/foreman_fog_proxmox/proxmox_vm_commands_server_update_hard_disk_test.rb
310
- - test/unit/foreman_fog_proxmox/proxmox_images_test.rb
311
314
  - test/unit/foreman_fog_proxmox/proxmox_vm_commands_server_update_test.rb
312
- - test/unit/foreman_fog_proxmox/helpers/proxmox_server_helper_test.rb
313
- - test/unit/foreman_fog_proxmox/helpers/proxmox_container_helper_test.rb
314
- - test/unit/foreman_fog_proxmox/helpers/proxmox_vm_uuid_helper_test.rb
315
- - test/unit/foreman_fog_proxmox/helpers/proxmox_vm_helper_test.rb
316
- - test/unit/foreman_fog_proxmox/helpers/proxmox_vm_volumes_helper_test.rb
317
- - test/functional/compute_resources_controller_test.rb
318
- - test/factories/foreman_fog_proxmox/proxmox_server_mock_factory.rb
319
- - test/factories/foreman_fog_proxmox/proxmox_container_mock_factory.rb
320
- - test/factories/foreman_fog_proxmox/proxmox_node_mock_factory.rb
321
- - test/factories/proxmox_factory.rb
315
+ - test/unit/foreman_fog_proxmox/proxmox_vm_commands_test.rb
316
+ - test/unit/foreman_fog_proxmox/proxmox_vm_new_test.rb
317
+ - test/unit/foreman_fog_proxmox/proxmox_vm_queries_test.rb
318
+ - test/unit/foreman_fog_proxmox/semver_test.rb