foreman_resource_quota 0.4.0 → 0.6.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.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -5
  3. data/app/controllers/foreman_resource_quota/api/v2/resource_quotas_controller.rb +1 -1
  4. data/app/controllers/foreman_resource_quota/concerns/api/v2/hosts_controller_extensions.rb +21 -0
  5. data/app/helpers/foreman_resource_quota/hosts_helper.rb +18 -7
  6. data/app/lib/foreman_resource_quota/exceptions.rb +1 -0
  7. data/app/models/concerns/foreman_resource_quota/host_managed_extensions.rb +9 -10
  8. data/app/models/concerns/foreman_resource_quota/user_extensions.rb +27 -0
  9. data/app/models/concerns/foreman_resource_quota/usergroup_extensions.rb +18 -0
  10. data/app/models/foreman_resource_quota/resource_quota.rb +23 -0
  11. data/app/views/foreman_resource_quota/resource_quotas/index.html.erb +9 -1
  12. data/app/views/hosts/_form_quota_fields.html.erb +14 -2
  13. data/app/views/users/_form_quota_tab.html.erb +2 -2
  14. data/db/migrate/20240611141939_drop_missing_hosts.rb +9 -2
  15. data/db/migrate/20250410082728_add_unassigned_flag_to_resource_quota.rb +7 -0
  16. data/db/seeds.d/030-unassigned_quota.rb +36 -0
  17. data/lib/foreman_resource_quota/register.rb +8 -0
  18. data/lib/foreman_resource_quota/version.rb +1 -1
  19. data/lib/tasks/foreman_resource_quota_tasks.rake +4 -5
  20. data/package.json +9 -10
  21. data/webpack/components/CreateResourceQuotaModal.js +1 -0
  22. data/webpack/components/ResourceQuotaEmptyState/__test__/__snapshots__/ResourceQuotaEmptyState.test.js.snap +4 -0
  23. data/webpack/components/ResourceQuotaEmptyState/index.js +1 -0
  24. data/webpack/components/ResourceQuotaForm/ResourceQuotaForm.scss +1 -1
  25. data/webpack/components/ResourceQuotaForm/ResourceQuotaFormConstants.js +1 -0
  26. data/webpack/components/ResourceQuotaForm/components/Properties/Properties.scss +4 -3
  27. data/webpack/components/ResourceQuotaForm/components/Properties/StaticDetail.js +3 -2
  28. data/webpack/components/ResourceQuotaForm/components/Properties/TextInputField.js +4 -1
  29. data/webpack/components/ResourceQuotaForm/components/Properties/index.js +86 -45
  30. data/webpack/components/ResourceQuotaForm/components/Resource/Resource.scss +5 -5
  31. data/webpack/components/ResourceQuotaForm/components/Resource/UnitInputField.js +84 -37
  32. data/webpack/components/ResourceQuotaForm/components/Resource/UnitInputField.scss +7 -0
  33. data/webpack/components/ResourceQuotaForm/components/Resource/UtilizationProgress.js +14 -13
  34. data/webpack/components/ResourceQuotaForm/components/Resource/UtilizationProgress.scss +4 -4
  35. data/webpack/components/ResourceQuotaForm/components/Resource/__test__/__snapshots__/UnitInputField.test.js.snap +149 -140
  36. data/webpack/components/ResourceQuotaForm/components/Resource/index.js +28 -17
  37. data/webpack/components/ResourceQuotaForm/components/Submit.js +2 -1
  38. data/webpack/components/ResourceQuotaForm/index.js +33 -19
  39. data/webpack/components/UpdateResourceQuotaModal.js +7 -1
  40. data/webpack/lib/ActionableDetail.scss +1 -1
  41. data/webpack/lib/EditableSwitch.js +1 -1
  42. data/webpack/lib/EditableTextInput/EditableTextInput.js +81 -77
  43. data/webpack/lib/EditableTextInput/editableTextInput.scss +30 -28
  44. metadata +8 -8
@@ -89,87 +89,91 @@ const EditableTextInput = ({
89
89
  onKeyUp,
90
90
  component,
91
91
  value: inputValue || '',
92
- onChange: setInputValue,
92
+ onChange: (_event, val) => setInputValue(val),
93
93
  validated: valid,
94
94
  };
95
95
 
96
- return editing ? (
97
- <Split>
98
- <SplitItem>
99
- {textArea ? (
100
- <TextArea {...inputProps} aria-label={`${attribute} text area`} />
101
- ) : (
102
- <TextInput
103
- {...inputProps}
104
- type={isPassword && !showPassword ? 'password' : 'text'}
105
- aria-label={`${attribute} text input`}
106
- ouiaId={ouiaId}
107
- />
108
- )}
109
- </SplitItem>
110
- <SplitItem>
111
- <Button
112
- ouiaId={`submit-button-${attribute}`}
113
- aria-label={`submit ${attribute}`}
114
- variant="plain"
115
- onClick={onSubmit}
116
- >
117
- <CheckIcon />
118
- </Button>
119
- </SplitItem>
120
- <SplitItem>
121
- <Button
122
- ouiaId={`clear-button-${attribute}`}
123
- aria-label={`clear ${attribute}`}
124
- variant="plain"
125
- onClick={onClear}
126
- >
127
- <TimesIcon />
128
- </Button>
129
- </SplitItem>
130
- {isPassword ? (
131
- <SplitItem>
132
- <Button
133
- ouiaId={`show-button-${attribute}`}
134
- aria-label={`show-password ${attribute}`}
135
- variant="plain"
136
- isDisabled={!inputValue?.length}
137
- onClick={toggleShowPassword}
138
- >
139
- {showPassword ? <EyeSlashIcon /> : <EyeIcon />}
140
- </Button>
141
- </SplitItem>
142
- ) : null}
143
- </Split>
144
- ) : (
145
- <Split>
146
- <SplitItem>
147
- {inputValue ? (
148
- <Text
149
- className={`text${textArea ? 'Area' : 'Input'}-value`}
150
- ouiaId={`${attribute}-text-value`}
151
- aria-label={`${attribute} text value`}
152
- component={component}
153
- >
154
- {editing ? inputValue : passwordPlaceholder || inputValue}
155
- </Text>
156
- ) : (
157
- <Text
158
- className={`text${textArea ? 'Area' : 'Input'}-placeholder`}
159
- ouiaId={`${attribute}-text-value`}
160
- aria-label={`${attribute} text value`}
161
- component={component}
162
- >
163
- {passwordPlaceholder || placeholder}
164
- </Text>
165
- )}
166
- </SplitItem>
167
- {!disabled && (
168
- <SplitItem>
169
- <PencilEditButton {...{ attribute, onEditClick }} />
170
- </SplitItem>
96
+ return (
97
+ <div className="container-editable-text-input">
98
+ {editing ? (
99
+ <Split>
100
+ <SplitItem>
101
+ {textArea ? (
102
+ <TextArea {...inputProps} aria-label={`${attribute} text area`} />
103
+ ) : (
104
+ <TextInput
105
+ {...inputProps}
106
+ type={isPassword && !showPassword ? 'password' : 'text'}
107
+ aria-label={`${attribute} text input`}
108
+ ouiaId={ouiaId}
109
+ />
110
+ )}
111
+ </SplitItem>
112
+ <SplitItem>
113
+ <Button
114
+ ouiaId={`submit-button-${attribute}`}
115
+ aria-label={`submit ${attribute}`}
116
+ variant="plain"
117
+ onClick={onSubmit}
118
+ >
119
+ <CheckIcon />
120
+ </Button>
121
+ </SplitItem>
122
+ <SplitItem>
123
+ <Button
124
+ ouiaId={`clear-button-${attribute}`}
125
+ aria-label={`clear ${attribute}`}
126
+ variant="plain"
127
+ onClick={onClear}
128
+ >
129
+ <TimesIcon />
130
+ </Button>
131
+ </SplitItem>
132
+ {isPassword ? (
133
+ <SplitItem>
134
+ <Button
135
+ ouiaId={`show-button-${attribute}`}
136
+ aria-label={`show-password ${attribute}`}
137
+ variant="plain"
138
+ isDisabled={!inputValue?.length}
139
+ onClick={toggleShowPassword}
140
+ >
141
+ {showPassword ? <EyeSlashIcon /> : <EyeIcon />}
142
+ </Button>
143
+ </SplitItem>
144
+ ) : null}
145
+ </Split>
146
+ ) : (
147
+ <Split>
148
+ <SplitItem>
149
+ {inputValue ? (
150
+ <Text
151
+ className={`text${textArea ? 'Area' : 'Input'}-value`}
152
+ ouiaId={`${attribute}-text-value`}
153
+ aria-label={`${attribute} text value`}
154
+ component={component}
155
+ >
156
+ {editing ? inputValue : passwordPlaceholder || inputValue}
157
+ </Text>
158
+ ) : (
159
+ <Text
160
+ className={`text${textArea ? 'Area' : 'Input'}-placeholder`}
161
+ ouiaId={`${attribute}-text-value`}
162
+ aria-label={`${attribute} text value`}
163
+ component={component}
164
+ >
165
+ {passwordPlaceholder || placeholder}
166
+ </Text>
167
+ )}
168
+ </SplitItem>
169
+ {!disabled && (
170
+ <SplitItem>
171
+ <PencilEditButton {...{ attribute, onEditClick }} />
172
+ </SplitItem>
173
+ )}
174
+ </Split>
171
175
  )}
172
- </Split>
176
+ </div>
173
177
  );
174
178
  };
175
179
 
@@ -1,38 +1,40 @@
1
1
  /* Credits: https://github.com/Katello/katello/blob/631d5bb83dc5d87320ee9002a6de33809a281b3e/webpack/components/EditableTextInput/editableTextInput.scss */
2
- @import '~@theforeman/vendor/scss/variables';
2
+ @import 'foremanReact/common/variables';
3
3
 
4
- .foreman-limited-text {
5
- max-width: 200px;
6
- margin: auto 0px;
7
- }
4
+ .container-editable-text-input {
5
+ .foreman-limited-text {
6
+ max-width: 200px;
7
+ margin: auto 0px;
8
+ }
8
9
 
9
- .foreman-limited-editable-text {
10
- max-width: 300px;
11
- margin: auto 0px;
12
- }
10
+ .foreman-limited-editable-text {
11
+ max-width: 300px;
12
+ margin: auto 0px;
13
+ }
13
14
 
14
- // Edit icon isn't in line with text
15
- .foreman-edit-icon {
16
- padding-top: 2px;
17
- }
15
+ // Edit icon isn't in line with text
16
+ .foreman-edit-icon {
17
+ padding-top: 2px;
18
+ }
18
19
 
19
- .textInput-placeholder, .textArea-placeholder {
20
- color: var(--pf-global--disabled-color--100);
21
- }
20
+ .textInput-placeholder, .textArea-placeholder {
21
+ color: var(--pf-v5-global--disabled-color--100);
22
+ }
22
23
 
23
- textarea.pf-c-form-control {
24
- width: 215px;
25
- }
24
+ textarea.pf-v5-c-form-control {
25
+ width: 215px;
26
+ }
26
27
 
27
- .pf-c-form-control:not(textarea) {
28
- width: 215px;
29
- }
28
+ .pf-v5-c-form-control:not(textarea) {
29
+ width: 215px;
30
+ }
30
31
 
31
- p {
32
- width: 215px;
33
- }
32
+ p {
33
+ width: 215px;
34
+ }
34
35
 
35
- p.textArea-placeholder, p.textArea-value {
36
- width: 215px;
37
- height: 50px;
36
+ p.textArea-placeholder, p.textArea-value {
37
+ width: 215px;
38
+ height: 50px;
39
+ }
38
40
  }
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_resource_quota
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bastian Schmidt
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2025-03-27 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: foreman-tasks
@@ -19,7 +18,7 @@ dependencies:
19
18
  version: '10.0'
20
19
  - - "<"
21
20
  - !ruby/object:Gem::Version
22
- version: '11'
21
+ version: '12'
23
22
  type: :runtime
24
23
  prerelease: false
25
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +28,7 @@ dependencies:
29
28
  version: '10.0'
30
29
  - - "<"
31
30
  - !ruby/object:Gem::Version
32
- version: '11'
31
+ version: '12'
33
32
  - !ruby/object:Gem::Dependency
34
33
  name: theforeman-rubocop
35
34
  requirement: !ruby/object:Gem::Requirement
@@ -153,6 +152,8 @@ files:
153
152
  - db/migrate/20240611141939_drop_missing_hosts.rb
154
153
  - db/migrate/20240611142813_create_hosts_resources.rb
155
154
  - db/migrate/20240618163434_remove_resource_quota_from_hosts.rb
155
+ - db/migrate/20250410082728_add_unassigned_flag_to_resource_quota.rb
156
+ - db/seeds.d/030-unassigned_quota.rb
156
157
  - lib/foreman_resource_quota.rb
157
158
  - lib/foreman_resource_quota/async/refresh_resource_quota_utilization.rb
158
159
  - lib/foreman_resource_quota/engine.rb
@@ -276,6 +277,7 @@ files:
276
277
  - webpack/components/ResourceQuotaForm/components/QuotaState.js
277
278
  - webpack/components/ResourceQuotaForm/components/Resource/Resource.scss
278
279
  - webpack/components/ResourceQuotaForm/components/Resource/UnitInputField.js
280
+ - webpack/components/ResourceQuotaForm/components/Resource/UnitInputField.scss
279
281
  - webpack/components/ResourceQuotaForm/components/Resource/UtilizationProgress.js
280
282
  - webpack/components/ResourceQuotaForm/components/Resource/UtilizationProgress.scss
281
283
  - webpack/components/ResourceQuotaForm/components/Resource/__test__/UnitInputField.test.js
@@ -305,7 +307,6 @@ licenses:
305
307
  - GPL-3.0
306
308
  metadata:
307
309
  is_foreman_plugin: 'true'
308
- post_install_message:
309
310
  rdoc_options: []
310
311
  require_paths:
311
312
  - lib
@@ -320,8 +321,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
320
321
  - !ruby/object:Gem::Version
321
322
  version: '0'
322
323
  requirements: []
323
- rubygems_version: 3.3.27
324
- signing_key:
324
+ rubygems_version: 3.6.7
325
325
  specification_version: 4
326
326
  summary: Foreman Plug-in for resource quota
327
327
  test_files: []