@openshift-assisted/ui-lib 2.56.1 → 2.56.2
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/common/config/constants.d.ts.map +1 -1
- package/build/@types/ocm/components/wizard/NewClusterWizard.d.ts.map +1 -1
- package/build/@types/ocm/components/wizard/clusterWizardContext/ClusterWizardContextProvider.d.ts +1 -1
- package/build/@types/ocm/components/wizard/clusterWizardContext/ClusterWizardContextProvider.d.ts.map +1 -1
- package/build/@types/ocm/components/wizard/clusterWizardContext/utils.d.ts +7 -0
- package/build/@types/ocm/components/wizard/clusterWizardContext/utils.d.ts.map +1 -0
- package/build/@types/ocm/components/wizard/steps/clusterDetails/ClusterDetailsForm.d.ts.map +1 -1
- package/build/@types/ocm/components/wizard/steps/disconnected/BasicStep.d.ts +2 -1
- package/build/@types/ocm/components/wizard/steps/disconnected/BasicStep.d.ts.map +1 -1
- package/build/@types/ocm/components/wizard/steps/disconnected/DisconnectedReviewStep.d.ts.map +1 -1
- package/build/@types/ocm/components/wizard/steps/disconnected/DisconnectedStaticIp.d.ts +4 -0
- package/build/@types/ocm/components/wizard/steps/disconnected/DisconnectedStaticIp.d.ts.map +1 -0
- package/build/@types/ocm/components/wizard/steps/disconnected/InstallDisconnectedSwitch.d.ts.map +1 -1
- package/build/@types/ocm/components/wizard/steps/disconnected/OptionalConfigurationsStep.d.ts.map +1 -1
- package/build/@types/ocm/components/wizard/steps/disconnected/index.d.ts +1 -0
- package/build/@types/ocm/components/wizard/steps/disconnected/index.d.ts.map +1 -1
- package/build/@types/ocm/components/wizard/steps/staticIp/StaticIp.d.ts +1 -1
- package/build/@types/ocm/components/wizard/steps/staticIp/StaticIp.d.ts.map +1 -1
- package/build/@types/ocm/components/wizard/steps/staticIp/commonValidationSchemas.d.ts +6 -1
- package/build/@types/ocm/components/wizard/steps/staticIp/commonValidationSchemas.d.ts.map +1 -1
- package/build/@types/ocm/components/wizard/steps/staticIp/components/FormViewNetworkWide/FormViewNetworkWide.d.ts.map +1 -1
- package/build/@types/ocm/components/wizard/steps/staticIp/components/FormViewNetworkWide/FormViewNetworkWideFields.d.ts.map +1 -1
- package/build/@types/ocm/components/wizard/steps/staticIp/components/FormViewNetworkWide/disconnectedNetworkWideValidationSchema.d.ts +24 -0
- package/build/@types/ocm/components/wizard/steps/staticIp/components/FormViewNetworkWide/disconnectedNetworkWideValidationSchema.d.ts.map +1 -0
- package/build/@types/ocm/components/wizard/steps/staticIp/components/FormViewNetworkWide/formViewNetworkWideValidationSchema.d.ts +46 -1
- package/build/@types/ocm/components/wizard/steps/staticIp/components/FormViewNetworkWide/formViewNetworkWideValidationSchema.d.ts.map +1 -1
- package/build/@types/ocm/components/wizard/steps/staticIp/components/StaticIpPage.d.ts.map +1 -1
- package/build/@types/ocm/components/wizard/steps/staticIp/data/dataTypes.d.ts +1 -1
- package/build/@types/ocm/components/wizard/steps/staticIp/data/dataTypes.d.ts.map +1 -1
- package/build/@types/ocm/components/wizard/steps/staticIp/data/disconnectedNetworkWide.d.ts +8 -0
- package/build/@types/ocm/components/wizard/steps/staticIp/data/disconnectedNetworkWide.d.ts.map +1 -0
- package/build/@types/ocm/components/wizard/steps/staticIp/data/formDataFromInfraEnvField.d.ts.map +1 -1
- package/build/@types/ocm/components/wizard/steps/staticIp/data/fromInfraEnv.d.ts +2 -0
- package/build/@types/ocm/components/wizard/steps/staticIp/data/fromInfraEnv.d.ts.map +1 -1
- package/build/@types/ocm/components/wizard/steps/staticIp/data/index.d.ts +1 -0
- package/build/@types/ocm/components/wizard/steps/staticIp/data/index.d.ts.map +1 -1
- package/build/@types/ocm/components/wizard/steps/staticIp/data/nmstateYaml.d.ts +1 -0
- package/build/@types/ocm/components/wizard/steps/staticIp/data/nmstateYaml.d.ts.map +1 -1
- package/build/@types/ocm/components/wizard/steps/staticIp/data/protocolVersion.d.ts +2 -2
- package/build/@types/ocm/components/wizard/steps/staticIp/data/protocolVersion.d.ts.map +1 -1
- package/build/@types/ocm/components/wizard/wizardComponents/ClusterWizardNavigation.d.ts +7 -0
- package/build/@types/ocm/components/wizard/wizardComponents/ClusterWizardNavigation.d.ts.map +1 -1
- package/build/cjs/common/components/clusterWizard/ClusterWizardStep.css +9 -0
- package/build/cjs/common/config/constants.js +1 -0
- package/build/cjs/common/config/constants.js.map +1 -1
- package/build/cjs/common/validationSchemas/addressValidation.js +2 -2
- package/build/cjs/common/validationSchemas/addressValidation.js.map +1 -1
- package/build/cjs/ocm/components/wizard/NewClusterWizard.js +4 -0
- package/build/cjs/ocm/components/wizard/NewClusterWizard.js.map +1 -1
- package/build/cjs/ocm/components/wizard/clusterWizardContext/ClusterWizardContextProvider.js +62 -62
- package/build/cjs/ocm/components/wizard/clusterWizardContext/ClusterWizardContextProvider.js.map +1 -1
- package/build/cjs/ocm/components/wizard/clusterWizardContext/utils.js +61 -0
- package/build/cjs/ocm/components/wizard/clusterWizardContext/utils.js.map +1 -0
- package/build/cjs/ocm/components/wizard/steps/clusterDetails/ClusterDetailsForm.js +1 -2
- package/build/cjs/ocm/components/wizard/steps/clusterDetails/ClusterDetailsForm.js.map +1 -1
- package/build/cjs/ocm/components/wizard/steps/disconnected/BasicStep.js +95 -7
- package/build/cjs/ocm/components/wizard/steps/disconnected/BasicStep.js.map +1 -1
- package/build/cjs/ocm/components/wizard/steps/disconnected/DisconnectedReviewStep.js +20 -9
- package/build/cjs/ocm/components/wizard/steps/disconnected/DisconnectedReviewStep.js.map +1 -1
- package/build/cjs/ocm/components/wizard/steps/disconnected/DisconnectedStaticIp.js +26 -0
- package/build/cjs/ocm/components/wizard/steps/disconnected/DisconnectedStaticIp.js.map +1 -0
- package/build/cjs/ocm/components/wizard/steps/disconnected/InstallDisconnectedSwitch.js +1 -1
- package/build/cjs/ocm/components/wizard/steps/disconnected/InstallDisconnectedSwitch.js.map +1 -1
- package/build/cjs/ocm/components/wizard/steps/disconnected/OptionalConfigurationsStep.js +87 -56
- package/build/cjs/ocm/components/wizard/steps/disconnected/OptionalConfigurationsStep.js.map +1 -1
- package/build/cjs/ocm/components/wizard/steps/disconnected/index.js +1 -0
- package/build/cjs/ocm/components/wizard/steps/disconnected/index.js.map +1 -1
- package/build/cjs/ocm/components/wizard/steps/staticIp/StaticIp.js.map +1 -1
- package/build/cjs/ocm/components/wizard/steps/staticIp/commonValidationSchemas.js +49 -12
- package/build/cjs/ocm/components/wizard/steps/staticIp/commonValidationSchemas.js.map +1 -1
- package/build/cjs/ocm/components/wizard/steps/staticIp/components/FormViewNetworkWide/FormViewNetworkWide.js +13 -4
- package/build/cjs/ocm/components/wizard/steps/staticIp/components/FormViewNetworkWide/FormViewNetworkWide.js.map +1 -1
- package/build/cjs/ocm/components/wizard/steps/staticIp/components/FormViewNetworkWide/FormViewNetworkWideFields.js +96 -4
- package/build/cjs/ocm/components/wizard/steps/staticIp/components/FormViewNetworkWide/FormViewNetworkWideFields.js.map +1 -1
- package/build/cjs/ocm/components/wizard/steps/staticIp/components/FormViewNetworkWide/disconnectedNetworkWideValidationSchema.js +70 -0
- package/build/cjs/ocm/components/wizard/steps/staticIp/components/FormViewNetworkWide/disconnectedNetworkWideValidationSchema.js.map +1 -0
- package/build/cjs/ocm/components/wizard/steps/staticIp/components/FormViewNetworkWide/formViewNetworkWideValidationSchema.js +19 -9
- package/build/cjs/ocm/components/wizard/steps/staticIp/components/FormViewNetworkWide/formViewNetworkWideValidationSchema.js.map +1 -1
- package/build/cjs/ocm/components/wizard/steps/staticIp/components/StaticIpPage.js +8 -2
- package/build/cjs/ocm/components/wizard/steps/staticIp/components/StaticIpPage.js.map +1 -1
- package/build/cjs/ocm/components/wizard/steps/staticIp/data/disconnectedNetworkWide.js +55 -0
- package/build/cjs/ocm/components/wizard/steps/staticIp/data/disconnectedNetworkWide.js.map +1 -0
- package/build/cjs/ocm/components/wizard/steps/staticIp/data/formDataFromInfraEnvField.js +5 -1
- package/build/cjs/ocm/components/wizard/steps/staticIp/data/formDataFromInfraEnvField.js.map +1 -1
- package/build/cjs/ocm/components/wizard/steps/staticIp/data/fromInfraEnv.js +48 -1
- package/build/cjs/ocm/components/wizard/steps/staticIp/data/fromInfraEnv.js.map +1 -1
- package/build/cjs/ocm/components/wizard/steps/staticIp/data/index.js +1 -0
- package/build/cjs/ocm/components/wizard/steps/staticIp/data/index.js.map +1 -1
- package/build/cjs/ocm/components/wizard/steps/staticIp/data/nmstateYaml.js +12 -1
- package/build/cjs/ocm/components/wizard/steps/staticIp/data/nmstateYaml.js.map +1 -1
- package/build/cjs/ocm/components/wizard/steps/staticIp/data/protocolVersion.js +9 -7
- package/build/cjs/ocm/components/wizard/steps/staticIp/data/protocolVersion.js.map +1 -1
- package/build/cjs/ocm/components/wizard/wizardComponents/ClusterWizardNavigation.js +31 -20
- package/build/cjs/ocm/components/wizard/wizardComponents/ClusterWizardNavigation.js.map +1 -1
- package/lib/common/components/clusterWizard/ClusterWizardStep.css +9 -0
- package/lib/common/config/constants.ts +1 -0
- package/lib/common/validationSchemas/_validationSchemas.test.ts +1 -1
- package/lib/common/validationSchemas/addressValidation.tsx +2 -2
- package/lib/ocm/components/wizard/NewClusterWizard.tsx +5 -0
- package/lib/ocm/components/wizard/clusterWizardContext/ClusterWizardContextProvider.tsx +63 -85
- package/lib/ocm/components/wizard/clusterWizardContext/utils.ts +73 -0
- package/lib/ocm/components/wizard/steps/clusterDetails/ClusterDetailsForm.tsx +0 -2
- package/lib/ocm/components/wizard/steps/disconnected/BasicStep.tsx +147 -7
- package/lib/ocm/components/wizard/steps/disconnected/DisconnectedReviewStep.tsx +44 -13
- package/lib/ocm/components/wizard/steps/disconnected/DisconnectedStaticIp.tsx +29 -0
- package/lib/ocm/components/wizard/steps/disconnected/InstallDisconnectedSwitch.tsx +1 -0
- package/lib/ocm/components/wizard/steps/disconnected/OptionalConfigurationsStep.tsx +137 -69
- package/lib/ocm/components/wizard/steps/disconnected/index.tsx +1 -0
- package/lib/ocm/components/wizard/steps/staticIp/StaticIp.tsx +1 -1
- package/lib/ocm/components/wizard/steps/staticIp/commonValidationSchemas.tsx +42 -3
- package/lib/ocm/components/wizard/steps/staticIp/components/FormViewNetworkWide/FormViewNetworkWide.tsx +15 -4
- package/lib/ocm/components/wizard/steps/staticIp/components/FormViewNetworkWide/FormViewNetworkWideFields.tsx +232 -14
- package/lib/ocm/components/wizard/steps/staticIp/components/FormViewNetworkWide/disconnectedNetworkWideValidationSchema.tsx +98 -0
- package/lib/ocm/components/wizard/steps/staticIp/components/FormViewNetworkWide/formViewNetworkWideValidationSchema.tsx +14 -5
- package/lib/ocm/components/wizard/steps/staticIp/components/StaticIpPage.tsx +8 -3
- package/lib/ocm/components/wizard/steps/staticIp/data/dataTypes.ts +1 -1
- package/lib/ocm/components/wizard/steps/staticIp/data/disconnectedNetworkWide.ts +81 -0
- package/lib/ocm/components/wizard/steps/staticIp/data/formDataFromInfraEnvField.ts +6 -2
- package/lib/ocm/components/wizard/steps/staticIp/data/fromInfraEnv.ts +57 -2
- package/lib/ocm/components/wizard/steps/staticIp/data/index.tsx +1 -0
- package/lib/ocm/components/wizard/steps/staticIp/data/nmstateYaml.ts +16 -0
- package/lib/ocm/components/wizard/steps/staticIp/data/protocolVersion.ts +9 -7
- package/lib/ocm/components/wizard/utils/_wizardTransition.test.ts +60 -1
- package/lib/ocm/components/wizard/wizardComponents/ClusterWizardNavigation.tsx +39 -16
- package/package.json +3 -3
|
@@ -1,10 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ClusterWizardNavigation = void 0;
|
|
3
|
+
exports.ClusterWizardNavigation = exports.getWizardNavEntries = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
6
|
const react_core_1 = require("@patternfly/react-core");
|
|
7
7
|
const wizardTransition_1 = require("../utils/wizardTransition");
|
|
8
|
+
const getWizardNavEntries = (wizardStepIds) => {
|
|
9
|
+
const entries = [];
|
|
10
|
+
let i = 0;
|
|
11
|
+
let visualNumber = 1;
|
|
12
|
+
while (i < wizardStepIds.length) {
|
|
13
|
+
const stepId = wizardStepIds[i];
|
|
14
|
+
if (stepId === 'static-ip-network-wide-configurations') {
|
|
15
|
+
entries.push({ stepId, visualNumber, isStaticIpFormGroup: true });
|
|
16
|
+
i += 2;
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
entries.push({ stepId, visualNumber, isStaticIpFormGroup: false });
|
|
20
|
+
i += 1;
|
|
21
|
+
}
|
|
22
|
+
visualNumber += 1;
|
|
23
|
+
}
|
|
24
|
+
return entries;
|
|
25
|
+
};
|
|
26
|
+
exports.getWizardNavEntries = getWizardNavEntries;
|
|
8
27
|
const ClusterWizardContext_1 = require("../clusterWizardContext/ClusterWizardContext");
|
|
9
28
|
const constants_1 = require("../constants");
|
|
10
29
|
const WizardNavItem_1 = tslib_1.__importDefault(require("../../../../common/components/ui/WizardNavItem"));
|
|
@@ -39,31 +58,23 @@ const ClusterWizardNavigation = ({ cluster }) => {
|
|
|
39
58
|
const isStepDisabled = (idx, stepId) => {
|
|
40
59
|
return stepId === 'cluster-details' ? false : isStepIdxAfterCurrent(idx);
|
|
41
60
|
};
|
|
42
|
-
const getNavItem = (idx, stepId) => {
|
|
43
|
-
return (react_1.default.createElement(WizardNavItem_1.default, { stepIndex: idx, key: stepId, id: `wizard-nv-${stepId}`, content: constants_1.wizardStepNames[stepId], onClick: () => clusterWizardContext.setCurrentStepId(stepId), isCurrent: clusterWizardContext.currentStepId === stepId, isDisabled: isStepDisabled(idx, stepId), isValid: () => isStepValid(stepId, cluster), "data-testid": `cluster-wizard-nav-item-${stepId}` }));
|
|
61
|
+
const getNavItem = (idx, stepId, visualNumber) => {
|
|
62
|
+
return (react_1.default.createElement(WizardNavItem_1.default, { stepIndex: idx, key: stepId, id: `wizard-nv-${stepId}`, content: constants_1.wizardStepNames[stepId], onClick: () => clusterWizardContext.setCurrentStepId(stepId), isCurrent: clusterWizardContext.currentStepId === stepId, isDisabled: isStepDisabled(idx, stepId), isValid: () => isStepValid(stepId, cluster), "data-testid": `cluster-wizard-nav-item-${stepId}`, style: { '--cluster-wizard-step-number': `"${visualNumber}"` } }));
|
|
44
63
|
};
|
|
45
|
-
const getStaticIpFormViewNavItem = (idx) => {
|
|
46
|
-
return (react_1.default.createElement(WizardNavItem_1.default, { stepIndex: idx, isExpandable: true, content: "Static network configurations", key: "static-network-configuration-form-view", isCurrent: (0, wizardTransition_1.isStaticIpStep)(clusterWizardContext.currentStepId), isDisabled: isStepIdxAfterCurrent(idx), "data-testid": `cluster-wizard-nav-item-static-network-configuration-form-view` },
|
|
64
|
+
const getStaticIpFormViewNavItem = (idx, visualNumber) => {
|
|
65
|
+
return (react_1.default.createElement(WizardNavItem_1.default, { stepIndex: idx, isExpandable: true, content: "Static network configurations", key: "static-network-configuration-form-view", isCurrent: (0, wizardTransition_1.isStaticIpStep)(clusterWizardContext.currentStepId), isDisabled: isStepIdxAfterCurrent(idx), "data-testid": `cluster-wizard-nav-item-static-network-configuration-form-view`, style: { '--cluster-wizard-step-number': `"${visualNumber}"` } },
|
|
47
66
|
react_1.default.createElement(react_core_1.WizardNav, { isInnerList: true, "data-testid": "cluster-wizard-nav-item-static-network-configuration-form-view-inner-list" }, constants_1.staticIpFormViewSubSteps.map((stepId, subIdx) => {
|
|
48
|
-
return getNavItem(idx + subIdx, stepId);
|
|
67
|
+
return getNavItem(idx + subIdx, stepId, visualNumber);
|
|
49
68
|
}))));
|
|
50
69
|
};
|
|
51
70
|
const getWizardNavItems = () => {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
if (stepId !== 'static-ip-network-wide-configurations') {
|
|
57
|
-
navItems.push(getNavItem(i, stepId));
|
|
58
|
-
i += 1;
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
navItems.push(getStaticIpFormViewNavItem(i));
|
|
62
|
-
//skip iteration on form view sub steps
|
|
63
|
-
i += 2;
|
|
71
|
+
return (0, exports.getWizardNavEntries)(clusterWizardContext.wizardStepIds).map((entry) => {
|
|
72
|
+
const idx = clusterWizardContext.wizardStepIds.indexOf(entry.stepId);
|
|
73
|
+
if (entry.isStaticIpFormGroup) {
|
|
74
|
+
return getStaticIpFormViewNavItem(idx, entry.visualNumber);
|
|
64
75
|
}
|
|
65
|
-
|
|
66
|
-
|
|
76
|
+
return getNavItem(idx, entry.stepId, entry.visualNumber);
|
|
77
|
+
});
|
|
67
78
|
};
|
|
68
79
|
return react_1.default.createElement(react_core_1.WizardNav, { "data-testid": "cluster-wizard-nav" }, getWizardNavItems());
|
|
69
80
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClusterWizardNavigation.js","sourceRoot":"","sources":["../../../../../../lib/ocm/components/wizard/wizardComponents/ClusterWizardNavigation.tsx"],"names":[],"mappings":";;;;AAAA,0DAAyC;AACzC,uDAAmD;AACnD,gEAOmC;
|
|
1
|
+
{"version":3,"file":"ClusterWizardNavigation.js","sourceRoot":"","sources":["../../../../../../lib/ocm/components/wizard/wizardComponents/ClusterWizardNavigation.tsx"],"names":[],"mappings":"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"}
|
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
white-space: nowrap;
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
+
/* PatternFly CSS counters do not re-sequence when nav items are added or removed */
|
|
6
|
+
.cluster-wizard-step
|
|
7
|
+
.pf-v6-c-wizard__nav
|
|
8
|
+
> .pf-v6-c-wizard__nav-list
|
|
9
|
+
> .pf-v6-c-wizard__nav-item
|
|
10
|
+
> .pf-v6-c-wizard__nav-link::before {
|
|
11
|
+
content: var(--cluster-wizard-step-number, counter(wizard-nav-count));
|
|
12
|
+
}
|
|
13
|
+
|
|
5
14
|
.wizard-nav-item-warning-icon {
|
|
6
15
|
margin-left: var(--pf-v6-global--spacer--sm);
|
|
7
16
|
}
|
|
@@ -131,6 +131,7 @@ describe('validationSchemas', () => {
|
|
|
131
131
|
|
|
132
132
|
test('ipValidationSchema', async () => {
|
|
133
133
|
const valid = [
|
|
134
|
+
'',
|
|
134
135
|
'1.1.1.1',
|
|
135
136
|
'0.0.0.0',
|
|
136
137
|
'255.255.255.255',
|
|
@@ -139,7 +140,6 @@ describe('validationSchemas', () => {
|
|
|
139
140
|
'::',
|
|
140
141
|
];
|
|
141
142
|
const invalid = [
|
|
142
|
-
'',
|
|
143
143
|
'1.1.1.1.',
|
|
144
144
|
'1.1.1',
|
|
145
145
|
'1.1.1.',
|
|
@@ -17,13 +17,13 @@ export const ipValidationSchema = (t: TFunction) =>
|
|
|
17
17
|
Yup.string().test(
|
|
18
18
|
'ip-validation',
|
|
19
19
|
t('ai:Not a valid IP address'),
|
|
20
|
-
(value?: string) => Address4.isValid(value
|
|
20
|
+
(value?: string) => !value || Address4.isValid(value) || Address6.isValid(value),
|
|
21
21
|
);
|
|
22
22
|
|
|
23
23
|
export const ipNoSuffixValidationSchema = (t: TFunction) =>
|
|
24
24
|
Yup.string().test('ip-validation-no-suffix', t('ai:Not a valid IP address'), (value?: string) => {
|
|
25
25
|
if (!value) return true;
|
|
26
|
-
const address = getAddress(value
|
|
26
|
+
const address = getAddress(value);
|
|
27
27
|
return !!address && address.address === address.addressMinusSuffix;
|
|
28
28
|
});
|
|
29
29
|
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
BasicStep,
|
|
9
9
|
OptionalConfigurationsStep,
|
|
10
10
|
DisconnectedReviewStep,
|
|
11
|
+
DisconnectedStaticIp,
|
|
11
12
|
} from './steps';
|
|
12
13
|
import { useClusterWizardContext } from './clusterWizardContext';
|
|
13
14
|
import { ClusterWizardStepsType } from './utils';
|
|
@@ -20,6 +21,10 @@ const getCurrentStep = (currentStepId: ClusterWizardStepsType, infraEnv?: InfraE
|
|
|
20
21
|
return <OptionalConfigurationsStep />;
|
|
21
22
|
case 'disconnected-basic':
|
|
22
23
|
return <BasicStep />;
|
|
24
|
+
case 'static-ip-yaml-view':
|
|
25
|
+
case 'static-ip-network-wide-configurations':
|
|
26
|
+
case 'static-ip-host-configurations':
|
|
27
|
+
return <DisconnectedStaticIp />;
|
|
23
28
|
default:
|
|
24
29
|
return <ClusterDetails infraEnv={infraEnv} />;
|
|
25
30
|
}
|
|
@@ -1,76 +1,26 @@
|
|
|
1
1
|
import React, { PropsWithChildren } from 'react';
|
|
2
2
|
import { useLocation } from 'react-router';
|
|
3
|
-
import {
|
|
3
|
+
import { AlertVariant } from '@patternfly/react-core';
|
|
4
|
+
import { Cluster, InfraEnv } from '@openshift-assisted/types/assisted-installer-service';
|
|
5
|
+
|
|
6
|
+
import { useAlerts, AssistedInstallerOCMPermissionTypesListType } from '../../../../common';
|
|
7
|
+
import { isThirdPartyCNI } from '../../../../common/types/networkType';
|
|
8
|
+
import { useFeature, useUISettings } from '../../../hooks';
|
|
9
|
+
import useSetClusterPermissions from '../../../hooks/useSetClusterPermissions';
|
|
10
|
+
import { HostsNetworkConfigurationType } from '../../../services';
|
|
11
|
+
import { isOciPlatformType } from '../../utils';
|
|
12
|
+
import { StaticIpView } from '../steps/staticIp/data/dataTypes';
|
|
13
|
+
import { getStaticIpInfo } from '../steps/staticIp/data/fromInfraEnv';
|
|
4
14
|
import {
|
|
5
|
-
ClusterWizardFlowStateType,
|
|
6
15
|
ClusterWizardStepsType,
|
|
16
|
+
ClusterWizardFlowStateType,
|
|
7
17
|
disconnectedSteps,
|
|
8
18
|
getClusterWizardFirstStep,
|
|
9
|
-
isStaticIpStep,
|
|
10
19
|
isStepAfter,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import useSetClusterPermissions from '../../../hooks/useSetClusterPermissions';
|
|
16
|
-
import { Cluster, InfraEnv } from '@openshift-assisted/types/assisted-installer-service';
|
|
17
|
-
import { useUISettings } from '../../../hooks';
|
|
18
|
-
import { AlertVariant } from '@patternfly/react-core';
|
|
19
|
-
import { useFeature } from '../../../hooks/use-feature';
|
|
20
|
-
import { isThirdPartyCNI } from '../../../../common/types/networkType';
|
|
21
|
-
import { isOciPlatformType } from '../../utils';
|
|
22
|
-
import { StaticIpView, getStaticIpInfo } from '../steps/staticIp/data';
|
|
23
|
-
|
|
24
|
-
const addStepToClusterWizard = (
|
|
25
|
-
wizardStepIds: ClusterWizardStepsType[],
|
|
26
|
-
addAfterStep: ClusterWizardStepsType,
|
|
27
|
-
itemsToAdd: ClusterWizardStepsType[],
|
|
28
|
-
) => {
|
|
29
|
-
const stepsIds = [...wizardStepIds];
|
|
30
|
-
const referencePosition = stepsIds.findIndex((step) => step === addAfterStep);
|
|
31
|
-
const found = wizardStepIds.filter((step) => step === itemsToAdd[0]);
|
|
32
|
-
if (referencePosition !== -1 && found.length === 0) {
|
|
33
|
-
stepsIds.splice(referencePosition + 1, 0, ...itemsToAdd);
|
|
34
|
-
}
|
|
35
|
-
return stepsIds;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const removeStepFromClusterWizard = (
|
|
39
|
-
wizardStepIds: ClusterWizardStepsType[],
|
|
40
|
-
itemToRemove: ClusterWizardStepsType,
|
|
41
|
-
numberItemsToRemove: number,
|
|
42
|
-
) => {
|
|
43
|
-
const stepsIds = [...wizardStepIds];
|
|
44
|
-
const position = stepsIds.findIndex((step) => step === itemToRemove);
|
|
45
|
-
if (position !== -1) {
|
|
46
|
-
stepsIds.splice(position, numberItemsToRemove);
|
|
47
|
-
}
|
|
48
|
-
return stepsIds;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
const getWizardStepIds = (
|
|
52
|
-
wizardStepIds: ClusterWizardStepsType[] | undefined,
|
|
53
|
-
staticIpView?: StaticIpView | 'dhcp-selected',
|
|
54
|
-
|
|
55
|
-
isSingleClusterFeatureEnabled?: boolean,
|
|
56
|
-
): ClusterWizardStepsType[] => {
|
|
57
|
-
let stepsCopy = wizardStepIds ? [...wizardStepIds] : [...defaultWizardSteps];
|
|
58
|
-
if (staticIpView === StaticIpView.YAML) {
|
|
59
|
-
stepsCopy = removeStepFromClusterWizard(stepsCopy, 'static-ip-network-wide-configurations', 2);
|
|
60
|
-
stepsCopy = addStepToClusterWizard(stepsCopy, 'cluster-details', ['static-ip-yaml-view']);
|
|
61
|
-
} else if (staticIpView === StaticIpView.FORM) {
|
|
62
|
-
stepsCopy = removeStepFromClusterWizard(stepsCopy, 'static-ip-yaml-view', 1);
|
|
63
|
-
stepsCopy = addStepToClusterWizard(stepsCopy, 'cluster-details', staticIpFormViewSubSteps);
|
|
64
|
-
} else if (staticIpView === 'dhcp-selected') {
|
|
65
|
-
stepsCopy = removeStepFromClusterWizard(stepsCopy, 'static-ip-network-wide-configurations', 2);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if (isSingleClusterFeatureEnabled && !stepsCopy.includes('credentials-download')) {
|
|
69
|
-
stepsCopy = addStepToClusterWizard(stepsCopy, 'custom-manifests', ['credentials-download']);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return stepsCopy;
|
|
73
|
-
};
|
|
20
|
+
isStaticIpStep,
|
|
21
|
+
} from '../utils';
|
|
22
|
+
import { ClusterWizardContextType, ClusterWizardContext } from './ClusterWizardContext';
|
|
23
|
+
import { getDisconnectedWizardStepIds, getWizardStepIds } from './utils';
|
|
74
24
|
|
|
75
25
|
export const ClusterWizardContextProvider = ({
|
|
76
26
|
children,
|
|
@@ -89,6 +39,8 @@ export const ClusterWizardContextProvider = ({
|
|
|
89
39
|
const [installDisconnected, setInstallDisconnected] = React.useState(false);
|
|
90
40
|
const [disconnectedCluster, setDisconnectedCluster] = React.useState<Cluster | undefined>();
|
|
91
41
|
const [disconnectedInfraEnv, setDisconnectedInfraEnv] = React.useState<InfraEnv | undefined>();
|
|
42
|
+
const [disconnectedWizardStepIds, setDisconnectedWizardStepIds] =
|
|
43
|
+
React.useState<ClusterWizardStepsType[]>(disconnectedSteps);
|
|
92
44
|
const location = useLocation();
|
|
93
45
|
const locationState = location.state as ClusterWizardFlowStateType | undefined;
|
|
94
46
|
const {
|
|
@@ -100,7 +52,7 @@ export const ClusterWizardContextProvider = ({
|
|
|
100
52
|
const { clearAlerts, addAlert, alerts } = useAlerts();
|
|
101
53
|
const setClusterPermissions = useSetClusterPermissions();
|
|
102
54
|
|
|
103
|
-
const wizardStepIds = installDisconnected ?
|
|
55
|
+
const wizardStepIds = installDisconnected ? disconnectedWizardStepIds : connectedWizardStepIds;
|
|
104
56
|
|
|
105
57
|
React.useEffect(() => {
|
|
106
58
|
if (!UISettingsLoading) {
|
|
@@ -158,17 +110,26 @@ export const ClusterWizardContextProvider = ({
|
|
|
158
110
|
|
|
159
111
|
const handleMoveFromStaticIp = () => {
|
|
160
112
|
//if static ip view change wasn't persisted, moving from static ip step should change the wizard steps to match the view in the infra env
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
113
|
+
if (installDisconnected) {
|
|
114
|
+
const staticIpInfo = disconnectedInfraEnv
|
|
115
|
+
? getStaticIpInfo(disconnectedInfraEnv)
|
|
116
|
+
: undefined;
|
|
117
|
+
if (!staticIpInfo) {
|
|
118
|
+
throw `Wizard step is currently ${currentStepId}, but no static ip info is defined`;
|
|
119
|
+
}
|
|
120
|
+
setDisconnectedWizardStepIds(getDisconnectedWizardStepIds(staticIpInfo.view));
|
|
121
|
+
} else {
|
|
122
|
+
const staticIpInfo = infraEnv ? getStaticIpInfo(infraEnv) : undefined;
|
|
123
|
+
if (!staticIpInfo) {
|
|
124
|
+
throw `Wizard step is currently ${currentStepId}, but no static ip info is defined`;
|
|
125
|
+
}
|
|
126
|
+
const newStepIds = getWizardStepIds(
|
|
127
|
+
wizardStepIds,
|
|
128
|
+
staticIpInfo.view,
|
|
129
|
+
isSingleClusterFeatureEnabled,
|
|
130
|
+
);
|
|
131
|
+
setWizardStepIds(newStepIds);
|
|
164
132
|
}
|
|
165
|
-
|
|
166
|
-
const newStepIds = getWizardStepIds(
|
|
167
|
-
wizardStepIds,
|
|
168
|
-
staticIpInfo.view,
|
|
169
|
-
isSingleClusterFeatureEnabled,
|
|
170
|
-
);
|
|
171
|
-
setWizardStepIds(newStepIds);
|
|
172
133
|
};
|
|
173
134
|
|
|
174
135
|
const onSetCurrentStepId = (stepId: ClusterWizardStepsType) => {
|
|
@@ -200,17 +161,33 @@ export const ClusterWizardContextProvider = ({
|
|
|
200
161
|
} else {
|
|
201
162
|
setCurrentStepId('static-ip-network-wide-configurations');
|
|
202
163
|
}
|
|
203
|
-
|
|
164
|
+
if (installDisconnected) {
|
|
165
|
+
setDisconnectedWizardStepIds(getDisconnectedWizardStepIds(view));
|
|
166
|
+
} else {
|
|
167
|
+
setWizardStepIds(getWizardStepIds(wizardStepIds, view, isSingleClusterFeatureEnabled));
|
|
168
|
+
}
|
|
204
169
|
},
|
|
205
170
|
onUpdateHostNetworkConfigType(type: HostsNetworkConfigurationType): void {
|
|
206
|
-
if (
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
171
|
+
if (installDisconnected) {
|
|
172
|
+
if (type === HostsNetworkConfigurationType.STATIC) {
|
|
173
|
+
const staticIpInfo = disconnectedInfraEnv
|
|
174
|
+
? getStaticIpInfo(disconnectedInfraEnv)
|
|
175
|
+
: undefined;
|
|
176
|
+
const view = staticIpInfo?.view ?? StaticIpView.FORM;
|
|
177
|
+
setDisconnectedWizardStepIds(getDisconnectedWizardStepIds(view));
|
|
178
|
+
} else {
|
|
179
|
+
setDisconnectedWizardStepIds(getDisconnectedWizardStepIds('dhcp-selected'));
|
|
180
|
+
}
|
|
210
181
|
} else {
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
182
|
+
if (type === HostsNetworkConfigurationType.STATIC) {
|
|
183
|
+
const staticIpInfo = infraEnv ? getStaticIpInfo(infraEnv) : undefined;
|
|
184
|
+
const view = staticIpInfo?.view ?? StaticIpView.FORM;
|
|
185
|
+
setWizardStepIds(getWizardStepIds(wizardStepIds, view, isSingleClusterFeatureEnabled));
|
|
186
|
+
} else {
|
|
187
|
+
setWizardStepIds(
|
|
188
|
+
getWizardStepIds(wizardStepIds, 'dhcp-selected', isSingleClusterFeatureEnabled),
|
|
189
|
+
);
|
|
190
|
+
}
|
|
214
191
|
}
|
|
215
192
|
},
|
|
216
193
|
wizardStepIds: wizardStepIds,
|
|
@@ -224,6 +201,7 @@ export const ClusterWizardContextProvider = ({
|
|
|
224
201
|
setInstallDisconnected: (enabled: boolean) => {
|
|
225
202
|
setInstallDisconnected(enabled);
|
|
226
203
|
if (enabled) {
|
|
204
|
+
setDisconnectedWizardStepIds(disconnectedSteps);
|
|
227
205
|
onSetCurrentStepId(disconnectedSteps[0]);
|
|
228
206
|
} else {
|
|
229
207
|
connectedWizardStepIds?.length && onSetCurrentStepId(connectedWizardStepIds[0]);
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { defaultWizardSteps, staticIpFormViewSubSteps } from '../constants';
|
|
2
|
+
import { StaticIpView } from '../steps/staticIp/data/dataTypes';
|
|
3
|
+
import { ClusterWizardStepsType, disconnectedSteps } from '../utils';
|
|
4
|
+
|
|
5
|
+
export const addStepToClusterWizard = (
|
|
6
|
+
wizardStepIds: ClusterWizardStepsType[],
|
|
7
|
+
addAfterStep: ClusterWizardStepsType,
|
|
8
|
+
itemsToAdd: ClusterWizardStepsType[],
|
|
9
|
+
): ClusterWizardStepsType[] => {
|
|
10
|
+
const stepsIds = [...wizardStepIds];
|
|
11
|
+
const referencePosition = stepsIds.findIndex((step) => step === addAfterStep);
|
|
12
|
+
const found = wizardStepIds.filter((step) => step === itemsToAdd[0]);
|
|
13
|
+
if (referencePosition !== -1 && found.length === 0) {
|
|
14
|
+
stepsIds.splice(referencePosition + 1, 0, ...itemsToAdd);
|
|
15
|
+
}
|
|
16
|
+
return stepsIds;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const removeStepFromClusterWizard = (
|
|
20
|
+
wizardStepIds: ClusterWizardStepsType[],
|
|
21
|
+
itemToRemove: ClusterWizardStepsType,
|
|
22
|
+
numberItemsToRemove: number,
|
|
23
|
+
): ClusterWizardStepsType[] => {
|
|
24
|
+
const stepsIds = [...wizardStepIds];
|
|
25
|
+
const position = stepsIds.findIndex((step) => step === itemToRemove);
|
|
26
|
+
if (position !== -1) {
|
|
27
|
+
stepsIds.splice(position, numberItemsToRemove);
|
|
28
|
+
}
|
|
29
|
+
return stepsIds;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const getWizardStepIds = (
|
|
33
|
+
wizardStepIds: ClusterWizardStepsType[] | undefined,
|
|
34
|
+
staticIpView?: StaticIpView | 'dhcp-selected',
|
|
35
|
+
isSingleClusterFeatureEnabled?: boolean,
|
|
36
|
+
): ClusterWizardStepsType[] => {
|
|
37
|
+
let stepsCopy = wizardStepIds ? [...wizardStepIds] : [...defaultWizardSteps];
|
|
38
|
+
if (staticIpView === StaticIpView.YAML) {
|
|
39
|
+
stepsCopy = removeStepFromClusterWizard(stepsCopy, 'static-ip-network-wide-configurations', 2);
|
|
40
|
+
stepsCopy = addStepToClusterWizard(stepsCopy, 'cluster-details', ['static-ip-yaml-view']);
|
|
41
|
+
} else if (staticIpView === StaticIpView.FORM) {
|
|
42
|
+
stepsCopy = removeStepFromClusterWizard(stepsCopy, 'static-ip-yaml-view', 1);
|
|
43
|
+
stepsCopy = addStepToClusterWizard(stepsCopy, 'cluster-details', staticIpFormViewSubSteps);
|
|
44
|
+
} else if (staticIpView === 'dhcp-selected') {
|
|
45
|
+
stepsCopy = removeStepFromClusterWizard(stepsCopy, 'static-ip-network-wide-configurations', 2);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (isSingleClusterFeatureEnabled && !stepsCopy.includes('credentials-download')) {
|
|
49
|
+
stepsCopy = addStepToClusterWizard(stepsCopy, 'custom-manifests', ['credentials-download']);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return stepsCopy;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const getDisconnectedWizardStepIds = (
|
|
56
|
+
staticIpView?: StaticIpView | 'dhcp-selected',
|
|
57
|
+
): ClusterWizardStepsType[] => {
|
|
58
|
+
// Always rebuild from the base disconnected steps so toggling static IP / DHCP
|
|
59
|
+
// cannot leave leftover sub-steps in the list.
|
|
60
|
+
const copy = [...disconnectedSteps];
|
|
61
|
+
|
|
62
|
+
if (staticIpView === StaticIpView.YAML) {
|
|
63
|
+
return addStepToClusterWizard(copy, 'disconnected-basic', ['static-ip-yaml-view']);
|
|
64
|
+
}
|
|
65
|
+
if (staticIpView === StaticIpView.FORM) {
|
|
66
|
+
return addStepToClusterWizard(copy, 'disconnected-basic', [
|
|
67
|
+
'static-ip-network-wide-configurations',
|
|
68
|
+
'static-ip-host-configurations',
|
|
69
|
+
]);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return copy;
|
|
73
|
+
};
|
|
@@ -19,7 +19,6 @@ import {
|
|
|
19
19
|
getFormikErrorFields,
|
|
20
20
|
ClusterWizardStep,
|
|
21
21
|
ClusterWizardStepHeader,
|
|
22
|
-
TechnologyPreview,
|
|
23
22
|
isInOcm,
|
|
24
23
|
useTranslation,
|
|
25
24
|
} from '../../../../../common';
|
|
@@ -184,7 +183,6 @@ export const ClusterDetailsForm = (props: ClusterDetailsFormProps) => {
|
|
|
184
183
|
<span>
|
|
185
184
|
{t("ai:I'm installing on a disconnected/air-gapped/secured environment")}
|
|
186
185
|
</span>
|
|
187
|
-
<TechnologyPreview />
|
|
188
186
|
</Flex>
|
|
189
187
|
</GridItem>
|
|
190
188
|
)}
|
|
@@ -1,24 +1,60 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import * as Yup from 'yup';
|
|
3
|
+
import { Formik, useFormikContext } from 'formik';
|
|
4
|
+
import { AlertVariant, Grid, GridItem, Content, Flex, Form } from '@patternfly/react-core';
|
|
5
|
+
import { ImageType } from '@openshift-assisted/types/assisted-installer-service';
|
|
3
6
|
import {
|
|
4
7
|
ClusterWizardStep,
|
|
5
|
-
TechnologyPreview,
|
|
6
8
|
StaticTextField,
|
|
7
9
|
WithErrorBoundary,
|
|
10
|
+
useAlerts,
|
|
11
|
+
ClustersAPI,
|
|
12
|
+
InfraEnvsAPI,
|
|
13
|
+
handleApiError,
|
|
14
|
+
getApiErrorMessage,
|
|
15
|
+
isInOcm,
|
|
16
|
+
PullSecret,
|
|
17
|
+
pullSecretValidationSchema,
|
|
18
|
+
useTranslation,
|
|
19
|
+
getFormikErrorFields,
|
|
8
20
|
} from '../../../../../common';
|
|
21
|
+
import { usePullSecret } from '../../../../hooks';
|
|
9
22
|
import { useClusterWizardContext } from '../../clusterWizardContext';
|
|
10
23
|
import { ClusterWizardNavigation, ClusterWizardFooter } from '../../wizardComponents';
|
|
24
|
+
import { HostsNetworkConfigurationControlGroup } from '../clusterDetails/fields/HostsNetworkConfigurationControlGroup';
|
|
25
|
+
import { HostsNetworkConfigurationType } from '../../../../services/types';
|
|
26
|
+
import { getDummyInfraEnvField } from '../staticIp/data/dummyData';
|
|
27
|
+
import { getStaticNetworkConfig } from '../staticIp/data/fromInfraEnv';
|
|
11
28
|
import { InstallDisconnectedSwitch } from './InstallDisconnectedSwitch';
|
|
12
29
|
|
|
13
|
-
export const DISCONNECTED_OPENSHIFT_VERSION = '4.
|
|
30
|
+
export const DISCONNECTED_OPENSHIFT_VERSION = '4.22.13';
|
|
14
31
|
|
|
15
|
-
|
|
16
|
-
|
|
32
|
+
const DISCONNECTED_IMAGE_TYPE: ImageType = 'disconnected-iso';
|
|
33
|
+
const DISCONNECTED_CLUSTER_NAME = 'disconnected-cluster';
|
|
34
|
+
|
|
35
|
+
type BasicStepValues = {
|
|
36
|
+
hostsNetworkConfigurationType: HostsNetworkConfigurationType;
|
|
37
|
+
pullSecret: string;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const BasicStepForm: React.FC<{
|
|
41
|
+
isSubmitting: boolean;
|
|
42
|
+
defaultPullSecret?: string;
|
|
43
|
+
}> = ({ isSubmitting, defaultPullSecret }) => {
|
|
44
|
+
const { submitForm, isValid, errors, touched } = useFormikContext<BasicStepValues>();
|
|
45
|
+
const errorFields = getFormikErrorFields(errors, touched);
|
|
17
46
|
|
|
18
47
|
return (
|
|
19
48
|
<ClusterWizardStep
|
|
20
49
|
navigation={<ClusterWizardNavigation />}
|
|
21
|
-
footer={
|
|
50
|
+
footer={
|
|
51
|
+
<ClusterWizardFooter
|
|
52
|
+
onNext={() => void submitForm()}
|
|
53
|
+
isSubmitting={isSubmitting}
|
|
54
|
+
isNextDisabled={!isValid || isSubmitting}
|
|
55
|
+
errorFields={errorFields}
|
|
56
|
+
/>
|
|
57
|
+
}
|
|
22
58
|
>
|
|
23
59
|
<WithErrorBoundary title="Failed to load Basic step">
|
|
24
60
|
<Grid hasGutter>
|
|
@@ -29,7 +65,6 @@ export const BasicStep = () => {
|
|
|
29
65
|
<Flex alignItems={{ default: 'alignItemsCenter' }} gap={{ default: 'gapSm' }}>
|
|
30
66
|
<InstallDisconnectedSwitch />
|
|
31
67
|
<span>I'm installing on a disconnected/air-gapped/secured environment</span>
|
|
32
|
-
<TechnologyPreview />
|
|
33
68
|
</Flex>
|
|
34
69
|
</GridItem>
|
|
35
70
|
<GridItem>
|
|
@@ -40,6 +75,8 @@ export const BasicStep = () => {
|
|
|
40
75
|
<StaticTextField name="cpuArchitecture" label="CPU architecture">
|
|
41
76
|
x86_64
|
|
42
77
|
</StaticTextField>
|
|
78
|
+
<HostsNetworkConfigurationControlGroup clusterExists={false} isDisabled={false} />
|
|
79
|
+
{!isInOcm && <PullSecret isOcm={false} defaultPullSecret={defaultPullSecret} />}
|
|
43
80
|
</Form>
|
|
44
81
|
</GridItem>
|
|
45
82
|
</Grid>
|
|
@@ -47,3 +84,106 @@ export const BasicStep = () => {
|
|
|
47
84
|
</ClusterWizardStep>
|
|
48
85
|
);
|
|
49
86
|
};
|
|
87
|
+
|
|
88
|
+
export const BasicStep = () => {
|
|
89
|
+
const { t } = useTranslation();
|
|
90
|
+
const {
|
|
91
|
+
moveNext,
|
|
92
|
+
disconnectedCluster,
|
|
93
|
+
setDisconnectedCluster,
|
|
94
|
+
disconnectedInfraEnv,
|
|
95
|
+
setDisconnectedInfraEnv,
|
|
96
|
+
} = useClusterWizardContext();
|
|
97
|
+
const { addAlert, clearAlerts } = useAlerts();
|
|
98
|
+
const [isSubmitting, setIsSubmitting] = React.useState(false);
|
|
99
|
+
const defaultPullSecret = usePullSecret();
|
|
100
|
+
|
|
101
|
+
const validationSchema = React.useMemo(
|
|
102
|
+
() =>
|
|
103
|
+
Yup.object({
|
|
104
|
+
pullSecret: isInOcm ? Yup.string() : pullSecretValidationSchema(t),
|
|
105
|
+
}),
|
|
106
|
+
[t],
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
const initialValues: BasicStepValues = {
|
|
110
|
+
hostsNetworkConfigurationType: disconnectedInfraEnv?.staticNetworkConfig
|
|
111
|
+
? HostsNetworkConfigurationType.STATIC
|
|
112
|
+
: HostsNetworkConfigurationType.DHCP,
|
|
113
|
+
pullSecret: defaultPullSecret ?? '',
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
const handleNext = React.useCallback(
|
|
117
|
+
async (values: BasicStepValues) => {
|
|
118
|
+
clearAlerts();
|
|
119
|
+
setIsSubmitting(true);
|
|
120
|
+
try {
|
|
121
|
+
const isStatic =
|
|
122
|
+
values.hostsNetworkConfigurationType === HostsNetworkConfigurationType.STATIC;
|
|
123
|
+
let infraEnvToUse = disconnectedInfraEnv;
|
|
124
|
+
|
|
125
|
+
if (!disconnectedCluster?.id || !infraEnvToUse?.id) {
|
|
126
|
+
const { data: cluster } = await ClustersAPI.registerDisconnected({
|
|
127
|
+
name: DISCONNECTED_CLUSTER_NAME,
|
|
128
|
+
openshiftVersion: DISCONNECTED_OPENSHIFT_VERSION,
|
|
129
|
+
});
|
|
130
|
+
setDisconnectedCluster(cluster);
|
|
131
|
+
|
|
132
|
+
const pullSecret = isInOcm ? defaultPullSecret ?? '' : values.pullSecret;
|
|
133
|
+
const { data: createdInfraEnv } = await InfraEnvsAPI.register({
|
|
134
|
+
name: 'disconnected-infra-env',
|
|
135
|
+
pullSecret,
|
|
136
|
+
clusterId: cluster.id,
|
|
137
|
+
imageType: DISCONNECTED_IMAGE_TYPE,
|
|
138
|
+
openshiftVersion: DISCONNECTED_OPENSHIFT_VERSION,
|
|
139
|
+
staticNetworkConfig: isStatic ? getDummyInfraEnvField() : undefined,
|
|
140
|
+
});
|
|
141
|
+
infraEnvToUse = createdInfraEnv;
|
|
142
|
+
} else {
|
|
143
|
+
const staticNetworkConfig = isStatic
|
|
144
|
+
? getStaticNetworkConfig(infraEnvToUse) ?? getDummyInfraEnvField()
|
|
145
|
+
: [];
|
|
146
|
+
const { data: updatedInfraEnv } = await InfraEnvsAPI.update(infraEnvToUse.id, {
|
|
147
|
+
staticNetworkConfig,
|
|
148
|
+
});
|
|
149
|
+
infraEnvToUse = updatedInfraEnv;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
setDisconnectedInfraEnv(infraEnvToUse);
|
|
153
|
+
moveNext();
|
|
154
|
+
} catch (error) {
|
|
155
|
+
handleApiError(error, () => {
|
|
156
|
+
addAlert({
|
|
157
|
+
title: 'Failed to save basic information',
|
|
158
|
+
message: getApiErrorMessage(error),
|
|
159
|
+
variant: AlertVariant.danger,
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
} finally {
|
|
163
|
+
setIsSubmitting(false);
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
[
|
|
167
|
+
clearAlerts,
|
|
168
|
+
defaultPullSecret,
|
|
169
|
+
disconnectedCluster,
|
|
170
|
+
disconnectedInfraEnv,
|
|
171
|
+
setDisconnectedCluster,
|
|
172
|
+
setDisconnectedInfraEnv,
|
|
173
|
+
addAlert,
|
|
174
|
+
moveNext,
|
|
175
|
+
],
|
|
176
|
+
);
|
|
177
|
+
|
|
178
|
+
return (
|
|
179
|
+
<Formik<BasicStepValues>
|
|
180
|
+
initialValues={initialValues}
|
|
181
|
+
validationSchema={validationSchema}
|
|
182
|
+
onSubmit={(values) => void handleNext(values)}
|
|
183
|
+
>
|
|
184
|
+
<BasicStepForm isSubmitting={isSubmitting} defaultPullSecret={defaultPullSecret} />
|
|
185
|
+
</Formik>
|
|
186
|
+
);
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
export default BasicStep;
|