@openshift-assisted/ui-lib 2.9.6-cim → 2.9.8-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 (203) hide show
  1. package/build/@types/cim/components/ClusterDeployment/ACMClusterDeploymentDetailsStep.d.ts +1 -0
  2. package/build/@types/cim/components/ClusterDeployment/ACMClusterDeploymentDetailsStep.d.ts.map +1 -1
  3. package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentDetails.d.ts.map +1 -1
  4. package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentDetailsForm.d.ts +1 -0
  5. package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentDetailsForm.d.ts.map +1 -1
  6. package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentDetailsStep.d.ts +2 -1
  7. package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentDetailsStep.d.ts.map +1 -1
  8. package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentHostSelectionStep.d.ts.map +1 -1
  9. package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentHostsSelection.d.ts.map +1 -1
  10. package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentNetworkingForm.d.ts +1 -0
  11. package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentNetworkingForm.d.ts.map +1 -1
  12. package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentNetworkingStep.d.ts.map +1 -1
  13. package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentWizard.d.ts.map +1 -1
  14. package/build/@types/cim/components/ClusterDeployment/ClusterDetailsFormFields.d.ts +1 -0
  15. package/build/@types/cim/components/ClusterDeployment/ClusterDetailsFormFields.d.ts.map +1 -1
  16. package/build/@types/cim/components/ClusterDeployment/helpers.d.ts.map +1 -1
  17. package/build/@types/cim/components/ClusterDeployment/types.d.ts +4 -0
  18. package/build/@types/cim/components/ClusterDeployment/types.d.ts.map +1 -1
  19. package/build/@types/cim/components/Hypershift/utils/nodepool.d.ts.map +1 -1
  20. package/build/@types/cim/components/InfraEnv/InfraEnvFormPage.d.ts +2 -0
  21. package/build/@types/cim/components/InfraEnv/InfraEnvFormPage.d.ts.map +1 -1
  22. package/build/@types/cim/components/helpers/versions.d.ts +1 -1
  23. package/build/@types/cim/components/helpers/versions.d.ts.map +1 -1
  24. package/build/@types/cim/components/modals/AddHostModal.d.ts.map +1 -1
  25. package/build/@types/common/api/assisted-service/ClustersAPI.d.ts +1 -3
  26. package/build/@types/common/api/assisted-service/ClustersAPI.d.ts.map +1 -1
  27. package/build/@types/common/api/assisted-service/NewFeatureSupportLevelsAPI.d.ts +1 -1
  28. package/build/@types/common/api/assisted-service/NewFeatureSupportLevelsAPI.d.ts.map +1 -1
  29. package/build/@types/common/components/clusterConfiguration/DiscoveryImageConfigForm.d.ts +4 -1
  30. package/build/@types/common/components/clusterConfiguration/DiscoveryImageConfigForm.d.ts.map +1 -1
  31. package/build/@types/common/components/clusterConfiguration/DownloadIso.d.ts +2 -1
  32. package/build/@types/common/components/clusterConfiguration/DownloadIso.d.ts.map +1 -1
  33. package/build/@types/common/components/hosts/HostRowDetail.d.ts +2 -1
  34. package/build/@types/common/components/hosts/HostRowDetail.d.ts.map +1 -1
  35. package/build/@types/common/components/newFeatureSupportLevels/types.d.ts +3 -3
  36. package/build/@types/common/components/newFeatureSupportLevels/types.d.ts.map +1 -1
  37. package/build/@types/common/components/ui/formik/validationSchemas.d.ts.map +1 -1
  38. package/build/@types/common/config/constants.d.ts +1 -1
  39. package/build/@types/common/config/constants.d.ts.map +1 -1
  40. package/build/@types/common/services/DateAndTime.d.ts.map +1 -0
  41. package/build/@types/common/types/featureSupportLevel.d.ts +3 -3
  42. package/build/@types/common/types/featureSupportLevel.d.ts.map +1 -1
  43. package/build/@types/ocm/components/HostsClusterDetailTab/HostsClusterDetailTabContent.d.ts.map +1 -1
  44. package/build/@types/ocm/components/clusterConfiguration/CpuArchitectureDropdown.d.ts +3 -3
  45. package/build/@types/ocm/components/clusterConfiguration/CpuArchitectureDropdown.d.ts.map +1 -1
  46. package/build/@types/ocm/components/clusterConfiguration/OcmClusterDetailsFormFields.d.ts.map +1 -1
  47. package/build/@types/ocm/components/clusterConfiguration/networkConfiguration/NetworkConfiguration.d.ts.map +1 -1
  48. package/build/@types/ocm/components/clusterConfiguration/networkConfiguration/NetworkConfigurationForm.d.ts.map +1 -1
  49. package/build/@types/ocm/components/clusterConfiguration/platformIntegration/ExternalPlatformDropdown.d.ts +2 -2
  50. package/build/@types/ocm/components/clusterConfiguration/platformIntegration/ExternalPlatformDropdown.d.ts.map +1 -1
  51. package/build/@types/ocm/components/clusterConfiguration/platformIntegration/constants.d.ts +0 -3
  52. package/build/@types/ocm/components/clusterConfiguration/platformIntegration/constants.d.ts.map +1 -1
  53. package/build/@types/ocm/components/clusterDetail/AssistedInstallerDetailCard.d.ts.map +1 -1
  54. package/build/@types/ocm/components/clusterDetail/AssistedInstallerExtraDetailCard.d.ts.map +1 -1
  55. package/build/@types/ocm/components/clusterWizard/ClusterDetails.d.ts.map +1 -1
  56. package/build/@types/ocm/components/clusters/ClusterPage.d.ts.map +1 -1
  57. package/build/@types/ocm/components/featureSupportLevels/FeatureSupportLevelProvider.d.ts +4 -3
  58. package/build/@types/ocm/components/featureSupportLevels/FeatureSupportLevelProvider.d.ts.map +1 -1
  59. package/build/@types/ocm/components/featureSupportLevels/ReviewClusterFeatureSupportLevels.d.ts.map +1 -1
  60. package/build/@types/ocm/components/featureSupportLevels/featureStateUtils.d.ts +3 -3
  61. package/build/@types/ocm/components/featureSupportLevels/featureStateUtils.d.ts.map +1 -1
  62. package/build/@types/ocm/components/hosts/HostsDiscoveryTable.d.ts.map +1 -1
  63. package/build/@types/ocm/hooks/index.d.ts +0 -1
  64. package/build/@types/ocm/hooks/index.d.ts.map +1 -1
  65. package/build/@types/ocm/hooks/useSupportLevelsAPI.d.ts +3 -1
  66. package/build/@types/ocm/hooks/useSupportLevelsAPI.d.ts.map +1 -1
  67. package/build/cjs/cim/components/ClusterDeployment/ACMClusterDeploymentDetailsStep.js +3 -2
  68. package/build/cjs/cim/components/ClusterDeployment/ACMClusterDeploymentDetailsStep.js.map +1 -1
  69. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentDetails.js +58 -55
  70. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentDetails.js.map +1 -1
  71. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentDetailsForm.js +3 -3
  72. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentDetailsForm.js.map +1 -1
  73. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentDetailsStep.js +5 -4
  74. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentDetailsStep.js.map +1 -1
  75. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentHostSelectionStep.js +2 -2
  76. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentHostSelectionStep.js.map +1 -1
  77. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentHostsSelection.js +14 -9
  78. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentHostsSelection.js.map +1 -1
  79. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentNetworkingForm.js +2 -2
  80. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentNetworkingForm.js.map +1 -1
  81. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentNetworkingStep.js +2 -2
  82. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentNetworkingStep.js.map +1 -1
  83. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentWizard.js +4 -4
  84. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentWizard.js.map +1 -1
  85. package/build/cjs/cim/components/ClusterDeployment/ClusterDetailsFormFields.js +4 -3
  86. package/build/cjs/cim/components/ClusterDeployment/ClusterDetailsFormFields.js.map +1 -1
  87. package/build/cjs/cim/components/ClusterDeployment/helpers.js +4 -2
  88. package/build/cjs/cim/components/ClusterDeployment/helpers.js.map +1 -1
  89. package/build/cjs/cim/components/Hypershift/hooks/useSupportedOCPVersions.js +1 -1
  90. package/build/cjs/cim/components/Hypershift/hooks/useSupportedOCPVersions.js.map +1 -1
  91. package/build/cjs/cim/components/Hypershift/utils/nodepool.js +6 -5
  92. package/build/cjs/cim/components/Hypershift/utils/nodepool.js.map +1 -1
  93. package/build/cjs/cim/components/InfraEnv/InfraEnvFormPage.js +2 -2
  94. package/build/cjs/cim/components/InfraEnv/InfraEnvFormPage.js.map +1 -1
  95. package/build/cjs/cim/components/helpers/versions.js +9 -2
  96. package/build/cjs/cim/components/helpers/versions.js.map +1 -1
  97. package/build/cjs/cim/components/modals/AddHostModal.js +4 -4
  98. package/build/cjs/cim/components/modals/AddHostModal.js.map +1 -1
  99. package/build/cjs/common/api/assisted-service/ClustersAPI.js +0 -6
  100. package/build/cjs/common/api/assisted-service/ClustersAPI.js.map +1 -1
  101. package/build/cjs/common/api/assisted-service/NewFeatureSupportLevelsAPI.js +8 -5
  102. package/build/cjs/common/api/assisted-service/NewFeatureSupportLevelsAPI.js.map +1 -1
  103. package/build/cjs/common/components/clusterConfiguration/DiscoveryImageConfigForm.js +4 -4
  104. package/build/cjs/common/components/clusterConfiguration/DiscoveryImageConfigForm.js.map +1 -1
  105. package/build/cjs/common/components/clusterConfiguration/DownloadIso.js +2 -2
  106. package/build/cjs/common/components/clusterConfiguration/DownloadIso.js.map +1 -1
  107. package/build/cjs/common/components/hosts/HostRowDetail.js +2 -2
  108. package/build/cjs/common/components/hosts/HostRowDetail.js.map +1 -1
  109. package/build/cjs/common/components/ui/formik/validationSchemas.js +14 -6
  110. package/build/cjs/common/components/ui/formik/validationSchemas.js.map +1 -1
  111. package/build/cjs/common/config/constants.js +3 -2
  112. package/build/cjs/common/config/constants.js.map +1 -1
  113. package/build/cjs/common/services/DateAndTime.js.map +1 -0
  114. package/build/cjs/common/types/featureSupportLevel.js.map +1 -1
  115. package/build/cjs/ocm/components/HostsClusterDetailTab/HostsClusterDetailTabContent.js +2 -2
  116. package/build/cjs/ocm/components/HostsClusterDetailTab/HostsClusterDetailTabContent.js.map +1 -1
  117. package/build/cjs/ocm/components/clusterConfiguration/CpuArchitectureDropdown.js.map +1 -1
  118. package/build/cjs/ocm/components/clusterConfiguration/OcmClusterDetailsFormFields.js.map +1 -1
  119. package/build/cjs/ocm/components/clusterConfiguration/networkConfiguration/NetworkConfiguration.js +17 -21
  120. package/build/cjs/ocm/components/clusterConfiguration/networkConfiguration/NetworkConfiguration.js.map +1 -1
  121. package/build/cjs/ocm/components/clusterConfiguration/networkConfiguration/NetworkConfigurationForm.js +1 -2
  122. package/build/cjs/ocm/components/clusterConfiguration/networkConfiguration/NetworkConfigurationForm.js.map +1 -1
  123. package/build/cjs/ocm/components/clusterConfiguration/platformIntegration/ExternalPlatformDropdown.js +4 -4
  124. package/build/cjs/ocm/components/clusterConfiguration/platformIntegration/ExternalPlatformDropdown.js.map +1 -1
  125. package/build/cjs/ocm/components/clusterConfiguration/platformIntegration/constants.js +2 -5
  126. package/build/cjs/ocm/components/clusterConfiguration/platformIntegration/constants.js.map +1 -1
  127. package/build/cjs/ocm/components/clusterDetail/AssistedInstallerDetailCard.js +2 -1
  128. package/build/cjs/ocm/components/clusterDetail/AssistedInstallerDetailCard.js.map +1 -1
  129. package/build/cjs/ocm/components/clusterDetail/AssistedInstallerExtraDetailCard.js +2 -1
  130. package/build/cjs/ocm/components/clusterDetail/AssistedInstallerExtraDetailCard.js.map +1 -1
  131. package/build/cjs/ocm/components/clusterDetail/ClusterDetailStatusMessages.js +1 -1
  132. package/build/cjs/ocm/components/clusterDetail/ClusterDetailStatusMessages.js.map +1 -1
  133. package/build/cjs/ocm/components/clusterWizard/ClusterDetails.js +6 -5
  134. package/build/cjs/ocm/components/clusterWizard/ClusterDetails.js.map +1 -1
  135. package/build/cjs/ocm/components/clusters/ClusterPage.js +2 -1
  136. package/build/cjs/ocm/components/clusters/ClusterPage.js.map +1 -1
  137. package/build/cjs/ocm/components/featureSupportLevels/FeatureSupportLevelProvider.js +4 -4
  138. package/build/cjs/ocm/components/featureSupportLevels/FeatureSupportLevelProvider.js.map +1 -1
  139. package/build/cjs/ocm/components/featureSupportLevels/ReviewClusterFeatureSupportLevels.js +1 -3
  140. package/build/cjs/ocm/components/featureSupportLevels/ReviewClusterFeatureSupportLevels.js.map +1 -1
  141. package/build/cjs/ocm/components/featureSupportLevels/featureStateUtils.js +8 -2
  142. package/build/cjs/ocm/components/featureSupportLevels/featureStateUtils.js.map +1 -1
  143. package/build/cjs/ocm/components/hosts/HostsDiscoveryTable.js +1 -1
  144. package/build/cjs/ocm/components/hosts/HostsDiscoveryTable.js.map +1 -1
  145. package/build/cjs/ocm/hooks/index.js +1 -3
  146. package/build/cjs/ocm/hooks/index.js.map +1 -1
  147. package/build/cjs/ocm/hooks/useSupportLevelsAPI.js +5 -4
  148. package/build/cjs/ocm/hooks/useSupportLevelsAPI.js.map +1 -1
  149. package/lib/cim/components/ClusterDeployment/ACMClusterDeploymentDetailsStep.tsx +8 -1
  150. package/lib/cim/components/ClusterDeployment/ClusterDeploymentDetails.tsx +112 -102
  151. package/lib/cim/components/ClusterDeployment/ClusterDeploymentDetailsForm.tsx +7 -1
  152. package/lib/cim/components/ClusterDeployment/ClusterDeploymentDetailsStep.tsx +6 -1
  153. package/lib/cim/components/ClusterDeployment/ClusterDeploymentHostSelectionStep.tsx +2 -0
  154. package/lib/cim/components/ClusterDeployment/ClusterDeploymentHostsSelection.tsx +14 -12
  155. package/lib/cim/components/ClusterDeployment/ClusterDeploymentNetworkingForm.tsx +3 -1
  156. package/lib/cim/components/ClusterDeployment/ClusterDeploymentNetworkingStep.tsx +3 -0
  157. package/lib/cim/components/ClusterDeployment/ClusterDeploymentWizard.tsx +4 -0
  158. package/lib/cim/components/ClusterDeployment/ClusterDetailsFormFields.tsx +8 -2
  159. package/lib/cim/components/ClusterDeployment/helpers.ts +13 -10
  160. package/lib/cim/components/ClusterDeployment/types.ts +4 -0
  161. package/lib/cim/components/Hypershift/hooks/useSupportedOCPVersions.ts +1 -1
  162. package/lib/cim/components/Hypershift/utils/nodepool.ts +3 -2
  163. package/lib/cim/components/InfraEnv/InfraEnvFormPage.tsx +11 -2
  164. package/lib/cim/components/helpers/versions.ts +8 -1
  165. package/lib/cim/components/modals/AddHostModal.tsx +5 -0
  166. package/lib/common/api/assisted-service/ClustersAPI.ts +0 -9
  167. package/lib/common/api/assisted-service/NewFeatureSupportLevelsAPI.ts +9 -5
  168. package/lib/common/components/clusterConfiguration/DiscoveryImageConfigForm.tsx +6 -4
  169. package/lib/common/components/clusterConfiguration/DownloadIso.tsx +3 -1
  170. package/lib/common/components/hosts/HostRowDetail.tsx +3 -1
  171. package/lib/common/components/newFeatureSupportLevels/types.ts +4 -2
  172. package/lib/common/components/ui/formik/validationSchemas.ts +16 -6
  173. package/lib/common/config/constants.ts +2 -2
  174. package/lib/common/types/featureSupportLevel.ts +6 -5
  175. package/lib/ocm/components/HostsClusterDetailTab/HostsClusterDetailTabContent.tsx +2 -1
  176. package/lib/ocm/components/clusterConfiguration/CpuArchitectureDropdown.tsx +5 -3
  177. package/lib/ocm/components/clusterConfiguration/OcmClusterDetailsFormFields.tsx +3 -2
  178. package/lib/ocm/components/clusterConfiguration/networkConfiguration/NetworkConfiguration.tsx +46 -36
  179. package/lib/ocm/components/clusterConfiguration/networkConfiguration/NetworkConfigurationForm.tsx +3 -4
  180. package/lib/ocm/components/clusterConfiguration/platformIntegration/ExternalPlatformDropdown.tsx +14 -19
  181. package/lib/ocm/components/clusterConfiguration/platformIntegration/constants.tsx +1 -5
  182. package/lib/ocm/components/clusterDetail/AssistedInstallerDetailCard.tsx +2 -1
  183. package/lib/ocm/components/clusterDetail/AssistedInstallerExtraDetailCard.tsx +2 -1
  184. package/lib/ocm/components/clusterDetail/ClusterDetailStatusMessages.tsx +1 -1
  185. package/lib/ocm/components/clusterWizard/ClusterDetails.tsx +11 -6
  186. package/lib/ocm/components/clusters/ClusterPage.tsx +2 -1
  187. package/lib/ocm/components/featureSupportLevels/FeatureSupportLevelProvider.tsx +14 -3
  188. package/lib/ocm/components/featureSupportLevels/ReviewClusterFeatureSupportLevels.tsx +1 -8
  189. package/lib/ocm/components/featureSupportLevels/featureStateUtils.ts +18 -3
  190. package/lib/ocm/components/hosts/HostsDiscoveryTable.tsx +1 -0
  191. package/lib/ocm/hooks/index.ts +0 -1
  192. package/lib/ocm/hooks/useSupportLevelsAPI.ts +12 -4
  193. package/package.json +3 -4
  194. package/build/@types/common/sevices/DateAndTime.d.ts.map +0 -1
  195. package/build/@types/ocm/hooks/useClusterSupportedPlatforms.d.ts +0 -11
  196. package/build/@types/ocm/hooks/useClusterSupportedPlatforms.d.ts.map +0 -1
  197. package/build/cjs/common/sevices/DateAndTime.js.map +0 -1
  198. package/build/cjs/ocm/hooks/useClusterSupportedPlatforms.js +0 -53
  199. package/build/cjs/ocm/hooks/useClusterSupportedPlatforms.js.map +0 -1
  200. package/lib/ocm/hooks/useClusterSupportedPlatforms.ts +0 -70
  201. /package/build/@types/common/{sevices → services}/DateAndTime.d.ts +0 -0
  202. /package/build/cjs/common/{sevices → services}/DateAndTime.js +0 -0
  203. /package/lib/common/{sevices → services}/DateAndTime.tsx +0 -0
@@ -142,8 +142,9 @@ const AssistedInstallerDetailCard = ({
142
142
  <NewFeatureSupportLevelProvider
143
143
  loadingUi={<LoadingCard />}
144
144
  cluster={cluster}
145
- cpuArchitecture={infraEnv.cpuArchitecture}
145
+ cpuArchitecture={infraEnv.cpuArchitecture as CpuArchitecture}
146
146
  openshiftVersion={cluster.openshiftVersion}
147
+ platformType={cluster.platform?.type}
147
148
  >
148
149
  {content}
149
150
  </NewFeatureSupportLevelProvider>
@@ -45,8 +45,9 @@ const AssistedInstallerExtraDetailCard: React.FC<AssistedInstallerExtraDetailCar
45
45
  <NewFeatureSupportLevelProvider
46
46
  loadingUi={<div />}
47
47
  cluster={cluster}
48
- cpuArchitecture={infraEnv?.cpuArchitecture}
48
+ cpuArchitecture={infraEnv?.cpuArchitecture as CpuArchitecture}
49
49
  openshiftVersion={cluster.openshiftVersion}
50
+ platformType={cluster.platform?.type}
50
51
  >
51
52
  <Grid className="pf-u-mt-md">
52
53
  <ClusterProperties cluster={cluster} externalMode />
@@ -10,7 +10,7 @@ import {
10
10
 
11
11
  import { useDefaultConfiguration } from '../clusterConfiguration/ClusterDefaultConfigurationContext';
12
12
  import { ExternalLinkAltIcon } from '@patternfly/react-icons';
13
- import { calculateClusterDateDiff } from '../../../common/sevices/DateAndTime';
13
+ import { calculateClusterDateDiff } from '../../../common/services/DateAndTime';
14
14
  import { isInOcm } from '../../api';
15
15
  import { ExternalPlatformLinks } from '../clusterConfiguration/platformIntegration/constants';
16
16
  import { useNewFeatureSupportLevel } from '../../../common/components/newFeatureSupportLevels';
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { useHistory } from 'react-router-dom';
3
3
  import { useDispatch } from 'react-redux';
4
- import { useAlerts, LoadingState, ClusterWizardStep } from '../../../common';
4
+ import { useAlerts, LoadingState, ClusterWizardStep, ErrorState } from '../../../common';
5
5
  import { usePullSecret } from '../../hooks';
6
6
  import { getApiErrorMessage, handleApiError, isUnknownServerError } from '../../api';
7
7
  import { setServerUpdateError, updateCluster } from '../../store/slices/current-cluster/slice';
@@ -34,9 +34,6 @@ const ClusterDetails = ({ cluster, infraEnv }: ClusterDetailsProps) => {
34
34
  const pullSecret = usePullSecret();
35
35
  const { error: errorOCPVersions, loading: loadingOCPVersions, versions } = useOpenshiftVersions();
36
36
  const { customManifests } = useClusterCustomManifests(cluster?.id || '', false);
37
- React.useEffect(() => {
38
- errorOCPVersions && addAlert(errorOCPVersions);
39
- }, [errorOCPVersions, addAlert]);
40
37
 
41
38
  const handleClusterUpdate = React.useCallback(
42
39
  async (clusterId: Cluster['id'], params: ClusterDetailsUpdateParams) => {
@@ -92,14 +89,22 @@ const ClusterDetails = ({ cluster, infraEnv }: ClusterDetailsProps) => {
92
89
  [clearAlerts, addAlert, dispatch, history, handleCustomManifestsChange],
93
90
  );
94
91
 
92
+ const navigation = <ClusterWizardNavigation cluster={cluster} />;
95
93
  if (pullSecret === undefined || !managedDomains || loadingOCPVersions || !usedClusterNames) {
96
94
  return (
97
- <ClusterWizardStep navigation={<ClusterWizardNavigation cluster={cluster} />}>
95
+ <ClusterWizardStep navigation={navigation}>
98
96
  <LoadingState />
99
97
  </ClusterWizardStep>
100
98
  );
101
99
  }
102
- const navigation = <ClusterWizardNavigation cluster={cluster} />;
100
+
101
+ if (!cluster && errorOCPVersions) {
102
+ return (
103
+ <ClusterWizardStep navigation={navigation}>
104
+ <ErrorState title="Failed to retrieve OpenShift versions" />
105
+ </ClusterWizardStep>
106
+ );
107
+ }
103
108
 
104
109
  return (
105
110
  <ClusterDetailsForm
@@ -171,8 +171,9 @@ const ClusterPageGeneric: React.FC<{ clusterId: string; showBreadcrumbs?: boolea
171
171
  <NewFeatureSupportLevelProvider
172
172
  loadingUi={<ClusterLoading />}
173
173
  cluster={cluster}
174
- cpuArchitecture={infraEnv.cpuArchitecture}
174
+ cpuArchitecture={infraEnv.cpuArchitecture as CpuArchitecture}
175
175
  openshiftVersion={cluster.openshiftVersion}
176
+ platformType={cluster.platform?.type}
176
177
  >
177
178
  {/* TODO(mlibra): Will be reworked within https://issues.redhat.com/browse/AGENT-522
178
179
  <RebootNodeZeroModal cluster={cluster} />
@@ -3,6 +3,7 @@ import {
3
3
  ActiveFeatureConfiguration,
4
4
  CpuArchitecture,
5
5
  FeatureId,
6
+ SupportedCpuArchitecture,
6
7
  getDefaultCpuArchitecture,
7
8
  } from '../../../common';
8
9
  import { useOpenshiftVersions, usePullSecret } from '../../hooks';
@@ -16,6 +17,7 @@ import {
16
17
  import useSupportLevelsAPI from '../../hooks/useSupportLevelsAPI';
17
18
  import {
18
19
  Cluster,
20
+ PlatformType,
19
21
  SupportLevel,
20
22
  SupportLevels,
21
23
  } from '@openshift-assisted/types/assisted-installer-service';
@@ -25,7 +27,8 @@ export type NewSupportLevelProviderProps = PropsWithChildren<{
25
27
  openshiftVersion?: string;
26
28
  loadingUi: React.ReactNode;
27
29
  cluster?: Cluster;
28
- cpuArchitecture?: string;
30
+ cpuArchitecture?: CpuArchitecture;
31
+ platformType?: PlatformType;
29
32
  }>;
30
33
 
31
34
  export const getFeatureSupported = (featureSupportLevels: SupportLevels, featureId: FeatureId) => {
@@ -38,6 +41,7 @@ export const NewFeatureSupportLevelProvider: React.FC<NewSupportLevelProviderPro
38
41
  loadingUi,
39
42
  cpuArchitecture,
40
43
  openshiftVersion,
44
+ platformType,
41
45
  }) => {
42
46
  const { loading: loadingOCPVersions } = useOpenshiftVersions();
43
47
  const pullSecret = usePullSecret();
@@ -50,7 +54,12 @@ export const NewFeatureSupportLevelProvider: React.FC<NewSupportLevelProviderPro
50
54
  pullSecret,
51
55
  cluster?.openshiftVersion,
52
56
  );
53
- const featureSupportLevels = useSupportLevelsAPI('features', openshiftVersion, cpuArchitecture);
57
+ const featureSupportLevels = useSupportLevelsAPI(
58
+ 'features',
59
+ openshiftVersion,
60
+ cpuArchitecture,
61
+ platformType,
62
+ );
54
63
 
55
64
  const supportLevelData = React.useMemo<NewFeatureSupportLevelMap>(() => {
56
65
  if (!featureSupportLevels) {
@@ -108,7 +117,8 @@ export const NewFeatureSupportLevelProvider: React.FC<NewSupportLevelProviderPro
108
117
  (
109
118
  featureId: FeatureId,
110
119
  supportLevelDataNew?: NewFeatureSupportLevelMap,
111
- cpuArchitecture?: string,
120
+ cpuArchitecture?: SupportedCpuArchitecture,
121
+ platformType?: PlatformType,
112
122
  ) => {
113
123
  const isSupported = isFeatureSupportedCallback(featureId, supportLevelDataNew);
114
124
  return getNewFeatureDisabledReason(
@@ -117,6 +127,7 @@ export const NewFeatureSupportLevelProvider: React.FC<NewSupportLevelProviderPro
117
127
  activeFeatureConfiguration,
118
128
  isSupported,
119
129
  cpuArchitecture,
130
+ platformType,
120
131
  );
121
132
  },
122
133
  [isFeatureSupportedCallback, cluster, activeFeatureConfiguration],
@@ -93,14 +93,7 @@ export const LimitedSupportedCluster = ({
93
93
  <>
94
94
  <InfoCircleIcon size="sm" color="var(--pf-global--info-color--100)" />
95
95
  &nbsp;Your cluster will be subject to support limitations because it includes:
96
- <TextList>
97
- {getPreviewFeatureList(clusterFeatureSupportLevels)}
98
- {clusterFeatureSupportLevels['CLUSTER_MANAGED_NETWORKING_WITH_VMS'] === 'unsupported' && (
99
- <TextListItem>
100
- Cluster-managed networking with some or all discovered hosts as virtual machines
101
- </TextListItem>
102
- )}
103
- </TextList>
96
+ <TextList>{getPreviewFeatureList(clusterFeatureSupportLevels)}</TextList>
104
97
  </>
105
98
  )}
106
99
  </TextContent>
@@ -7,7 +7,12 @@ import {
7
7
  SupportedCpuArchitecture,
8
8
  } from '../../../common';
9
9
  import { architectureData } from '../clusterConfiguration/CpuArchitectureDropdown';
10
- import { Cluster, SupportLevel } from '@openshift-assisted/types/assisted-installer-service';
10
+ import {
11
+ Cluster,
12
+ PlatformType,
13
+ SupportLevel,
14
+ } from '@openshift-assisted/types/assisted-installer-service';
15
+ import { ExternalPlatformLabels } from '../clusterConfiguration/platformIntegration/constants';
11
16
 
12
17
  const CNV_OPERATOR_LABEL = 'Openshift Virtualization';
13
18
  const LVMS_OPERATOR_LABEL = 'Logical Volume Manager Storage';
@@ -149,7 +154,8 @@ export const getNewFeatureDisabledReason = (
149
154
  cluster: Cluster | undefined,
150
155
  activeFeatureConfiguration: ActiveFeatureConfiguration,
151
156
  isSupported: boolean,
152
- cpuArchitecture?: string,
157
+ cpuArchitecture?: SupportedCpuArchitecture,
158
+ platformType?: PlatformType,
153
159
  ): string | undefined => {
154
160
  switch (featureId) {
155
161
  case 'SNO': {
@@ -171,7 +177,9 @@ export const getNewFeatureDisabledReason = (
171
177
  return getNetworkTypeSelectionDisabledReason(cluster);
172
178
  }
173
179
  case 'CLUSTER_MANAGED_NETWORKING': {
174
- return 'Cluster-managed networking is not supported for ARM architecture with this version of OpenShift.';
180
+ return `Cluster-managed networking is not supported when using ${
181
+ platformType ? ExternalPlatformLabels[platformType] : ''
182
+ }`;
175
183
  }
176
184
  case 'EXTERNAL_PLATFORM_OCI': {
177
185
  return getOciDisabledReason(cpuArchitecture, isSupported);
@@ -191,6 +199,13 @@ export const getNewFeatureDisabledReason = (
191
199
  return `Integration with vSphere is not available with the selected CPU architecture.`;
192
200
  }
193
201
  }
202
+ case 'USER_MANAGED_NETWORKING': {
203
+ if (!isSupported) {
204
+ return `User-Managed Networking is not supported when using ${
205
+ platformType ? ExternalPlatformLabels[platformType] : ''
206
+ }`;
207
+ }
208
+ }
194
209
  default: {
195
210
  return undefined;
196
211
  }
@@ -35,6 +35,7 @@ const HostRowDetailExpand = ({ obj: host }: ExpandComponentProps<Host>) => (
35
35
  key={host.id}
36
36
  host={host}
37
37
  AdditionalNTPSourcesDialogToggleComponent={AdditionalNTPSourcesDialogToggle}
38
+ hideStorage
38
39
  />
39
40
  );
40
41
 
@@ -1,5 +1,4 @@
1
1
  export { default as useOpenshiftVersions } from './useOpenshiftVersions';
2
- export { default as useClusterSupportedPlatforms } from './useClusterSupportedPlatforms';
3
2
  export { default as useManagedDomains } from './useManagedDomains';
4
3
  export { default as useUsedClusterNames } from './useUsedClusterNames';
5
4
  export { default as useInfraEnvId } from './useInfraEnvId';
@@ -1,11 +1,12 @@
1
1
  import React from 'react';
2
- import { useAlerts } from '../../common';
2
+ import { CpuArchitecture, useAlerts } from '../../common';
3
3
  import {
4
4
  ArchitectureSupportLevelMap,
5
5
  NewFeatureSupportLevelMap,
6
6
  } from '../../common/components/newFeatureSupportLevels';
7
7
  import { getApiErrorMessage, handleApiError } from '../api';
8
8
  import NewFeatureSupportLevelsAPI from '../../common/api/assisted-service/NewFeatureSupportLevelsAPI';
9
+ import { PlatformType } from '@openshift-assisted/types/./assisted-installer-service';
9
10
 
10
11
  type SupportLevelAPIResources = 'architectures' | 'features';
11
12
  type UseSupportLevelAPIResponse<T extends SupportLevelAPIResources> = T extends 'architectures'
@@ -17,7 +18,8 @@ type UseSupportLevelAPIResponse<T extends SupportLevelAPIResources> = T extends
17
18
  export default function useSupportLevelsAPI<T extends SupportLevelAPIResources>(
18
19
  resourceKind: T,
19
20
  openshiftVersion?: string,
20
- cpuArchitecture?: string,
21
+ cpuArchitecture?: CpuArchitecture,
22
+ platformType?: PlatformType,
21
23
  ): UseSupportLevelAPIResponse<T> | null {
22
24
  const [cpuArchitectures, setCpuArchitectures] =
23
25
  React.useState<ArchitectureSupportLevelMap | null>(null);
@@ -45,11 +47,16 @@ export default function useSupportLevelsAPI<T extends SupportLevelAPIResources>(
45
47
  );
46
48
 
47
49
  const fetchFeaturesSupportLevels = React.useCallback(
48
- async (openshiftVersion: string, cpuArchitecture?: string) => {
50
+ async (
51
+ openshiftVersion: string,
52
+ cpuArchitecture?: CpuArchitecture,
53
+ platformType?: PlatformType,
54
+ ) => {
49
55
  try {
50
56
  const { data: features } = await NewFeatureSupportLevelsAPI.featuresSupportLevel(
51
57
  openshiftVersion,
52
58
  cpuArchitecture,
59
+ platformType,
53
60
  );
54
61
  setFeatures(features.features);
55
62
  } catch (e) {
@@ -70,7 +77,7 @@ export default function useSupportLevelsAPI<T extends SupportLevelAPIResources>(
70
77
  if (resourceKind === 'architectures') {
71
78
  void fetchArchitecturesSupportLevels(openshiftVersion);
72
79
  } else {
73
- void fetchFeaturesSupportLevels(openshiftVersion, cpuArchitecture);
80
+ void fetchFeaturesSupportLevels(openshiftVersion, cpuArchitecture, platformType);
74
81
  }
75
82
  }
76
83
  }, [
@@ -79,6 +86,7 @@ export default function useSupportLevelsAPI<T extends SupportLevelAPIResources>(
79
86
  fetchArchitecturesSupportLevels,
80
87
  fetchFeaturesSupportLevels,
81
88
  resourceKind,
89
+ platformType,
82
90
  ]);
83
91
 
84
92
  if (resourceKind === 'architectures') {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "dependencies": {
3
- "@openshift-assisted/locales": "2.9.6-cim",
4
- "@openshift-assisted/types": "2.9.6-cim",
3
+ "@openshift-assisted/locales": "2.9.8-cim",
4
+ "@openshift-assisted/types": "2.9.8-cim",
5
5
  "axios-case-converter": "^0.11.1",
6
6
  "camel-case": "^4.1.2",
7
7
  "cidr-tools": "^4.3.0",
@@ -26,7 +26,6 @@
26
26
  },
27
27
  "description": "React component library for the Assisted Installer UI",
28
28
  "devDependencies": {
29
- "@openshift-assisted/eslint-config-assisted-ui": "^1.0.0",
30
29
  "@tsconfig/recommended": "^1.0.2",
31
30
  "@types/file-saver": "^2.0.1",
32
31
  "@types/human-date": "^1.4.0",
@@ -128,5 +127,5 @@
128
127
  ]
129
128
  }
130
129
  },
131
- "version": "2.9.6-cim"
130
+ "version": "2.9.8-cim"
132
131
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"DateAndTime.d.ts","sourceRoot":"","sources":["../../../../lib/common/sevices/DateAndTime.tsx"],"names":[],"mappings":"AAEA,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,UAIvD;AAED,wBAAgB,wBAAwB,CAAC,oBAAoB,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,UAM1F"}
@@ -1,11 +0,0 @@
1
- import { AxiosError } from 'axios';
2
- import { SupportedPlatformType } from '../../common';
3
- import { APIErrorMixin } from '../../common/api/utils';
4
- export type SupportedPlatformIntegrationType = 'no-active-integrations' | SupportedPlatformType;
5
- export default function useClusterSupportedPlatforms(clusterId: string): {
6
- isPlatformIntegrationSupported: boolean;
7
- supportedPlatformIntegration: SupportedPlatformIntegrationType;
8
- isLoading: boolean;
9
- error: AxiosError<APIErrorMixin, any> | undefined;
10
- };
11
- //# sourceMappingURL=useClusterSupportedPlatforms.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useClusterSupportedPlatforms.d.ts","sourceRoot":"","sources":["../../../../lib/ocm/hooks/useClusterSupportedPlatforms.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAInC,OAAO,EAKL,qBAAqB,EACtB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAGvD,MAAM,MAAM,gCAAgC,GAAG,wBAAwB,GAAG,qBAAqB,CAAC;AAgBhG,MAAM,CAAC,OAAO,UAAU,4BAA4B,CAAC,SAAS,EAAE,MAAM;;;;;EAsCrE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"DateAndTime.js","sourceRoot":"","sources":["../../../../lib/common/sevices/DateAndTime.tsx"],"names":[],"mappings":";;;AAAA,mDAA4D;AAE5D,SAAgB,sBAAsB,CAAC,SAAiB;IACtD,MAAM,UAAU,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC;IACvC,MAAM,KAAK,GAAG,IAAI,IAAI,EAAE,CAAC;IACzB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,UAAU,CAAC,OAAO,EAAE,CAAC,GAAG,sBAAU,CAAC,CAAC;AACnF,CAAC;AAJD,wDAIC;AAED,SAAgB,wBAAwB,CAAC,oBAA4B,EAAE,WAAoB;IACzF,IAAI,WAAW,IAAI,WAAW,KAAK,qBAAS,EAAE;QAC5C,OAAO,oBAAoB,GAAG,sBAAsB,CAAC,WAAW,CAAC,CAAC;KACnE;SAAM;QACL,OAAO,oBAAoB,CAAC;KAC7B;AACH,CAAC;AAND,4DAMC"}
@@ -1,53 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const react_1 = tslib_1.__importDefault(require("react"));
5
- const swr_1 = tslib_1.__importDefault(require("swr"));
6
- const api_1 = require("../api");
7
- const apis_1 = require("../services/apis");
8
- const common_1 = require("../../common");
9
- function getIntegrablePlatformIntegration(allClusterPlatforms) {
10
- const integrationPlatforms = allClusterPlatforms.filter((platform) => !common_1.NonPlatformIntegrations.includes(platform));
11
- const uniqueIntegrationPlatforms = Array.from(new Set(integrationPlatforms));
12
- if (integrationPlatforms.length === 1) {
13
- const [exclusivelyAvailablePlatform] = uniqueIntegrationPlatforms;
14
- return (0, common_1.isClusterPlatformTypeVM)({ platform: { type: exclusivelyAvailablePlatform } })
15
- ? exclusivelyAvailablePlatform
16
- : undefined;
17
- }
18
- return undefined;
19
- }
20
- function useClusterSupportedPlatforms(clusterId) {
21
- const { addAlert, alerts } = (0, common_1.useAlerts)();
22
- const url = apis_1.ClustersAPI.makeSupportedPlatformsBaseURI(clusterId);
23
- const fetcher = () => apis_1.ClustersAPI.getSupportedPlatforms(clusterId).then((res) => res.data);
24
- const { data, error } = (0, swr_1.default)(url, fetcher, {
25
- refreshInterval: common_1.POLLING_INTERVAL,
26
- errorRetryCount: 0,
27
- revalidateOnFocus: false,
28
- });
29
- const isLoading = !error && !data;
30
- const supportedPlatformIntegration = isLoading || !data ? undefined : getIntegrablePlatformIntegration(data);
31
- react_1.default.useEffect(() => {
32
- if (error) {
33
- const title = `Failed to retrieve supported platforms (clusterId: ${clusterId})`;
34
- //TODO(brotman) add handling of existing errors to alerts context
35
- if (alerts.find((alert) => alert.title === title)) {
36
- return;
37
- }
38
- (0, api_1.handleApiError)(error, () => addAlert({
39
- title,
40
- message: (0, api_1.getApiErrorMessage)(error),
41
- }));
42
- }
43
- }, [error, addAlert, clusterId, alerts]);
44
- return {
45
- isPlatformIntegrationSupported: supportedPlatformIntegration !== undefined,
46
- supportedPlatformIntegration: (supportedPlatformIntegration ||
47
- 'no-active-integrations'),
48
- isLoading,
49
- error,
50
- };
51
- }
52
- exports.default = useClusterSupportedPlatforms;
53
- //# sourceMappingURL=useClusterSupportedPlatforms.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useClusterSupportedPlatforms.js","sourceRoot":"","sources":["../../../../lib/ocm/hooks/useClusterSupportedPlatforms.ts"],"names":[],"mappings":";;;AAAA,0DAA0B;AAE1B,sDAAyB;AACzB,gCAA4D;AAC5D,2CAA+C;AAC/C,yCAMsB;AAMtB,SAAS,gCAAgC,CAAC,mBAAmC;IAC3E,MAAM,oBAAoB,GAAG,mBAAmB,CAAC,MAAM,CACrD,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,gCAAuB,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAC1D,CAAC;IACF,MAAM,0BAA0B,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,oBAAoB,CAAC,CAAC,CAAC;IAC7E,IAAI,oBAAoB,CAAC,MAAM,KAAK,CAAC,EAAE;QACrC,MAAM,CAAC,4BAA4B,CAAC,GAAG,0BAA0B,CAAC;QAClE,OAAO,IAAA,gCAAuB,EAAC,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,4BAA4B,EAAE,EAAE,CAAC;YAClF,CAAC,CAAC,4BAA4B;YAC9B,CAAC,CAAC,SAAS,CAAC;KACf;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAwB,4BAA4B,CAAC,SAAiB;IACpE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAA,kBAAS,GAAE,CAAC;IACzC,MAAM,GAAG,GAAG,kBAAW,CAAC,6BAA6B,CAAC,SAAS,CAAC,CAAC;IACjE,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,kBAAW,CAAC,qBAAqB,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC3F,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,IAAA,aAAM,EAA4C,GAAG,EAAE,OAAO,EAAE;QACtF,eAAe,EAAE,yBAAgB;QACjC,eAAe,EAAE,CAAC;QAClB,iBAAiB,EAAE,KAAK;KACzB,CAAC,CAAC;IAEH,MAAM,SAAS,GAAG,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC;IAElC,MAAM,4BAA4B,GAChC,SAAS,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,gCAAgC,CAAC,IAAI,CAAC,CAAC;IAE1E,eAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,KAAK,EAAE;YACT,MAAM,KAAK,GAAG,sDAAsD,SAAS,GAAG,CAAC;YACjF,iEAAiE;YACjE,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,KAAK,KAAK,CAAC,EAAE;gBACjD,OAAO;aACR;YACD,IAAA,oBAAc,EAAC,KAAK,EAAE,GAAG,EAAE,CACzB,QAAQ,CAAC;gBACP,KAAK;gBACL,OAAO,EAAE,IAAA,wBAAkB,EAAC,KAAK,CAAC;aACnC,CAAC,CACH,CAAC;SACH;IACH,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;IAEzC,OAAO;QACL,8BAA8B,EAAE,4BAA4B,KAAK,SAAS;QAC1E,4BAA4B,EAAE,CAAC,4BAA4B;YACzD,wBAAwB,CAAqC;QAC/D,SAAS;QACT,KAAK;KACN,CAAC;AACJ,CAAC;AAtCD,+CAsCC"}
@@ -1,70 +0,0 @@
1
- import React from 'react';
2
- import { AxiosError } from 'axios';
3
- import useSWR from 'swr';
4
- import { getApiErrorMessage, handleApiError } from '../api';
5
- import { ClustersAPI } from '../services/apis';
6
- import {
7
- POLLING_INTERVAL,
8
- NonPlatformIntegrations,
9
- isClusterPlatformTypeVM,
10
- useAlerts,
11
- SupportedPlatformType,
12
- } from '../../common';
13
- import { APIErrorMixin } from '../../common/api/utils';
14
- import { PlatformType } from '@openshift-assisted/types/assisted-installer-service';
15
-
16
- export type SupportedPlatformIntegrationType = 'no-active-integrations' | SupportedPlatformType;
17
-
18
- function getIntegrablePlatformIntegration(allClusterPlatforms: PlatformType[]) {
19
- const integrationPlatforms = allClusterPlatforms.filter(
20
- (platform) => !NonPlatformIntegrations.includes(platform),
21
- );
22
- const uniqueIntegrationPlatforms = Array.from(new Set(integrationPlatforms));
23
- if (integrationPlatforms.length === 1) {
24
- const [exclusivelyAvailablePlatform] = uniqueIntegrationPlatforms;
25
- return isClusterPlatformTypeVM({ platform: { type: exclusivelyAvailablePlatform } })
26
- ? exclusivelyAvailablePlatform
27
- : undefined;
28
- }
29
- return undefined;
30
- }
31
-
32
- export default function useClusterSupportedPlatforms(clusterId: string) {
33
- const { addAlert, alerts } = useAlerts();
34
- const url = ClustersAPI.makeSupportedPlatformsBaseURI(clusterId);
35
- const fetcher = () => ClustersAPI.getSupportedPlatforms(clusterId).then((res) => res.data);
36
- const { data, error } = useSWR<PlatformType[], AxiosError<APIErrorMixin>>(url, fetcher, {
37
- refreshInterval: POLLING_INTERVAL,
38
- errorRetryCount: 0,
39
- revalidateOnFocus: false,
40
- });
41
-
42
- const isLoading = !error && !data;
43
-
44
- const supportedPlatformIntegration =
45
- isLoading || !data ? undefined : getIntegrablePlatformIntegration(data);
46
-
47
- React.useEffect(() => {
48
- if (error) {
49
- const title = `Failed to retrieve supported platforms (clusterId: ${clusterId})`;
50
- //TODO(brotman) add handling of existing errors to alerts context
51
- if (alerts.find((alert) => alert.title === title)) {
52
- return;
53
- }
54
- handleApiError(error, () =>
55
- addAlert({
56
- title,
57
- message: getApiErrorMessage(error),
58
- }),
59
- );
60
- }
61
- }, [error, addAlert, clusterId, alerts]);
62
-
63
- return {
64
- isPlatformIntegrationSupported: supportedPlatformIntegration !== undefined,
65
- supportedPlatformIntegration: (supportedPlatformIntegration ||
66
- 'no-active-integrations') as SupportedPlatformIntegrationType,
67
- isLoading,
68
- error,
69
- };
70
- }