@openshift-assisted/ui-lib 2.51.0 → 2.51.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.
Files changed (190) hide show
  1. package/build/@types/common/api/assisted-service/ClustersAPI.d.ts +0 -4
  2. package/build/@types/common/api/assisted-service/ClustersAPI.d.ts.map +1 -1
  3. package/build/@types/common/components/clusterWizard/clusterDetailsValidation.d.ts.map +1 -1
  4. package/build/@types/common/components/clusterWizard/networkingSteps/StackTypeControlGroup.d.ts.map +1 -1
  5. package/build/@types/common/components/clusterWizard/networkingSteps/VirtualIPControlGroup.d.ts.map +1 -1
  6. package/build/@types/common/components/ui/OpenShiftVersionModal.d.ts.map +1 -1
  7. package/build/@types/common/components/ui/formik/PullSecretField.d.ts.map +1 -1
  8. package/build/@types/common/config/constants.d.ts +0 -7
  9. package/build/@types/common/config/constants.d.ts.map +1 -1
  10. package/build/@types/common/types/index.d.ts +1 -0
  11. package/build/@types/common/types/index.d.ts.map +1 -1
  12. package/build/@types/common/types/networkType.d.ts +12 -0
  13. package/build/@types/common/types/networkType.d.ts.map +1 -0
  14. package/build/@types/common/validationSchemas/addressValidation.d.ts.map +1 -1
  15. package/build/@types/common/validationSchemas/clusterDetailsValidation.d.ts +0 -5
  16. package/build/@types/common/validationSchemas/clusterDetailsValidation.d.ts.map +1 -1
  17. package/build/@types/ocm/components/Routes.d.ts.map +1 -1
  18. package/build/@types/ocm/components/clusterConfiguration/DiscoveryImageTypeDropdown.d.ts.map +1 -1
  19. package/build/@types/ocm/components/clusterConfiguration/OcmDiscoveryImageConfigForm.d.ts +2 -2
  20. package/build/@types/ocm/components/clusterConfiguration/OcmDiscoveryImageConfigForm.d.ts.map +1 -1
  21. package/build/@types/ocm/components/clusterConfiguration/manifestsConfiguration/CustomManifestsPage.d.ts.map +1 -1
  22. package/build/@types/ocm/components/clusterConfiguration/manifestsConfiguration/components/CustomManifestsArray.d.ts.map +1 -1
  23. package/build/@types/ocm/components/clusterConfiguration/networkConfiguration/NetworkConfiguration.d.ts.map +1 -1
  24. package/build/@types/ocm/components/clusterConfiguration/networkConfiguration/NetworkTypeDropdown.d.ts +1 -2
  25. package/build/@types/ocm/components/clusterConfiguration/networkConfiguration/NetworkTypeDropdown.d.ts.map +1 -1
  26. package/build/@types/ocm/components/clusterConfiguration/review/ReviewStep.d.ts.map +1 -1
  27. package/build/@types/ocm/components/clusterConfiguration/staticIp/commonValidationSchemas.d.ts.map +1 -1
  28. package/build/@types/ocm/components/clusterConfiguration/staticIp/components/FormViewHosts/FormViewHostsFields.d.ts.map +1 -1
  29. package/build/@types/ocm/components/clusterConfiguration/staticIp/components/FormViewNetworkWide/formViewNetworkWideValidationSchema.d.ts +0 -22
  30. package/build/@types/ocm/components/clusterConfiguration/staticIp/components/FormViewNetworkWide/formViewNetworkWideValidationSchema.d.ts.map +1 -1
  31. package/build/@types/ocm/components/clusterWizard/ClusterDetails.d.ts.map +1 -1
  32. package/build/@types/ocm/components/clusterWizard/ClusterDetailsForm.d.ts.map +1 -1
  33. package/build/@types/ocm/components/clusterWizard/ClusterWizardContext.d.ts +0 -3
  34. package/build/@types/ocm/components/clusterWizard/ClusterWizardContext.d.ts.map +1 -1
  35. package/build/@types/ocm/components/clusterWizard/ClusterWizardContextProvider.d.ts.map +1 -1
  36. package/build/@types/ocm/components/clusterWizard/ClusterWizardFooter.d.ts +1 -2
  37. package/build/@types/ocm/components/clusterWizard/ClusterWizardFooter.d.ts.map +1 -1
  38. package/build/@types/ocm/components/clusterWizard/NewClusterWizard.d.ts.map +1 -1
  39. package/build/@types/ocm/components/clusterWizard/constants.d.ts.map +1 -1
  40. package/build/@types/ocm/components/clusterWizard/disconnected/BasicStep.d.ts.map +1 -1
  41. package/build/@types/ocm/components/clusterWizard/disconnected/ReviewStep.d.ts.map +1 -1
  42. package/build/@types/ocm/components/clusterWizard/index.d.ts +0 -1
  43. package/build/@types/ocm/components/clusterWizard/index.d.ts.map +1 -1
  44. package/build/@types/ocm/components/clusterWizard/wizardTransition.d.ts +1 -1
  45. package/build/@types/ocm/components/clusterWizard/wizardTransition.d.ts.map +1 -1
  46. package/build/@types/ocm/components/featureSupportLevels/featureStateUtils.d.ts.map +1 -1
  47. package/build/@types/ocm/components/utils.d.ts +0 -1
  48. package/build/@types/ocm/components/utils.d.ts.map +1 -1
  49. package/build/@types/ocm/services/ClustersService.d.ts +0 -4
  50. package/build/@types/ocm/services/ClustersService.d.ts.map +1 -1
  51. package/build/@types/ocm/services/InfraEnvsService.d.ts.map +1 -1
  52. package/build/@types/ocm/store/slices/clusters/selectors.d.ts +1 -2
  53. package/build/@types/ocm/store/slices/clusters/selectors.d.ts.map +1 -1
  54. package/build/cjs/cim/components/ClusterDeployment/networkConfigurationValidation.js +3 -3
  55. package/build/cjs/cim/components/ClusterDeployment/networkConfigurationValidation.js.map +1 -1
  56. package/build/cjs/common/api/assisted-service/ClustersAPI.js +0 -3
  57. package/build/cjs/common/api/assisted-service/ClustersAPI.js.map +1 -1
  58. package/build/cjs/common/components/clusterWizard/clusterDetailsValidation.js +8 -17
  59. package/build/cjs/common/components/clusterWizard/clusterDetailsValidation.js.map +1 -1
  60. package/build/cjs/common/components/clusterWizard/networkingSteps/NetworkTypeControlGroup.js +3 -3
  61. package/build/cjs/common/components/clusterWizard/networkingSteps/NetworkTypeControlGroup.js.map +1 -1
  62. package/build/cjs/common/components/clusterWizard/networkingSteps/StackTypeControlGroup.js +3 -2
  63. package/build/cjs/common/components/clusterWizard/networkingSteps/StackTypeControlGroup.js.map +1 -1
  64. package/build/cjs/common/components/clusterWizard/networkingSteps/VirtualIPControlGroup.js +2 -1
  65. package/build/cjs/common/components/clusterWizard/networkingSteps/VirtualIPControlGroup.js.map +1 -1
  66. package/build/cjs/common/components/ui/OpenShiftVersionModal.js +1 -3
  67. package/build/cjs/common/components/ui/OpenShiftVersionModal.js.map +1 -1
  68. package/build/cjs/common/components/ui/WizardFooter.js +1 -1
  69. package/build/cjs/common/components/ui/WizardFooter.js.map +1 -1
  70. package/build/cjs/common/components/ui/formik/PullSecretField.js.map +1 -1
  71. package/build/cjs/common/config/constants.js +2 -21
  72. package/build/cjs/common/config/constants.js.map +1 -1
  73. package/build/cjs/common/types/index.js +1 -0
  74. package/build/cjs/common/types/index.js.map +1 -1
  75. package/build/cjs/common/types/networkType.js +28 -0
  76. package/build/cjs/common/types/networkType.js.map +1 -0
  77. package/build/cjs/common/validationSchemas/addressValidation.js +1 -3
  78. package/build/cjs/common/validationSchemas/addressValidation.js.map +1 -1
  79. package/build/cjs/common/validationSchemas/clusterDetailsValidation.js +2 -31
  80. package/build/cjs/common/validationSchemas/clusterDetailsValidation.js.map +1 -1
  81. package/build/cjs/ocm/components/Routes.js +1 -2
  82. package/build/cjs/ocm/components/Routes.js.map +1 -1
  83. package/build/cjs/ocm/components/clusterConfiguration/DiscoveryImageTypeDropdown.js +0 -1
  84. package/build/cjs/ocm/components/clusterConfiguration/DiscoveryImageTypeDropdown.js.map +1 -1
  85. package/build/cjs/ocm/components/clusterConfiguration/OcmDiscoveryImageConfigForm.js +1 -1
  86. package/build/cjs/ocm/components/clusterConfiguration/OcmDiscoveryImageConfigForm.js.map +1 -1
  87. package/build/cjs/ocm/components/clusterConfiguration/manifestsConfiguration/CustomManifestsPage.js +11 -6
  88. package/build/cjs/ocm/components/clusterConfiguration/manifestsConfiguration/CustomManifestsPage.js.map +1 -1
  89. package/build/cjs/ocm/components/clusterConfiguration/manifestsConfiguration/components/CustomManifestsArray.js +4 -1
  90. package/build/cjs/ocm/components/clusterConfiguration/manifestsConfiguration/components/CustomManifestsArray.js.map +1 -1
  91. package/build/cjs/ocm/components/clusterConfiguration/networkConfiguration/NetworkConfiguration.js +1 -4
  92. package/build/cjs/ocm/components/clusterConfiguration/networkConfiguration/NetworkConfiguration.js.map +1 -1
  93. package/build/cjs/ocm/components/clusterConfiguration/networkConfiguration/NetworkTypeDropdown.js +22 -29
  94. package/build/cjs/ocm/components/clusterConfiguration/networkConfiguration/NetworkTypeDropdown.js.map +1 -1
  95. package/build/cjs/ocm/components/clusterConfiguration/review/ReviewStep.js +8 -14
  96. package/build/cjs/ocm/components/clusterConfiguration/review/ReviewStep.js.map +1 -1
  97. package/build/cjs/ocm/components/clusterConfiguration/staticIp/commonValidationSchemas.js +2 -5
  98. package/build/cjs/ocm/components/clusterConfiguration/staticIp/commonValidationSchemas.js.map +1 -1
  99. package/build/cjs/ocm/components/clusterConfiguration/staticIp/components/FormViewHosts/FormViewHostsFields.js +1 -1
  100. package/build/cjs/ocm/components/clusterConfiguration/staticIp/components/FormViewHosts/FormViewHostsFields.js.map +1 -1
  101. package/build/cjs/ocm/components/clusterConfiguration/staticIp/components/FormViewNetworkWide/FormViewNetworkWide.js +1 -1
  102. package/build/cjs/ocm/components/clusterConfiguration/staticIp/components/FormViewNetworkWide/FormViewNetworkWide.js.map +1 -1
  103. package/build/cjs/ocm/components/clusterConfiguration/staticIp/components/FormViewNetworkWide/formViewNetworkWideValidationSchema.js +3 -31
  104. package/build/cjs/ocm/components/clusterConfiguration/staticIp/components/FormViewNetworkWide/formViewNetworkWideValidationSchema.js.map +1 -1
  105. package/build/cjs/ocm/components/clusterWizard/ClusterDetails.js +1 -2
  106. package/build/cjs/ocm/components/clusterWizard/ClusterDetails.js.map +1 -1
  107. package/build/cjs/ocm/components/clusterWizard/ClusterDetailsForm.js +1 -2
  108. package/build/cjs/ocm/components/clusterWizard/ClusterDetailsForm.js.map +1 -1
  109. package/build/cjs/ocm/components/clusterWizard/ClusterWizardContext.js.map +1 -1
  110. package/build/cjs/ocm/components/clusterWizard/ClusterWizardContextProvider.js +9 -62
  111. package/build/cjs/ocm/components/clusterWizard/ClusterWizardContextProvider.js.map +1 -1
  112. package/build/cjs/ocm/components/clusterWizard/ClusterWizardFooter.js +6 -21
  113. package/build/cjs/ocm/components/clusterWizard/ClusterWizardFooter.js.map +1 -1
  114. package/build/cjs/ocm/components/clusterWizard/NewClusterWizard.js +1 -11
  115. package/build/cjs/ocm/components/clusterWizard/NewClusterWizard.js.map +1 -1
  116. package/build/cjs/ocm/components/clusterWizard/constants.js +0 -1
  117. package/build/cjs/ocm/components/clusterWizard/constants.js.map +1 -1
  118. package/build/cjs/ocm/components/clusterWizard/disconnected/BasicStep.js +18 -96
  119. package/build/cjs/ocm/components/clusterWizard/disconnected/BasicStep.js.map +1 -1
  120. package/build/cjs/ocm/components/clusterWizard/disconnected/ReviewStep.js +7 -11
  121. package/build/cjs/ocm/components/clusterWizard/disconnected/ReviewStep.js.map +1 -1
  122. package/build/cjs/ocm/components/clusterWizard/index.js +1 -3
  123. package/build/cjs/ocm/components/clusterWizard/index.js.map +1 -1
  124. package/build/cjs/ocm/components/clusterWizard/wizardTransition.js +0 -3
  125. package/build/cjs/ocm/components/clusterWizard/wizardTransition.js.map +1 -1
  126. package/build/cjs/ocm/components/featureSupportLevels/featureStateUtils.js +13 -4
  127. package/build/cjs/ocm/components/featureSupportLevels/featureStateUtils.js.map +1 -1
  128. package/build/cjs/ocm/components/utils.js +1 -4
  129. package/build/cjs/ocm/components/utils.js.map +1 -1
  130. package/build/cjs/ocm/hooks/useInfraEnvId.js +2 -2
  131. package/build/cjs/ocm/hooks/useInfraEnvId.js.map +1 -1
  132. package/build/cjs/ocm/services/ClustersService.js +0 -6
  133. package/build/cjs/ocm/services/ClustersService.js.map +1 -1
  134. package/build/cjs/ocm/services/InfraEnvsService.js +1 -4
  135. package/build/cjs/ocm/services/InfraEnvsService.js.map +1 -1
  136. package/build/cjs/ocm/store/slices/clusters/selectors.js.map +1 -1
  137. package/lib/cim/components/ClusterDeployment/networkConfigurationValidation.ts +1 -1
  138. package/lib/common/api/assisted-service/ClustersAPI.ts +0 -6
  139. package/lib/common/components/clusterWizard/clusterDetailsValidation.ts +9 -19
  140. package/lib/common/components/clusterWizard/networkingSteps/NetworkTypeControlGroup.tsx +1 -1
  141. package/lib/common/components/clusterWizard/networkingSteps/StackTypeControlGroup.tsx +5 -6
  142. package/lib/common/components/clusterWizard/networkingSteps/VirtualIPControlGroup.tsx +2 -2
  143. package/lib/common/components/ui/OpenShiftVersionModal.tsx +1 -3
  144. package/lib/common/components/ui/WizardFooter.tsx +1 -1
  145. package/lib/common/components/ui/formik/PullSecretField.tsx +0 -1
  146. package/lib/common/config/constants.ts +0 -21
  147. package/lib/common/types/index.ts +1 -0
  148. package/lib/common/types/networkType.ts +37 -0
  149. package/lib/common/validationSchemas/addressValidation.tsx +1 -4
  150. package/lib/common/validationSchemas/clusterDetailsValidation.tsx +15 -47
  151. package/lib/ocm/components/Routes.tsx +1 -3
  152. package/lib/ocm/components/clusterConfiguration/DiscoveryImageTypeDropdown.tsx +0 -1
  153. package/lib/ocm/components/clusterConfiguration/OcmDiscoveryImageConfigForm.tsx +3 -2
  154. package/lib/ocm/components/clusterConfiguration/manifestsConfiguration/CustomManifestsPage.tsx +14 -6
  155. package/lib/ocm/components/clusterConfiguration/manifestsConfiguration/components/CustomManifestsArray.tsx +5 -1
  156. package/lib/ocm/components/clusterConfiguration/networkConfiguration/NetworkConfiguration.tsx +0 -5
  157. package/lib/ocm/components/clusterConfiguration/networkConfiguration/NetworkTypeDropdown.tsx +32 -47
  158. package/lib/ocm/components/clusterConfiguration/review/ReviewStep.tsx +10 -12
  159. package/lib/ocm/components/clusterConfiguration/staticIp/commonValidationSchemas.tsx +2 -8
  160. package/lib/ocm/components/clusterConfiguration/staticIp/components/FormViewHosts/FormViewHostsFields.tsx +0 -1
  161. package/lib/ocm/components/clusterConfiguration/staticIp/components/FormViewNetworkWide/FormViewNetworkWide.tsx +2 -2
  162. package/lib/ocm/components/clusterConfiguration/staticIp/components/FormViewNetworkWide/formViewNetworkWideValidationSchema.tsx +24 -63
  163. package/lib/ocm/components/clusterWizard/ClusterDetails.tsx +1 -2
  164. package/lib/ocm/components/clusterWizard/ClusterDetailsForm.tsx +2 -1
  165. package/lib/ocm/components/clusterWizard/ClusterWizardContext.tsx +0 -3
  166. package/lib/ocm/components/clusterWizard/ClusterWizardContextProvider.tsx +27 -91
  167. package/lib/ocm/components/clusterWizard/ClusterWizardFooter.tsx +5 -26
  168. package/lib/ocm/components/clusterWizard/NewClusterWizard.tsx +3 -14
  169. package/lib/ocm/components/clusterWizard/constants.ts +0 -1
  170. package/lib/ocm/components/clusterWizard/disconnected/BasicStep.tsx +37 -138
  171. package/lib/ocm/components/clusterWizard/disconnected/ReviewStep.tsx +9 -19
  172. package/lib/ocm/components/clusterWizard/index.ts +0 -1
  173. package/lib/ocm/components/clusterWizard/wizardTransition.ts +1 -5
  174. package/lib/ocm/components/featureSupportLevels/featureStateUtils.ts +15 -4
  175. package/lib/ocm/components/utils.ts +0 -4
  176. package/lib/ocm/hooks/useInfraEnvId.ts +2 -2
  177. package/lib/ocm/services/ClustersService.ts +0 -6
  178. package/lib/ocm/services/InfraEnvsService.ts +1 -4
  179. package/lib/ocm/store/slices/clusters/selectors.tsx +2 -1
  180. package/package.json +3 -3
  181. package/build/@types/ocm/components/clusterWizard/disconnected/DisconnectedStaticIp.d.ts +0 -4
  182. package/build/@types/ocm/components/clusterWizard/disconnected/DisconnectedStaticIp.d.ts.map +0 -1
  183. package/build/@types/ocm/components/clusterWizard/disconnected/OptionalConfigurationsStep.d.ts +0 -4
  184. package/build/@types/ocm/components/clusterWizard/disconnected/OptionalConfigurationsStep.d.ts.map +0 -1
  185. package/build/cjs/ocm/components/clusterWizard/disconnected/DisconnectedStaticIp.js +0 -48
  186. package/build/cjs/ocm/components/clusterWizard/disconnected/DisconnectedStaticIp.js.map +0 -1
  187. package/build/cjs/ocm/components/clusterWizard/disconnected/OptionalConfigurationsStep.js +0 -182
  188. package/build/cjs/ocm/components/clusterWizard/disconnected/OptionalConfigurationsStep.js.map +0 -1
  189. package/lib/ocm/components/clusterWizard/disconnected/DisconnectedStaticIp.tsx +0 -78
  190. package/lib/ocm/components/clusterWizard/disconnected/OptionalConfigurationsStep.tsx +0 -364
@@ -1,364 +0,0 @@
1
- import * as React from 'react';
2
- import { Formik } from 'formik';
3
- import { TFunction } from 'i18next';
4
- import * as Yup from 'yup';
5
- import {
6
- ClusterWizardStep,
7
- TechnologyPreview,
8
- sshPublicKeyValidationSchema,
9
- getFormikErrorFields,
10
- httpProxyValidationSchema,
11
- noProxyValidationSchema,
12
- ipValidationSchema,
13
- InputField,
14
- CheckboxField,
15
- AdditionalNTPSourcesField,
16
- ProxyFieldsType,
17
- PullSecret,
18
- pullSecretValidationSchema,
19
- } from '../../../../common';
20
- import { Split, SplitItem, Grid, GridItem, Form, Content } from '@patternfly/react-core';
21
- import { useClusterWizardContext } from '../ClusterWizardContext';
22
- import ClusterWizardFooter from '../ClusterWizardFooter';
23
- import ClusterWizardNavigation from '../ClusterWizardNavigation';
24
- import { WithErrorBoundary } from '../../../../common/components/ErrorHandling/WithErrorBoundary';
25
- import UploadSSH from '../../../../common/components/clusterConfiguration/UploadSSH';
26
- import { ProxyInputFields } from '../../../../common/components/clusterConfiguration/ProxyFields';
27
- import { handleApiError, getApiErrorMessage } from '../../../../common/api';
28
- import { useAlerts } from '../../../../common/components/AlertsContextProvider';
29
- import { AlertVariant } from '@patternfly/react-core';
30
- import InfraEnvsService from '../../../services/InfraEnvsService';
31
- import { InfraEnvsAPI } from '../../../services/apis';
32
- import usePullSecret from '../../../hooks/usePullSecret';
33
- import { useParams } from 'react-router-dom-v5-compat';
34
- import ClustersService from '../../../services/ClustersService';
35
- import {
36
- Cluster,
37
- InfraEnv,
38
- InfraEnvCreateParams,
39
- InfraEnvUpdateParams,
40
- } from '@openshift-assisted/types/assisted-installer-service';
41
- import { HostsNetworkConfigurationControlGroup } from '../../clusterConfiguration/HostsNetworkConfigurationControlGroup';
42
- import { HostsNetworkConfigurationType } from '../../../services/types';
43
- import { useTranslation } from '../../../../common/hooks/use-translation-wrapper';
44
- import { getDummyInfraEnvField } from '../../clusterConfiguration/staticIp/data/dummyData';
45
- import { ntpSourceValidationSchema } from '../../../../common/validationSchemas/ntpValidation';
46
- import { isInOcm } from '../../../../common/api';
47
-
48
- const DEFAULT_CPU_ARCHITECTURE = 'x86_64' as const;
49
- const DISCONNECTED_IMAGE_TYPE = 'disconnected-iso' as const;
50
-
51
- type OptionalConfigurationsFormValues = ProxyFieldsType & {
52
- sshPublicKey?: string;
53
- enableNtpSources: boolean;
54
- additionalNtpSources?: string;
55
- hostsNetworkConfigurationType: HostsNetworkConfigurationType;
56
- rendezvousIp?: string;
57
- pullSecret?: string;
58
- };
59
-
60
- const DEFAULT_INITIAL_VALUES: OptionalConfigurationsFormValues = {
61
- sshPublicKey: '',
62
- enableProxy: false,
63
- httpProxy: '',
64
- httpsProxy: '',
65
- noProxy: '',
66
- enableNtpSources: false,
67
- additionalNtpSources: '',
68
- hostsNetworkConfigurationType: HostsNetworkConfigurationType.DHCP,
69
- rendezvousIp: '',
70
- pullSecret: '',
71
- };
72
-
73
- /**
74
- * Rehydrate form values from infraEnv when navigating back to this step.
75
- */
76
- const infraEnvToFormValues = (infraEnv: InfraEnv): OptionalConfigurationsFormValues => ({
77
- ...DEFAULT_INITIAL_VALUES,
78
- sshPublicKey: infraEnv.sshAuthorizedKey ?? '',
79
- enableProxy: !!(infraEnv.proxy?.httpProxy || infraEnv.proxy?.httpsProxy),
80
- httpProxy: infraEnv.proxy?.httpProxy ?? '',
81
- httpsProxy: infraEnv.proxy?.httpsProxy ?? '',
82
- noProxy: infraEnv.proxy?.noProxy ?? '',
83
- enableNtpSources: !!infraEnv.additionalNtpSources,
84
- additionalNtpSources: infraEnv.additionalNtpSources ?? '',
85
- hostsNetworkConfigurationType:
86
- (infraEnv.staticNetworkConfig?.length ?? 0) > 0
87
- ? HostsNetworkConfigurationType.STATIC
88
- : HostsNetworkConfigurationType.DHCP,
89
- rendezvousIp: infraEnv.rendezvousIp ?? '',
90
- });
91
-
92
- /**
93
- * Builds common infrastructure environment params from form values
94
- */
95
- const buildInfraEnvParams = (values: OptionalConfigurationsFormValues) => {
96
- // Build proxy object - only include fields that have values
97
- const proxy = {
98
- ...(values.httpProxy && { httpProxy: values.httpProxy }),
99
- ...(values.httpsProxy && { httpsProxy: values.httpsProxy }),
100
- ...(values.noProxy && { noProxy: values.noProxy }),
101
- };
102
- const hasProxy = Object.keys(proxy).length > 0;
103
-
104
- return {
105
- ...(values.sshPublicKey && { sshAuthorizedKey: values.sshPublicKey }),
106
- ...(hasProxy && { proxy }),
107
- ...(values.additionalNtpSources && {
108
- additionalNtpSources: values.additionalNtpSources,
109
- }),
110
- ...(values.rendezvousIp && { rendezvousIp: values.rendezvousIp }),
111
- // Initialize with dummy static network config when static IP is selected
112
- // This is required for the StaticIpPage to render properly
113
- ...(values.hostsNetworkConfigurationType === HostsNetworkConfigurationType.STATIC && {
114
- staticNetworkConfig: getDummyInfraEnvField(),
115
- }),
116
- };
117
- };
118
-
119
- const getValidationSchema = (t: TFunction, requirePullSecret: boolean) =>
120
- Yup.lazy((values: OptionalConfigurationsFormValues) =>
121
- Yup.object().shape({
122
- sshPublicKey: sshPublicKeyValidationSchema(t),
123
- enableProxy: Yup.boolean().required(),
124
- httpProxy: httpProxyValidationSchema({
125
- values,
126
- pairValueName: 'httpsProxy',
127
- allowEmpty: true,
128
- t,
129
- }),
130
- httpsProxy: httpProxyValidationSchema({
131
- values,
132
- pairValueName: 'httpProxy',
133
- allowEmpty: true,
134
- t,
135
- }),
136
- noProxy: noProxyValidationSchema(t),
137
- enableNtpSources: Yup.boolean().required(),
138
- additionalNtpSources: ntpSourceValidationSchema(t),
139
- hostsNetworkConfigurationType: Yup.string()
140
- .oneOf(Object.values(HostsNetworkConfigurationType))
141
- .required(),
142
- rendezvousIp: Yup.string()
143
- .max(45, 'IP address must be at most 45 characters')
144
- .test(
145
- 'ip-validation',
146
- 'Not a valid IP address',
147
- (value) => !value || ipValidationSchema(t).isValidSync(value),
148
- ),
149
- ...(requirePullSecret && {
150
- pullSecret: pullSecretValidationSchema(t).required(t('ai:Required field')),
151
- }),
152
- }),
153
- );
154
-
155
- const OptionalConfigurationsStep = () => {
156
- const { clusterId } = useParams<{ clusterId: string }>();
157
- const [cluster, setCluster] = React.useState<Cluster | null>(null);
158
- const { t } = useTranslation();
159
- const defaultPullSecret = usePullSecret();
160
-
161
- const { moveNext, moveBack, setDisconnectedInfraEnv, disconnectedInfraEnv } =
162
- useClusterWizardContext();
163
- const { addAlert, clearAlerts } = useAlerts();
164
-
165
- React.useEffect(() => {
166
- const fetchCluster = async () => {
167
- if (!clusterId) {
168
- return;
169
- }
170
- try {
171
- const fetchedCluster = await ClustersService.get(clusterId);
172
- setCluster(fetchedCluster);
173
- } catch (error) {
174
- handleApiError(error, () => {
175
- addAlert({
176
- title: t('ai:Failed to fetch cluster'),
177
- message: getApiErrorMessage(error),
178
- variant: AlertVariant.danger,
179
- });
180
- });
181
- }
182
- };
183
- void fetchCluster();
184
- }, [clusterId, addAlert, t]);
185
-
186
- const initialValues: OptionalConfigurationsFormValues = disconnectedInfraEnv
187
- ? infraEnvToFormValues(disconnectedInfraEnv)
188
- : DEFAULT_INITIAL_VALUES;
189
-
190
- return (
191
- <Formik
192
- initialValues={initialValues}
193
- validateOnMount
194
- validationSchema={getValidationSchema(t, !isInOcm)}
195
- onSubmit={async (values) => {
196
- clearAlerts();
197
- if (!cluster?.id) {
198
- addAlert({
199
- title: t('ai:Missing cluster'),
200
- message: t('ai:Cluster must be created before configuring infrastructure environment'),
201
- variant: AlertVariant.danger,
202
- });
203
- return;
204
- }
205
-
206
- const commonParams = buildInfraEnvParams(values);
207
- // Default pull secret only exists in OCM; when !isInOcm the user must provide it via the field
208
- const pullSecretToUse = isInOcm ? defaultPullSecret : values.pullSecret;
209
-
210
- try {
211
- if (disconnectedInfraEnv?.id) {
212
- // Update existing infraEnv
213
- const updateParams: InfraEnvUpdateParams = {
214
- ...commonParams,
215
- imageType: DISCONNECTED_IMAGE_TYPE,
216
- pullSecret: pullSecretToUse,
217
- };
218
- const { data: updatedInfraEnv } = await InfraEnvsAPI.update(
219
- disconnectedInfraEnv.id,
220
- updateParams,
221
- );
222
- setDisconnectedInfraEnv({
223
- ...updatedInfraEnv,
224
- // infraEnv does not return the whole OCP version
225
- openshiftVersion: cluster.openshiftVersion,
226
- });
227
- } else {
228
- // Create new infraEnv
229
- const createParams: InfraEnvCreateParams = {
230
- name: InfraEnvsService.makeInfraEnvName(DEFAULT_CPU_ARCHITECTURE, cluster.name),
231
- clusterId: cluster.id,
232
- openshiftVersion: cluster.openshiftVersion,
233
- cpuArchitecture: DEFAULT_CPU_ARCHITECTURE,
234
- imageType: DISCONNECTED_IMAGE_TYPE,
235
- pullSecret: pullSecretToUse ?? '',
236
- ...commonParams,
237
- };
238
- const createdInfraEnv = await InfraEnvsService.create(createParams);
239
- setDisconnectedInfraEnv({
240
- ...createdInfraEnv,
241
- // infraEnv does not return the whole OCP version
242
- openshiftVersion: cluster.openshiftVersion,
243
- });
244
- }
245
- moveNext();
246
- } catch (error) {
247
- handleApiError(error, () => {
248
- addAlert({
249
- title: disconnectedInfraEnv?.id
250
- ? t('ai:Failed to update infrastructure environment')
251
- : t('ai:Failed to create infrastructure environment'),
252
- message: getApiErrorMessage(error),
253
- variant: AlertVariant.danger,
254
- });
255
- });
256
- }
257
- }}
258
- >
259
- {({ submitForm, isValid, errors, touched, isSubmitting, values }) => {
260
- const errorFields = getFormikErrorFields(errors, touched);
261
- const handleNext = () => {
262
- void submitForm(); // This will trigger onSubmit
263
- };
264
-
265
- return (
266
- <ClusterWizardStep
267
- navigation={<ClusterWizardNavigation />}
268
- footer={
269
- <ClusterWizardFooter
270
- disconnectedClusterId={clusterId}
271
- onNext={handleNext} // Changed from moveNext
272
- onBack={moveBack}
273
- isNextDisabled={!isValid || !cluster}
274
- errorFields={errorFields}
275
- isSubmitting={isSubmitting}
276
- />
277
- }
278
- >
279
- <WithErrorBoundary title="Failed to load Optional Configurations step">
280
- <Grid hasGutter>
281
- <GridItem>
282
- <Split>
283
- <SplitItem>
284
- <Content component="h2">{t('ai:Optional configurations')}</Content>
285
- </SplitItem>
286
- <SplitItem>
287
- <TechnologyPreview />
288
- </SplitItem>
289
- </Split>
290
- </GridItem>
291
- <GridItem>
292
- <Form id="wizard-cluster-optional-configurations__form">
293
- {/* Pull secret (!OCM only) */}
294
- {!isInOcm && <PullSecret defaultPullSecret={defaultPullSecret} isOcm={false} />}
295
-
296
- {/* Rendezvous IP */}
297
- <InputField
298
- label={t('ai:Rendezvous IP')}
299
- name="rendezvousIp"
300
- helperText={t(
301
- 'ai:The IP address that hosts will use to communicate with the bootstrap node during installation.',
302
- )}
303
- placeholder="e.g., 192.168.1.10"
304
- maxLength={45}
305
- />
306
-
307
- <UploadSSH />
308
-
309
- {/* Proxy Settings */}
310
- <CheckboxField
311
- label={t('ai:Configure proxy settings')}
312
- name="enableProxy"
313
- helperText={
314
- <p>
315
- {t(
316
- 'ai:If hosts are behind a firewall that requires the use of a proxy, provide additional information about the proxy.',
317
- )}
318
- </p>
319
- }
320
- body={values.enableProxy && <ProxyInputFields />}
321
- />
322
-
323
- {/* NTP Configuration */}
324
- <CheckboxField
325
- label={t('ai:Add your own NTP (Network Time Protocol) sources')}
326
- name="enableNtpSources"
327
- helperText={
328
- <p>
329
- {t(
330
- 'ai:Configure your own NTP sources to synchronize the time between the hosts that will be added to this infrastructure environment.',
331
- )}
332
- </p>
333
- }
334
- body={
335
- values.enableNtpSources && (
336
- <Grid hasGutter>
337
- <AdditionalNTPSourcesField
338
- name="additionalNtpSources"
339
- helperText={t(
340
- 'ai:A comma separated list of IP or domain names of the NTP pools or servers.',
341
- )}
342
- />
343
- </Grid>
344
- )
345
- }
346
- />
347
-
348
- {/* Network Configuration */}
349
- <HostsNetworkConfigurationControlGroup
350
- clusterExists={false}
351
- isDisabled={false}
352
- />
353
- </Form>
354
- </GridItem>
355
- </Grid>
356
- </WithErrorBoundary>
357
- </ClusterWizardStep>
358
- );
359
- }}
360
- </Formik>
361
- );
362
- };
363
-
364
- export default OptionalConfigurationsStep;