foreman_resource_quota 0.4.0 → 0.5.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 +4 -4
- data/lib/foreman_resource_quota/version.rb +1 -1
- data/package.json +5 -5
- data/webpack/components/ResourceQuotaEmptyState/__test__/__snapshots__/ResourceQuotaEmptyState.test.js.snap +1 -0
- data/webpack/components/ResourceQuotaForm/ResourceQuotaForm.scss +1 -1
- data/webpack/components/ResourceQuotaForm/components/Properties/Properties.scss +4 -3
- data/webpack/components/ResourceQuotaForm/components/Properties/StaticDetail.js +2 -2
- data/webpack/components/ResourceQuotaForm/components/Properties/index.js +76 -62
- data/webpack/components/ResourceQuotaForm/components/Resource/Resource.scss +5 -5
- data/webpack/components/ResourceQuotaForm/components/Resource/UnitInputField.js +80 -37
- data/webpack/components/ResourceQuotaForm/components/Resource/UnitInputField.scss +7 -0
- data/webpack/components/ResourceQuotaForm/components/Resource/UtilizationProgress.js +1 -1
- data/webpack/components/ResourceQuotaForm/components/Resource/UtilizationProgress.scss +4 -4
- data/webpack/components/ResourceQuotaForm/components/Resource/__test__/__snapshots__/UnitInputField.test.js.snap +138 -140
- data/webpack/components/ResourceQuotaForm/components/Resource/index.js +24 -17
- data/webpack/lib/ActionableDetail.scss +1 -1
- data/webpack/lib/EditableSwitch.js +1 -1
- data/webpack/lib/EditableTextInput/EditableTextInput.js +81 -77
- data/webpack/lib/EditableTextInput/editableTextInput.scss +30 -28
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf7fe8ad234e899887460b9e87041b4e2d05f6eaad6540a9567110326dc6ec7b
|
4
|
+
data.tar.gz: 100ee9af0fd01a0f7d026cafaae6ef1faf9b1e2897952bdb935ae896ed948dca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8511f2e3460efa522ced8b3759555755fc2e4bd44613f68d74266a103a32bc54beafe75982ad58d9263264fd1c77102b44f0eb9564abdf4c972813f7ecbd4135
|
7
|
+
data.tar.gz: 5bd4034854f07d0cc7600864c84904a9295c49f4f0142880c6c5c37855d9fd3b77834dad065fdcf1ffc481a7a2dc7a40c5724e8861896352e349c72440f0c2e6
|
data/package.json
CHANGED
@@ -28,11 +28,11 @@
|
|
28
28
|
"@sheerun/mutationobserver-shim": "^0.3.3",
|
29
29
|
"@testing-library/react": "^16.2.0",
|
30
30
|
"@testing-library/user-event": "^14.6.1",
|
31
|
-
"@theforeman/builder": ">=
|
32
|
-
"@theforeman/eslint-plugin-foreman": ">=
|
33
|
-
"@theforeman/find-foreman": ">=
|
34
|
-
"@theforeman/test": ">=
|
35
|
-
"@theforeman/vendor-dev": ">=
|
31
|
+
"@theforeman/builder": ">= 15.0.0",
|
32
|
+
"@theforeman/eslint-plugin-foreman": ">= 15.0.0",
|
33
|
+
"@theforeman/find-foreman": ">= 15.0.0",
|
34
|
+
"@theforeman/test": ">= 15.0.0",
|
35
|
+
"@theforeman/vendor-dev": ">= 15.0.0",
|
36
36
|
"babel-eslint": "^10.0.3",
|
37
37
|
"eslint": "^6.7.2",
|
38
38
|
"prettier": "^1.19.1",
|
@@ -1 +1 @@
|
|
1
|
-
@import '
|
1
|
+
@import 'foremanReact/common/variables';
|
@@ -34,7 +34,7 @@ const StaticDetail = ({
|
|
34
34
|
{isTextArea ? (
|
35
35
|
<TextArea
|
36
36
|
id={id}
|
37
|
-
onChange={onChange}
|
37
|
+
onChange={(_event, val) => onChange(val)}
|
38
38
|
value={value}
|
39
39
|
validated={validated}
|
40
40
|
isRequired={isRequired}
|
@@ -42,7 +42,7 @@ const StaticDetail = ({
|
|
42
42
|
) : (
|
43
43
|
<TextInput
|
44
44
|
id={id}
|
45
|
-
onChange={onChange}
|
45
|
+
onChange={(_event, val) => onChange(val)}
|
46
46
|
value={value}
|
47
47
|
validated={validated}
|
48
48
|
isRequired={isRequired}
|
@@ -8,9 +8,9 @@ import {
|
|
8
8
|
Card,
|
9
9
|
CardBody,
|
10
10
|
CardHeader,
|
11
|
-
CardActions,
|
12
11
|
CardTitle,
|
13
|
-
|
12
|
+
Flex,
|
13
|
+
FlexItem,
|
14
14
|
LabelGroup,
|
15
15
|
Button,
|
16
16
|
Tooltip,
|
@@ -70,69 +70,83 @@ const Properties = ({
|
|
70
70
|
);
|
71
71
|
};
|
72
72
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
73
|
+
const renderSyncButton = () => {
|
74
|
+
if (isNewQuota) {
|
75
|
+
return <></>;
|
76
|
+
}
|
77
|
+
return (
|
78
|
+
<Tooltip
|
79
|
+
content={
|
80
|
+
<div>
|
81
|
+
<b> {__('Fetch quota utilization')} </b>
|
82
|
+
<div>
|
83
|
+
{__(
|
84
|
+
'This can take some time since the resources of every host, assigned to this quota, must be requested.'
|
85
|
+
)}
|
86
|
+
</div>
|
87
|
+
</div>
|
88
|
+
}
|
89
|
+
reference={tooltipRefFetchButton}
|
90
|
+
>
|
91
|
+
<Button
|
92
|
+
isLoading={isFetchLoading}
|
93
|
+
icon={<SyncAltIcon />}
|
94
|
+
size="sm"
|
95
|
+
onClick={onClickFetch}
|
96
|
+
ref={tooltipRefFetchButton}
|
97
|
+
/>
|
98
|
+
</Tooltip>
|
99
|
+
);
|
100
|
+
};
|
101
|
+
|
102
|
+
const renderHeaderTitle = () => {
|
103
|
+
if (isNewQuota) {
|
104
|
+
return <CardTitle>{__('Properties')}</CardTitle>;
|
105
|
+
}
|
106
|
+
return (
|
107
|
+
<Flex>
|
108
|
+
<FlexItem>
|
109
|
+
<CardTitle>{__('Properties')}</CardTitle>
|
110
|
+
</FlexItem>
|
111
|
+
<FlexItem>
|
112
|
+
<LabelGroup isCompact>
|
113
|
+
<StatusPropertiesLabel
|
114
|
+
color="blue"
|
115
|
+
iconChild={<ClusterIcon />}
|
116
|
+
statusContent={
|
117
|
+
statusProperties[RESOURCE_IDENTIFIER_STATUS_NUM_HOSTS]
|
118
|
+
}
|
119
|
+
linkUrl={`/hosts?search=resource_quota="${initialName}"`}
|
120
|
+
tooltipText="Number of assigned hosts"
|
84
121
|
/>
|
85
|
-
<
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
{__(
|
91
|
-
'This can take some time since the resources of every host, assigned to this quota, must be requested.'
|
92
|
-
)}
|
93
|
-
</div>
|
94
|
-
</div>
|
122
|
+
<StatusPropertiesLabel
|
123
|
+
color="blue"
|
124
|
+
iconChild={<UserIcon />}
|
125
|
+
statusContent={
|
126
|
+
statusProperties[RESOURCE_IDENTIFIER_STATUS_NUM_USERS]
|
95
127
|
}
|
96
|
-
|
128
|
+
linkUrl={`/users?search=resource_quota="${initialName}"`}
|
129
|
+
tooltipText="Number of assigned users"
|
97
130
|
/>
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
iconChild={<UserIcon />}
|
118
|
-
statusContent={
|
119
|
-
statusProperties[RESOURCE_IDENTIFIER_STATUS_NUM_USERS]
|
120
|
-
}
|
121
|
-
linkUrl={`/users?search=resource_quota="${initialName}"`}
|
122
|
-
tooltipText="Number of assigned users"
|
123
|
-
/>
|
124
|
-
<StatusPropertiesLabel
|
125
|
-
color="blue"
|
126
|
-
iconChild={<UsersIcon />}
|
127
|
-
statusContent={
|
128
|
-
statusProperties[RESOURCE_IDENTIFIER_STATUS_NUM_USERGROUPS]
|
129
|
-
}
|
130
|
-
linkUrl={`/usergroups?search=resource_quota="${initialName}"`}
|
131
|
-
tooltipText="Number of assigned usergroups"
|
132
|
-
/>
|
133
|
-
</LabelGroup>
|
134
|
-
</Level>
|
135
|
-
)}
|
131
|
+
<StatusPropertiesLabel
|
132
|
+
color="blue"
|
133
|
+
iconChild={<UsersIcon />}
|
134
|
+
statusContent={
|
135
|
+
statusProperties[RESOURCE_IDENTIFIER_STATUS_NUM_USERGROUPS]
|
136
|
+
}
|
137
|
+
linkUrl={`/usergroups?search=resource_quota="${initialName}"`}
|
138
|
+
tooltipText="Number of assigned usergroups"
|
139
|
+
/>
|
140
|
+
</LabelGroup>
|
141
|
+
</FlexItem>
|
142
|
+
</Flex>
|
143
|
+
);
|
144
|
+
};
|
145
|
+
|
146
|
+
return (
|
147
|
+
<Card>
|
148
|
+
<CardHeader actions={{ actions: renderSyncButton() }}>
|
149
|
+
{renderHeaderTitle()}
|
136
150
|
</CardHeader>
|
137
151
|
<CardBody>
|
138
152
|
<TextContent>
|
@@ -1,13 +1,13 @@
|
|
1
1
|
//@import '~@theforeman/vendor/scss/variables';
|
2
2
|
|
3
|
-
.pf-c-card__body:first-child {
|
3
|
+
.pf-v5-c-card__body:first-child {
|
4
4
|
padding-top: 1rem;
|
5
5
|
}
|
6
6
|
|
7
|
-
.pf-c-form__label {
|
8
|
-
font-size: var(--pf-global--FontSize--sm);
|
7
|
+
.pf-v5-c-form__label {
|
8
|
+
font-size: var(--pf-v5-global--FontSize--sm);
|
9
9
|
}
|
10
10
|
|
11
|
-
.pf-c-form__group-label-help {
|
12
|
-
font-size: var(--pf-global--FontSize--sm);
|
11
|
+
.pf-v5-c-form__group-label-help {
|
12
|
+
font-size: var(--pf-v5-global--FontSize--sm);
|
13
13
|
}
|
@@ -3,16 +3,24 @@ import PropTypes from 'prop-types';
|
|
3
3
|
import {
|
4
4
|
FormGroup,
|
5
5
|
FormHelperText,
|
6
|
+
HelperText,
|
7
|
+
HelperTextItem,
|
6
8
|
TextInput,
|
7
9
|
InputGroup,
|
10
|
+
InputGroupItem,
|
8
11
|
InputGroupText,
|
12
|
+
} from '@patternfly/react-core';
|
13
|
+
import { ExclamationCircleIcon } from '@patternfly/react-icons';
|
14
|
+
|
15
|
+
import {
|
9
16
|
Dropdown,
|
10
17
|
DropdownItem,
|
11
18
|
DropdownToggle,
|
12
|
-
} from '@patternfly/react-core';
|
19
|
+
} from '@patternfly/react-core/deprecated';
|
13
20
|
|
14
21
|
import { sprintf, translate as __ } from 'foremanReact/common/I18n';
|
15
22
|
|
23
|
+
import './UnitInputField.scss';
|
16
24
|
import { findLargestFittingUnit } from '../../../../helper';
|
17
25
|
|
18
26
|
const UnitInputField = ({
|
@@ -69,11 +77,6 @@ const UnitInputField = ({
|
|
69
77
|
[units]
|
70
78
|
);
|
71
79
|
|
72
|
-
/* warning text displayed beneath value input field (built-in is used for errors) */
|
73
|
-
const helperTextWarning = (text, isHidden) => (
|
74
|
-
<FormHelperText isHidden={isHidden}>{text}</FormHelperText>
|
75
|
-
);
|
76
|
-
|
77
80
|
/* applies the selected unit and checks the bounds */
|
78
81
|
const isValid = useCallback(
|
79
82
|
val => {
|
@@ -164,41 +167,81 @@ const UnitInputField = ({
|
|
164
167
|
}
|
165
168
|
|
166
169
|
return (
|
167
|
-
<
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
170
|
+
<InputGroupItem>
|
171
|
+
<Dropdown
|
172
|
+
onSelect={onUnitSelect}
|
173
|
+
toggle={
|
174
|
+
<DropdownToggle
|
175
|
+
isDisabled={isDisabled}
|
176
|
+
onToggle={(_event, _val) => onUnitToggle()}
|
177
|
+
>
|
178
|
+
{__(`${selectedUnit.symbol}`)}
|
179
|
+
</DropdownToggle>
|
180
|
+
}
|
181
|
+
isOpen={isUnitOpen}
|
182
|
+
dropdownItems={unitDropdownItems}
|
183
|
+
/>
|
184
|
+
</InputGroupItem>
|
177
185
|
);
|
178
186
|
};
|
179
187
|
|
188
|
+
const renderFormHelperText = () => {
|
189
|
+
if (validated === 'error') {
|
190
|
+
return (
|
191
|
+
<FormHelperText>
|
192
|
+
<HelperText>
|
193
|
+
<HelperTextItem
|
194
|
+
icon={<ExclamationCircleIcon />}
|
195
|
+
variant={validated}
|
196
|
+
>
|
197
|
+
{errorText}
|
198
|
+
</HelperTextItem>
|
199
|
+
</HelperText>
|
200
|
+
</FormHelperText>
|
201
|
+
);
|
202
|
+
}
|
203
|
+
if (validated === 'warning') {
|
204
|
+
return (
|
205
|
+
<FormHelperText>
|
206
|
+
<HelperText>
|
207
|
+
<HelperTextItem
|
208
|
+
icon={<ExclamationCircleIcon />}
|
209
|
+
variant={validated}
|
210
|
+
>
|
211
|
+
{errorText}
|
212
|
+
</HelperTextItem>
|
213
|
+
</HelperText>
|
214
|
+
</FormHelperText>
|
215
|
+
);
|
216
|
+
}
|
217
|
+
return <></>;
|
218
|
+
};
|
219
|
+
|
180
220
|
return (
|
181
|
-
<
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
221
|
+
<div className="container-unit-input-field">
|
222
|
+
<FormGroup
|
223
|
+
label={__('Quota Limit')}
|
224
|
+
validated={validated}
|
225
|
+
fieldId="quota-limit-resource-quota-form-group"
|
226
|
+
labelIcon={labelIcon || {}}
|
227
|
+
>
|
228
|
+
<InputGroup>
|
229
|
+
<InputGroupItem>
|
230
|
+
<TextInput
|
231
|
+
isDisabled={isDisabled}
|
232
|
+
value={inputValue}
|
233
|
+
min={minValue}
|
234
|
+
max={maxValue}
|
235
|
+
validated={validated}
|
236
|
+
id="reg_token_life_time_input"
|
237
|
+
onChange={(_event, val) => setInputValue(val)}
|
238
|
+
/>
|
239
|
+
</InputGroupItem>
|
240
|
+
{unitView()}
|
241
|
+
</InputGroup>
|
242
|
+
{renderFormHelperText()}
|
243
|
+
</FormGroup>
|
244
|
+
</div>
|
202
245
|
);
|
203
246
|
};
|
204
247
|
|
@@ -1,10 +1,10 @@
|
|
1
1
|
.progress-disabled {
|
2
2
|
background-color: transparent;
|
3
|
-
.pf-c-progress .pf-c-progress__bar::before {
|
4
|
-
background-color: var(--pf-global--disabled-color--100);
|
3
|
+
.pf-v5-c-progress .pf-v5-c-progress__bar::before {
|
4
|
+
background-color: var(--pf-v5-global--disabled-color--100);
|
5
5
|
}
|
6
6
|
}
|
7
7
|
|
8
|
-
.progress-disabled .pf-c-progress.pf-m-inside .pf-c-progress__indicator {
|
9
|
-
background-color: var(--pf-global--palette--black-500);
|
8
|
+
.progress-disabled .pf-v5-c-progress.pf-v5-m-inside .pf-v5-c-progress__indicator {
|
9
|
+
background-color: var(--pf-v5-global--palette--black-500);
|
10
10
|
}
|
@@ -1,155 +1,153 @@
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
2
|
|
3
3
|
exports[`UnitInputField should render as disabled field 1`] = `
|
4
|
-
<
|
5
|
-
|
6
|
-
helperText={
|
7
|
-
<FormHelperText
|
8
|
-
isHidden={true}
|
9
|
-
>
|
10
|
-
|
11
|
-
</FormHelperText>
|
12
|
-
}
|
13
|
-
helperTextInvalid=""
|
14
|
-
label="Quota Limit"
|
15
|
-
labelIcon={
|
16
|
-
<LabelIcon
|
17
|
-
text="Descriptive title."
|
18
|
-
/>
|
19
|
-
}
|
20
|
-
validated="default"
|
4
|
+
<div
|
5
|
+
className="container-unit-input-field"
|
21
6
|
>
|
22
|
-
<
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
<
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
id="unit-dropdownitem-mib"
|
37
|
-
>
|
38
|
-
MiB
|
39
|
-
</DropdownItem>,
|
40
|
-
<DropdownItem
|
41
|
-
id="unit-dropdownitem-gib"
|
42
|
-
>
|
43
|
-
GiB
|
44
|
-
</DropdownItem>,
|
45
|
-
]
|
46
|
-
}
|
47
|
-
isOpen={false}
|
48
|
-
onSelect={[Function]}
|
49
|
-
toggle={
|
50
|
-
<DropdownToggle
|
7
|
+
<FormGroup
|
8
|
+
fieldId="quota-limit-resource-quota-form-group"
|
9
|
+
label="Quota Limit"
|
10
|
+
labelIcon={
|
11
|
+
<LabelIcon
|
12
|
+
text="Descriptive title."
|
13
|
+
/>
|
14
|
+
}
|
15
|
+
validated="default"
|
16
|
+
>
|
17
|
+
<InputGroup>
|
18
|
+
<InputGroupItem>
|
19
|
+
<TextInput
|
20
|
+
id="reg_token_life_time_input"
|
51
21
|
isDisabled={true}
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
22
|
+
max={5}
|
23
|
+
min={0}
|
24
|
+
onChange={[Function]}
|
25
|
+
validated="default"
|
26
|
+
value={0}
|
27
|
+
/>
|
28
|
+
</InputGroupItem>
|
29
|
+
<InputGroupItem>
|
30
|
+
<Dropdown
|
31
|
+
dropdownItems={
|
32
|
+
Array [
|
33
|
+
<DropdownItem
|
34
|
+
id="unit-dropdownitem-mib"
|
35
|
+
>
|
36
|
+
MiB
|
37
|
+
</DropdownItem>,
|
38
|
+
<DropdownItem
|
39
|
+
id="unit-dropdownitem-gib"
|
40
|
+
>
|
41
|
+
GiB
|
42
|
+
</DropdownItem>,
|
43
|
+
]
|
44
|
+
}
|
45
|
+
isOpen={false}
|
46
|
+
onSelect={[Function]}
|
47
|
+
toggle={
|
48
|
+
<DropdownToggle
|
49
|
+
isDisabled={true}
|
50
|
+
onToggle={[Function]}
|
51
|
+
>
|
52
|
+
MiB
|
53
|
+
</DropdownToggle>
|
54
|
+
}
|
55
|
+
/>
|
56
|
+
</InputGroupItem>
|
57
|
+
</InputGroup>
|
58
|
+
</FormGroup>
|
59
|
+
</div>
|
60
60
|
`;
|
61
61
|
|
62
62
|
exports[`UnitInputField should render default 1`] = `
|
63
|
-
<
|
64
|
-
|
65
|
-
helperText={
|
66
|
-
<FormHelperText
|
67
|
-
isHidden={true}
|
68
|
-
>
|
69
|
-
|
70
|
-
</FormHelperText>
|
71
|
-
}
|
72
|
-
helperTextInvalid=""
|
73
|
-
label="Quota Limit"
|
74
|
-
labelIcon={
|
75
|
-
<LabelIcon
|
76
|
-
text="Descriptive title."
|
77
|
-
/>
|
78
|
-
}
|
79
|
-
validated="default"
|
63
|
+
<div
|
64
|
+
className="container-unit-input-field"
|
80
65
|
>
|
81
|
-
<
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
<
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
id="unit-dropdownitem-mib"
|
96
|
-
>
|
97
|
-
MiB
|
98
|
-
</DropdownItem>,
|
99
|
-
<DropdownItem
|
100
|
-
id="unit-dropdownitem-gib"
|
101
|
-
>
|
102
|
-
GiB
|
103
|
-
</DropdownItem>,
|
104
|
-
]
|
105
|
-
}
|
106
|
-
isOpen={false}
|
107
|
-
onSelect={[Function]}
|
108
|
-
toggle={
|
109
|
-
<DropdownToggle
|
66
|
+
<FormGroup
|
67
|
+
fieldId="quota-limit-resource-quota-form-group"
|
68
|
+
label="Quota Limit"
|
69
|
+
labelIcon={
|
70
|
+
<LabelIcon
|
71
|
+
text="Descriptive title."
|
72
|
+
/>
|
73
|
+
}
|
74
|
+
validated="default"
|
75
|
+
>
|
76
|
+
<InputGroup>
|
77
|
+
<InputGroupItem>
|
78
|
+
<TextInput
|
79
|
+
id="reg_token_life_time_input"
|
110
80
|
isDisabled={false}
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
81
|
+
max={5}
|
82
|
+
min={0}
|
83
|
+
onChange={[Function]}
|
84
|
+
validated="default"
|
85
|
+
value={0}
|
86
|
+
/>
|
87
|
+
</InputGroupItem>
|
88
|
+
<InputGroupItem>
|
89
|
+
<Dropdown
|
90
|
+
dropdownItems={
|
91
|
+
Array [
|
92
|
+
<DropdownItem
|
93
|
+
id="unit-dropdownitem-mib"
|
94
|
+
>
|
95
|
+
MiB
|
96
|
+
</DropdownItem>,
|
97
|
+
<DropdownItem
|
98
|
+
id="unit-dropdownitem-gib"
|
99
|
+
>
|
100
|
+
GiB
|
101
|
+
</DropdownItem>,
|
102
|
+
]
|
103
|
+
}
|
104
|
+
isOpen={false}
|
105
|
+
onSelect={[Function]}
|
106
|
+
toggle={
|
107
|
+
<DropdownToggle
|
108
|
+
isDisabled={false}
|
109
|
+
onToggle={[Function]}
|
110
|
+
>
|
111
|
+
MiB
|
112
|
+
</DropdownToggle>
|
113
|
+
}
|
114
|
+
/>
|
115
|
+
</InputGroupItem>
|
116
|
+
</InputGroup>
|
117
|
+
</FormGroup>
|
118
|
+
</div>
|
119
119
|
`;
|
120
120
|
|
121
121
|
exports[`UnitInputField should render without dropdown (single unit) 1`] = `
|
122
|
-
<
|
123
|
-
|
124
|
-
helperText={
|
125
|
-
<FormHelperText
|
126
|
-
isHidden={true}
|
127
|
-
>
|
128
|
-
|
129
|
-
</FormHelperText>
|
130
|
-
}
|
131
|
-
helperTextInvalid=""
|
132
|
-
label="Quota Limit"
|
133
|
-
labelIcon={
|
134
|
-
<LabelIcon
|
135
|
-
text="Descriptive title."
|
136
|
-
/>
|
137
|
-
}
|
138
|
-
validated="default"
|
122
|
+
<div
|
123
|
+
className="container-unit-input-field"
|
139
124
|
>
|
140
|
-
<
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
<
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
125
|
+
<FormGroup
|
126
|
+
fieldId="quota-limit-resource-quota-form-group"
|
127
|
+
label="Quota Limit"
|
128
|
+
labelIcon={
|
129
|
+
<LabelIcon
|
130
|
+
text="Descriptive title."
|
131
|
+
/>
|
132
|
+
}
|
133
|
+
validated="default"
|
134
|
+
>
|
135
|
+
<InputGroup>
|
136
|
+
<InputGroupItem>
|
137
|
+
<TextInput
|
138
|
+
id="reg_token_life_time_input"
|
139
|
+
isDisabled={false}
|
140
|
+
max={5}
|
141
|
+
min={0}
|
142
|
+
onChange={[Function]}
|
143
|
+
validated="default"
|
144
|
+
value={0}
|
145
|
+
/>
|
146
|
+
</InputGroupItem>
|
147
|
+
<InputGroupText>
|
148
|
+
cores
|
149
|
+
</InputGroupText>
|
150
|
+
</InputGroup>
|
151
|
+
</FormGroup>
|
152
|
+
</div>
|
155
153
|
`;
|
@@ -4,7 +4,6 @@ import { useDispatch } from 'react-redux';
|
|
4
4
|
import {
|
5
5
|
Button,
|
6
6
|
Card,
|
7
|
-
CardActions,
|
8
7
|
CardExpandableContent,
|
9
8
|
CardHeader,
|
10
9
|
CardTitle,
|
@@ -132,19 +131,41 @@ const Resource = ({
|
|
132
131
|
onChange,
|
133
132
|
]);
|
134
133
|
|
134
|
+
const renderApplyButton = () => {
|
135
|
+
if (isNewQuota) {
|
136
|
+
return <></>;
|
137
|
+
}
|
138
|
+
return (
|
139
|
+
<Button
|
140
|
+
isDisabled={!isUpdateApplicable}
|
141
|
+
size="sm"
|
142
|
+
isActive={isApplyLoading}
|
143
|
+
variant="primary"
|
144
|
+
onClick={onClickApply}
|
145
|
+
isLoading={isApplyLoading}
|
146
|
+
>
|
147
|
+
{__('Apply')}
|
148
|
+
</Button>
|
149
|
+
);
|
150
|
+
};
|
151
|
+
|
135
152
|
return (
|
136
153
|
<Card
|
137
154
|
isExpanded={isExpanded}
|
138
155
|
isDisabledRaised={!isEnabled}
|
139
156
|
id={`resource-card-${cardId}`}
|
140
157
|
>
|
141
|
-
<CardHeader
|
158
|
+
<CardHeader
|
159
|
+
actions={{ actions: renderApplyButton() }}
|
160
|
+
onExpand={onExpand}
|
161
|
+
isToggleRightAligned={false}
|
162
|
+
>
|
142
163
|
<Flex>
|
143
164
|
<FlexItem>
|
144
165
|
<Switch
|
145
166
|
id={`switch-${cardId}`}
|
146
167
|
aria-label={`switch-${cardId}`}
|
147
|
-
onChange={onChangeEnabled}
|
168
|
+
onChange={(_event, val) => onChangeEnabled(val)}
|
148
169
|
isChecked={isEnabled}
|
149
170
|
/>
|
150
171
|
</FlexItem>
|
@@ -152,20 +173,6 @@ const Resource = ({
|
|
152
173
|
<CardTitle>{resourceTitle}</CardTitle>
|
153
174
|
</FlexItem>
|
154
175
|
</Flex>
|
155
|
-
{!isNewQuota && (
|
156
|
-
<CardActions>
|
157
|
-
<Button
|
158
|
-
isDisabled={!isUpdateApplicable}
|
159
|
-
isSmall
|
160
|
-
isActive={isApplyLoading}
|
161
|
-
variant="primary"
|
162
|
-
onClick={onClickApply}
|
163
|
-
isLoading={isApplyLoading}
|
164
|
-
>
|
165
|
-
{__('Apply')}
|
166
|
-
</Button>
|
167
|
-
</CardActions>
|
168
|
-
)}
|
169
176
|
</CardHeader>
|
170
177
|
<CardExpandableContent>
|
171
178
|
<CardBody>
|
@@ -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
|
97
|
-
<
|
98
|
-
|
99
|
-
|
100
|
-
<
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
<
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
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
|
-
</
|
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 '
|
2
|
+
@import 'foremanReact/common/variables';
|
3
3
|
|
4
|
-
.
|
5
|
-
|
6
|
-
|
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
|
-
|
11
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
25
|
-
}
|
24
|
+
textarea.pf-v5-c-form-control {
|
25
|
+
width: 215px;
|
26
|
+
}
|
26
27
|
|
27
|
-
.pf-c-form-control:not(textarea) {
|
28
|
-
|
29
|
-
}
|
28
|
+
.pf-v5-c-form-control:not(textarea) {
|
29
|
+
width: 215px;
|
30
|
+
}
|
30
31
|
|
31
|
-
p {
|
32
|
-
|
33
|
-
}
|
32
|
+
p {
|
33
|
+
width: 215px;
|
34
|
+
}
|
34
35
|
|
35
|
-
p.textArea-placeholder, p.textArea-value {
|
36
|
-
|
37
|
-
|
36
|
+
p.textArea-placeholder, p.textArea-value {
|
37
|
+
width: 215px;
|
38
|
+
height: 50px;
|
39
|
+
}
|
38
40
|
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_resource_quota
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bastian Schmidt
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '10.0'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
22
|
+
version: '12'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: '10.0'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '12'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: theforeman-rubocop
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -276,6 +276,7 @@ files:
|
|
276
276
|
- webpack/components/ResourceQuotaForm/components/QuotaState.js
|
277
277
|
- webpack/components/ResourceQuotaForm/components/Resource/Resource.scss
|
278
278
|
- webpack/components/ResourceQuotaForm/components/Resource/UnitInputField.js
|
279
|
+
- webpack/components/ResourceQuotaForm/components/Resource/UnitInputField.scss
|
279
280
|
- webpack/components/ResourceQuotaForm/components/Resource/UtilizationProgress.js
|
280
281
|
- webpack/components/ResourceQuotaForm/components/Resource/UtilizationProgress.scss
|
281
282
|
- webpack/components/ResourceQuotaForm/components/Resource/__test__/UnitInputField.test.js
|