@openshift-assisted/ui-lib 2.50.0 → 2.50.1
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/api/assisted-service/ClustersAPI.d.ts +0 -4
- package/build/@types/common/api/assisted-service/ClustersAPI.d.ts.map +1 -1
- package/build/@types/common/components/clusterWizard/clusterDetailsValidation.d.ts.map +1 -1
- package/build/@types/common/components/clusterWizard/networkingSteps/VirtualIPControlGroup.d.ts.map +1 -1
- package/build/@types/common/components/ui/OpenShiftVersionModal.d.ts.map +1 -1
- package/build/@types/common/components/ui/formik/PullSecretField.d.ts.map +1 -1
- package/build/@types/common/config/constants.d.ts.map +1 -1
- package/build/@types/common/validationSchemas/addressValidation.d.ts.map +1 -1
- package/build/@types/common/validationSchemas/clusterDetailsValidation.d.ts +0 -5
- package/build/@types/common/validationSchemas/clusterDetailsValidation.d.ts.map +1 -1
- package/build/@types/ocm/components/Routes.d.ts.map +1 -1
- package/build/@types/ocm/components/clusterConfiguration/DiscoveryImageTypeDropdown.d.ts.map +1 -1
- package/build/@types/ocm/components/clusterConfiguration/OcmDiscoveryImageConfigForm.d.ts +2 -2
- package/build/@types/ocm/components/clusterConfiguration/OcmDiscoveryImageConfigForm.d.ts.map +1 -1
- package/build/@types/ocm/components/clusterConfiguration/networkConfiguration/NetworkConfigurationForm.d.ts.map +1 -1
- package/build/@types/ocm/components/clusterWizard/ClusterWizardContext.d.ts +0 -9
- package/build/@types/ocm/components/clusterWizard/ClusterWizardContext.d.ts.map +1 -1
- package/build/@types/ocm/components/clusterWizard/ClusterWizardContextProvider.d.ts.map +1 -1
- package/build/@types/ocm/components/clusterWizard/ClusterWizardFooter.d.ts +1 -2
- package/build/@types/ocm/components/clusterWizard/ClusterWizardFooter.d.ts.map +1 -1
- package/build/@types/ocm/components/clusterWizard/NewClusterWizard.d.ts.map +1 -1
- package/build/@types/ocm/components/clusterWizard/constants.d.ts.map +1 -1
- package/build/@types/ocm/components/clusterWizard/disconnected/BasicStep.d.ts.map +1 -1
- package/build/@types/ocm/components/clusterWizard/disconnected/ReviewStep.d.ts.map +1 -1
- package/build/@types/ocm/components/clusterWizard/index.d.ts +0 -1
- package/build/@types/ocm/components/clusterWizard/index.d.ts.map +1 -1
- package/build/@types/ocm/components/clusterWizard/wizardTransition.d.ts +1 -1
- package/build/@types/ocm/components/clusterWizard/wizardTransition.d.ts.map +1 -1
- package/build/@types/ocm/services/ClustersService.d.ts +0 -4
- package/build/@types/ocm/services/ClustersService.d.ts.map +1 -1
- package/build/@types/ocm/services/InfraEnvsService.d.ts.map +1 -1
- package/build/cjs/common/api/assisted-service/ClustersAPI.js +0 -3
- package/build/cjs/common/api/assisted-service/ClustersAPI.js.map +1 -1
- package/build/cjs/common/components/clusterWizard/clusterDetailsValidation.js +8 -17
- package/build/cjs/common/components/clusterWizard/clusterDetailsValidation.js.map +1 -1
- package/build/cjs/common/components/clusterWizard/networkingSteps/VirtualIPControlGroup.js +2 -2
- package/build/cjs/common/components/clusterWizard/networkingSteps/VirtualIPControlGroup.js.map +1 -1
- package/build/cjs/common/components/ui/OpenShiftVersionModal.js +1 -3
- package/build/cjs/common/components/ui/OpenShiftVersionModal.js.map +1 -1
- package/build/cjs/common/components/ui/WizardFooter.js +1 -1
- package/build/cjs/common/components/ui/WizardFooter.js.map +1 -1
- package/build/cjs/common/components/ui/formik/PullSecretField.js.map +1 -1
- package/build/cjs/common/config/constants.js +0 -1
- package/build/cjs/common/config/constants.js.map +1 -1
- package/build/cjs/common/validationSchemas/addressValidation.js +16 -4
- package/build/cjs/common/validationSchemas/addressValidation.js.map +1 -1
- package/build/cjs/common/validationSchemas/clusterDetailsValidation.js +2 -31
- package/build/cjs/common/validationSchemas/clusterDetailsValidation.js.map +1 -1
- package/build/cjs/ocm/components/Routes.js +1 -2
- package/build/cjs/ocm/components/Routes.js.map +1 -1
- package/build/cjs/ocm/components/clusterConfiguration/DiscoveryImageTypeDropdown.js +0 -1
- package/build/cjs/ocm/components/clusterConfiguration/DiscoveryImageTypeDropdown.js.map +1 -1
- package/build/cjs/ocm/components/clusterConfiguration/OcmDiscoveryImageConfigForm.js +1 -1
- package/build/cjs/ocm/components/clusterConfiguration/OcmDiscoveryImageConfigForm.js.map +1 -1
- package/build/cjs/ocm/components/clusterConfiguration/networkConfiguration/NetworkConfigurationForm.js +5 -2
- package/build/cjs/ocm/components/clusterConfiguration/networkConfiguration/NetworkConfigurationForm.js.map +1 -1
- package/build/cjs/ocm/components/clusterWizard/ClusterWizardContext.js.map +1 -1
- package/build/cjs/ocm/components/clusterWizard/ClusterWizardContextProvider.js +9 -69
- package/build/cjs/ocm/components/clusterWizard/ClusterWizardContextProvider.js.map +1 -1
- package/build/cjs/ocm/components/clusterWizard/ClusterWizardFooter.js +6 -21
- package/build/cjs/ocm/components/clusterWizard/ClusterWizardFooter.js.map +1 -1
- package/build/cjs/ocm/components/clusterWizard/NewClusterWizard.js +1 -11
- package/build/cjs/ocm/components/clusterWizard/NewClusterWizard.js.map +1 -1
- package/build/cjs/ocm/components/clusterWizard/constants.js +0 -1
- package/build/cjs/ocm/components/clusterWizard/constants.js.map +1 -1
- package/build/cjs/ocm/components/clusterWizard/disconnected/BasicStep.js +18 -96
- package/build/cjs/ocm/components/clusterWizard/disconnected/BasicStep.js.map +1 -1
- package/build/cjs/ocm/components/clusterWizard/disconnected/ReviewStep.js +6 -10
- package/build/cjs/ocm/components/clusterWizard/disconnected/ReviewStep.js.map +1 -1
- package/build/cjs/ocm/components/clusterWizard/index.js +1 -3
- package/build/cjs/ocm/components/clusterWizard/index.js.map +1 -1
- package/build/cjs/ocm/components/clusterWizard/wizardTransition.js +0 -3
- package/build/cjs/ocm/components/clusterWizard/wizardTransition.js.map +1 -1
- package/build/cjs/ocm/hooks/useInfraEnvId.js +2 -2
- package/build/cjs/ocm/hooks/useInfraEnvId.js.map +1 -1
- package/build/cjs/ocm/services/ClustersService.js +0 -6
- package/build/cjs/ocm/services/ClustersService.js.map +1 -1
- package/build/cjs/ocm/services/InfraEnvsService.js +1 -4
- package/build/cjs/ocm/services/InfraEnvsService.js.map +1 -1
- package/lib/common/api/assisted-service/ClustersAPI.ts +0 -6
- package/lib/common/components/clusterWizard/clusterDetailsValidation.ts +9 -19
- package/lib/common/components/clusterWizard/networkingSteps/VirtualIPControlGroup.tsx +0 -2
- package/lib/common/components/ui/OpenShiftVersionModal.tsx +1 -3
- package/lib/common/components/ui/WizardFooter.tsx +1 -1
- package/lib/common/components/ui/formik/PullSecretField.tsx +0 -1
- package/lib/common/config/constants.ts +0 -1
- package/lib/common/validationSchemas/addressValidation.tsx +16 -11
- package/lib/common/validationSchemas/clusterDetailsValidation.tsx +15 -47
- package/lib/ocm/components/Routes.tsx +1 -3
- package/lib/ocm/components/clusterConfiguration/DiscoveryImageTypeDropdown.tsx +0 -1
- package/lib/ocm/components/clusterConfiguration/OcmDiscoveryImageConfigForm.tsx +3 -2
- package/lib/ocm/components/clusterConfiguration/networkConfiguration/NetworkConfigurationForm.tsx +6 -3
- package/lib/ocm/components/clusterWizard/ClusterWizardContext.tsx +0 -9
- package/lib/ocm/components/clusterWizard/ClusterWizardContextProvider.tsx +24 -106
- package/lib/ocm/components/clusterWizard/ClusterWizardFooter.tsx +5 -26
- package/lib/ocm/components/clusterWizard/NewClusterWizard.tsx +3 -14
- package/lib/ocm/components/clusterWizard/constants.ts +0 -1
- package/lib/ocm/components/clusterWizard/disconnected/BasicStep.tsx +37 -138
- package/lib/ocm/components/clusterWizard/disconnected/ReviewStep.tsx +8 -18
- package/lib/ocm/components/clusterWizard/index.ts +0 -1
- package/lib/ocm/components/clusterWizard/wizardTransition.ts +1 -5
- package/lib/ocm/hooks/useInfraEnvId.ts +2 -2
- package/lib/ocm/services/ClustersService.ts +0 -6
- package/lib/ocm/services/InfraEnvsService.ts +1 -4
- package/package.json +3 -3
- package/build/@types/ocm/components/clusterWizard/disconnected/DisconnectedStaticIp.d.ts +0 -4
- package/build/@types/ocm/components/clusterWizard/disconnected/DisconnectedStaticIp.d.ts.map +0 -1
- package/build/@types/ocm/components/clusterWizard/disconnected/OptionalConfigurationsStep.d.ts +0 -4
- package/build/@types/ocm/components/clusterWizard/disconnected/OptionalConfigurationsStep.d.ts.map +0 -1
- package/build/cjs/ocm/components/clusterWizard/disconnected/DisconnectedStaticIp.js +0 -48
- package/build/cjs/ocm/components/clusterWizard/disconnected/DisconnectedStaticIp.js.map +0 -1
- package/build/cjs/ocm/components/clusterWizard/disconnected/OptionalConfigurationsStep.js +0 -204
- package/build/cjs/ocm/components/clusterWizard/disconnected/OptionalConfigurationsStep.js.map +0 -1
- package/lib/ocm/components/clusterWizard/disconnected/DisconnectedStaticIp.tsx +0 -78
- package/lib/ocm/components/clusterWizard/disconnected/OptionalConfigurationsStep.tsx +0 -402
|
@@ -7,13 +7,7 @@ import { getAddress } from '../components/ui/formik/utils';
|
|
|
7
7
|
import { getSubnet } from '../components/clusterConfiguration/utils';
|
|
8
8
|
import { HostSubnets, NetworkConfigurationValues } from '../types';
|
|
9
9
|
import { IP_V4_ZERO, IP_V6_ZERO, MAC_REGEX } from './regexes';
|
|
10
|
-
import {
|
|
11
|
-
alwaysRequired,
|
|
12
|
-
getArrayIndexFromPath,
|
|
13
|
-
isIPorDN,
|
|
14
|
-
isIPv4Address,
|
|
15
|
-
isIPv6Address,
|
|
16
|
-
} from './utils';
|
|
10
|
+
import { getArrayIndexFromPath, isIPorDN, isIPv4Address, isIPv6Address } from './utils';
|
|
17
11
|
import { NO_SUBNET_SET } from '../config';
|
|
18
12
|
import { overlap } from 'cidr-tools';
|
|
19
13
|
import parseUrl from 'parse-url';
|
|
@@ -28,6 +22,7 @@ export const ipValidationSchema = (t: TFunction) =>
|
|
|
28
22
|
|
|
29
23
|
export const ipNoSuffixValidationSchema = (t: TFunction) =>
|
|
30
24
|
Yup.string().test('ip-validation-no-suffix', t('ai:Not a valid IP address'), (value?: string) => {
|
|
25
|
+
if (!value) return true;
|
|
31
26
|
const address = getAddress(value || '');
|
|
32
27
|
return !!address && address.address === address.addressMinusSuffix;
|
|
33
28
|
});
|
|
@@ -173,15 +168,25 @@ export const vipNoSuffixValidationSchema = (
|
|
|
173
168
|
}
|
|
174
169
|
if (apiVip === ingressVip) {
|
|
175
170
|
return this.createError({
|
|
176
|
-
message:
|
|
177
|
-
|
|
178
|
-
|
|
171
|
+
message:
|
|
172
|
+
index === 0
|
|
173
|
+
? t('ai:The primary Ingress and API IP addresses cannot be the same.')
|
|
174
|
+
: t('ai:The secondary Ingress and API IP addresses cannot be the same.'),
|
|
179
175
|
});
|
|
180
176
|
}
|
|
181
177
|
return true;
|
|
182
178
|
});
|
|
179
|
+
const requiredField = (message: string) =>
|
|
180
|
+
Yup.string().test('required-field', message, function (value?: string) {
|
|
181
|
+
const index = getArrayIndexFromPath(this.path || '');
|
|
182
|
+
const api1 = (values.apiVips?.[1]?.ip ?? '').toString().trim();
|
|
183
|
+
const ingress1 = (values.ingressVips?.[1]?.ip ?? '').toString().trim();
|
|
184
|
+
// Dual-stack: secondary VIPs (index 1) are optional; skip required when both are empty
|
|
185
|
+
if (index === 1 && api1 === '' && ingress1 === '') return true;
|
|
186
|
+
return !!value;
|
|
187
|
+
});
|
|
183
188
|
|
|
184
|
-
return
|
|
189
|
+
return requiredField(t('ai:Required field'))
|
|
185
190
|
.concat(ipNoSuffixValidationSchema(t))
|
|
186
191
|
.concat(vipFamilyMatchSchema)
|
|
187
192
|
.concat(vipRangeValidationSchema(hostSubnets, values, false, t))
|
|
@@ -123,55 +123,23 @@ export const dnsNameValidationSchema = (t: TFunction) =>
|
|
|
123
123
|
excludeEmptyString: true,
|
|
124
124
|
});
|
|
125
125
|
|
|
126
|
-
const MAX_DNS_NAME_LENGTH = 253;
|
|
127
|
-
/** Only letters, digits, hyphen, and dot (valid DNS/hostname characters). */
|
|
128
|
-
const DNS_CHARS_REGEX = /^[a-z0-9.-]+$/i;
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Validates the full cluster address [clusterName].[baseDomain] as a single DNS/hostname
|
|
132
|
-
* (e.g. "doma.ca" is valid even though "ca" alone might not pass standalone base-domain rules).
|
|
133
|
-
*/
|
|
134
|
-
export const isValidFullClusterAddress = (full: string): boolean => {
|
|
135
|
-
if (!full || full === '.' || /\s/.test(full)) {
|
|
136
|
-
return false;
|
|
137
|
-
}
|
|
138
|
-
if (full.length > MAX_DNS_NAME_LENGTH) {
|
|
139
|
-
return false;
|
|
140
|
-
}
|
|
141
|
-
if (!DNS_CHARS_REGEX.test(full)) {
|
|
142
|
-
return false;
|
|
143
|
-
}
|
|
144
|
-
const labels = full.split('.');
|
|
145
|
-
if (labels.some((label) => label.length === 0 || label.length > 63)) {
|
|
146
|
-
return false;
|
|
147
|
-
}
|
|
148
|
-
return HOST_NAME_REGEX.test(full);
|
|
149
|
-
};
|
|
150
|
-
|
|
151
126
|
export const baseDomainValidationSchema = (t: TFunction) =>
|
|
152
|
-
Yup.string()
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}
|
|
127
|
+
Yup.string().test(
|
|
128
|
+
'dns-name-label-length',
|
|
129
|
+
t(
|
|
130
|
+
'ai:Every single host component in the base domain name cannot contain more than 63 characters and must not contain spaces.',
|
|
131
|
+
),
|
|
132
|
+
(value?: string) => {
|
|
133
|
+
// Check if the value contains any spaces
|
|
134
|
+
if (/\s/.test(value as string)) {
|
|
135
|
+
return false; // Value contains spaces, validation fails
|
|
136
|
+
}
|
|
163
137
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
.matches(NAME_CHARS_REGEX, {
|
|
170
|
-
message: t(
|
|
171
|
-
'ai:Base domain can only contain letters, digits, hyphens, and dots. Example: example.com',
|
|
172
|
-
),
|
|
173
|
-
excludeEmptyString: true,
|
|
174
|
-
});
|
|
138
|
+
// Check the label lengths
|
|
139
|
+
const labels = (value || '').split('.');
|
|
140
|
+
return labels.every((label: string) => label.length <= 63);
|
|
141
|
+
},
|
|
142
|
+
);
|
|
175
143
|
|
|
176
144
|
export const locationValidationSchema = (t: TFunction) =>
|
|
177
145
|
Yup.string()
|
|
@@ -34,9 +34,7 @@ export const UILibRoutes = ({
|
|
|
34
34
|
<>
|
|
35
35
|
<Routes>
|
|
36
36
|
<Route path="assisted-installer/clusters" element={<Outlet />}>
|
|
37
|
-
<Route path="~new" element={<NewClusterPage />}
|
|
38
|
-
<Route path=":clusterId" element={<NewClusterPage />} />
|
|
39
|
-
</Route>
|
|
37
|
+
<Route path="~new" element={<NewClusterPage />} />
|
|
40
38
|
<Route path=":clusterId" element={<ClusterPage />} />
|
|
41
39
|
<Route index element={<Clusters />} />
|
|
42
40
|
</Route>
|
|
@@ -20,7 +20,6 @@ export const discoveryImageTypes: Record<DiscoveryImageType, string> = {
|
|
|
20
20
|
'minimal-iso': 'Minimal image file - Download an ISO that fetches content on boot',
|
|
21
21
|
'full-iso': 'Full image file - Download a self-contained ISO',
|
|
22
22
|
'discovery-image-ipxe': 'iPXE - Provision from your network server',
|
|
23
|
-
'disconnected-iso': 'Disconnected ISO - Provision from a local file',
|
|
24
23
|
};
|
|
25
24
|
|
|
26
25
|
type DiscoveryImageTypeDropdownProps = {
|
|
@@ -16,6 +16,7 @@ import { Formik, FormikHelpers } from 'formik';
|
|
|
16
16
|
import { TFunction } from 'i18next';
|
|
17
17
|
import {
|
|
18
18
|
HostStaticNetworkConfig,
|
|
19
|
+
ImageType,
|
|
19
20
|
InfraEnv,
|
|
20
21
|
Proxy,
|
|
21
22
|
} from '@openshift-assisted/types/assisted-installer-service';
|
|
@@ -71,7 +72,7 @@ type OcmDiscoveryImageConfigFormProps = Proxy & {
|
|
|
71
72
|
formikActions: FormikHelpers<OcmDiscoveryImageFormValues>,
|
|
72
73
|
) => Promise<void>;
|
|
73
74
|
sshPublicKey?: string;
|
|
74
|
-
imageType?:
|
|
75
|
+
imageType?: ImageType;
|
|
75
76
|
isIpxeSelected?: boolean;
|
|
76
77
|
enableCertificate?: boolean;
|
|
77
78
|
trustBundle?: InfraEnv['additionalTrustBundle'];
|
|
@@ -105,7 +106,7 @@ export const OcmDiscoveryImageConfigForm = ({
|
|
|
105
106
|
httpsProxy: httpsProxy || '',
|
|
106
107
|
noProxy: noProxy || '',
|
|
107
108
|
enableProxy: !!(httpProxy || httpsProxy || noProxy),
|
|
108
|
-
imageType:
|
|
109
|
+
imageType: imageTypeValue as ImageType,
|
|
109
110
|
enableCertificate: enableCertificate || false,
|
|
110
111
|
trustBundle: trustBundle || '',
|
|
111
112
|
};
|
package/lib/ocm/components/clusterConfiguration/networkConfiguration/NetworkConfigurationForm.tsx
CHANGED
|
@@ -236,9 +236,13 @@ const NetworkConfigurationPage = ({ cluster }: { cluster: Cluster }) => {
|
|
|
236
236
|
const isMultiNodeCluster = !isSNO(cluster);
|
|
237
237
|
const isUserManagedNetworking = values.managedNetworkingType === 'userManaged';
|
|
238
238
|
|
|
239
|
+
// Only send VIPs that have a non-empty IP;
|
|
240
|
+
const apiVips = (values.apiVips || []).filter((v) => (v?.ip ?? '').trim() !== '');
|
|
241
|
+
const ingressVips = (values.ingressVips || []).filter((v) => (v?.ip ?? '').trim() !== '');
|
|
242
|
+
|
|
239
243
|
const params: V2ClusterUpdateParams = {
|
|
240
|
-
apiVips
|
|
241
|
-
ingressVips
|
|
244
|
+
apiVips,
|
|
245
|
+
ingressVips,
|
|
242
246
|
sshPublicKey: values.sshPublicKey,
|
|
243
247
|
vipDhcpAllocation: values.vipDhcpAllocation,
|
|
244
248
|
networkType: values.networkType,
|
|
@@ -247,7 +251,6 @@ const NetworkConfigurationPage = ({ cluster }: { cluster: Cluster }) => {
|
|
|
247
251
|
serviceNetworks: values.serviceNetworks,
|
|
248
252
|
userManagedNetworking: isUserManagedNetworking,
|
|
249
253
|
};
|
|
250
|
-
|
|
251
254
|
if (params.userManagedNetworking) {
|
|
252
255
|
params.apiVips = [];
|
|
253
256
|
params.ingressVips = [];
|
|
@@ -3,7 +3,6 @@ import { HostsNetworkConfigurationType } from '../../services';
|
|
|
3
3
|
import { StaticIpView } from '../clusterConfiguration/staticIp/data/dataTypes';
|
|
4
4
|
import { ClusterWizardStepsType } from './wizardTransition';
|
|
5
5
|
import { UISettingsValues } from '../../../common';
|
|
6
|
-
import { InfraEnv } from '@openshift-assisted/types/assisted-installer-service';
|
|
7
6
|
|
|
8
7
|
export type ClusterWizardContextType = {
|
|
9
8
|
currentStepId: ClusterWizardStepsType;
|
|
@@ -21,14 +20,6 @@ export type ClusterWizardContextType = {
|
|
|
21
20
|
uiSettings?: UISettingsValues;
|
|
22
21
|
installDisconnected: boolean;
|
|
23
22
|
setInstallDisconnected: (enabled: boolean) => void;
|
|
24
|
-
disconnectedInfraEnv?: InfraEnv;
|
|
25
|
-
setDisconnectedInfraEnv: (infraEnv: InfraEnv | undefined) => void;
|
|
26
|
-
/** Last pull secret submitted in disconnected Optional configurations (restored when going back from Review) */
|
|
27
|
-
disconnectedFormPullSecret?: string;
|
|
28
|
-
setDisconnectedFormPullSecret: (value: string | undefined) => void;
|
|
29
|
-
/** Whether "Edit pull secret" was checked when user last clicked Next (restored when going back from Review) */
|
|
30
|
-
disconnectedFormEditPullSecret?: boolean;
|
|
31
|
-
setDisconnectedFormEditPullSecret: (value: boolean) => void;
|
|
32
23
|
};
|
|
33
24
|
|
|
34
25
|
export const ClusterWizardContext = React.createContext<ClusterWizardContextType | null>(null);
|
|
@@ -76,33 +76,6 @@ const getWizardStepIds = (
|
|
|
76
76
|
return stepsCopy;
|
|
77
77
|
};
|
|
78
78
|
|
|
79
|
-
// Same logic as getWizardStepIds but for disconnected flow
|
|
80
|
-
// Adds static IP steps after 'disconnected-optional-configurations' instead of 'cluster-details'
|
|
81
|
-
const getDisconnectedWizardStepIds = (
|
|
82
|
-
wizardStepIds: ClusterWizardStepsType[] | undefined,
|
|
83
|
-
staticIpView?: StaticIpView | 'dhcp-selected',
|
|
84
|
-
): ClusterWizardStepsType[] => {
|
|
85
|
-
let stepsCopy = wizardStepIds ? [...wizardStepIds] : [...disconnectedSteps];
|
|
86
|
-
if (staticIpView === StaticIpView.YAML) {
|
|
87
|
-
stepsCopy = removeStepFromClusterWizard(stepsCopy, 'static-ip-network-wide-configurations', 2);
|
|
88
|
-
stepsCopy = addStepToClusterWizard(stepsCopy, 'disconnected-optional-configurations', [
|
|
89
|
-
'static-ip-yaml-view',
|
|
90
|
-
]);
|
|
91
|
-
} else if (staticIpView === StaticIpView.FORM) {
|
|
92
|
-
stepsCopy = removeStepFromClusterWizard(stepsCopy, 'static-ip-yaml-view', 1);
|
|
93
|
-
stepsCopy = addStepToClusterWizard(
|
|
94
|
-
stepsCopy,
|
|
95
|
-
'disconnected-optional-configurations',
|
|
96
|
-
staticIpFormViewSubSteps,
|
|
97
|
-
);
|
|
98
|
-
} else if (staticIpView === 'dhcp-selected') {
|
|
99
|
-
stepsCopy = removeStepFromClusterWizard(stepsCopy, 'static-ip-network-wide-configurations', 2);
|
|
100
|
-
stepsCopy = removeStepFromClusterWizard(stepsCopy, 'static-ip-yaml-view', 1);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
return stepsCopy;
|
|
104
|
-
};
|
|
105
|
-
|
|
106
79
|
const ClusterWizardContextProvider = ({
|
|
107
80
|
children,
|
|
108
81
|
cluster,
|
|
@@ -116,17 +89,9 @@ const ClusterWizardContextProvider = ({
|
|
|
116
89
|
const isSingleClusterFeatureEnabled = useFeature('ASSISTED_INSTALLER_SINGLE_CLUSTER_FEATURE');
|
|
117
90
|
const [currentStepId, setCurrentStepId] = React.useState<ClusterWizardStepsType>();
|
|
118
91
|
const [connectedWizardStepIds, setWizardStepIds] = React.useState<ClusterWizardStepsType[]>();
|
|
119
|
-
const [disconnectedWizardStepIds, setDisconnectedWizardStepIds] =
|
|
120
|
-
React.useState<ClusterWizardStepsType[]>(disconnectedSteps);
|
|
121
92
|
const [wizardPerPage, setWizardPerPage] = React.useState(10);
|
|
122
93
|
const [customManifestsStep, setCustomManifestsStep] = React.useState<boolean>(false);
|
|
123
94
|
const [installDisconnected, setInstallDisconnected] = React.useState(false);
|
|
124
|
-
const [disconnectedInfraEnv, setDisconnectedInfraEnv] = React.useState<InfraEnv | undefined>(
|
|
125
|
-
infraEnv,
|
|
126
|
-
);
|
|
127
|
-
const [disconnectedFormPullSecret, setDisconnectedFormPullSecret] = React.useState<string>();
|
|
128
|
-
const [disconnectedFormEditPullSecret, setDisconnectedFormEditPullSecret] =
|
|
129
|
-
React.useState<boolean>();
|
|
130
95
|
const location = useLocation();
|
|
131
96
|
const locationState = location.state as ClusterWizardFlowStateType | undefined;
|
|
132
97
|
const {
|
|
@@ -138,7 +103,7 @@ const ClusterWizardContextProvider = ({
|
|
|
138
103
|
const { clearAlerts, addAlert, alerts } = useAlerts();
|
|
139
104
|
const setClusterPermissions = useSetClusterPermissions();
|
|
140
105
|
|
|
141
|
-
const wizardStepIds = installDisconnected ?
|
|
106
|
+
const wizardStepIds = installDisconnected ? disconnectedSteps : connectedWizardStepIds;
|
|
142
107
|
|
|
143
108
|
React.useEffect(() => {
|
|
144
109
|
if (!UISettingsLoading) {
|
|
@@ -197,29 +162,17 @@ const ClusterWizardContextProvider = ({
|
|
|
197
162
|
|
|
198
163
|
const handleMoveFromStaticIp = () => {
|
|
199
164
|
//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
|
|
200
|
-
const
|
|
201
|
-
const staticIpInfo = currentInfraEnv ? getStaticIpInfo(currentInfraEnv) : undefined;
|
|
165
|
+
const staticIpInfo = infraEnv ? getStaticIpInfo(infraEnv) : undefined;
|
|
202
166
|
if (!staticIpInfo) {
|
|
203
167
|
throw `Wizard step is currently ${currentStepId}, but no static ip info is defined`;
|
|
204
168
|
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
setDisconnectedWizardStepIds(newStepIds);
|
|
213
|
-
} else {
|
|
214
|
-
// For connected wizard, update wizard steps directly
|
|
215
|
-
const newStepIds = getWizardStepIds(
|
|
216
|
-
wizardStepIds,
|
|
217
|
-
staticIpInfo.view,
|
|
218
|
-
customManifestsStep,
|
|
219
|
-
isSingleClusterFeatureEnabled,
|
|
220
|
-
);
|
|
221
|
-
setWizardStepIds(newStepIds);
|
|
222
|
-
}
|
|
169
|
+
const newStepIds = getWizardStepIds(
|
|
170
|
+
wizardStepIds,
|
|
171
|
+
staticIpInfo.view,
|
|
172
|
+
customManifestsStep,
|
|
173
|
+
isSingleClusterFeatureEnabled,
|
|
174
|
+
);
|
|
175
|
+
setWizardStepIds(newStepIds);
|
|
223
176
|
};
|
|
224
177
|
|
|
225
178
|
const onSetCurrentStepId = (stepId: ClusterWizardStepsType) => {
|
|
@@ -263,57 +216,31 @@ const ClusterWizardContextProvider = ({
|
|
|
263
216
|
} else {
|
|
264
217
|
setCurrentStepId('static-ip-network-wide-configurations');
|
|
265
218
|
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
219
|
+
setWizardStepIds(
|
|
220
|
+
getWizardStepIds(wizardStepIds, view, customManifestsStep, isSingleClusterFeatureEnabled),
|
|
221
|
+
);
|
|
222
|
+
},
|
|
223
|
+
onUpdateHostNetworkConfigType(type: HostsNetworkConfigurationType): void {
|
|
224
|
+
if (type === HostsNetworkConfigurationType.STATIC) {
|
|
225
|
+
setWizardStepIds(
|
|
226
|
+
getWizardStepIds(
|
|
227
|
+
wizardStepIds,
|
|
228
|
+
StaticIpView.FORM,
|
|
229
|
+
customManifestsStep,
|
|
230
|
+
isSingleClusterFeatureEnabled,
|
|
231
|
+
),
|
|
270
232
|
);
|
|
271
233
|
} else {
|
|
272
234
|
setWizardStepIds(
|
|
273
235
|
getWizardStepIds(
|
|
274
236
|
wizardStepIds,
|
|
275
|
-
|
|
237
|
+
'dhcp-selected',
|
|
276
238
|
customManifestsStep,
|
|
277
239
|
isSingleClusterFeatureEnabled,
|
|
278
240
|
),
|
|
279
241
|
);
|
|
280
242
|
}
|
|
281
243
|
},
|
|
282
|
-
onUpdateHostNetworkConfigType(type: HostsNetworkConfigurationType): void {
|
|
283
|
-
if (installDisconnected) {
|
|
284
|
-
// For disconnected wizard, update wizard steps (same pattern as connected)
|
|
285
|
-
if (type === HostsNetworkConfigurationType.STATIC) {
|
|
286
|
-
setDisconnectedWizardStepIds(
|
|
287
|
-
getDisconnectedWizardStepIds(disconnectedWizardStepIds, StaticIpView.FORM),
|
|
288
|
-
);
|
|
289
|
-
} else {
|
|
290
|
-
setDisconnectedWizardStepIds(
|
|
291
|
-
getDisconnectedWizardStepIds(disconnectedWizardStepIds, 'dhcp-selected'),
|
|
292
|
-
);
|
|
293
|
-
}
|
|
294
|
-
} else {
|
|
295
|
-
// For connected wizard, update wizard steps directly
|
|
296
|
-
if (type === HostsNetworkConfigurationType.STATIC) {
|
|
297
|
-
setWizardStepIds(
|
|
298
|
-
getWizardStepIds(
|
|
299
|
-
wizardStepIds,
|
|
300
|
-
StaticIpView.FORM,
|
|
301
|
-
customManifestsStep,
|
|
302
|
-
isSingleClusterFeatureEnabled,
|
|
303
|
-
),
|
|
304
|
-
);
|
|
305
|
-
} else {
|
|
306
|
-
setWizardStepIds(
|
|
307
|
-
getWizardStepIds(
|
|
308
|
-
wizardStepIds,
|
|
309
|
-
'dhcp-selected',
|
|
310
|
-
customManifestsStep,
|
|
311
|
-
isSingleClusterFeatureEnabled,
|
|
312
|
-
),
|
|
313
|
-
);
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
},
|
|
317
244
|
wizardStepIds: wizardStepIds,
|
|
318
245
|
currentStepId,
|
|
319
246
|
setCurrentStepId: onSetCurrentStepId,
|
|
@@ -332,12 +259,6 @@ const ClusterWizardContextProvider = ({
|
|
|
332
259
|
connectedWizardStepIds?.length && onSetCurrentStepId(connectedWizardStepIds[0]);
|
|
333
260
|
}
|
|
334
261
|
},
|
|
335
|
-
disconnectedInfraEnv,
|
|
336
|
-
setDisconnectedInfraEnv,
|
|
337
|
-
disconnectedFormPullSecret,
|
|
338
|
-
setDisconnectedFormPullSecret,
|
|
339
|
-
disconnectedFormEditPullSecret,
|
|
340
|
-
setDisconnectedFormEditPullSecret,
|
|
341
262
|
};
|
|
342
263
|
}, [
|
|
343
264
|
wizardStepIds,
|
|
@@ -350,11 +271,8 @@ const ClusterWizardContextProvider = ({
|
|
|
350
271
|
uiSettings,
|
|
351
272
|
updateUISettings,
|
|
352
273
|
installDisconnected,
|
|
274
|
+
setInstallDisconnected,
|
|
353
275
|
connectedWizardStepIds,
|
|
354
|
-
disconnectedWizardStepIds,
|
|
355
|
-
disconnectedInfraEnv,
|
|
356
|
-
disconnectedFormPullSecret,
|
|
357
|
-
disconnectedFormEditPullSecret,
|
|
358
276
|
]);
|
|
359
277
|
|
|
360
278
|
if (!contextValue) {
|
|
@@ -17,8 +17,6 @@ import { onFetchEvents } from '../fetching/fetchEvents';
|
|
|
17
17
|
import { Cluster } from '@openshift-assisted/types/assisted-installer-service';
|
|
18
18
|
import { useFeature } from '../../hooks/use-feature';
|
|
19
19
|
import { useModalDialogsContext } from '../hosts/ModalDialogsContext';
|
|
20
|
-
import ClustersService from '../../services/ClustersService';
|
|
21
|
-
import { handleApiError, getApiErrorMessage } from '../../../common/api';
|
|
22
20
|
|
|
23
21
|
type ClusterValidationSectionProps = {
|
|
24
22
|
cluster?: Cluster;
|
|
@@ -73,7 +71,6 @@ type ClusterWizardFooterProps = WizardFooterGenericProps & {
|
|
|
73
71
|
errorFields?: string[];
|
|
74
72
|
alertTitle?: string;
|
|
75
73
|
alertContent?: string | null;
|
|
76
|
-
disconnectedClusterId?: string;
|
|
77
74
|
};
|
|
78
75
|
|
|
79
76
|
const ClusterWizardFooter = ({
|
|
@@ -83,37 +80,19 @@ const ClusterWizardFooter = ({
|
|
|
83
80
|
alertTitle,
|
|
84
81
|
alertContent,
|
|
85
82
|
onCancel,
|
|
86
|
-
disconnectedClusterId,
|
|
87
83
|
...rest
|
|
88
84
|
}: ClusterWizardFooterProps) => {
|
|
89
|
-
const { alerts
|
|
85
|
+
const { alerts } = useAlerts();
|
|
90
86
|
const navigate = useNavigate();
|
|
91
87
|
const isSingleClusterFeatureEnabled = useFeature('ASSISTED_INSTALLER_SINGLE_CLUSTER_FEATURE');
|
|
92
88
|
const { currentStepId } = useClusterWizardContext();
|
|
93
89
|
const { resetSingleClusterDialog } = useModalDialogsContext();
|
|
94
|
-
const { setDisconnectedInfraEnv } = useClusterWizardContext();
|
|
95
90
|
|
|
96
|
-
const handleCancel = React.useCallback(
|
|
97
|
-
if (disconnectedClusterId) {
|
|
98
|
-
try {
|
|
99
|
-
await ClustersService.remove(disconnectedClusterId);
|
|
100
|
-
} catch (e) {
|
|
101
|
-
handleApiError(e, () =>
|
|
102
|
-
addAlert({
|
|
103
|
-
title: 'Failed to remove cluster',
|
|
104
|
-
message: getApiErrorMessage(e),
|
|
105
|
-
}),
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
setDisconnectedInfraEnv(undefined);
|
|
110
|
-
navigate('/cluster-list');
|
|
111
|
-
}, [navigate, setDisconnectedInfraEnv, addAlert, disconnectedClusterId]);
|
|
91
|
+
const handleCancel = React.useCallback(() => navigate('/cluster-list'), [navigate]);
|
|
112
92
|
|
|
113
|
-
const handleReset = React.useCallback(
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
);
|
|
93
|
+
const handleReset = React.useCallback(() => {
|
|
94
|
+
resetSingleClusterDialog.open({ cluster });
|
|
95
|
+
}, [resetSingleClusterDialog, cluster]);
|
|
117
96
|
|
|
118
97
|
const alertsSection = alerts.length ? <Alerts /> : undefined;
|
|
119
98
|
|
|
@@ -4,10 +4,7 @@ import ClusterDetails from './ClusterDetails';
|
|
|
4
4
|
import { useClusterWizardContext } from './ClusterWizardContext';
|
|
5
5
|
import ReviewStep from './disconnected/ReviewStep';
|
|
6
6
|
import BasicStep from './disconnected/BasicStep';
|
|
7
|
-
import OptionalConfigurationsStep from './disconnected/OptionalConfigurationsStep';
|
|
8
|
-
import DisconnectedStaticIp from './disconnected/DisconnectedStaticIp';
|
|
9
7
|
import { ClusterWizardStepsType } from './wizardTransition';
|
|
10
|
-
import { ModalDialogsContextProvider } from '../hosts/ModalDialogsContext';
|
|
11
8
|
|
|
12
9
|
const getCurrentStep = (currentStepId: ClusterWizardStepsType) => {
|
|
13
10
|
switch (currentStepId) {
|
|
@@ -15,12 +12,6 @@ const getCurrentStep = (currentStepId: ClusterWizardStepsType) => {
|
|
|
15
12
|
return <ReviewStep />;
|
|
16
13
|
case 'disconnected-basic':
|
|
17
14
|
return <BasicStep />;
|
|
18
|
-
case 'disconnected-optional-configurations':
|
|
19
|
-
return <OptionalConfigurationsStep />;
|
|
20
|
-
case 'static-ip-yaml-view':
|
|
21
|
-
case 'static-ip-network-wide-configurations':
|
|
22
|
-
case 'static-ip-host-configurations':
|
|
23
|
-
return <DisconnectedStaticIp />;
|
|
24
15
|
default:
|
|
25
16
|
return <ClusterDetails />;
|
|
26
17
|
}
|
|
@@ -29,11 +20,9 @@ const getCurrentStep = (currentStepId: ClusterWizardStepsType) => {
|
|
|
29
20
|
const NewClusterWizard: React.FC = () => {
|
|
30
21
|
const { currentStepId } = useClusterWizardContext();
|
|
31
22
|
return (
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
</div>
|
|
36
|
-
</ModalDialogsContextProvider>
|
|
23
|
+
<div className={classNames('pf-v6-c-wizard', 'cluster-wizard')}>
|
|
24
|
+
{getCurrentStep(currentStepId)}
|
|
25
|
+
</div>
|
|
37
26
|
);
|
|
38
27
|
};
|
|
39
28
|
|
|
@@ -14,7 +14,6 @@ export const wizardStepNames: { [key in ClusterWizardStepsType]: string } = {
|
|
|
14
14
|
'credentials-download': 'Download credentials',
|
|
15
15
|
'disconnected-review': 'Review and download ISO',
|
|
16
16
|
'disconnected-basic': 'Basic information',
|
|
17
|
-
'disconnected-optional-configurations': 'Optional configurations',
|
|
18
17
|
};
|
|
19
18
|
|
|
20
19
|
export const defaultWizardSteps: ClusterWizardStepsType[] = [
|