@openshift-assisted/ui-lib 2.14.12-cim → 2.14.13-cim
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.
- package/build/@types/cim/components/Hypershift/HostedClusterWizard/HostsStep/NodePoolForm.d.ts.map +1 -1
- package/build/@types/cim/components/Hypershift/forms/NodePoolAgentsForm.d.ts.map +1 -1
- package/build/cjs/cim/components/Hypershift/HostedClusterWizard/HostsStep/NodePoolForm.js +0 -28
- package/build/cjs/cim/components/Hypershift/HostedClusterWizard/HostsStep/NodePoolForm.js.map +1 -1
- package/build/cjs/cim/components/Hypershift/forms/NodePoolAgentsForm.js +8 -3
- package/build/cjs/cim/components/Hypershift/forms/NodePoolAgentsForm.js.map +1 -1
- package/lib/cim/components/Hypershift/HostedClusterWizard/HostsStep/NodePoolForm.tsx +1 -33
- package/lib/cim/components/Hypershift/forms/NodePoolAgentsForm.tsx +24 -12
- package/package.json +3 -3
package/build/@types/cim/components/Hypershift/HostedClusterWizard/HostsStep/NodePoolForm.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodePoolForm.d.ts","sourceRoot":"","sources":["../../../../../../../lib/cim/components/Hypershift/HostedClusterWizard/HostsStep/NodePoolForm.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"NodePoolForm.d.ts","sourceRoot":"","sources":["../../../../../../../lib/cim/components/Hypershift/HostedClusterWizard/HostsStep/NodePoolForm.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAO1E,OAAO,oBAAoB,CAAC;AAG5B,KAAK,iBAAiB,GAAG;IACvB,SAAS,EAAE,mBAAmB,EAAE,CAAC;IACjC,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,YAAY,CAAC;CACxB,CAAC;AAEF,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAwG7C,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodePoolAgentsForm.d.ts","sourceRoot":"","sources":["../../../../../../lib/cim/components/Hypershift/forms/NodePoolAgentsForm.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAIlD,KAAK,uBAAuB,GAAG;IAC7B,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,kBAAkB,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,QAAA,MAAM,kBAAkB,8FAQrB,uBAAuB,
|
|
1
|
+
{"version":3,"file":"NodePoolAgentsForm.d.ts","sourceRoot":"","sources":["../../../../../../lib/cim/components/Hypershift/forms/NodePoolAgentsForm.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAIlD,KAAK,uBAAuB,GAAG;IAC7B,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,kBAAkB,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,QAAA,MAAM,kBAAkB,8FAQrB,uBAAuB,sBA6EzB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -10,15 +10,11 @@ const ClusterDeployment_1 = require("../../../ClusterDeployment");
|
|
|
10
10
|
const formik_1 = require("formik");
|
|
11
11
|
const helpers_1 = require("../../../helpers");
|
|
12
12
|
const use_translation_wrapper_1 = require("../../../../../common/hooks/use-translation-wrapper");
|
|
13
|
-
const useFormikHelpers_1 = require("../../../../../common/hooks/useFormikHelpers");
|
|
14
13
|
require("./NodePoolForm.css");
|
|
15
14
|
const NodePoolAgentsForm_1 = tslib_1.__importDefault(require("../../forms/NodePoolAgentsForm"));
|
|
16
15
|
const NodePoolForm = ({ infraEnvs, agents, index, onRemove }) => {
|
|
17
16
|
const { t } = (0, use_translation_wrapper_1.useTranslation)();
|
|
18
17
|
const { values } = (0, formik_1.useFormikContext)();
|
|
19
|
-
const { setValue: setCountValue } = (0, useFormikHelpers_1.useFormikHelpers)(`nodePools[${index}].count`);
|
|
20
|
-
const { setValue: setMinAutoscalingValue } = (0, useFormikHelpers_1.useFormikHelpers)(`nodePools[${index}].autoscaling.minReplicas`);
|
|
21
|
-
const { setValue: setMaxAutoscalingValue } = (0, useFormikHelpers_1.useFormikHelpers)(`nodePools[${index}].autoscaling.maxReplicas`);
|
|
22
18
|
const [isExpanded, setExpanded] = React.useState(true);
|
|
23
19
|
const infraEnvAgents = React.useMemo(() => {
|
|
24
20
|
const infraEnv = infraEnvs.find((ie) => { var _a; return ((_a = ie.metadata) === null || _a === void 0 ? void 0 : _a.namespace) === values.agentNamespace; });
|
|
@@ -43,30 +39,6 @@ const NodePoolForm = ({ infraEnvs, agents, index, onRemove }) => {
|
|
|
43
39
|
: values.nodePools[i].count;
|
|
44
40
|
}
|
|
45
41
|
const maxAgents = Math.max(0, Math.min(matchingAgents.length, availableAgents.length - previousNodePoolsCount));
|
|
46
|
-
const currentCount = values.nodePools[index].useAutoscaling
|
|
47
|
-
? values.nodePools[index].autoscaling.maxReplicas
|
|
48
|
-
: values.nodePools[index].count;
|
|
49
|
-
React.useEffect(() => {
|
|
50
|
-
if (currentCount > maxAgents) {
|
|
51
|
-
if (values.nodePools[index].useAutoscaling) {
|
|
52
|
-
if (maxAgents === 0) {
|
|
53
|
-
void setMinAutoscalingValue(maxAgents);
|
|
54
|
-
}
|
|
55
|
-
void setMaxAutoscalingValue(maxAgents);
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
void setCountValue(maxAgents);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}, [
|
|
62
|
-
maxAgents,
|
|
63
|
-
currentCount,
|
|
64
|
-
values.nodePools,
|
|
65
|
-
index,
|
|
66
|
-
setCountValue,
|
|
67
|
-
setMinAutoscalingValue,
|
|
68
|
-
setMaxAutoscalingValue,
|
|
69
|
-
]);
|
|
70
42
|
return (React.createElement(react_core_1.Stack, { hasGutter: true },
|
|
71
43
|
React.createElement(react_core_1.StackItem, null,
|
|
72
44
|
React.createElement(react_core_1.Level, { hasGutter: true },
|
package/build/cjs/cim/components/Hypershift/HostedClusterWizard/HostsStep/NodePoolForm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodePoolForm.js","sourceRoot":"","sources":["../../../../../../../lib/cim/components/Hypershift/HostedClusterWizard/HostsStep/NodePoolForm.tsx"],"names":[],"mappings":";;;AAAA,uDAagC;AAChC,qDAA+B;AAC/B,iFAA6E;AAC7E,8EAA2C;AAC3C,kDAAwD;AAExD,kEAA+D;AAE/D,mCAA0C;AAC1C,8CAAyD;AACzD,iGAAqF;
|
|
1
|
+
{"version":3,"file":"NodePoolForm.js","sourceRoot":"","sources":["../../../../../../../lib/cim/components/Hypershift/HostedClusterWizard/HostsStep/NodePoolForm.tsx"],"names":[],"mappings":";;;AAAA,uDAagC;AAChC,qDAA+B;AAC/B,iFAA6E;AAC7E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Deployment/LabelsSelector");
|
|
|
9
9
|
const formik_1 = require("formik");
|
|
10
10
|
const NodePoolAgentsForm = ({ agents, labelName, countName, autoscalingName, maxAgents, useAutoscalingName, isEdit = false, }) => {
|
|
11
11
|
const { t } = (0, use_translation_wrapper_1.useTranslation)();
|
|
12
|
+
const [{ value: count }] = (0, formik_1.useField)(countName);
|
|
12
13
|
const [{ value: minValue }] = (0, formik_1.useField)(`${autoscalingName}.minReplicas`);
|
|
13
14
|
const [{ value: maxValue }] = (0, formik_1.useField)(`${autoscalingName}.maxReplicas`);
|
|
14
15
|
const [{ value: useAutoscalingValue }] = (0, formik_1.useField)(useAutoscalingName);
|
|
@@ -23,10 +24,14 @@ const NodePoolAgentsForm = ({ agents, labelName, countName, autoscalingName, max
|
|
|
23
24
|
React.createElement(common_1.CheckboxField, { name: useAutoscalingName, label: t('ai:Use autoscaling') })),
|
|
24
25
|
useAutoscalingValue ? (React.createElement(React.Fragment, null,
|
|
25
26
|
React.createElement(react_core_1.GridItem, null,
|
|
26
|
-
React.createElement(common_1.NumberInputField, { name: `${autoscalingName}.minReplicas`, label: t('ai:Minimum number of hosts'), isRequired: true, minValue: 1, maxValue: maxValue
|
|
27
|
+
React.createElement(common_1.NumberInputField, { name: `${autoscalingName}.minReplicas`, label: t('ai:Minimum number of hosts'), isRequired: true, minValue: 1, maxValue: maxValue })),
|
|
27
28
|
React.createElement(react_core_1.GridItem, null,
|
|
28
|
-
React.createElement(common_1.NumberInputField, { name: `${autoscalingName}.maxReplicas`, label: t('ai:Maximum number of hosts'), isRequired: true, minValue: minValue || 1,
|
|
29
|
-
React.createElement(
|
|
29
|
+
React.createElement(common_1.NumberInputField, { name: `${autoscalingName}.maxReplicas`, label: t('ai:Maximum number of hosts'), isRequired: true, minValue: minValue || 1, helperText: helperText })))) : (React.createElement(React.Fragment, null,
|
|
30
|
+
React.createElement(react_core_1.GridItem, null,
|
|
31
|
+
React.createElement(common_1.NumberInputField, { label: t('ai:Number of hosts'), idPostfix: "count", name: countName, isRequired: true, minValue: 0, helperText: helperText })))),
|
|
32
|
+
(useAutoscalingValue ? maxValue : count) > maxAgents && (React.createElement(react_core_1.GridItem, null,
|
|
33
|
+
React.createElement(react_core_1.Alert, { isInline: true, variant: react_core_1.AlertVariant.warning, title: t('ai:Host count exceeds the current number of available hosts.') },
|
|
34
|
+
React.createElement(react_core_1.Text, null, t('ai:Scale down the nodepool or make more hosts available.')))))));
|
|
30
35
|
};
|
|
31
36
|
exports.default = NodePoolAgentsForm;
|
|
32
37
|
//# sourceMappingURL=NodePoolAgentsForm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodePoolAgentsForm.js","sourceRoot":"","sources":["../../../../../../lib/cim/components/Hypershift/forms/NodePoolAgentsForm.tsx"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"NodePoolAgentsForm.js","sourceRoot":"","sources":["../../../../../../lib/cim/components/Hypershift/forms/NodePoolAgentsForm.tsx"],"names":[],"mappings":";;;AAAA,uDAAmF;AACnF,qDAA+B;AAC/B,+CAAkF;AAClF,8FAAkF;AAElF,2EAA4E;AAC5E,mCAAkC;AAYlC,MAAM,kBAAkB,GAAG,CAAC,EAC1B,MAAM,EACN,SAAS,EACT,SAAS,EACT,eAAe,EACf,SAAS,EACT,kBAAkB,EAClB,MAAM,GAAG,KAAK,GACU,EAAE,EAAE;IAC5B,MAAM,EAAE,CAAC,EAAE,GAAG,IAAA,wCAAc,GAAE,CAAC;IAE/B,MAAM,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,GAAG,IAAA,iBAAQ,EAAS,SAAS,CAAC,CAAC;IACvD,MAAM,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,GAAG,IAAA,iBAAQ,EAAS,GAAG,eAAe,cAAc,CAAC,CAAC;IACjF,MAAM,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,GAAG,IAAA,iBAAQ,EAAS,GAAG,eAAe,c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EAAE,CAAC,EACX,UAAU,EAAE,UAAU,GACtB,CACO,CACV,CACJ;QACA,CAAC,mBAAmB,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,SAAS,IAAI,CACvD,oBAAC,qBAAQ;YACP,oBAAC,kBAAK,IACJ,QAAQ,QACR,OAAO,EAAE,yBAAY,CAAC,OAAO,EAC7B,KAAK,EAAE,CAAC,CAAC,8DAA8D,CAAC;gBAExE,oBAAC,iBAAI,QAAE,CAAC,CAAC,0DAA0D,CAAC,CAAQ,CACtE,CACC,CACZ,CACI,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,kBAAkB,CAAC"}
|
|
@@ -22,7 +22,6 @@ import { HostsFormValues } from './types';
|
|
|
22
22
|
import { useFormikContext } from 'formik';
|
|
23
23
|
import { getAgentsForSelection } from '../../../helpers';
|
|
24
24
|
import { useTranslation } from '../../../../../common/hooks/use-translation-wrapper';
|
|
25
|
-
import { useFormikHelpers } from '../../../../../common/hooks/useFormikHelpers';
|
|
26
25
|
|
|
27
26
|
import './NodePoolForm.css';
|
|
28
27
|
import NodePoolAgentsForm from '../../forms/NodePoolAgentsForm';
|
|
@@ -37,14 +36,8 @@ type NodePoolFormProps = {
|
|
|
37
36
|
const NodePoolForm: React.FC<NodePoolFormProps> = ({ infraEnvs, agents, index, onRemove }) => {
|
|
38
37
|
const { t } = useTranslation();
|
|
39
38
|
const { values } = useFormikContext<HostsFormValues>();
|
|
40
|
-
const { setValue: setCountValue } = useFormikHelpers(`nodePools[${index}].count`);
|
|
41
|
-
const { setValue: setMinAutoscalingValue } = useFormikHelpers(
|
|
42
|
-
`nodePools[${index}].autoscaling.minReplicas`,
|
|
43
|
-
);
|
|
44
|
-
const { setValue: setMaxAutoscalingValue } = useFormikHelpers(
|
|
45
|
-
`nodePools[${index}].autoscaling.maxReplicas`,
|
|
46
|
-
);
|
|
47
39
|
const [isExpanded, setExpanded] = React.useState(true);
|
|
40
|
+
|
|
48
41
|
const infraEnvAgents = React.useMemo(() => {
|
|
49
42
|
const infraEnv = infraEnvs.find((ie) => ie.metadata?.namespace === values.agentNamespace);
|
|
50
43
|
return agents.filter((agent) => isAgentOfInfraEnv(infraEnv, agent));
|
|
@@ -79,31 +72,6 @@ const NodePoolForm: React.FC<NodePoolFormProps> = ({ infraEnvs, agents, index, o
|
|
|
79
72
|
Math.min(matchingAgents.length, availableAgents.length - previousNodePoolsCount),
|
|
80
73
|
);
|
|
81
74
|
|
|
82
|
-
const currentCount = values.nodePools[index].useAutoscaling
|
|
83
|
-
? values.nodePools[index].autoscaling.maxReplicas
|
|
84
|
-
: values.nodePools[index].count;
|
|
85
|
-
|
|
86
|
-
React.useEffect(() => {
|
|
87
|
-
if (currentCount > maxAgents) {
|
|
88
|
-
if (values.nodePools[index].useAutoscaling) {
|
|
89
|
-
if (maxAgents === 0) {
|
|
90
|
-
void setMinAutoscalingValue(maxAgents);
|
|
91
|
-
}
|
|
92
|
-
void setMaxAutoscalingValue(maxAgents);
|
|
93
|
-
} else {
|
|
94
|
-
void setCountValue(maxAgents);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}, [
|
|
98
|
-
maxAgents,
|
|
99
|
-
currentCount,
|
|
100
|
-
values.nodePools,
|
|
101
|
-
index,
|
|
102
|
-
setCountValue,
|
|
103
|
-
setMinAutoscalingValue,
|
|
104
|
-
setMaxAutoscalingValue,
|
|
105
|
-
]);
|
|
106
|
-
|
|
107
75
|
return (
|
|
108
76
|
<Stack hasGutter>
|
|
109
77
|
<StackItem>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Grid, GridItem } from '@patternfly/react-core';
|
|
1
|
+
import { Alert, AlertVariant, Grid, GridItem, Text } from '@patternfly/react-core';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { CheckboxField, NumberInputField, PopoverIcon } from '../../../../common';
|
|
4
4
|
import { useTranslation } from '../../../../common/hooks/use-translation-wrapper';
|
|
@@ -27,6 +27,7 @@ const NodePoolAgentsForm = ({
|
|
|
27
27
|
}: NodePoolAgentsFormProps) => {
|
|
28
28
|
const { t } = useTranslation();
|
|
29
29
|
|
|
30
|
+
const [{ value: count }] = useField<number>(countName);
|
|
30
31
|
const [{ value: minValue }] = useField<number>(`${autoscalingName}.minReplicas`);
|
|
31
32
|
const [{ value: maxValue }] = useField<number>(`${autoscalingName}.maxReplicas`);
|
|
32
33
|
const [{ value: useAutoscalingValue }] = useField<boolean>(useAutoscalingName);
|
|
@@ -60,7 +61,7 @@ const NodePoolAgentsForm = ({
|
|
|
60
61
|
label={t('ai:Minimum number of hosts')}
|
|
61
62
|
isRequired
|
|
62
63
|
minValue={1}
|
|
63
|
-
maxValue={maxValue
|
|
64
|
+
maxValue={maxValue}
|
|
64
65
|
/>
|
|
65
66
|
</GridItem>
|
|
66
67
|
<GridItem>
|
|
@@ -69,22 +70,33 @@ const NodePoolAgentsForm = ({
|
|
|
69
70
|
label={t('ai:Maximum number of hosts')}
|
|
70
71
|
isRequired
|
|
71
72
|
minValue={minValue || 1}
|
|
72
|
-
maxValue={maxAgents}
|
|
73
73
|
helperText={helperText}
|
|
74
74
|
/>
|
|
75
75
|
</GridItem>
|
|
76
76
|
</>
|
|
77
77
|
) : (
|
|
78
|
+
<>
|
|
79
|
+
<GridItem>
|
|
80
|
+
<NumberInputField
|
|
81
|
+
label={t('ai:Number of hosts')}
|
|
82
|
+
idPostfix="count"
|
|
83
|
+
name={countName}
|
|
84
|
+
isRequired
|
|
85
|
+
minValue={0}
|
|
86
|
+
helperText={helperText}
|
|
87
|
+
/>
|
|
88
|
+
</GridItem>
|
|
89
|
+
</>
|
|
90
|
+
)}
|
|
91
|
+
{(useAutoscalingValue ? maxValue : count) > maxAgents && (
|
|
78
92
|
<GridItem>
|
|
79
|
-
<
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
helperText={helperText}
|
|
87
|
-
/>
|
|
93
|
+
<Alert
|
|
94
|
+
isInline
|
|
95
|
+
variant={AlertVariant.warning}
|
|
96
|
+
title={t('ai:Host count exceeds the current number of available hosts.')}
|
|
97
|
+
>
|
|
98
|
+
<Text>{t('ai:Scale down the nodepool or make more hosts available.')}</Text>
|
|
99
|
+
</Alert>
|
|
88
100
|
</GridItem>
|
|
89
101
|
)}
|
|
90
102
|
</Grid>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dependencies": {
|
|
3
|
-
"@openshift-assisted/locales": "2.14.
|
|
4
|
-
"@openshift-assisted/types": "2.14.
|
|
3
|
+
"@openshift-assisted/locales": "2.14.13-cim",
|
|
4
|
+
"@openshift-assisted/types": "2.14.13-cim",
|
|
5
5
|
"@openshift-console/dynamic-plugin-sdk": "0.0.3",
|
|
6
6
|
"@patternfly/patternfly": "5.2.0",
|
|
7
7
|
"@patternfly/react-code-editor": "5.2.0",
|
|
@@ -140,5 +140,5 @@
|
|
|
140
140
|
]
|
|
141
141
|
}
|
|
142
142
|
},
|
|
143
|
-
"version": "2.14.
|
|
143
|
+
"version": "2.14.13-cim"
|
|
144
144
|
}
|