@openshift-assisted/ui-lib 2.14.0-cim → 2.14.2-cim

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (199) hide show
  1. package/build/@types/cim/components/ClusterDeployment/ACMClusterDeploymentDetailsStep.d.ts +2 -3
  2. package/build/@types/cim/components/ClusterDeployment/ACMClusterDeploymentDetailsStep.d.ts.map +1 -1
  3. package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentDetailsForm.d.ts +3 -0
  4. package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentDetailsForm.d.ts.map +1 -1
  5. package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentDetailsStep.d.ts.map +1 -1
  6. package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentHostDiscoveryTable.d.ts.map +1 -1
  7. package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentHostSelectionStep.d.ts.map +1 -1
  8. package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentHostsDiscovery.d.ts.map +1 -1
  9. package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentHostsDiscoveryStep.d.ts +1 -1
  10. package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentHostsDiscoveryStep.d.ts.map +1 -1
  11. package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentNetworkingStep.d.ts +15 -2
  12. package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentNetworkingStep.d.ts.map +1 -1
  13. package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentReviewStep.d.ts +1 -2
  14. package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentReviewStep.d.ts.map +1 -1
  15. package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentWizard.d.ts +1 -2
  16. package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentWizard.d.ts.map +1 -1
  17. package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentWizardContext.d.ts +8 -7
  18. package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentWizardContext.d.ts.map +1 -1
  19. package/build/@types/cim/components/ClusterDeployment/ClusterDetailsFormFields.d.ts.map +1 -1
  20. package/build/@types/cim/components/ClusterDeployment/components/ClusterDeploymentHostsSelectionAdvanced.d.ts +17 -0
  21. package/build/@types/cim/components/ClusterDeployment/components/ClusterDeploymentHostsSelectionAdvanced.d.ts.map +1 -0
  22. package/build/@types/cim/components/ClusterDeployment/components/ClusterScaleUpAutoHostsSelection.d.ts +8 -0
  23. package/build/@types/cim/components/ClusterDeployment/components/ClusterScaleUpAutoHostsSelection.d.ts.map +1 -0
  24. package/build/@types/cim/components/ClusterDeployment/components/ValidationSection.d.ts +16 -0
  25. package/build/@types/cim/components/ClusterDeployment/components/ValidationSection.d.ts.map +1 -0
  26. package/build/@types/cim/components/ClusterDeployment/constants.d.ts +2 -0
  27. package/build/@types/cim/components/ClusterDeployment/constants.d.ts.map +1 -1
  28. package/build/@types/cim/components/ClusterDeployment/index.d.ts +1 -2
  29. package/build/@types/cim/components/ClusterDeployment/index.d.ts.map +1 -1
  30. package/build/@types/cim/components/ClusterDeployment/networkConfigurationValidation.d.ts +1 -11
  31. package/build/@types/cim/components/ClusterDeployment/networkConfigurationValidation.d.ts.map +1 -1
  32. package/build/@types/cim/components/ClusterDeployment/types.d.ts +7 -9
  33. package/build/@types/cim/components/ClusterDeployment/types.d.ts.map +1 -1
  34. package/build/@types/cim/components/ClusterDeployment/use-networking-formik.d.ts +8 -2
  35. package/build/@types/cim/components/ClusterDeployment/use-networking-formik.d.ts.map +1 -1
  36. package/build/@types/cim/components/Hypershift/DetailsPage/HypershiftKubeconfigDownload.d.ts.map +1 -1
  37. package/build/@types/cim/components/Hypershift/types.d.ts +6 -3
  38. package/build/@types/cim/components/Hypershift/types.d.ts.map +1 -1
  39. package/build/@types/cim/components/InfraEnv/InfraEnvAgentTable.d.ts.map +1 -1
  40. package/build/@types/cim/components/common/constants.d.ts.map +1 -1
  41. package/build/@types/cim/components/helpers/agents.d.ts +3 -0
  42. package/build/@types/cim/components/helpers/agents.d.ts.map +1 -1
  43. package/build/@types/cim/components/helpers/toAssisted.d.ts.map +1 -1
  44. package/build/@types/cim/components/modals/AddHostModal.d.ts.map +1 -1
  45. package/build/@types/cim/components/modals/EditAgentModal.d.ts.map +1 -1
  46. package/build/@types/cim/components/modals/ScaleUpModal.d.ts +3 -0
  47. package/build/@types/cim/components/modals/ScaleUpModal.d.ts.map +1 -1
  48. package/build/@types/cim/types/k8s/infra-env-k8s-resource.d.ts +1 -0
  49. package/build/@types/cim/types/k8s/infra-env-k8s-resource.d.ts.map +1 -1
  50. package/build/@types/common/components/clusterConfiguration/ControlPlaneNodesDropdown.d.ts +7 -0
  51. package/build/@types/common/components/clusterConfiguration/ControlPlaneNodesDropdown.d.ts.map +1 -0
  52. package/build/@types/common/components/clusterConfiguration/DiscoveryImageConfigForm.d.ts.map +1 -1
  53. package/build/@types/common/components/clusterWizard/clusterDetailsValidation.d.ts.map +1 -1
  54. package/build/@types/common/components/clusterWizard/networkingSteps/AvailableSubnetsControl.d.ts.map +1 -1
  55. package/build/@types/common/components/clusterWizard/types.d.ts +1 -0
  56. package/build/@types/common/components/clusterWizard/types.d.ts.map +1 -1
  57. package/build/@types/common/components/hosts/EditHostForm.d.ts.map +1 -1
  58. package/build/@types/common/components/ui/formik/validationSchemas.d.ts.map +1 -1
  59. package/build/@types/ocm/store/slices/current-cluster/slice.d.ts +1 -0
  60. package/build/@types/ocm/store/slices/current-cluster/slice.d.ts.map +1 -1
  61. package/build/cjs/cim/components/ClusterDeployment/ACMClusterDeploymentDetailsStep.js +9 -7
  62. package/build/cjs/cim/components/ClusterDeployment/ACMClusterDeploymentDetailsStep.js.map +1 -1
  63. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentDetailsForm.js +26 -1
  64. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentDetailsForm.js.map +1 -1
  65. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentDetailsStep.js +13 -29
  66. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentDetailsStep.js.map +1 -1
  67. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentHostDiscoveryTable.js +2 -12
  68. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentHostDiscoveryTable.js.map +1 -1
  69. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentHostSelectionStep.js +50 -26
  70. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentHostSelectionStep.js.map +1 -1
  71. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentHostsDiscovery.js +3 -3
  72. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentHostsDiscovery.js.map +1 -1
  73. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentHostsDiscoveryStep.js +39 -21
  74. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentHostsDiscoveryStep.js.map +1 -1
  75. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentNetworkingStep.js +58 -27
  76. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentNetworkingStep.js.map +1 -1
  77. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentReviewStep.js +24 -24
  78. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentReviewStep.js.map +1 -1
  79. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentWizard.js +26 -42
  80. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentWizard.js.map +1 -1
  81. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentWizardContext.js +12 -8
  82. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentWizardContext.js.map +1 -1
  83. package/build/cjs/cim/components/ClusterDeployment/ClusterDetailsFormFields.js +4 -5
  84. package/build/cjs/cim/components/ClusterDeployment/ClusterDetailsFormFields.js.map +1 -1
  85. package/build/cjs/cim/components/ClusterDeployment/NetworkConfiguration.js +5 -5
  86. package/build/cjs/cim/components/ClusterDeployment/NetworkConfiguration.js.map +1 -1
  87. package/build/cjs/cim/components/ClusterDeployment/components/ClusterDeploymentHostsSelectionAdvanced.js +50 -0
  88. package/build/cjs/cim/components/ClusterDeployment/components/ClusterDeploymentHostsSelectionAdvanced.js.map +1 -0
  89. package/build/cjs/cim/components/ClusterDeployment/components/ClusterScaleUpAutoHostsSelection.js +24 -0
  90. package/build/cjs/cim/components/ClusterDeployment/components/ClusterScaleUpAutoHostsSelection.js.map +1 -0
  91. package/build/cjs/cim/components/ClusterDeployment/components/ValidationSection.js +17 -0
  92. package/build/cjs/cim/components/ClusterDeployment/components/ValidationSection.js.map +1 -0
  93. package/build/cjs/cim/components/ClusterDeployment/constants.js +2 -0
  94. package/build/cjs/cim/components/ClusterDeployment/constants.js.map +1 -1
  95. package/build/cjs/cim/components/ClusterDeployment/index.js +2 -5
  96. package/build/cjs/cim/components/ClusterDeployment/index.js.map +1 -1
  97. package/build/cjs/cim/components/ClusterDeployment/networkConfigurationValidation.js +1 -14
  98. package/build/cjs/cim/components/ClusterDeployment/networkConfigurationValidation.js.map +1 -1
  99. package/build/cjs/cim/components/ClusterDeployment/use-networking-formik.js +2 -2
  100. package/build/cjs/cim/components/ClusterDeployment/use-networking-formik.js.map +1 -1
  101. package/build/cjs/cim/components/Hypershift/DetailsPage/HypershiftKubeconfigDownload.js +6 -4
  102. package/build/cjs/cim/components/Hypershift/DetailsPage/HypershiftKubeconfigDownload.js.map +1 -1
  103. package/build/cjs/cim/components/InfraEnv/InfraEnvAgentTable.js +2 -12
  104. package/build/cjs/cim/components/InfraEnv/InfraEnvAgentTable.js.map +1 -1
  105. package/build/cjs/cim/components/InfraEnv/OpenshiftVersionDropdown.js +1 -1
  106. package/build/cjs/cim/components/InfraEnv/OpenshiftVersionDropdown.js.map +1 -1
  107. package/build/cjs/cim/components/common/constants.js +1 -1
  108. package/build/cjs/cim/components/common/constants.js.map +1 -1
  109. package/build/cjs/cim/components/helpers/agents.js +19 -1
  110. package/build/cjs/cim/components/helpers/agents.js.map +1 -1
  111. package/build/cjs/cim/components/helpers/toAssisted.js +25 -22
  112. package/build/cjs/cim/components/helpers/toAssisted.js.map +1 -1
  113. package/build/cjs/cim/components/modals/AddHostModal.js +4 -5
  114. package/build/cjs/cim/components/modals/AddHostModal.js.map +1 -1
  115. package/build/cjs/cim/components/modals/EditAgentModal.js +2 -2
  116. package/build/cjs/cim/components/modals/EditAgentModal.js.map +1 -1
  117. package/build/cjs/cim/components/modals/ScaleUpModal.js +3 -2
  118. package/build/cjs/cim/components/modals/ScaleUpModal.js.map +1 -1
  119. package/build/cjs/common/components/clusterConfiguration/ControlPlaneNodesDropdown.js +41 -0
  120. package/build/cjs/common/components/clusterConfiguration/ControlPlaneNodesDropdown.js.map +1 -0
  121. package/build/cjs/common/components/clusterConfiguration/DiscoveryImageConfigForm.js +4 -5
  122. package/build/cjs/common/components/clusterConfiguration/DiscoveryImageConfigForm.js.map +1 -1
  123. package/build/cjs/common/components/clusterConfiguration/DiscoveryImageTypeControlGroup.js +5 -5
  124. package/build/cjs/common/components/clusterConfiguration/DiscoveryImageTypeControlGroup.js.map +1 -1
  125. package/build/cjs/common/components/clusterWizard/clusterDetailsValidation.js +1 -0
  126. package/build/cjs/common/components/clusterWizard/clusterDetailsValidation.js.map +1 -1
  127. package/build/cjs/common/components/clusterWizard/networkingSteps/AvailableSubnetsControl.js +14 -18
  128. package/build/cjs/common/components/clusterWizard/networkingSteps/AvailableSubnetsControl.js.map +1 -1
  129. package/build/cjs/common/components/clusterWizard/networkingSteps/VirtualIPControlGroup.js +4 -4
  130. package/build/cjs/common/components/clusterWizard/networkingSteps/VirtualIPControlGroup.js.map +1 -1
  131. package/build/cjs/common/components/hosts/EditHostForm.js +3 -3
  132. package/build/cjs/common/components/hosts/EditHostForm.js.map +1 -1
  133. package/build/cjs/common/components/ui/formik/validationSchemas.js +18 -15
  134. package/build/cjs/common/components/ui/formik/validationSchemas.js.map +1 -1
  135. package/build/cjs/common/config/constants.js +1 -1
  136. package/build/cjs/common/config/constants.js.map +1 -1
  137. package/lib/cim/components/ClusterDeployment/ACMClusterDeploymentDetailsStep.tsx +11 -9
  138. package/lib/cim/components/ClusterDeployment/ClusterDeploymentDetailsForm.tsx +63 -3
  139. package/lib/cim/components/ClusterDeployment/ClusterDeploymentDetailsStep.tsx +25 -53
  140. package/lib/cim/components/ClusterDeployment/ClusterDeploymentHostDiscoveryTable.tsx +7 -16
  141. package/lib/cim/components/ClusterDeployment/ClusterDeploymentHostSelectionStep.tsx +102 -59
  142. package/lib/cim/components/ClusterDeployment/ClusterDeploymentHostsDiscovery.tsx +16 -10
  143. package/lib/cim/components/ClusterDeployment/ClusterDeploymentHostsDiscoveryStep.tsx +84 -48
  144. package/lib/cim/components/ClusterDeployment/ClusterDeploymentNetworkingStep.tsx +106 -54
  145. package/lib/cim/components/ClusterDeployment/ClusterDeploymentReviewStep.tsx +96 -85
  146. package/lib/cim/components/ClusterDeployment/ClusterDeploymentWizard.tsx +109 -119
  147. package/lib/cim/components/ClusterDeployment/ClusterDeploymentWizardContext.tsx +27 -14
  148. package/lib/cim/components/ClusterDeployment/ClusterDetailsFormFields.tsx +4 -6
  149. package/lib/cim/components/ClusterDeployment/NetworkConfiguration.tsx +5 -5
  150. package/lib/cim/components/ClusterDeployment/components/ClusterDeploymentHostsSelectionAdvanced.tsx +107 -0
  151. package/lib/cim/components/ClusterDeployment/components/ClusterScaleUpAutoHostsSelection.tsx +49 -0
  152. package/lib/cim/components/ClusterDeployment/components/ValidationSection.tsx +41 -0
  153. package/lib/cim/components/ClusterDeployment/constants.ts +3 -1
  154. package/lib/cim/components/ClusterDeployment/index.ts +1 -3
  155. package/lib/cim/components/ClusterDeployment/networkConfigurationValidation.ts +1 -26
  156. package/lib/cim/components/ClusterDeployment/types.ts +7 -10
  157. package/lib/cim/components/ClusterDeployment/use-networking-formik.ts +3 -3
  158. package/lib/cim/components/Hypershift/DetailsPage/HypershiftKubeconfigDownload.tsx +4 -2
  159. package/lib/cim/components/Hypershift/types.ts +6 -3
  160. package/lib/cim/components/InfraEnv/InfraEnvAgentTable.tsx +7 -16
  161. package/lib/cim/components/InfraEnv/OpenshiftVersionDropdown.tsx +1 -1
  162. package/lib/cim/components/common/constants.ts +1 -2
  163. package/lib/cim/components/helpers/agents.ts +30 -1
  164. package/lib/cim/components/helpers/toAssisted.ts +13 -8
  165. package/lib/cim/components/modals/AddHostModal.tsx +4 -5
  166. package/lib/cim/components/modals/EditAgentModal.tsx +2 -1
  167. package/lib/cim/components/modals/ScaleUpModal.tsx +12 -2
  168. package/lib/cim/types/k8s/infra-env-k8s-resource.ts +1 -0
  169. package/lib/common/components/clusterConfiguration/ControlPlaneNodesDropdown.tsx +93 -0
  170. package/lib/common/components/clusterConfiguration/DiscoveryImageConfigForm.tsx +10 -12
  171. package/lib/common/components/clusterConfiguration/DiscoveryImageTypeControlGroup.tsx +9 -9
  172. package/lib/common/components/clusterWizard/clusterDetailsValidation.ts +1 -0
  173. package/lib/common/components/clusterWizard/networkingSteps/AvailableSubnetsControl.tsx +50 -61
  174. package/lib/common/components/clusterWizard/networkingSteps/VirtualIPControlGroup.tsx +4 -4
  175. package/lib/common/components/clusterWizard/types.ts +1 -0
  176. package/lib/common/components/hosts/EditHostForm.tsx +16 -6
  177. package/lib/common/components/ui/formik/validationSchemas.ts +13 -10
  178. package/lib/common/config/constants.ts +1 -1
  179. package/package.json +4 -3
  180. package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentCreateProgress.d.ts +0 -10
  181. package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentCreateProgress.d.ts.map +0 -1
  182. package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentWizardFooter.d.ts +0 -13
  183. package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentWizardFooter.d.ts.map +0 -1
  184. package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentWizardNavigation.d.ts +0 -4
  185. package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentWizardNavigation.d.ts.map +0 -1
  186. package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentWizardStep.d.ts +0 -7
  187. package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentWizardStep.d.ts.map +0 -1
  188. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentCreateProgress.js +0 -31
  189. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentCreateProgress.js.map +0 -1
  190. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentWizardFooter.js +0 -50
  191. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentWizardFooter.js.map +0 -1
  192. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentWizardNavigation.js +0 -35
  193. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentWizardNavigation.js.map +0 -1
  194. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentWizardStep.js +0 -9
  195. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentWizardStep.js.map +0 -1
  196. package/lib/cim/components/ClusterDeployment/ClusterDeploymentCreateProgress.tsx +0 -79
  197. package/lib/cim/components/ClusterDeployment/ClusterDeploymentWizardFooter.tsx +0 -128
  198. package/lib/cim/components/ClusterDeployment/ClusterDeploymentWizardNavigation.tsx +0 -81
  199. package/lib/cim/components/ClusterDeployment/ClusterDeploymentWizardStep.tsx +0 -13
@@ -1,16 +1,21 @@
1
1
  import React from 'react';
2
2
  import * as Yup from 'yup';
3
3
  import { Formik, FormikConfig, useFormikContext } from 'formik';
4
- import { Alert, AlertVariant, Grid, GridItem } from '@patternfly/react-core';
5
- import { ClusterWizardStepHeader, useAlerts } from '../../../common';
4
+ import {
5
+ Alert,
6
+ AlertVariant,
7
+ Grid,
8
+ GridItem,
9
+ useWizardContext,
10
+ useWizardFooter,
11
+ WizardFooter,
12
+ } from '@patternfly/react-core';
13
+ import { Alerts, ClusterWizardStepHeader, useAlerts } from '../../../common';
6
14
  import {
7
15
  AgentClusterInstallK8sResource,
8
16
  AgentK8sResource,
9
17
  ClusterDeploymentK8sResource,
10
18
  } from '../../types';
11
- import ClusterDeploymentWizardContext from './ClusterDeploymentWizardContext';
12
- import ClusterDeploymentWizardFooter from './ClusterDeploymentWizardFooter';
13
- import ClusterDeploymentWizardStep from './ClusterDeploymentWizardStep';
14
19
  import ClusterDeploymentHostsSelection from './ClusterDeploymentHostsSelection';
15
20
  import {
16
21
  ClusterDeploymentHostSelectionStepProps,
@@ -25,6 +30,8 @@ import {
25
30
  import { canNextFromHostSelectionStep } from './wizardTransition';
26
31
  import { useTranslation } from '../../../common/hooks/use-translation-wrapper';
27
32
  import { TFunction } from 'i18next';
33
+ import { ValidationSection } from './components/ValidationSection';
34
+ import { ClusterDeploymentWizardContext } from './ClusterDeploymentWizardContext';
28
35
 
29
36
  const getInitialValues = ({
30
37
  agents,
@@ -138,14 +145,15 @@ type HostSelectionFormProps = Omit<ClusterDeploymentHostSelectionStepProps, 'onS
138
145
  const HostSelectionForm: React.FC<HostSelectionFormProps> = ({
139
146
  agents,
140
147
  agentClusterInstall,
141
- onClose,
142
148
  clusterDeployment,
143
149
  aiConfigMap,
144
150
  onEditRole: onEditRoleInit,
145
151
  onSetInstallationDiskId,
146
152
  isNutanix,
147
153
  }) => {
148
- const { setCurrentStepId } = React.useContext(ClusterDeploymentWizardContext);
154
+ const { activeStep, goToNextStep, goToPrevStep, close } = useWizardContext();
155
+ const { syncError } = React.useContext(ClusterDeploymentWizardContext);
156
+ const { alerts } = useAlerts();
149
157
  const [showClusterErrors, setShowClusterErrors] = React.useState(false);
150
158
  const {
151
159
  values,
@@ -186,7 +194,7 @@ const HostSelectionForm: React.FC<HostSelectionFormProps> = ({
186
194
  setShowClusterErrors(false);
187
195
  }, []);
188
196
 
189
- const onNext = async () => {
197
+ const onNext = React.useCallback(async () => {
190
198
  if (!showFormErrors) {
191
199
  setShowFormErrors(true);
192
200
  const errors = await validateForm();
@@ -202,7 +210,7 @@ const HostSelectionForm: React.FC<HostSelectionFormProps> = ({
202
210
  }
203
211
  void submitForm();
204
212
  setNextRequested(true);
205
- };
213
+ }, [setTouched, showFormErrors, submitForm, validateForm]);
206
214
 
207
215
  React.useEffect(() => {
208
216
  if (nextRequested && !isSubmitting) {
@@ -223,71 +231,106 @@ const HostSelectionForm: React.FC<HostSelectionFormProps> = ({
223
231
  ) {
224
232
  setShowClusterErrors(true);
225
233
  if (canNextFromHostSelectionStep(agentClusterInstall, selectedAgents)) {
226
- setCurrentStepId('networking');
234
+ void goToNextStep();
227
235
  }
228
236
  }
229
237
  }
230
- }, [nextRequested, selectedAgents, agentClusterInstall, setCurrentStepId, isSubmitting, t]);
231
-
232
- let submittingText: string | undefined = undefined;
238
+ }, [nextRequested, selectedAgents, agentClusterInstall, isSubmitting, t, goToNextStep]);
233
239
 
234
- if (isSubmitting) {
235
- submittingText = t('ai:Saving changes...');
236
- } else if (nextRequested && !showClusterErrors) {
237
- submittingText = t('ai:Binding hosts...');
238
- }
240
+ const submittingText = React.useMemo(() => {
241
+ if (isSubmitting) {
242
+ return t('ai:Saving changes...');
243
+ } else if (nextRequested && !showClusterErrors) {
244
+ return t('ai:Binding hosts...');
245
+ }
246
+ return undefined;
247
+ }, [isSubmitting, nextRequested, showClusterErrors, t]);
239
248
 
240
- const onSyncError = React.useCallback(() => setNextRequested(false), []);
249
+ React.useEffect(() => {
250
+ if (syncError) {
251
+ setNextRequested(false);
252
+ }
253
+ }, [syncError]);
241
254
 
242
- const footer = (
243
- <ClusterDeploymentWizardFooter
244
- agentClusterInstall={agentClusterInstall}
245
- agents={selectedAgents}
246
- isSubmitting={!!submittingText}
247
- submittingText={submittingText}
248
- isNextDisabled={
249
- nextRequested || isSubmitting || (showFormErrors ? !isValid || isValidating : false)
250
- }
251
- // eslint-disable-next-line @typescript-eslint/no-misused-promises
252
- onNext={onNext}
253
- onBack={() => setCurrentStepId('cluster-details')}
254
- onCancel={onClose}
255
- showClusterErrors={showClusterErrors}
256
- onSyncError={onSyncError}
257
- >
258
- {showFormErrors && errors.selectedHostIds && touched.selectedHostIds && (
259
- <Alert
260
- variant={AlertVariant.danger}
261
- title={t('ai:Provided cluster configuration is not valid')}
262
- isInline
263
- >
264
- {errors.selectedHostIds}
255
+ const errorsSection = (
256
+ <ValidationSection currentStepId={'cluster-details'} hosts={[]}>
257
+ {syncError && (
258
+ <Alert variant={AlertVariant.danger} title={t('ai:An error occured')} isInline>
259
+ {syncError}
265
260
  </Alert>
266
261
  )}
267
- </ClusterDeploymentWizardFooter>
262
+ </ValidationSection>
268
263
  );
269
264
 
265
+ const footer = React.useMemo(
266
+ () => (
267
+ <WizardFooter
268
+ activeStep={activeStep}
269
+ onNext={onNext}
270
+ isNextDisabled={
271
+ nextRequested || isSubmitting || (showFormErrors ? !isValid || isValidating : false) // ||
272
+ // !!syncError
273
+ }
274
+ nextButtonText={submittingText || t('ai:Next')}
275
+ nextButtonProps={{ isLoading: !!submittingText }}
276
+ onBack={goToPrevStep}
277
+ onClose={close}
278
+ />
279
+ ),
280
+ [
281
+ activeStep,
282
+ onNext,
283
+ nextRequested,
284
+ isSubmitting,
285
+ showFormErrors,
286
+ isValid,
287
+ isValidating,
288
+ submittingText,
289
+ t,
290
+ goToPrevStep,
291
+ close,
292
+ ],
293
+ );
294
+
295
+ useWizardFooter(footer);
296
+
270
297
  return (
271
- <ClusterDeploymentWizardStep footer={footer}>
272
- <Grid hasGutter>
298
+ <Grid hasGutter>
299
+ <GridItem>
300
+ <ClusterWizardStepHeader>{t('ai:Cluster hosts')}</ClusterWizardStepHeader>
301
+ </GridItem>
302
+ <GridItem>
303
+ <ClusterDeploymentHostsSelection
304
+ agentClusterInstall={agentClusterInstall}
305
+ agents={agents}
306
+ clusterDeployment={clusterDeployment}
307
+ aiConfigMap={aiConfigMap}
308
+ onEditRole={onEditRole}
309
+ onSetInstallationDiskId={onSetInstallationDiskId}
310
+ onAutoSelectChange={onAutoSelectChange}
311
+ onHostSelect={onHostSelect}
312
+ isNutanix={isNutanix}
313
+ />
314
+ </GridItem>
315
+ {(showClusterErrors || showFormErrors) && !!alerts.length && (
273
316
  <GridItem>
274
- <ClusterWizardStepHeader>{t('ai:Cluster hosts')}</ClusterWizardStepHeader>
317
+ <Alerts />
275
318
  </GridItem>
319
+ )}
320
+
321
+ {syncError && <GridItem>{errorsSection}</GridItem>}
322
+ {showFormErrors && errors.selectedHostIds && touched.selectedHostIds && (
276
323
  <GridItem>
277
- <ClusterDeploymentHostsSelection
278
- agentClusterInstall={agentClusterInstall}
279
- agents={agents}
280
- clusterDeployment={clusterDeployment}
281
- aiConfigMap={aiConfigMap}
282
- onEditRole={onEditRole}
283
- onSetInstallationDiskId={onSetInstallationDiskId}
284
- onAutoSelectChange={onAutoSelectChange}
285
- onHostSelect={onHostSelect}
286
- isNutanix={isNutanix}
287
- />
324
+ <Alert
325
+ variant={AlertVariant.danger}
326
+ title={t('ai:Provided cluster configuration is not valid')}
327
+ isInline
328
+ >
329
+ {errors.selectedHostIds}
330
+ </Alert>
288
331
  </GridItem>
289
- </Grid>
290
- </ClusterDeploymentWizardStep>
332
+ )}
333
+ </Grid>
291
334
  );
292
335
  };
293
336
 
@@ -15,7 +15,7 @@ import {
15
15
  HostsNotShowingLink,
16
16
  VMRebootConfigurationInfo,
17
17
  } from '../../../common';
18
- import { getIsSNOCluster } from '../helpers';
18
+ import { getIsSNOCluster, onAgentChangeHostname } from '../helpers';
19
19
  import MinimalHWRequirements from '../Agent/MinimalHWRequirements';
20
20
  import { ClusterDeploymentHostsDiscoveryProps } from './types';
21
21
  import { EditBMHModal, EditAgentModal } from '../modals';
@@ -57,7 +57,7 @@ const ClusterDeploymentHostsDiscovery: React.FC<ClusterDeploymentHostsDiscoveryP
57
57
  infraEnv,
58
58
  infraNMStates,
59
59
  usedHostnames,
60
- onSaveAgent,
60
+ onChangeHostname,
61
61
  onEditRole,
62
62
  onSetInstallationDiskId,
63
63
  onSaveBMH,
@@ -119,7 +119,7 @@ const ClusterDeploymentHostsDiscovery: React.FC<ClusterDeploymentHostsDiscoveryP
119
119
  onEditRole={onEditRole}
120
120
  onSetInstallationDiskId={onSetInstallationDiskId}
121
121
  onEditBMH={setEditBMH}
122
- onChangeHostname={onSaveAgent}
122
+ onChangeHostname={onChangeHostname}
123
123
  onChangeBMHHostname={onChangeBMHHostname}
124
124
  onApprove={onApproveAgent}
125
125
  width={contentRect.bounds?.width}
@@ -138,13 +138,19 @@ const ClusterDeploymentHostsDiscovery: React.FC<ClusterDeploymentHostsDiscoveryP
138
138
  fetchSecret={fetchSecret}
139
139
  usedHostnames={usedHostnames || []}
140
140
  />
141
- <EditAgentModal
142
- isOpen={!!editAgent}
143
- onClose={() => setEditAgent(undefined)}
144
- usedHostnames={usedHostnames}
145
- agent={editAgent}
146
- onSave={onSaveAgent}
147
- />
141
+ {editAgent && (
142
+ <EditAgentModal
143
+ onClose={() => setEditAgent(undefined)}
144
+ usedHostnames={usedHostnames}
145
+ agent={editAgent}
146
+ onSave={onAgentChangeHostname(
147
+ agents,
148
+ bareMetalHosts,
149
+ onChangeHostname,
150
+ onChangeBMHHostname,
151
+ )}
152
+ />
153
+ )}
148
154
  </GridItem>
149
155
  <DiscoveryTroubleshootingModal
150
156
  isOpen={isDiscoveryHintModalOpen}
@@ -1,28 +1,37 @@
1
1
  import React from 'react';
2
2
  import uniq from 'lodash-es/uniq.js';
3
- import { Grid, GridItem, Alert, AlertVariant, List, ListItem } from '@patternfly/react-core';
3
+ import {
4
+ Grid,
5
+ GridItem,
6
+ Alert,
7
+ AlertVariant,
8
+ List,
9
+ ListItem,
10
+ useWizardFooter,
11
+ WizardFooter,
12
+ useWizardContext,
13
+ } from '@patternfly/react-core';
4
14
 
5
- import { ClusterWizardStepHeader } from '../../../common';
6
- import ClusterDeploymentWizardContext from './ClusterDeploymentWizardContext';
7
- import ClusterDeploymentWizardFooter from './ClusterDeploymentWizardFooter';
8
- import ClusterDeploymentWizardStep from './ClusterDeploymentWizardStep';
15
+ import { Alerts, ClusterWizardStepHeader } from '../../../common';
9
16
  import { ClusterDeploymentHostsDiscoveryStepProps } from './types';
10
17
  import ClusterDeploymentHostsDiscovery from './ClusterDeploymentHostsDiscovery';
11
18
  import { getAgentsHostsNames, isAgentOfInfraEnv } from './helpers';
12
19
  import { getIsSNOCluster, getWizardStepAgentStatus } from '../helpers';
13
20
  import { canNextFromHostDiscoveryStep } from './wizardTransition';
14
21
  import { useTranslation } from '../../../common/hooks/use-translation-wrapper';
22
+ import { ValidationSection } from './components/ValidationSection';
23
+ import { ClusterDeploymentWizardContext } from './ClusterDeploymentWizardContext';
15
24
 
16
- const ClusterDeploymentHostsDiscoveryStep: React.FC<ClusterDeploymentHostsDiscoveryStepProps> = ({
25
+ const ClusterDeploymentHostsDiscoveryStep = ({
17
26
  agentClusterInstall,
18
27
  agents: allAgents,
19
28
  infraEnv,
20
29
  onSaveHostsDiscovery,
21
- onClose,
22
30
  ...rest
23
- }) => {
31
+ }: ClusterDeploymentHostsDiscoveryStepProps) => {
24
32
  const { t } = useTranslation();
25
- const { setCurrentStepId } = React.useContext(ClusterDeploymentWizardContext);
33
+ const { syncError } = React.useContext(ClusterDeploymentWizardContext);
34
+ const { activeStep, goToNextStep, goToPrevStep, close } = useWizardContext();
26
35
  const [showClusterErrors, setShowClusterErrors] = React.useState(false);
27
36
  const [nextRequested, setNextRequested] = React.useState(false);
28
37
  const [showFormErrors, setShowFormErrors] = React.useState(false);
@@ -61,7 +70,7 @@ const ClusterDeploymentHostsDiscoveryStep: React.FC<ClusterDeploymentHostsDiscov
61
70
  errors.push(t('ai:Some hosts are not ready.'));
62
71
  }
63
72
 
64
- const onNext = async () => {
73
+ const onNext = React.useCallback(async () => {
65
74
  if (!showFormErrors) {
66
75
  setShowFormErrors(true);
67
76
  if (errors.length) {
@@ -70,7 +79,7 @@ const ClusterDeploymentHostsDiscoveryStep: React.FC<ClusterDeploymentHostsDiscov
70
79
  }
71
80
  await onSaveHostsDiscovery();
72
81
  setNextRequested(true);
73
- };
82
+ }, [errors.length, onSaveHostsDiscovery, showFormErrors]);
74
83
 
75
84
  React.useEffect(() => {
76
85
  setNextRequested(false);
@@ -86,31 +95,68 @@ const ClusterDeploymentHostsDiscoveryStep: React.FC<ClusterDeploymentHostsDiscov
86
95
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
87
96
  // @ts-ignore
88
97
  if (canNextFromHostDiscoveryStep(agentClusterInstall, infraEnvAgents)) {
89
- setCurrentStepId('networking');
98
+ void goToNextStep();
90
99
  }
91
100
  }
92
101
  }
93
- }, [nextRequested, infraEnvAgents, agentClusterInstall, setCurrentStepId, agentsNotHealthy]);
102
+ }, [nextRequested, infraEnvAgents, agentClusterInstall, agentsNotHealthy, goToNextStep]);
94
103
 
95
- const submittingText =
96
- nextRequested && !showClusterErrors ? t('ai:Saving changes...') : undefined;
104
+ const submittingText = React.useMemo(
105
+ () => (nextRequested && !showClusterErrors ? t('ai:Saving changes...') : undefined),
106
+ [nextRequested, showClusterErrors, t],
107
+ );
108
+
109
+ React.useEffect(() => {
110
+ if (syncError) {
111
+ setNextRequested(false);
112
+ }
113
+ }, [syncError]);
97
114
 
98
- const onSyncError = React.useCallback(() => setNextRequested(false), []);
115
+ const footer = React.useMemo(
116
+ () => (
117
+ <WizardFooter
118
+ activeStep={activeStep}
119
+ onNext={onNext}
120
+ isNextDisabled={nextRequested || (showFormErrors ? !!errors.length : false)}
121
+ nextButtonText={submittingText || t('ai:Next')}
122
+ nextButtonProps={{ isLoading: !!submittingText }}
123
+ onBack={goToPrevStep}
124
+ onClose={close}
125
+ />
126
+ ),
127
+ [
128
+ activeStep,
129
+ close,
130
+ errors.length,
131
+ goToPrevStep,
132
+ nextRequested,
133
+ onNext,
134
+ showFormErrors,
135
+ submittingText,
136
+ t,
137
+ ],
138
+ );
139
+ useWizardFooter(footer);
99
140
 
100
- const footer = (
101
- <ClusterDeploymentWizardFooter
102
- agentClusterInstall={agentClusterInstall}
103
- agents={infraEnvAgents}
104
- isSubmitting={!!submittingText}
105
- submittingText={submittingText}
106
- isNextDisabled={nextRequested || (showFormErrors ? !!errors.length : false)}
107
- // eslint-disable-next-line @typescript-eslint/no-misused-promises
108
- onNext={onNext}
109
- onBack={() => setCurrentStepId('cluster-details')}
110
- showClusterErrors={showClusterErrors}
111
- onSyncError={onSyncError}
112
- onCancel={onClose}
113
- >
141
+ return (
142
+ <Grid hasGutter>
143
+ <GridItem>
144
+ <ClusterWizardStepHeader>{t('ai:Cluster hosts')}</ClusterWizardStepHeader>
145
+ </GridItem>
146
+ <GridItem>
147
+ <ClusterDeploymentHostsDiscovery
148
+ agentClusterInstall={agentClusterInstall}
149
+ agents={infraEnvAgents}
150
+ infraEnv={infraEnv}
151
+ usedHostnames={usedHostnames}
152
+ {...rest}
153
+ />
154
+ </GridItem>
155
+ {showClusterErrors && !!errors.length && (
156
+ <GridItem>
157
+ <Alerts />
158
+ </GridItem>
159
+ )}
114
160
  {showFormErrors && !!errors.length && (
115
161
  <Alert
116
162
  variant={AlertVariant.danger}
@@ -124,27 +170,17 @@ const ClusterDeploymentHostsDiscoveryStep: React.FC<ClusterDeploymentHostsDiscov
124
170
  </List>
125
171
  </Alert>
126
172
  )}
127
- </ClusterDeploymentWizardFooter>
128
- );
129
173
 
130
- return (
131
- <ClusterDeploymentWizardStep footer={footer}>
132
- <Grid hasGutter>
174
+ {!!syncError && (
133
175
  <GridItem>
134
- <ClusterWizardStepHeader>{t('ai:Cluster hosts')}</ClusterWizardStepHeader>
176
+ <ValidationSection currentStepId={'hosts-selection'} hosts={[]}>
177
+ <Alert variant={AlertVariant.danger} title={t('ai:An error occured')} isInline>
178
+ {syncError}
179
+ </Alert>
180
+ </ValidationSection>
135
181
  </GridItem>
136
- <GridItem>
137
- <ClusterDeploymentHostsDiscovery
138
- agentClusterInstall={agentClusterInstall}
139
- agents={infraEnvAgents}
140
- infraEnv={infraEnv}
141
- usedHostnames={usedHostnames}
142
- {...rest}
143
- />
144
- </GridItem>
145
- </Grid>
146
- </ClusterDeploymentWizardStep>
182
+ )}
183
+ </Grid>
147
184
  );
148
185
  };
149
-
150
186
  export default ClusterDeploymentHostsDiscoveryStep;