@openshift-assisted/ui-lib 2.12.1-cim → 2.13.0-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/ClusterDeployment/ACMClusterDeploymentDetailsStep.d.ts +2 -0
- package/build/@types/cim/components/ClusterDeployment/ACMClusterDeploymentDetailsStep.d.ts.map +1 -1
- package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentDetailsForm.d.ts +2 -1
- package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentDetailsForm.d.ts.map +1 -1
- package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentDetailsStep.d.ts +3 -5
- package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentDetailsStep.d.ts.map +1 -1
- package/build/@types/cim/components/ClusterDeployment/ClusterDetailsFormFields.d.ts +1 -0
- package/build/@types/cim/components/ClusterDeployment/ClusterDetailsFormFields.d.ts.map +1 -1
- package/build/@types/cim/components/InfraEnv/EnvironmentDetails.d.ts.map +1 -1
- package/build/@types/cim/components/InfraEnv/InfraEnvFormPage.d.ts +4 -0
- package/build/@types/cim/components/InfraEnv/InfraEnvFormPage.d.ts.map +1 -1
- package/build/@types/cim/components/InfraEnv/OpenshiftVersionDropdown.d.ts +6 -0
- package/build/@types/cim/components/InfraEnv/OpenshiftVersionDropdown.d.ts.map +1 -0
- package/build/@types/cim/components/common/CpuArchitectureDropdown.d.ts +2 -1
- package/build/@types/cim/components/common/CpuArchitectureDropdown.d.ts.map +1 -1
- package/build/@types/cim/components/helpers/versions.d.ts +2 -2
- package/build/@types/cim/components/helpers/versions.d.ts.map +1 -1
- package/build/@types/cim/types/k8s/agent-service-config.d.ts +7 -0
- package/build/@types/cim/types/k8s/agent-service-config.d.ts.map +1 -1
- package/build/@types/cim/types/k8s/infra-env-k8s-resource.d.ts +1 -0
- package/build/@types/cim/types/k8s/infra-env-k8s-resource.d.ts.map +1 -1
- package/build/cjs/cim/components/ClusterDeployment/ACMClusterDeploymentDetailsStep.js +7 -6
- package/build/cjs/cim/components/ClusterDeployment/ACMClusterDeploymentDetailsStep.js.map +1 -1
- package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentDetailsForm.js +19 -4
- package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentDetailsForm.js.map +1 -1
- package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentDetailsStep.js +4 -5
- package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentDetailsStep.js.map +1 -1
- package/build/cjs/cim/components/ClusterDeployment/ClusterDetailsFormFields.js +2 -2
- package/build/cjs/cim/components/ClusterDeployment/ClusterDetailsFormFields.js.map +1 -1
- package/build/cjs/cim/components/InfraEnv/EnvironmentDetails.js +10 -7
- package/build/cjs/cim/components/InfraEnv/EnvironmentDetails.js.map +1 -1
- package/build/cjs/cim/components/InfraEnv/InfraEnvFormPage.js +4 -1
- package/build/cjs/cim/components/InfraEnv/InfraEnvFormPage.js.map +1 -1
- package/build/cjs/cim/components/InfraEnv/OpenshiftVersionDropdown.js +34 -0
- package/build/cjs/cim/components/InfraEnv/OpenshiftVersionDropdown.js.map +1 -0
- package/build/cjs/cim/components/common/CpuArchitectureDropdown.js +23 -7
- package/build/cjs/cim/components/common/CpuArchitectureDropdown.js.map +1 -1
- package/build/cjs/cim/components/helpers/versions.js +6 -1
- package/build/cjs/cim/components/helpers/versions.js.map +1 -1
- package/build/cjs/common/components/ui/formik/LabelField.css +5 -0
- package/lib/cim/components/ClusterDeployment/ACMClusterDeploymentDetailsStep.tsx +17 -3
- package/lib/cim/components/ClusterDeployment/ClusterDeploymentDetailsForm.tsx +30 -4
- package/lib/cim/components/ClusterDeployment/ClusterDeploymentDetailsStep.tsx +9 -9
- package/lib/cim/components/ClusterDeployment/ClusterDetailsFormFields.tsx +3 -2
- package/lib/cim/components/InfraEnv/EnvironmentDetails.tsx +10 -0
- package/lib/cim/components/InfraEnv/InfraEnvFormPage.tsx +8 -0
- package/lib/cim/components/InfraEnv/OpenshiftVersionDropdown.tsx +71 -0
- package/lib/cim/components/common/CpuArchitectureDropdown.tsx +47 -27
- package/lib/cim/components/helpers/versions.ts +12 -0
- package/lib/cim/types/k8s/agent-service-config.ts +8 -0
- package/lib/cim/types/k8s/infra-env-k8s-resource.ts +1 -0
- package/lib/common/components/ui/formik/LabelField.css +5 -0
- package/package.json +3 -3
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const React = tslib_1.__importStar(require("react"));
|
|
5
|
+
const react_core_1 = require("@patternfly/react-core");
|
|
6
|
+
const formik_1 = require("formik");
|
|
7
|
+
const use_translation_wrapper_1 = require("../../../common/hooks/use-translation-wrapper");
|
|
8
|
+
const common_1 = require("../../../common");
|
|
9
|
+
const OpenshiftVersionDropdown = ({ osImages }) => {
|
|
10
|
+
const { t } = (0, use_translation_wrapper_1.useTranslation)();
|
|
11
|
+
const [{ name, value }, , { setValue }] = (0, formik_1.useField)('osImageVersion');
|
|
12
|
+
const [{ value: cpuArchitecture }] = (0, formik_1.useField)('cpuArchitecture');
|
|
13
|
+
const [osImageOpen, setOsImageOpen] = React.useState(false);
|
|
14
|
+
const fieldId = (0, common_1.getFieldId)(name, 'input');
|
|
15
|
+
const onOsImageSelect = (e) => {
|
|
16
|
+
const val = (e === null || e === void 0 ? void 0 : e.currentTarget.id) || '';
|
|
17
|
+
setValue(val);
|
|
18
|
+
setOsImageOpen(false);
|
|
19
|
+
};
|
|
20
|
+
const filteredImages = React.useMemo(() => osImages.filter((image) => image.cpuArchitecture === cpuArchitecture), [osImages, cpuArchitecture]);
|
|
21
|
+
React.useEffect(() => {
|
|
22
|
+
if (filteredImages.length === 0 && value !== '') {
|
|
23
|
+
setValue('');
|
|
24
|
+
}
|
|
25
|
+
}, [filteredImages.length, setValue, t, value]);
|
|
26
|
+
return (React.createElement(react_core_1.FormGroup, { isInline: true, fieldId: fieldId, label: t('ai:OpenShift version') },
|
|
27
|
+
React.createElement(react_core_1.Tooltip, { content: t('ai:No OpenShift images available for selected CPU architecture {{cpuArchitecture}}.', common_1.architectureData[cpuArchitecture].label), hidden: !!filteredImages.length },
|
|
28
|
+
React.createElement(react_core_1.Dropdown, { toggle: React.createElement(react_core_1.DropdownToggle, { onToggle: () => setOsImageOpen(!osImageOpen), className: "pf-u-w-100", isDisabled: !filteredImages.length }, value ? `OpenShift ${value}` : t('ai:No version selected')), name: "osImageVersion", isOpen: osImageOpen, onSelect: onOsImageSelect, dropdownItems: [
|
|
29
|
+
React.createElement(react_core_1.DropdownItem, { key: 'NO_VALUE', value: '' }, t('ai:No version selected')),
|
|
30
|
+
...filteredImages.map((image) => (React.createElement(react_core_1.DropdownItem, { key: image.openshiftVersion, id: image.openshiftVersion }, `OpenShift ${image.openshiftVersion}`))),
|
|
31
|
+
], className: "pf-u-w-100" }))));
|
|
32
|
+
};
|
|
33
|
+
exports.default = OpenshiftVersionDropdown;
|
|
34
|
+
//# sourceMappingURL=OpenshiftVersionDropdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OpenshiftVersionDropdown.js","sourceRoot":"","sources":["../../../../../lib/cim/components/InfraEnv/OpenshiftVersionDropdown.tsx"],"names":[],"mappings":";;;AAAA,qDAA+B;AAC/B,uDAAoG;AACpG,mCAAkC;AAClC,2FAA+E;AAC/E,4CAAyF;AAGzF,MAAM,wBAAwB,GAAG,CAAC,EAAE,QAAQ,EAA2B,EAAE,EAAE;IACzE,MAAM,EAAE,CAAC,EAAE,GAAG,IAAA,wCAAc,GAAE,CAAC;IAC/B,MAAM,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,AAAD,EAAG,EAAE,QAAQ,EAAE,CAAC,GAAG,IAAA,iBAAQ,EAAS,gBAAgB,CAAC,CAAC;IAC7E,MAAM,CAAC,EAAE,KAAK,EAAE,eAAe,EAAE,CAAC,GAAG,I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AAc,IACb,QAAQ,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,CAAC,WAAW,CAAC,EAC5C,SAAS,EAAC,YAAY,EACtB,UAAU,EAAE,CAAC,cAAc,CAAC,MAAM,IAEjC,KAAK,CAAC,CAAC,CAAC,aAAa,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAC5C,EAEnB,IAAI,EAAC,gBAAgB,EACrB,MAAM,EAAE,WAAW,EACnB,QAAQ,EAAE,eAAe,EACzB,aAAa,EAAE;oBACb,oBAAC,yBAAY,IAAC,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,EAAE,IACrC,CAAC,CAAC,wBAAwB,CAAC,CACf;oBACf,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAC/B,oBAAC,yBAAY,IAAC,GAAG,EAAE,KAAK,CAAC,gBAAgB,EAAE,EAAE,EAAE,KAAK,CAAC,gBAAgB,IAClE,aAAa,KAAK,CAAC,gBAAgB,EAAE,CACzB,CAChB,CAAC;iBACH,EACD,SAAS,EAAC,YAAY,GACtB,CACM,CACA,CACb,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,wBAAwB,CAAC"}
|
|
@@ -7,7 +7,12 @@ const use_translation_wrapper_1 = require("../../../common/hooks/use-translation
|
|
|
7
7
|
const common_1 = require("../../../common");
|
|
8
8
|
const formik_1 = require("formik");
|
|
9
9
|
const useFormikHelpers_1 = require("../../../common/hooks/useFormikHelpers");
|
|
10
|
-
const
|
|
10
|
+
const allDropdownItems = {
|
|
11
|
+
[common_1.CpuArchitecture.x86]: (React.createElement(react_core_1.DropdownItem, { key: 'x86_64', id: "x86_64", description: common_1.architectureData['x86_64'].description }, common_1.architectureData['x86_64'].label)),
|
|
12
|
+
[common_1.CpuArchitecture.ARM]: (React.createElement(react_core_1.DropdownItem, { key: 'arm64', id: "arm64", description: common_1.architectureData['arm64'].description }, common_1.architectureData['arm64'].label)),
|
|
13
|
+
[common_1.CpuArchitecture.s390x]: (React.createElement(react_core_1.DropdownItem, { key: 's390x', id: "s390x", description: common_1.architectureData['s390x'].description }, common_1.architectureData['s390x'].label)),
|
|
14
|
+
};
|
|
15
|
+
const CpuArchitectureDropdown = ({ isDisabled = false, cpuArchitectures, }) => {
|
|
11
16
|
const { t } = (0, use_translation_wrapper_1.useTranslation)();
|
|
12
17
|
const [{ name, value }, , { setValue }] = (0, formik_1.useField)('cpuArchitecture');
|
|
13
18
|
const [cpuArchOpen, setCpuArchOpen] = React.useState(false);
|
|
@@ -19,12 +24,23 @@ const CpuArchitectureDropdown = ({ isDisabled = false }) => {
|
|
|
19
24
|
setUserManagedNetworking(val === common_1.CpuArchitecture.s390x);
|
|
20
25
|
setCpuArchOpen(false);
|
|
21
26
|
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
const dropdownItems = React.useMemo(() => {
|
|
28
|
+
if (!cpuArchitectures) {
|
|
29
|
+
return Object.values(allDropdownItems);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
return Object.entries(allDropdownItems)
|
|
33
|
+
.filter(([key, _]) => cpuArchitectures.includes(key))
|
|
34
|
+
.map(([_, val]) => val);
|
|
35
|
+
}
|
|
36
|
+
}, [cpuArchitectures]);
|
|
37
|
+
React.useEffect(() => {
|
|
38
|
+
if (!isDisabled && value !== '' && cpuArchitectures && !(cpuArchitectures === null || cpuArchitectures === void 0 ? void 0 : cpuArchitectures.includes(value))) {
|
|
39
|
+
setValue('');
|
|
40
|
+
}
|
|
41
|
+
}, [cpuArchitectures, isDisabled, setValue, value]);
|
|
42
|
+
return !isDisabled ? (React.createElement(react_core_1.FormGroup, { isInline: true, fieldId: fieldId, label: t('ai:CPU architecture'), isRequired: true },
|
|
43
|
+
React.createElement(react_core_1.Dropdown, { toggle: React.createElement(react_core_1.DropdownToggle, { onToggle: () => setCpuArchOpen(!cpuArchOpen), className: "pf-u-w-100" }, value ? common_1.architectureData[value].label : t('ai:CPU architecture')), name: "cpuArchitecture", isOpen: cpuArchOpen, onSelect: onCpuArchSelect, dropdownItems: dropdownItems, className: "pf-u-w-100" }))) : (React.createElement(common_1.StaticField, { name: 'cpuArchitecture', label: t('ai:CPU architecture'), isRequired: true }, common_1.architectureData[value].label));
|
|
28
44
|
};
|
|
29
45
|
exports.default = CpuArchitectureDropdown;
|
|
30
46
|
//# sourceMappingURL=CpuArchitectureDropdown.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CpuArchitectureDropdown.js","sourceRoot":"","sources":["../../../../../lib/cim/components/common/CpuArchitectureDropdown.tsx"],"names":[],"mappings":";;;AAAA,qDAA+B;AAC/B,uDAA2F;AAC3F,2FAA+E;AAC/E,4CAMyB;AACzB,mCAAkC;AAClC,6EAA0E;AAE1E,MAAM,
|
|
1
|
+
{"version":3,"file":"CpuArchitectureDropdown.js","sourceRoot":"","sources":["../../../../../lib/cim/components/common/CpuArchitectureDropdown.tsx"],"names":[],"mappings":";;;AAAA,qDAA+B;AAC/B,uDAA2F;AAC3F,2FAA+E;AAC/E,4CAMyB;AACzB,mCAAkC;AAClC,6EAA0E;AAE1E,MAAM,gBAAgB,GAAG;IACvB,CAAC,wBAAe,CAAC,GAAG,CAAC,EAAE,CACrB,oBAAC,yBAAY,IAAC,GAAG,EAAE,QAAQ,EAAE,EAAE,EAAC,QAAQ,EAAC,WAAW,EAAE,yBAAgB,CAAC,QAAQ,CAAC,CAAC,WAAW,IACzF,yBAAgB,CAAC,QAAQ,CAAC,CAAC,KAAK,CACpB,CAChB;IACD,CAAC,wBAAe,CAAC,GAAG,CAAC,EAAE,CACrB,oBAAC,yBAAY,IAAC,GAAG,EAAE,OAAO,EAAE,EAAE,EAAC,OAAO,EAAC,WAAW,EAAE,yBAAgB,CAAC,OAAO,CAAC,CAAC,WAAW,IACtF,yBAAgB,CAAC,OAAO,CAAC,CAAC,KAAK,CACnB,CA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,CAAC,CAAC,CACF,oBAAC,oBAAW,IAAC,IAAI,EAAE,iBAAiB,EAAE,KAAK,EAAE,CAAC,CAAC,qBAAqB,CAAC,EAAE,UAAU,UAC9E,yBAAgB,CAAC,KAAiC,CAAC,CAAC,KAAK,CAC9C,CACf,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,uBAAuB,CAAC"}
|
|
@@ -35,7 +35,8 @@ const isValidImageSet = (cis, architectures) => {
|
|
|
35
35
|
return architectures.some((arch) => { var _a, _b, _c; return ((_a = cis.spec) === null || _a === void 0 ? void 0 : _a.releaseImage.endsWith(arch)) || ((_c = (_b = cis.metadata) === null || _b === void 0 ? void 0 : _b.labels) === null || _c === void 0 ? void 0 : _c.architecture) === arch; });
|
|
36
36
|
};
|
|
37
37
|
exports.isValidImageSet = isValidImageSet;
|
|
38
|
-
const getOCPVersions = (clusterImageSets, isNutanix) => {
|
|
38
|
+
const getOCPVersions = (clusterImageSets, isNutanix, osImages) => {
|
|
39
|
+
const ocpImageVersions = Array.from(new Set(osImages === null || osImages === void 0 ? void 0 : osImages.map((osImage) => osImage.openshiftVersion)));
|
|
39
40
|
const versions = clusterImageSets
|
|
40
41
|
.filter((clusterImageSet) => (0, exports.isValidImageSet)(clusterImageSet, isNutanix ? exports.supportedNutanixPlatforms : undefined))
|
|
41
42
|
.map((clusterImageSet) => {
|
|
@@ -49,6 +50,10 @@ const getOCPVersions = (clusterImageSets, isNutanix) => {
|
|
|
49
50
|
// (rawagner) ACM does not have the warning so changing to 'production'
|
|
50
51
|
supportLevel: 'production', // getSupportLevelFromChannel(clusterImageSet.metadata?.labels?.channel),
|
|
51
52
|
};
|
|
53
|
+
})
|
|
54
|
+
.filter((ocpVersion) => {
|
|
55
|
+
const ver = ocpVersion.version.split('.').slice(0, 2).join('.');
|
|
56
|
+
return !!ocpImageVersions.length ? ocpImageVersions.includes(ver) : true;
|
|
52
57
|
})
|
|
53
58
|
.sort((versionA, versionB) => /* descending */ -1 * versionA.label.localeCompare(versionB.label));
|
|
54
59
|
if (versions.length) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"versions.js","sourceRoot":"","sources":["../../../../../lib/cim/components/helpers/versions.ts"],"names":[],"mappings":";;;;AAAA,4EAAyC;
|
|
1
|
+
{"version":3,"file":"versions.js","sourceRoot":"","sources":["../../../../../lib/cim/components/helpers/versions.ts"],"names":[],"mappings":";;;;AAAA,4EAAyC;AAWlC,MAAM,0BAA0B,GAAG,CAAC,YAAY,GAAG,EAAE,EAAE,EAAE;IAC9D,MAAM,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAC9C,IAAI,KAAK,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE;QACzC,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;KACjB;AACH,CAAC,CAAC;AALW,QAAA,0BAA0B,8BAKrC;AAEF,2BAA2B;AAC3B,MAAM,0BAA0B,GAAG,CACjC,OAAgB,EAC6B,EAAE;IAC/C,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,aAAa,CAAC;KACtB;IAED,IAAI,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;QAC9B,OAAO,MAAM,CAAC,CAAC,iCAAiC;KACjD;IAED,IAAI,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;QAChC,OAAO,YAAY,CAAC;KACrB;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEW,QAAA,yBAAyB,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAEvD,MAAM,eAAe,GAAG,CAAC,GAA+B,EAAE,aAAwB,EAAE,EAAE;;IAC3F,IAAI,CAAA,MAAA,MAAA,GAAG,CAAC,QAAQ,0CAAE,MAAM,0CAAE,OAAO,MAAK,MAAM,EAAE;QAC5C,OAAO,KAAK,CAAC;KACd;IACD,IAAI,CAAC,aAAa,EAAE;QAClB,OAAO,I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useDetailsFormik } from './ClusterDeploymentDetailsStep';
|
|
9
9
|
import { ClusterDetailsFormFieldsProps } from './ClusterDetailsFormFields';
|
|
10
|
+
import { OsImage } from '../../types';
|
|
11
|
+
import { getOCPVersions } from '../helpers';
|
|
10
12
|
|
|
11
13
|
type DetailsFormBodyProps = {
|
|
12
14
|
clusterImages: ClusterImageSetK8sResource[];
|
|
13
15
|
onValuesChanged: (values: ClusterDetailsValues, initRender: boolean) => void;
|
|
14
16
|
extensionAfter: ClusterDetailsFormFieldsProps['extensionAfter'];
|
|
17
|
+
osImages?: OsImage[];
|
|
15
18
|
isNutanix?: boolean;
|
|
16
19
|
};
|
|
17
20
|
|
|
@@ -20,6 +23,7 @@ const DetailsFormBody: React.FC<DetailsFormBodyProps> = ({
|
|
|
20
23
|
clusterImages,
|
|
21
24
|
extensionAfter,
|
|
22
25
|
isNutanix,
|
|
26
|
+
osImages,
|
|
23
27
|
}) => {
|
|
24
28
|
const { values } = useFormikContext<ClusterDetailsValues>();
|
|
25
29
|
const initRenderRef = React.useRef(true);
|
|
@@ -33,6 +37,7 @@ const DetailsFormBody: React.FC<DetailsFormBodyProps> = ({
|
|
|
33
37
|
clusterImages={clusterImages}
|
|
34
38
|
extensionAfter={extensionAfter}
|
|
35
39
|
isNutanix={isNutanix}
|
|
40
|
+
osImages={osImages}
|
|
36
41
|
/>
|
|
37
42
|
);
|
|
38
43
|
};
|
|
@@ -46,13 +51,17 @@ const ACMClusterDeploymentDetailsStep: React.FC<ACMClusterDeploymentDetailsStepP
|
|
|
46
51
|
clusterImages,
|
|
47
52
|
formRef,
|
|
48
53
|
usedClusterNames,
|
|
54
|
+
osImages,
|
|
55
|
+
isNutanix,
|
|
49
56
|
...rest
|
|
50
57
|
}) => {
|
|
58
|
+
const ocpVersions = getOCPVersions(clusterImages, !!isNutanix, osImages);
|
|
59
|
+
|
|
51
60
|
const [initialValues, validationSchema] = useDetailsFormik({
|
|
52
|
-
|
|
61
|
+
ocpVersions,
|
|
53
62
|
usedClusterNames,
|
|
54
|
-
isNutanix: !!rest.isNutanix,
|
|
55
63
|
});
|
|
64
|
+
|
|
56
65
|
return (
|
|
57
66
|
<Formik
|
|
58
67
|
initialValues={initialValues}
|
|
@@ -60,7 +69,12 @@ const ACMClusterDeploymentDetailsStep: React.FC<ACMClusterDeploymentDetailsStepP
|
|
|
60
69
|
innerRef={formRef}
|
|
61
70
|
onSubmit={noop}
|
|
62
71
|
>
|
|
63
|
-
<DetailsFormBody
|
|
72
|
+
<DetailsFormBody
|
|
73
|
+
clusterImages={clusterImages}
|
|
74
|
+
osImages={osImages}
|
|
75
|
+
isNutanix={isNutanix}
|
|
76
|
+
{...rest}
|
|
77
|
+
/>
|
|
64
78
|
</Formik>
|
|
65
79
|
);
|
|
66
80
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { Alert, Stack, StackItem } from '@patternfly/react-core';
|
|
3
|
-
import { AgentClusterInstallK8sResource, ClusterDeploymentK8sResource } from '../../types';
|
|
3
|
+
import { AgentClusterInstallK8sResource, ClusterDeploymentK8sResource, OsImage } from '../../types';
|
|
4
4
|
import { ClusterImageSetK8sResource } from '../../types/k8s/cluster-image-set';
|
|
5
5
|
import { getOCPVersions, getSelectedVersion } from '../helpers';
|
|
6
6
|
import { useTranslation } from '../../../common/hooks/use-translation-wrapper';
|
|
@@ -8,6 +8,8 @@ import {
|
|
|
8
8
|
ClusterDetailsFormFields,
|
|
9
9
|
ClusterDetailsFormFieldsProps,
|
|
10
10
|
} from './ClusterDetailsFormFields';
|
|
11
|
+
import { useFormikContext } from 'formik';
|
|
12
|
+
import { ClusterDetailsValues, CpuArchitecture, SupportedCpuArchitecture } from '../../../common';
|
|
11
13
|
|
|
12
14
|
type ClusterDeploymentDetailsFormProps = {
|
|
13
15
|
clusterImages: ClusterImageSetK8sResource[];
|
|
@@ -15,6 +17,7 @@ type ClusterDeploymentDetailsFormProps = {
|
|
|
15
17
|
agentClusterInstall?: AgentClusterInstallK8sResource;
|
|
16
18
|
extensionAfter?: ClusterDetailsFormFieldsProps['extensionAfter'];
|
|
17
19
|
isNutanix?: boolean;
|
|
20
|
+
osImages?: OsImage[];
|
|
18
21
|
};
|
|
19
22
|
|
|
20
23
|
const ClusterDeploymentDetailsForm: React.FC<ClusterDeploymentDetailsFormProps> = ({
|
|
@@ -23,16 +26,38 @@ const ClusterDeploymentDetailsForm: React.FC<ClusterDeploymentDetailsFormProps>
|
|
|
23
26
|
clusterImages,
|
|
24
27
|
extensionAfter,
|
|
25
28
|
isNutanix,
|
|
29
|
+
osImages,
|
|
26
30
|
}) => {
|
|
31
|
+
const { t } = useTranslation();
|
|
27
32
|
const ocpVersions = React.useMemo(
|
|
28
|
-
() => getOCPVersions(clusterImages, isNutanix),
|
|
29
|
-
[clusterImages, isNutanix],
|
|
33
|
+
() => getOCPVersions(clusterImages, isNutanix, osImages),
|
|
34
|
+
[clusterImages, isNutanix, osImages],
|
|
30
35
|
);
|
|
36
|
+
|
|
31
37
|
const forceOpenshiftVersion = agentClusterInstall
|
|
32
38
|
? getSelectedVersion(clusterImages, agentClusterInstall)
|
|
33
39
|
: undefined;
|
|
34
40
|
const isEditFlow = !!clusterDeployment;
|
|
35
|
-
|
|
41
|
+
|
|
42
|
+
const { values } = useFormikContext<ClusterDetailsValues>();
|
|
43
|
+
|
|
44
|
+
const cpuArchitectures = React.useMemo(() => {
|
|
45
|
+
const cpuArchitectures = [CpuArchitecture.x86, CpuArchitecture.ARM, CpuArchitecture.s390x];
|
|
46
|
+
if (!osImages) {
|
|
47
|
+
return cpuArchitectures;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const openshiftVersion = ocpVersions
|
|
51
|
+
.find((ver) => ver.value === values.openshiftVersion)
|
|
52
|
+
?.version.split('.')
|
|
53
|
+
.slice(0, 2)
|
|
54
|
+
.join('.');
|
|
55
|
+
|
|
56
|
+
return osImages
|
|
57
|
+
.filter((osImage) => osImage.openshiftVersion === openshiftVersion)
|
|
58
|
+
.map((osImage) => osImage.cpuArchitecture as SupportedCpuArchitecture);
|
|
59
|
+
}, [osImages, ocpVersions, values.openshiftVersion]);
|
|
60
|
+
|
|
36
61
|
return (
|
|
37
62
|
<Stack hasGutter>
|
|
38
63
|
{isEditFlow && (
|
|
@@ -51,6 +76,7 @@ const ClusterDeploymentDetailsForm: React.FC<ClusterDeploymentDetailsFormProps>
|
|
|
51
76
|
forceOpenshiftVersion={forceOpenshiftVersion}
|
|
52
77
|
extensionAfter={extensionAfter}
|
|
53
78
|
isNutanix={isNutanix}
|
|
79
|
+
cpuArchitectures={cpuArchitectures}
|
|
54
80
|
/>
|
|
55
81
|
</StackItem>
|
|
56
82
|
</Stack>
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
ClusterDetailsValues,
|
|
12
12
|
useFeatureSupportLevel,
|
|
13
13
|
getRichTextValidation,
|
|
14
|
+
OpenshiftVersionOptionType,
|
|
14
15
|
} from '../../../common';
|
|
15
16
|
|
|
16
17
|
import { ClusterDeploymentDetailsStepProps, ClusterDeploymentDetailsValues } from './types';
|
|
@@ -25,35 +26,33 @@ import {
|
|
|
25
26
|
InfraEnvK8sResource,
|
|
26
27
|
} from '../../types';
|
|
27
28
|
import ClusterDeploymentDetailsForm from './ClusterDeploymentDetailsForm';
|
|
28
|
-
import { ClusterImageSetK8sResource } from '../../types/k8s/cluster-image-set';
|
|
29
29
|
import { isCIMFlow, getGridSpans } from './helpers';
|
|
30
30
|
import { useTranslation } from '../../../common/hooks/use-translation-wrapper';
|
|
31
31
|
|
|
32
32
|
type UseDetailsFormikArgs = {
|
|
33
|
-
clusterImages: ClusterImageSetK8sResource[];
|
|
34
33
|
usedClusterNames: string[];
|
|
34
|
+
ocpVersions: OpenshiftVersionOptionType[];
|
|
35
35
|
clusterDeployment?: ClusterDeploymentK8sResource;
|
|
36
36
|
agentClusterInstall?: AgentClusterInstallK8sResource;
|
|
37
37
|
agents?: AgentK8sResource[];
|
|
38
38
|
infraEnv?: InfraEnvK8sResource;
|
|
39
|
-
isNutanix: boolean;
|
|
40
39
|
};
|
|
41
40
|
|
|
42
41
|
export const useDetailsFormik = ({
|
|
43
42
|
clusterDeployment,
|
|
44
43
|
agentClusterInstall,
|
|
45
44
|
agents,
|
|
46
|
-
clusterImages,
|
|
47
45
|
usedClusterNames,
|
|
48
46
|
infraEnv,
|
|
49
|
-
|
|
47
|
+
ocpVersions,
|
|
50
48
|
}: UseDetailsFormikArgs): [
|
|
51
49
|
ClusterDetailsValues & { networkType: 'OpenShiftSDN' | 'OVNKubernetes' },
|
|
52
50
|
Lazy,
|
|
53
51
|
] => {
|
|
54
52
|
const { t } = useTranslation();
|
|
55
53
|
const featureSupportLevels = useFeatureSupportLevel();
|
|
56
|
-
const
|
|
54
|
+
const isEdit = !!clusterDeployment || !!agentClusterInstall;
|
|
55
|
+
|
|
57
56
|
const cluster = React.useMemo(
|
|
58
57
|
() =>
|
|
59
58
|
clusterDeployment && agentClusterInstall
|
|
@@ -66,6 +65,7 @@ export const useDetailsFormik = ({
|
|
|
66
65
|
: undefined,
|
|
67
66
|
[agentClusterInstall, clusterDeployment, agents, infraEnv],
|
|
68
67
|
);
|
|
68
|
+
|
|
69
69
|
const initialValues = React.useMemo(
|
|
70
70
|
() => {
|
|
71
71
|
const initValues = getClusterDetailsInitialValues({
|
|
@@ -85,7 +85,6 @@ export const useDetailsFormik = ({
|
|
|
85
85
|
[], // eslint-disable-line react-hooks/exhaustive-deps
|
|
86
86
|
);
|
|
87
87
|
|
|
88
|
-
const isEdit = !!clusterDeployment || !!agentClusterInstall;
|
|
89
88
|
const validationSchema = React.useMemo(
|
|
90
89
|
() =>
|
|
91
90
|
getClusterDetailsValidationSchema({
|
|
@@ -117,14 +116,15 @@ const ClusterDeploymentDetailsStep: React.FC<ClusterDeploymentDetailsStepProps>
|
|
|
117
116
|
const { addAlert } = useAlerts();
|
|
118
117
|
const { setCurrentStepId } = React.useContext(ClusterDeploymentWizardContext);
|
|
119
118
|
const { t } = useTranslation();
|
|
119
|
+
const ocpVersions = getOCPVersions(clusterImages, isNutanix);
|
|
120
|
+
|
|
120
121
|
const [initialValues, validationSchema] = useDetailsFormik({
|
|
121
122
|
clusterDeployment,
|
|
123
|
+
ocpVersions,
|
|
122
124
|
agentClusterInstall,
|
|
123
125
|
agents,
|
|
124
|
-
clusterImages,
|
|
125
126
|
usedClusterNames,
|
|
126
127
|
infraEnv,
|
|
127
|
-
isNutanix,
|
|
128
128
|
});
|
|
129
129
|
const next = () =>
|
|
130
130
|
isCIMFlow(clusterDeployment)
|
|
@@ -16,13 +16,13 @@ import { useTranslation } from '../../../common/hooks/use-translation-wrapper';
|
|
|
16
16
|
import CpuArchitectureDropdown from '../common/CpuArchitectureDropdown';
|
|
17
17
|
import { SNOControlGroup } from '../../../common';
|
|
18
18
|
import { getNetworkType } from '../helpers';
|
|
19
|
-
|
|
20
19
|
export type ClusterDetailsFormFieldsProps = {
|
|
21
20
|
isEditFlow: boolean;
|
|
22
21
|
forceOpenshiftVersion?: string;
|
|
23
22
|
extensionAfter?: { [key: string]: React.ReactElement };
|
|
24
23
|
versions: OpenshiftVersionOptionType[];
|
|
25
24
|
isNutanix?: boolean;
|
|
25
|
+
cpuArchitectures?: string[];
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
export const BaseDnsHelperText: React.FC<{ name?: string; baseDnsDomain?: string }> = ({
|
|
@@ -49,6 +49,7 @@ export const ClusterDetailsFormFields: React.FC<ClusterDetailsFormFieldsProps> =
|
|
|
49
49
|
forceOpenshiftVersion,
|
|
50
50
|
extensionAfter,
|
|
51
51
|
isNutanix,
|
|
52
|
+
cpuArchitectures,
|
|
52
53
|
}) => {
|
|
53
54
|
const { values, setFieldValue } = useFormikContext<ClusterDetailsValues>();
|
|
54
55
|
const { name, baseDnsDomain, highAvailabilityMode } = values;
|
|
@@ -112,7 +113,7 @@ export const ClusterDetailsFormFields: React.FC<ClusterDetailsFormFieldsProps> =
|
|
|
112
113
|
{!isNutanix && (
|
|
113
114
|
<>
|
|
114
115
|
<SNOControlGroup versions={versions} highAvailabilityMode={highAvailabilityMode} />
|
|
115
|
-
<CpuArchitectureDropdown isDisabled={isEditFlow} />
|
|
116
|
+
<CpuArchitectureDropdown isDisabled={isEditFlow} cpuArchitectures={cpuArchitectures} />
|
|
116
117
|
</>
|
|
117
118
|
)}
|
|
118
119
|
{extensionAfter?.['openshiftVersion'] && extensionAfter['openshiftVersion']}
|
|
@@ -169,6 +169,16 @@ const EnvironmentDetails: React.FC<EnvironmentDetailsProps> = ({
|
|
|
169
169
|
.label ?? CpuArchitecture.x86}
|
|
170
170
|
</DescriptionListDescription>
|
|
171
171
|
</DescriptionListGroup>
|
|
172
|
+
|
|
173
|
+
{infraEnv.spec?.osImageVersion && (
|
|
174
|
+
<DescriptionListGroup>
|
|
175
|
+
<DescriptionListTerm>{t('ai:OpenShift version')}</DescriptionListTerm>
|
|
176
|
+
<DescriptionListDescription>
|
|
177
|
+
{`OpenShift ${infraEnv.spec?.osImageVersion}`}
|
|
178
|
+
</DescriptionListDescription>
|
|
179
|
+
</DescriptionListGroup>
|
|
180
|
+
)}
|
|
181
|
+
|
|
172
182
|
<DescriptionListGroup>
|
|
173
183
|
<DescriptionListTerm>{t('ai:Labels')}</DescriptionListTerm>
|
|
174
184
|
<DescriptionListDescription>
|
|
@@ -49,6 +49,8 @@ import { getErrorMessage } from '../../../common/utils';
|
|
|
49
49
|
import { useTranslation } from '../../../common/hooks/use-translation-wrapper';
|
|
50
50
|
import { TFunction } from 'i18next';
|
|
51
51
|
import CpuArchitectureDropdown from '../common/CpuArchitectureDropdown';
|
|
52
|
+
import OpenshiftVersionDropdown from './OpenshiftVersionDropdown';
|
|
53
|
+
import { OsImage } from '../../types';
|
|
52
54
|
|
|
53
55
|
export type EnvironmentStepFormValues = {
|
|
54
56
|
name: string;
|
|
@@ -67,6 +69,7 @@ export type EnvironmentStepFormValues = {
|
|
|
67
69
|
>;
|
|
68
70
|
enableNtpSources: boolean;
|
|
69
71
|
additionalNtpSources: string;
|
|
72
|
+
osImageVersion?: string;
|
|
70
73
|
};
|
|
71
74
|
|
|
72
75
|
const validationSchema = (usedNames: string[], t: TFunction) =>
|
|
@@ -116,6 +119,7 @@ const initialValues: EnvironmentStepFormValues = {
|
|
|
116
119
|
cpuArchitecture: CpuArchitecture.x86,
|
|
117
120
|
enableNtpSources: false,
|
|
118
121
|
additionalNtpSources: '',
|
|
122
|
+
osImageVersion: '',
|
|
119
123
|
};
|
|
120
124
|
|
|
121
125
|
type InfraEnvFormProps = {
|
|
@@ -123,6 +127,7 @@ type InfraEnvFormProps = {
|
|
|
123
127
|
pullSecret?: string;
|
|
124
128
|
sshPublicKey?: string;
|
|
125
129
|
docVersion: string;
|
|
130
|
+
osImages?: OsImage[];
|
|
126
131
|
};
|
|
127
132
|
|
|
128
133
|
const InfraEnvForm: React.FC<InfraEnvFormProps> = ({
|
|
@@ -131,6 +136,7 @@ const InfraEnvForm: React.FC<InfraEnvFormProps> = ({
|
|
|
131
136
|
pullSecret,
|
|
132
137
|
sshPublicKey,
|
|
133
138
|
docVersion,
|
|
139
|
+
osImages,
|
|
134
140
|
}) => {
|
|
135
141
|
const { values, setFieldValue } = useFormikContext<EnvironmentStepFormValues>();
|
|
136
142
|
const { t } = useTranslation();
|
|
@@ -222,6 +228,7 @@ const InfraEnvForm: React.FC<InfraEnvFormProps> = ({
|
|
|
222
228
|
</Flex>
|
|
223
229
|
</FormGroup>
|
|
224
230
|
<CpuArchitectureDropdown />
|
|
231
|
+
{!!osImages && <OpenshiftVersionDropdown osImages={osImages} />}
|
|
225
232
|
<RichInputField
|
|
226
233
|
label={t('ai:Location')}
|
|
227
234
|
name="location"
|
|
@@ -276,6 +283,7 @@ type InfraEnvFormPageProps = InfraEnvFormProps & {
|
|
|
276
283
|
pullSecret?: string;
|
|
277
284
|
sshPublicKey?: string;
|
|
278
285
|
docVersion: string;
|
|
286
|
+
osImages?: OsImage[];
|
|
279
287
|
};
|
|
280
288
|
|
|
281
289
|
export const InfraEnvFormPage: React.FC<InfraEnvFormPageProps> = ({
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Dropdown, DropdownItem, DropdownToggle, FormGroup, Tooltip } from '@patternfly/react-core';
|
|
3
|
+
import { useField } from 'formik';
|
|
4
|
+
import { useTranslation } from '../../../common/hooks/use-translation-wrapper';
|
|
5
|
+
import { architectureData, getFieldId, SupportedCpuArchitecture } from '../../../common';
|
|
6
|
+
import { OsImage } from '../../types';
|
|
7
|
+
|
|
8
|
+
const OpenshiftVersionDropdown = ({ osImages }: { osImages: OsImage[] }) => {
|
|
9
|
+
const { t } = useTranslation();
|
|
10
|
+
const [{ name, value }, , { setValue }] = useField<string>('osImageVersion');
|
|
11
|
+
const [{ value: cpuArchitecture }] = useField<string>('cpuArchitecture');
|
|
12
|
+
const [osImageOpen, setOsImageOpen] = React.useState(false);
|
|
13
|
+
const fieldId = getFieldId(name, 'input');
|
|
14
|
+
|
|
15
|
+
const onOsImageSelect = (e?: React.SyntheticEvent<HTMLDivElement>) => {
|
|
16
|
+
const val = e?.currentTarget.id || '';
|
|
17
|
+
setValue(val);
|
|
18
|
+
setOsImageOpen(false);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const filteredImages = React.useMemo(
|
|
22
|
+
() => osImages.filter((image) => image.cpuArchitecture === cpuArchitecture),
|
|
23
|
+
[osImages, cpuArchitecture],
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
React.useEffect(() => {
|
|
27
|
+
if (filteredImages.length === 0 && value !== '') {
|
|
28
|
+
setValue('');
|
|
29
|
+
}
|
|
30
|
+
}, [filteredImages.length, setValue, t, value]);
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<FormGroup isInline fieldId={fieldId} label={t('ai:OpenShift version')}>
|
|
34
|
+
<Tooltip
|
|
35
|
+
content={t(
|
|
36
|
+
'ai:No OpenShift images available for selected CPU architecture {{cpuArchitecture}}.',
|
|
37
|
+
architectureData[cpuArchitecture as SupportedCpuArchitecture].label,
|
|
38
|
+
)}
|
|
39
|
+
hidden={!!filteredImages.length}
|
|
40
|
+
>
|
|
41
|
+
<Dropdown
|
|
42
|
+
toggle={
|
|
43
|
+
<DropdownToggle
|
|
44
|
+
onToggle={() => setOsImageOpen(!osImageOpen)}
|
|
45
|
+
className="pf-u-w-100"
|
|
46
|
+
isDisabled={!filteredImages.length}
|
|
47
|
+
>
|
|
48
|
+
{value ? `OpenShift ${value}` : t('ai:No version selected')}
|
|
49
|
+
</DropdownToggle>
|
|
50
|
+
}
|
|
51
|
+
name="osImageVersion"
|
|
52
|
+
isOpen={osImageOpen}
|
|
53
|
+
onSelect={onOsImageSelect}
|
|
54
|
+
dropdownItems={[
|
|
55
|
+
<DropdownItem key={'NO_VALUE'} value={''}>
|
|
56
|
+
{t('ai:No version selected')}
|
|
57
|
+
</DropdownItem>,
|
|
58
|
+
...filteredImages.map((image) => (
|
|
59
|
+
<DropdownItem key={image.openshiftVersion} id={image.openshiftVersion}>
|
|
60
|
+
{`OpenShift ${image.openshiftVersion}`}
|
|
61
|
+
</DropdownItem>
|
|
62
|
+
)),
|
|
63
|
+
]}
|
|
64
|
+
className="pf-u-w-100"
|
|
65
|
+
/>
|
|
66
|
+
</Tooltip>
|
|
67
|
+
</FormGroup>
|
|
68
|
+
);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export default OpenshiftVersionDropdown;
|