@openshift-assisted/ui-lib 2.11.3-cim → 2.12.1-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 (173) hide show
  1. package/build/@types/cim/components/Agent/NoAgentsAlert.d.ts.map +1 -1
  2. package/build/@types/cim/components/ClusterDeployment/ClusterDetailsFormFields.d.ts.map +1 -1
  3. package/build/@types/cim/components/InfraEnv/EnvironmentDetails.d.ts.map +1 -1
  4. package/build/@types/cim/components/InfraEnv/InfraEnvFormPage.d.ts +1 -1
  5. package/build/@types/cim/components/InfraEnv/InfraEnvFormPage.d.ts.map +1 -1
  6. package/build/@types/cim/components/InfraEnv/InfraTableToolbar.d.ts.map +1 -1
  7. package/build/@types/cim/components/common/CpuArchitectureDropdown.d.ts +5 -0
  8. package/build/@types/cim/components/common/CpuArchitectureDropdown.d.ts.map +1 -0
  9. package/build/@types/cim/components/helpers/agentStatus.d.ts.map +1 -1
  10. package/build/@types/cim/components/helpers/clusterDeployment.d.ts +1 -1
  11. package/build/@types/cim/components/helpers/clusterDeployment.d.ts.map +1 -1
  12. package/build/@types/cim/components/modals/CimConfiguration/CimStorageMissingAlert.d.ts.map +1 -1
  13. package/build/@types/cim/types/k8s/infra-env-k8s-resource.d.ts +1 -1
  14. package/build/@types/cim/types/k8s/infra-env-k8s-resource.d.ts.map +1 -1
  15. package/build/@types/common/components/clusterWizard/clusterDetailsValidation.d.ts.map +1 -1
  16. package/build/@types/common/components/clusterWizard/types.d.ts +1 -0
  17. package/build/@types/common/components/clusterWizard/types.d.ts.map +1 -1
  18. package/build/@types/common/components/hosts/utils.d.ts.map +1 -1
  19. package/build/@types/common/types/cpuArchitecture.d.ts +6 -0
  20. package/build/@types/common/types/cpuArchitecture.d.ts.map +1 -1
  21. package/build/@types/ocm/components/HostsClusterDetailTab/HostsClusterDetailTabMock.d.ts +1 -4
  22. package/build/@types/ocm/components/HostsClusterDetailTab/HostsClusterDetailTabMock.d.ts.map +1 -1
  23. package/build/@types/ocm/components/Routes.d.ts +3 -2
  24. package/build/@types/ocm/components/Routes.d.ts.map +1 -1
  25. package/build/@types/ocm/components/clusterConfiguration/CpuArchitectureDropdown.d.ts +1 -7
  26. package/build/@types/ocm/components/clusterConfiguration/CpuArchitectureDropdown.d.ts.map +1 -1
  27. package/build/@types/ocm/components/clusterConfiguration/OcmClusterDetailsFormFields.d.ts.map +1 -1
  28. package/build/@types/ocm/components/clusterConfiguration/platformIntegration/ExternalPlatformDropdown.d.ts.map +1 -1
  29. package/build/@types/ocm/components/clusterDetail/AssistedInstallerDetailCard.d.ts.map +1 -1
  30. package/build/@types/ocm/components/clusterWizard/ClusterDetails.d.ts.map +1 -1
  31. package/build/@types/ocm/components/clusterWizard/ClusterWizardContextProvider.d.ts.map +1 -1
  32. package/build/@types/ocm/components/clusterWizard/ClusterWizardFooter.d.ts.map +1 -1
  33. package/build/@types/ocm/components/clusterWizard/Operators.d.ts.map +1 -1
  34. package/build/@types/ocm/components/clusters/ClusterBreadcrumbs.d.ts.map +1 -1
  35. package/build/@types/ocm/components/clusters/ClusterPage.d.ts +3 -9
  36. package/build/@types/ocm/components/clusters/ClusterPage.d.ts.map +1 -1
  37. package/build/@types/ocm/components/clusters/ClusterPageErrors.d.ts.map +1 -1
  38. package/build/@types/ocm/components/clusters/Clusters.d.ts +1 -3
  39. package/build/@types/ocm/components/clusters/Clusters.d.ts.map +1 -1
  40. package/build/@types/ocm/components/clusters/ClustersListToolbar.d.ts.map +1 -1
  41. package/build/@types/ocm/components/clusters/NewClusterPage.d.ts +2 -3
  42. package/build/@types/ocm/components/clusters/NewClusterPage.d.ts.map +1 -1
  43. package/build/@types/ocm/components/featureSupportLevels/featureStateUtils.d.ts.map +1 -1
  44. package/build/@types/ocm/components/ui/Buttons/BackButton.d.ts +2 -3
  45. package/build/@types/ocm/components/ui/Buttons/BackButton.d.ts.map +1 -1
  46. package/build/@types/ocm/store/slices/clusters/selectors.d.ts.map +1 -1
  47. package/build/@types/ocm/store/slices/current-cluster/slice.d.ts +1 -1
  48. package/build/cjs/cim/components/Agent/NoAgentsAlert.js +12 -7
  49. package/build/cjs/cim/components/Agent/NoAgentsAlert.js.map +1 -1
  50. package/build/cjs/cim/components/Agent/tableUtils.js +3 -3
  51. package/build/cjs/cim/components/Agent/tableUtils.js.map +1 -1
  52. package/build/cjs/cim/components/ClusterDeployment/ClusterDetailsFormFields.js +2 -2
  53. package/build/cjs/cim/components/ClusterDeployment/ClusterDetailsFormFields.js.map +1 -1
  54. package/build/cjs/cim/components/Hypershift/DetailsPage/NodePoolsTable.js +2 -2
  55. package/build/cjs/cim/components/Hypershift/DetailsPage/NodePoolsTable.js.map +1 -1
  56. package/build/cjs/cim/components/InfraEnv/AddHostDropdown.js +2 -2
  57. package/build/cjs/cim/components/InfraEnv/AddHostDropdown.js.map +1 -1
  58. package/build/cjs/cim/components/InfraEnv/EnvironmentDetails.js +2 -1
  59. package/build/cjs/cim/components/InfraEnv/EnvironmentDetails.js.map +1 -1
  60. package/build/cjs/cim/components/InfraEnv/InfraEnvFormPage.js +2 -9
  61. package/build/cjs/cim/components/InfraEnv/InfraEnvFormPage.js.map +1 -1
  62. package/build/cjs/cim/components/InfraEnv/InfraTableToolbar.js +1 -4
  63. package/build/cjs/cim/components/InfraEnv/InfraTableToolbar.js.map +1 -1
  64. package/build/cjs/cim/components/common/CpuArchitectureDropdown.js +30 -0
  65. package/build/cjs/cim/components/common/CpuArchitectureDropdown.js.map +1 -0
  66. package/build/cjs/cim/components/helpers/agentStatus.js +5 -0
  67. package/build/cjs/cim/components/helpers/agentStatus.js.map +1 -1
  68. package/build/cjs/cim/components/helpers/clusterDeployment.js +8 -1
  69. package/build/cjs/cim/components/helpers/clusterDeployment.js.map +1 -1
  70. package/build/cjs/cim/components/modals/CimConfiguration/CimConfigProgressAlert.js +3 -3
  71. package/build/cjs/cim/components/modals/CimConfiguration/CimConfigProgressAlert.js.map +1 -1
  72. package/build/cjs/cim/components/modals/CimConfiguration/CimStorageMissingAlert.js +3 -3
  73. package/build/cjs/cim/components/modals/CimConfiguration/CimStorageMissingAlert.js.map +1 -1
  74. package/build/cjs/cim/components/modals/MassDeleteAgentModal.js +2 -2
  75. package/build/cjs/cim/components/modals/MassDeleteAgentModal.js.map +1 -1
  76. package/build/cjs/common/components/clusterWizard/clusterDetailsValidation.js +1 -0
  77. package/build/cjs/common/components/clusterWizard/clusterDetailsValidation.js.map +1 -1
  78. package/build/cjs/common/components/hosts/utils.js +1 -0
  79. package/build/cjs/common/components/hosts/utils.js.map +1 -1
  80. package/build/cjs/common/types/cpuArchitecture.js +22 -1
  81. package/build/cjs/common/types/cpuArchitecture.js.map +1 -1
  82. package/build/cjs/ocm/components/HostsClusterDetailTab/HostsClusterDetailTabMock.js.map +1 -1
  83. package/build/cjs/ocm/components/Routes.js +10 -10
  84. package/build/cjs/ocm/components/Routes.js.map +1 -1
  85. package/build/cjs/ocm/components/clusterConfiguration/CpuArchitectureDropdown.js +5 -27
  86. package/build/cjs/ocm/components/clusterConfiguration/CpuArchitectureDropdown.js.map +1 -1
  87. package/build/cjs/ocm/components/clusterConfiguration/OcmClusterDetailsFormFields.js +2 -4
  88. package/build/cjs/ocm/components/clusterConfiguration/OcmClusterDetailsFormFields.js.map +1 -1
  89. package/build/cjs/ocm/components/clusterConfiguration/platformIntegration/ExternalPlatformDropdown.js +1 -2
  90. package/build/cjs/ocm/components/clusterConfiguration/platformIntegration/ExternalPlatformDropdown.js.map +1 -1
  91. package/build/cjs/ocm/components/clusterDetail/AssistedInstallerDetailCard.js +2 -3
  92. package/build/cjs/ocm/components/clusterDetail/AssistedInstallerDetailCard.js.map +1 -1
  93. package/build/cjs/ocm/components/clusterDetail/ClusterDetail.js +5 -5
  94. package/build/cjs/ocm/components/clusterDetail/ClusterDetail.js.map +1 -1
  95. package/build/cjs/ocm/components/clusterWizard/ClusterDetails.js +4 -5
  96. package/build/cjs/ocm/components/clusterWizard/ClusterDetails.js.map +1 -1
  97. package/build/cjs/ocm/components/clusterWizard/ClusterDetailsForm.js +2 -2
  98. package/build/cjs/ocm/components/clusterWizard/ClusterDetailsForm.js.map +1 -1
  99. package/build/cjs/ocm/components/clusterWizard/ClusterWizardContextProvider.js +3 -2
  100. package/build/cjs/ocm/components/clusterWizard/ClusterWizardContextProvider.js.map +1 -1
  101. package/build/cjs/ocm/components/clusterWizard/ClusterWizardFooter.js +3 -4
  102. package/build/cjs/ocm/components/clusterWizard/ClusterWizardFooter.js.map +1 -1
  103. package/build/cjs/ocm/components/clusterWizard/Operators.js +6 -4
  104. package/build/cjs/ocm/components/clusterWizard/Operators.js.map +1 -1
  105. package/build/cjs/ocm/components/clusters/ClusterBreadcrumbs.js +3 -4
  106. package/build/cjs/ocm/components/clusters/ClusterBreadcrumbs.js.map +1 -1
  107. package/build/cjs/ocm/components/clusters/ClusterPage.js +10 -7
  108. package/build/cjs/ocm/components/clusters/ClusterPage.js.map +1 -1
  109. package/build/cjs/ocm/components/clusters/ClusterPageErrors.js +1 -2
  110. package/build/cjs/ocm/components/clusters/ClusterPageErrors.js.map +1 -1
  111. package/build/cjs/ocm/components/clusters/Clusters.js +6 -5
  112. package/build/cjs/ocm/components/clusters/Clusters.js.map +1 -1
  113. package/build/cjs/ocm/components/clusters/ClustersListToolbar.js +3 -4
  114. package/build/cjs/ocm/components/clusters/ClustersListToolbar.js.map +1 -1
  115. package/build/cjs/ocm/components/clusters/NewClusterPage.js +1 -1
  116. package/build/cjs/ocm/components/clusters/NewClusterPage.js.map +1 -1
  117. package/build/cjs/ocm/components/featureSupportLevels/featureStateUtils.js +1 -2
  118. package/build/cjs/ocm/components/featureSupportLevels/featureStateUtils.js.map +1 -1
  119. package/build/cjs/ocm/components/ui/Buttons/BackButton.js +2 -2
  120. package/build/cjs/ocm/components/ui/Buttons/BackButton.js.map +1 -1
  121. package/build/cjs/ocm/store/slices/clusters/selectors.js +2 -3
  122. package/build/cjs/ocm/store/slices/clusters/selectors.js.map +1 -1
  123. package/lib/cim/components/Agent/NoAgentsAlert.tsx +9 -5
  124. package/lib/cim/components/Agent/tableUtils.tsx +1 -1
  125. package/lib/cim/components/ClusterDeployment/ClusterDetailsFormFields.tsx +3 -2
  126. package/lib/cim/components/Hypershift/DetailsPage/NodePoolsTable.tsx +1 -1
  127. package/lib/cim/components/InfraEnv/AddHostDropdown.tsx +1 -1
  128. package/lib/cim/components/InfraEnv/EnvironmentDetails.tsx +8 -2
  129. package/lib/cim/components/InfraEnv/InfraEnvFormPage.tsx +7 -22
  130. package/lib/cim/components/InfraEnv/InfraTableToolbar.tsx +1 -3
  131. package/lib/cim/components/common/CpuArchitectureDropdown.tsx +73 -0
  132. package/lib/cim/components/helpers/agentStatus.tsx +5 -0
  133. package/lib/cim/components/helpers/clusterDeployment.ts +8 -1
  134. package/lib/cim/components/modals/CimConfiguration/CimConfigProgressAlert.tsx +3 -3
  135. package/lib/cim/components/modals/CimConfiguration/CimStorageMissingAlert.tsx +3 -6
  136. package/lib/cim/components/modals/MassDeleteAgentModal.tsx +1 -1
  137. package/lib/cim/types/k8s/infra-env-k8s-resource.ts +1 -1
  138. package/lib/common/components/clusterWizard/clusterDetailsValidation.ts +1 -0
  139. package/lib/common/components/clusterWizard/types.ts +1 -0
  140. package/lib/common/components/hosts/utils.ts +2 -0
  141. package/lib/common/types/cpuArchitecture.ts +28 -0
  142. package/lib/ocm/components/HostsClusterDetailTab/HostsClusterDetailTabMock.tsx +1 -5
  143. package/lib/ocm/components/Routes.tsx +13 -9
  144. package/lib/ocm/components/clusterConfiguration/CpuArchitectureDropdown.tsx +2 -33
  145. package/lib/ocm/components/clusterConfiguration/OcmClusterDetailsFormFields.tsx +4 -7
  146. package/lib/ocm/components/clusterConfiguration/platformIntegration/ExternalPlatformDropdown.tsx +1 -1
  147. package/lib/ocm/components/clusterDetail/AssistedInstallerDetailCard.tsx +2 -3
  148. package/lib/ocm/components/clusterDetail/ClusterDetail.tsx +5 -5
  149. package/lib/ocm/components/clusterWizard/ClusterDetails.tsx +4 -5
  150. package/lib/ocm/components/clusterWizard/ClusterDetailsForm.tsx +1 -1
  151. package/lib/ocm/components/clusterWizard/ClusterWizardContextProvider.tsx +3 -2
  152. package/lib/ocm/components/clusterWizard/ClusterWizardFooter.tsx +3 -7
  153. package/lib/ocm/components/clusterWizard/Operators.tsx +5 -3
  154. package/lib/ocm/components/clusters/ClusterBreadcrumbs.tsx +2 -3
  155. package/lib/ocm/components/clusters/ClusterPage.tsx +19 -16
  156. package/lib/ocm/components/clusters/ClusterPageErrors.tsx +1 -2
  157. package/lib/ocm/components/clusters/Clusters.tsx +6 -8
  158. package/lib/ocm/components/clusters/ClustersListToolbar.tsx +3 -4
  159. package/lib/ocm/components/clusters/NewClusterPage.tsx +4 -6
  160. package/lib/ocm/components/featureSupportLevels/featureStateUtils.ts +1 -1
  161. package/lib/ocm/components/ui/Buttons/BackButton.tsx +2 -4
  162. package/lib/ocm/store/slices/clusters/selectors.tsx +2 -3
  163. package/package.json +4 -4
  164. package/build/@types/cim/components/ClusterDeployment/ArmCheckbox.d.ts +0 -8
  165. package/build/@types/cim/components/ClusterDeployment/ArmCheckbox.d.ts.map +0 -1
  166. package/build/@types/ocm/components/ui/RedirectToCluster.d.ts +0 -8
  167. package/build/@types/ocm/components/ui/RedirectToCluster.d.ts.map +0 -1
  168. package/build/cjs/cim/components/ClusterDeployment/ArmCheckbox.js +0 -44
  169. package/build/cjs/cim/components/ClusterDeployment/ArmCheckbox.js.map +0 -1
  170. package/build/cjs/ocm/components/ui/RedirectToCluster.js +0 -14
  171. package/build/cjs/ocm/components/ui/RedirectToCluster.js.map +0 -1
  172. package/lib/cim/components/ClusterDeployment/ArmCheckbox.tsx +0 -101
  173. package/lib/ocm/components/ui/RedirectToCluster.tsx +0 -14
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { useHistory } from 'react-router-dom';
2
+ import { useNavigate } from 'react-router-dom-v5-compat';
3
3
  import { Alert, AlertGroup, AlertVariant } from '@patternfly/react-core';
4
4
  import {
5
5
  WizardFooter,
@@ -9,7 +9,6 @@ import {
9
9
  clusterFieldLabels,
10
10
  selectClusterValidationsInfo,
11
11
  } from '../../../common';
12
- import { routeBasePath } from '../../config';
13
12
  import { wizardStepsValidationsMap } from './wizardTransition';
14
13
  import { useClusterWizardContext } from './ClusterWizardContext';
15
14
  import ClusterWizardStepValidationsAlert from '../../../common/components/clusterWizard/ClusterWizardStepValidationsAlert';
@@ -79,12 +78,9 @@ const ClusterWizardFooter = ({
79
78
  ...rest
80
79
  }: ClusterWizardFooterProps) => {
81
80
  const { alerts } = useAlerts();
82
- const history = useHistory();
81
+ const navigate = useNavigate();
83
82
 
84
- const handleCancel = React.useCallback(
85
- () => history.push(`${routeBasePath}/clusters/`),
86
- [history],
87
- );
83
+ const handleCancel = React.useCallback(() => navigate('..'), [navigate]);
88
84
 
89
85
  const alertsSection = alerts.length ? <Alerts /> : undefined;
90
86
 
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { useDispatch } from 'react-redux';
3
- import { useHistory, useLocation } from 'react-router-dom';
3
+ import { useLocation, useNavigate } from 'react-router-dom-v5-compat';
4
4
  import { Formik, FormikConfig, useFormikContext } from 'formik';
5
5
  import {
6
6
  ClusterWizardStep,
@@ -42,7 +42,7 @@ const OperatorsForm = ({ cluster }: { cluster: Cluster }) => {
42
42
  const clusterWizardContext = useClusterWizardContext();
43
43
  const isAutoSaveRunning = useFormikAutoSave();
44
44
  const { errors, touched, isSubmitting, isValid } = useFormikContext<OperatorsValues>();
45
- const history = useHistory();
45
+ const navigate = useNavigate();
46
46
  const { pathname } = useLocation();
47
47
 
48
48
  const isNextDisabled =
@@ -53,7 +53,9 @@ const OperatorsForm = ({ cluster }: { cluster: Cluster }) => {
53
53
  !canNextOperators({ cluster });
54
54
 
55
55
  const handleNext = () => {
56
- history.replace(pathname, undefined);
56
+ if (window.location.pathname.indexOf('assisted-installer') > -1) {
57
+ navigate(pathname, { state: undefined, replace: true });
58
+ }
57
59
  clusterWizardContext.moveNext();
58
60
  };
59
61
 
@@ -5,8 +5,7 @@ import {
5
5
  BreadcrumbItem,
6
6
  PageSection,
7
7
  } from '@patternfly/react-core';
8
- import { Link } from 'react-router-dom';
9
- import { routeBasePath } from '../../config';
8
+ import { Link } from 'react-router-dom-v5-compat';
10
9
  import { isInOcm } from '../../../common/api';
11
10
 
12
11
  const ClusterBreadcrumbs = ({ clusterName }: { clusterName?: string }) => (
@@ -18,7 +17,7 @@ const ClusterBreadcrumbs = ({ clusterName }: { clusterName?: string }) => (
18
17
  </BreadcrumbItem>
19
18
  {clusterName ? (
20
19
  <BreadcrumbItem>
21
- <Link to={`${routeBasePath}/clusters`}>Assisted Clusters</Link>
20
+ <Link to={`..`}>Assisted Clusters</Link>
22
21
  </BreadcrumbItem>
23
22
  ) : (
24
23
  <BreadcrumbItem isActive>Assisted Clusters</BreadcrumbItem>
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { Redirect, RouteComponentProps } from 'react-router-dom';
2
+ import { useParams, Navigate } from 'react-router-dom-v5-compat';
3
3
  import { useDispatch } from 'react-redux';
4
4
  import { PageSection, PageSectionVariants, Text, TextContent } from '@patternfly/react-core';
5
5
  import {
@@ -34,13 +34,12 @@ import { usePullSecret } from '../../hooks';
34
34
  import { Cluster, InfraEnv } from '@openshift-assisted/types/assisted-installer-service';
35
35
  import { AssistedInstallerHeader } from './AssistedInstallerHeader';
36
36
 
37
- type MatchParams = {
38
- clusterId: string;
39
- };
40
-
41
- const ClusterPageGeneric: React.FC<{ clusterId: string; showBreadcrumbs?: boolean }> = ({
37
+ const ClusterPageGeneric = ({
42
38
  clusterId,
43
39
  showBreadcrumbs = false,
40
+ }: {
41
+ clusterId: string;
42
+ showBreadcrumbs?: boolean;
44
43
  }) => {
45
44
  if (!clusterId) {
46
45
  // console.error('ClusterPageGeneric: missing clusterId');
@@ -129,7 +128,7 @@ const ClusterPageGeneric: React.FC<{ clusterId: string; showBreadcrumbs?: boolea
129
128
 
130
129
  if (uiState === ResourceUIState.POLLING_ERROR && !cluster) {
131
130
  if (Number(errorDetail?.code) === 404) {
132
- return <Redirect to={`${routeBasePath}/clusters`} />;
131
+ return <Navigate to={`${routeBasePath}/clusters`} />;
133
132
  }
134
133
  return (
135
134
  <PageSection variant={PageSectionVariants.light} isFilled>
@@ -138,7 +137,7 @@ const ClusterPageGeneric: React.FC<{ clusterId: string; showBreadcrumbs?: boolea
138
137
  fetchData={
139
138
  Number(errorDetail?.code) === 401 ? () => window.location.reload() : fetchCluster
140
139
  }
141
- actions={[<BackButton key={'cancel'} to={`${routeBasePath}/clusters`} />]}
140
+ actions={[<BackButton key={'cancel'} to={'..'} />]}
142
141
  />
143
142
  </PageSection>
144
143
  );
@@ -149,7 +148,7 @@ const ClusterPageGeneric: React.FC<{ clusterId: string; showBreadcrumbs?: boolea
149
148
  <PageSection variant={PageSectionVariants.light} isFilled>
150
149
  <ErrorState
151
150
  title="Cluster details not found"
152
- actions={[<BackButton key={'cancel'} to={`${routeBasePath}/clusters`} />]}
151
+ actions={[<BackButton key={'cancel'} to={`..`} />]}
153
152
  content={
154
153
  'Check to make sure the cluster-ID is valid. Otherwise, the cluster details may have been deleted.'
155
154
  }
@@ -193,16 +192,20 @@ const ClusterPageGeneric: React.FC<{ clusterId: string; showBreadcrumbs?: boolea
193
192
  );
194
193
  }
195
194
 
196
- return <Redirect to="/clusters" />;
195
+ return <Navigate to="/clusters" />;
197
196
  };
198
197
 
199
- export const SingleClusterPage: React.FC<{ clusterId: string }> = ({ clusterId }) => (
198
+ export const SingleClusterPage = ({ clusterId }: { clusterId: string }) => (
200
199
  <AlertsContextProvider>
201
200
  <ClusterPageGeneric clusterId={clusterId} />
202
201
  </AlertsContextProvider>
203
202
  );
204
- export const ClusterPage: React.FC<RouteComponentProps<MatchParams>> = ({ match }) => (
205
- <AlertsContextProvider>
206
- <ClusterPageGeneric clusterId={match.params.clusterId} showBreadcrumbs />
207
- </AlertsContextProvider>
208
- );
203
+
204
+ export const ClusterPage = () => {
205
+ const { clusterId } = useParams<{ clusterId: string }>();
206
+ return (
207
+ <AlertsContextProvider>
208
+ <ClusterPageGeneric clusterId={clusterId || ''} showBreadcrumbs />
209
+ </AlertsContextProvider>
210
+ );
211
+ };
@@ -1,14 +1,13 @@
1
1
  import React from 'react';
2
2
  import { PageSection, PageSectionVariants } from '@patternfly/react-core';
3
3
  import { ErrorState } from '../../../common';
4
- import { routeBasePath } from '../../config';
5
4
  import { BackButton } from '../ui/Buttons/BackButton';
6
5
 
7
6
  export const ClusterUiError = () => (
8
7
  <PageSection variant={PageSectionVariants.light} isFilled>
9
8
  <ErrorState
10
9
  title="Failed to retrieve the default configuration"
11
- actions={[<BackButton key={'cancel'} to={`${routeBasePath}/clusters`} />]}
10
+ actions={[<BackButton key={'cancel'} to={'..'} />]}
12
11
  />
13
12
  </PageSection>
14
13
  );
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { RouteComponentProps } from 'react-router-dom';
2
+ import { useNavigate } from 'react-router-dom-v5-compat';
3
3
  import {
4
4
  Button,
5
5
  ButtonVariant,
@@ -22,7 +22,6 @@ import ClustersTable from './ClustersTable';
22
22
  import { fetchClustersAsync, deleteCluster } from '../../store/slices/clusters/slice';
23
23
  import { handleApiError, getApiErrorMessage } from '../../../common/api';
24
24
  import ClusterBreadcrumbs from './ClusterBreadcrumbs';
25
- import { routeBasePath } from '../../config';
26
25
  import { ClustersService } from '../../services';
27
26
  import { useTranslation } from '../../../common/hooks/use-translation-wrapper';
28
27
  import ClusterPollingErrorModal from '../clusterDetail/ClusterPollingErrorModal';
@@ -33,9 +32,8 @@ import {
33
32
  selectClusterTableRows,
34
33
  } from '../../store/slices/clusters/selectors';
35
34
 
36
- type ClustersProps = RouteComponentProps;
37
-
38
- const Clusters: React.FC<ClustersProps> = ({ history }) => {
35
+ const Clusters = () => {
36
+ const navigate = useNavigate();
39
37
  const { LOADING, EMPTY, POLLING_ERROR, RELOADING } = ResourceUIState;
40
38
  const { addAlert } = useAlerts();
41
39
  const { t } = useTranslation();
@@ -85,7 +83,7 @@ const Clusters: React.FC<ClustersProps> = ({ history }) => {
85
83
  primaryAction={
86
84
  <Button
87
85
  variant={ButtonVariant.primary}
88
- onClick={() => history.push(`${routeBasePath}/clusters/~new`)}
86
+ onClick={() => navigate(`~new`)}
89
87
  id="empty-state-new-cluster-button"
90
88
  data-ouia-id="button-create-new-cluster"
91
89
  >
@@ -129,9 +127,9 @@ const Clusters: React.FC<ClustersProps> = ({ history }) => {
129
127
  }
130
128
  };
131
129
 
132
- const ClustersPage: React.FC<RouteComponentProps> = (props) => (
130
+ const ClustersPage = () => (
133
131
  <AlertsContextProvider>
134
- <Clusters {...props} />
132
+ <Clusters />
135
133
  </AlertsContextProvider>
136
134
  );
137
135
 
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { useHistory } from 'react-router-dom';
2
+ import { useNavigate } from 'react-router-dom-v5-compat';
3
3
  import {
4
4
  Toolbar,
5
5
  ToolbarItem,
@@ -23,7 +23,6 @@ import { SyncIcon } from '@patternfly/react-icons/dist/js/icons/sync-icon';
23
23
  import { clusterStatusLabels, isSelectEventChecked, ToolbarButton } from '../../../common';
24
24
  import { ResourceUIState } from '../../../common';
25
25
  import { fetchClustersAsync } from '../../store/slices/clusters/slice';
26
- import { routeBasePath } from '../../config';
27
26
  import omit from 'lodash-es/omit.js';
28
27
  import { TFunction } from 'i18next';
29
28
  import { useTranslation } from '../../../common/hooks/use-translation-wrapper';
@@ -52,7 +51,7 @@ const ClustersListToolbar: React.FC<ClustersListToolbarProps> = ({
52
51
  setFilters,
53
52
  }) => {
54
53
  const [isStatusExpanded, setStatusExpanded] = React.useState(false);
55
- const history = useHistory();
54
+ const navigate = useNavigate();
56
55
  const clustersUIState = useSelectorDay1(selectClustersUIState);
57
56
  const dispatch = useDispatchDay1();
58
57
  const fetchClusters = React.useCallback(() => void dispatch(fetchClustersAsync()), [dispatch]);
@@ -153,7 +152,7 @@ const ClustersListToolbar: React.FC<ClustersListToolbarProps> = ({
153
152
  </ToolbarFilter>
154
153
  <ToolbarButton
155
154
  variant={ButtonVariant.primary}
156
- onClick={() => history.push(`${routeBasePath}/clusters/~new`)}
155
+ onClick={() => navigate(`~new`)}
157
156
  id="button-create-new-cluster"
158
157
  data-ouia-id="button-create-new-cluster"
159
158
  >
@@ -11,9 +11,7 @@ import { ClusterUiError } from './ClusterPageErrors';
11
11
  import { NewFeatureSupportLevelProvider } from '../featureSupportLevels';
12
12
  import { AssistedInstallerHeader } from './AssistedInstallerHeader';
13
13
 
14
- const NewClusterPageGeneric: React.FC<{ pageTitleSection?: ReactNode }> = ({
15
- pageTitleSection,
16
- }) => {
14
+ const NewClusterPageGeneric = ({ pageTitleSection }: { pageTitleSection?: ReactNode }) => {
17
15
  return (
18
16
  <AlertsContextProvider>
19
17
  <SentryErrorMonitorContextProvider>
@@ -35,7 +33,7 @@ const NewClusterPageGeneric: React.FC<{ pageTitleSection?: ReactNode }> = ({
35
33
  );
36
34
  };
37
35
 
38
- const NewClusterTitleSection: React.FC = () => (
36
+ const NewClusterTitleSection = () => (
39
37
  <>
40
38
  <ClusterBreadcrumbs clusterName="New cluster" />
41
39
  <PageSection variant={PageSectionVariants.light}>
@@ -44,7 +42,7 @@ const NewClusterTitleSection: React.FC = () => (
44
42
  </>
45
43
  );
46
44
 
47
- export const NewSingleClusterPage: React.FC = () => <NewClusterPageGeneric />;
48
- export const NewClusterPage: React.FC = () => (
45
+ export const NewSingleClusterPage = () => <NewClusterPageGeneric />;
46
+ export const NewClusterPage = () => (
49
47
  <NewClusterPageGeneric pageTitleSection={<NewClusterTitleSection />} />
50
48
  );
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  ActiveFeatureConfiguration,
3
+ architectureData,
3
4
  CpuArchitecture,
4
5
  FeatureId,
5
6
  isSNO,
6
7
  OperatorsValues,
7
8
  SupportedCpuArchitecture,
8
9
  } from '../../../common';
9
- import { architectureData } from '../clusterConfiguration/CpuArchitectureDropdown';
10
10
  import {
11
11
  Cluster,
12
12
  PlatformType,
@@ -1,12 +1,10 @@
1
- import { Link } from 'react-router-dom';
2
- import type { LinkProps } from 'react-router-dom';
3
- import type { LocationState } from 'history';
1
+ import { Link, LinkProps } from 'react-router-dom-v5-compat';
4
2
  import type { ButtonProps } from '@patternfly/react-core';
5
3
  import { Button } from '@patternfly/react-core';
6
4
  import React from 'react';
7
5
 
8
6
  export type BackButtonProps = {
9
- to: LinkProps<LocationState>['to'];
7
+ to: LinkProps['to'];
10
8
  variant?: ButtonProps['variant'];
11
9
  };
12
10
  export const BackButton = ({ to, variant = 'secondary' }: BackButtonProps) => (
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { createSelector } from '@reduxjs/toolkit';
3
3
  import type { IRow, IRowData } from '@patternfly/react-table';
4
- import { Link } from 'react-router-dom';
4
+ import { Link } from 'react-router-dom-v5-compat';
5
5
  import type { TFunction } from 'i18next';
6
6
  import {
7
7
  DASH,
@@ -14,7 +14,6 @@ import {
14
14
  } from '../../../../common';
15
15
  import type { ClusterTableRows, HumanizedSortable } from '../../../../common';
16
16
  import ClusterStatus, { getClusterStatusText } from '../../../components/clusters/ClusterStatus';
17
- import { routeBasePath } from '../../../config';
18
17
  import { RootStateDay1 } from '../../store-day1';
19
18
  import type { Cluster } from '@openshift-assisted/types/assisted-installer-service';
20
19
 
@@ -53,7 +52,7 @@ const clusterToClusterTableRow = (cluster: Cluster, t: TFunction): IRow => {
53
52
  cells: [
54
53
  {
55
54
  title: (
56
- <Link key={name} to={`${routeBasePath}/clusters/${id}`} id={`cluster-link-${id}`}>
55
+ <Link key={name} to={id} id={`cluster-link-${id}`}>
57
56
  {name}
58
57
  </Link>
59
58
  ),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "dependencies": {
3
- "@openshift-assisted/locales": "2.11.3-cim",
4
- "@openshift-assisted/types": "2.11.3-cim",
3
+ "@openshift-assisted/locales": "2.12.1-cim",
4
+ "@openshift-assisted/types": "2.12.1-cim",
5
5
  "@openshift-console/dynamic-plugin-sdk": "0.0.3",
6
6
  "@patternfly/patternfly": "^4.222.4",
7
7
  "@patternfly/react-code-editor": "^4.82.113",
@@ -103,7 +103,7 @@
103
103
  "react-i18next": ">11.7.3",
104
104
  "react-monaco-editor": "^0.51.0",
105
105
  "react-redux": "^8.0.5",
106
- "react-router-dom": "^5.3.0",
106
+ "react-router-dom-v5-compat": "^6.21.2",
107
107
  "react-tagsinput": "^3.20",
108
108
  "redux": "^4",
109
109
  "uuid": "^8.1",
@@ -141,5 +141,5 @@
141
141
  ]
142
142
  }
143
143
  },
144
- "version": "2.11.3-cim"
144
+ "version": "2.12.1-cim"
145
145
  }
@@ -1,8 +0,0 @@
1
- import * as React from 'react';
2
- import { OpenshiftVersionOptionType } from '../../../common';
3
- type ArmCheckboxProps = {
4
- versions: OpenshiftVersionOptionType[];
5
- };
6
- declare const ArmCheckbox: React.FC<ArmCheckboxProps>;
7
- export default ArmCheckbox;
8
- //# sourceMappingURL=ArmCheckbox.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ArmCheckbox.d.ts","sourceRoot":"","sources":["../../../../../lib/cim/components/ClusterDeployment/ArmCheckbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAIL,0BAA0B,EAE3B,MAAM,iBAAiB,CAAC;AA4BzB,KAAK,gBAAgB,GAAG;IAAE,QAAQ,EAAE,0BAA0B,EAAE,CAAA;CAAE,CAAC;AAEnE,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA2D3C,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- import { History } from 'history';
3
- export declare const redirectToCluster: (history: History, id: string) => void;
4
- declare const RedirectToCluster: React.FC<{
5
- id: string;
6
- }>;
7
- export default RedirectToCluster;
8
- //# sourceMappingURL=RedirectToCluster.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RedirectToCluster.d.ts","sourceRoot":"","sources":["../../../../../lib/ocm/components/ui/RedirectToCluster.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAGlC,eAAO,MAAM,iBAAiB,YAAa,OAAO,MAAM,MAAM,SAE7D,CAAC;AAEF,QAAA,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAE/C,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
@@ -1,44 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const React = tslib_1.__importStar(require("react"));
5
- const react_core_1 = require("@patternfly/react-core");
6
- const formik_1 = require("formik");
7
- const common_1 = require("../../../common");
8
- const featureSupportLevels_1 = require("../../../common/components/featureSupportLevels");
9
- const use_translation_wrapper_1 = require("../../../common/hooks/use-translation-wrapper");
10
- const Label = ({ version }) => {
11
- const { t } = (0, use_translation_wrapper_1.useTranslation)();
12
- return (React.createElement(React.Fragment, null,
13
- t('ai:Use arm64 CPU architecture'),
14
- ' ',
15
- React.createElement(common_1.PopoverIcon, { noVerticalAlign: true, bodyContent: React.createElement("p", null, t('ai:Check this option if you want to use the arm64 CPU architecture instead of the default x86_64 CPU architecture. Please note that some features will not be available.')) }),
16
- React.createElement(featureSupportLevels_1.FeatureSupportLevelBadge, { featureId: "ARM64_ARCHITECTURE", openshiftVersion: version })));
17
- };
18
- const ArmCheckbox = ({ versions }) => {
19
- const { t } = (0, use_translation_wrapper_1.useTranslation)();
20
- const { values: { openshiftVersion }, } = (0, formik_1.useFormikContext)();
21
- const [{ name, value }, , { setValue }] = (0, formik_1.useField)('cpuArchitecture');
22
- const fieldId = (0, common_1.getFieldId)(name, 'input');
23
- const featureSupportLevelContext = (0, featureSupportLevels_1.useFeatureSupportLevel)();
24
- const isSupportedVersionAvailable = !!versions.find((version) => featureSupportLevelContext.isFeatureSupported(version.value, 'ARM64_ARCHITECTURE'));
25
- const prevVersionRef = React.useRef(openshiftVersion);
26
- const handleChange = React.useCallback((checked) => setValue(checked ? common_1.CpuArchitecture.ARM : common_1.CpuArchitecture.x86), [setValue]);
27
- React.useEffect(() => {
28
- if (prevVersionRef.current !== openshiftVersion &&
29
- !featureSupportLevelContext.isFeatureSupported(openshiftVersion, 'ARM64_ARCHITECTURE')) {
30
- //invoke updating cpu architecture value only if the version changed to not be in danger of touching existing clusters
31
- handleChange(false);
32
- }
33
- prevVersionRef.current = openshiftVersion;
34
- }, [openshiftVersion, handleChange, featureSupportLevelContext]);
35
- if (!isSupportedVersionAvailable) {
36
- return null;
37
- }
38
- const disabledReason = featureSupportLevelContext.getFeatureDisabledReason(openshiftVersion, 'ARM64_ARCHITECTURE');
39
- return (React.createElement(react_core_1.FormGroup, { isInline: true, fieldId: fieldId },
40
- React.createElement(react_core_1.Tooltip, { hidden: !disabledReason, content: disabledReason },
41
- React.createElement(react_core_1.Checkbox, { id: fieldId, name: name, isDisabled: featureSupportLevelContext.isFeatureDisabled(openshiftVersion, 'ARM64_ARCHITECTURE'), label: React.createElement(Label, { version: openshiftVersion }), "aria-describedby": `${fieldId}-helper`, description: React.createElement(common_1.HelperText, { fieldId: fieldId }, t('ai:Make sure all the hosts are using arm64 CPU architecture.')), isChecked: value === common_1.CpuArchitecture.ARM, onChange: handleChange }))));
42
- };
43
- exports.default = ArmCheckbox;
44
- //# sourceMappingURL=ArmCheckbox.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ArmCheckbox.js","sourceRoot":"","sources":["../../../../../lib/cim/components/ClusterDeployment/ArmCheckbox.tsx"],"names":[],"mappings":"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"}
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.redirectToCluster = void 0;
4
- const tslib_1 = require("tslib");
5
- const react_1 = tslib_1.__importDefault(require("react"));
6
- const react_router_dom_1 = require("react-router-dom");
7
- const config_1 = require("../../config");
8
- const redirectToCluster = (history, id) => {
9
- history.push(`${config_1.routeBasePath}/clusters/${id}`);
10
- };
11
- exports.redirectToCluster = redirectToCluster;
12
- const RedirectToCluster = ({ id }) => (react_1.default.createElement(react_router_dom_1.Redirect, { to: `${config_1.routeBasePath}/clusters/${id}` }));
13
- exports.default = RedirectToCluster;
14
- //# sourceMappingURL=RedirectToCluster.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RedirectToCluster.js","sourceRoot":"","sources":["../../../../../lib/ocm/components/ui/RedirectToCluster.tsx"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAC1B,uDAA4C;AAE5C,yCAA6C;AAEtC,MAAM,iBAAiB,GAAG,CAAC,OAAgB,EAAE,EAAU,EAAE,EAAE;IAChE,OAAO,CAAC,IAAI,CAAC,GAAG,sBAAa,aAAa,EAAE,EAAE,CAAC,CAAC;AAClD,CAAC,CAAC;AAFW,QAAA,iBAAiB,qBAE5B;AAEF,MAAM,iBAAiB,GAA6B,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAC9D,8BAAC,2BAAQ,IAAC,EAAE,EAAE,GAAG,sBAAa,aAAa,EAAE,EAAE,GAAI,CACpD,CAAC;AAEF,kBAAe,iBAAiB,CAAC"}
@@ -1,101 +0,0 @@
1
- import * as React from 'react';
2
- import { Checkbox, FormGroup, Tooltip } from '@patternfly/react-core';
3
- import { useField, useFormikContext } from 'formik';
4
- import {
5
- CpuArchitecture,
6
- getFieldId,
7
- HelperText,
8
- OpenshiftVersionOptionType,
9
- PopoverIcon,
10
- } from '../../../common';
11
- import {
12
- FeatureSupportLevelBadge,
13
- useFeatureSupportLevel,
14
- } from '../../../common/components/featureSupportLevels';
15
- import { useTranslation } from '../../../common/hooks/use-translation-wrapper';
16
- import { ClusterCreateParams } from '@openshift-assisted/types/assisted-installer-service';
17
-
18
- const Label = ({ version }: { version: string }) => {
19
- const { t } = useTranslation();
20
- return (
21
- <>
22
- {t('ai:Use arm64 CPU architecture')}{' '}
23
- <PopoverIcon
24
- noVerticalAlign
25
- bodyContent={
26
- <p>
27
- {t(
28
- 'ai:Check this option if you want to use the arm64 CPU architecture instead of the default x86_64 CPU architecture. Please note that some features will not be available.',
29
- )}
30
- </p>
31
- }
32
- />
33
- <FeatureSupportLevelBadge featureId="ARM64_ARCHITECTURE" openshiftVersion={version} />
34
- </>
35
- );
36
- };
37
-
38
- type ArmCheckboxProps = { versions: OpenshiftVersionOptionType[] };
39
-
40
- const ArmCheckbox: React.FC<ArmCheckboxProps> = ({ versions }) => {
41
- const { t } = useTranslation();
42
- const {
43
- values: { openshiftVersion },
44
- } = useFormikContext<ClusterCreateParams>();
45
- const [{ name, value }, , { setValue }] = useField<CpuArchitecture>('cpuArchitecture');
46
- const fieldId = getFieldId(name, 'input');
47
-
48
- const featureSupportLevelContext = useFeatureSupportLevel();
49
- const isSupportedVersionAvailable = !!versions.find((version) =>
50
- featureSupportLevelContext.isFeatureSupported(version.value, 'ARM64_ARCHITECTURE'),
51
- );
52
-
53
- const prevVersionRef = React.useRef(openshiftVersion);
54
- const handleChange = React.useCallback(
55
- (checked: boolean) => setValue(checked ? CpuArchitecture.ARM : CpuArchitecture.x86),
56
- [setValue],
57
- );
58
-
59
- React.useEffect(() => {
60
- if (
61
- prevVersionRef.current !== openshiftVersion &&
62
- !featureSupportLevelContext.isFeatureSupported(openshiftVersion, 'ARM64_ARCHITECTURE')
63
- ) {
64
- //invoke updating cpu architecture value only if the version changed to not be in danger of touching existing clusters
65
- handleChange(false);
66
- }
67
- prevVersionRef.current = openshiftVersion;
68
- }, [openshiftVersion, handleChange, featureSupportLevelContext]);
69
- if (!isSupportedVersionAvailable) {
70
- return null;
71
- }
72
- const disabledReason = featureSupportLevelContext.getFeatureDisabledReason(
73
- openshiftVersion,
74
- 'ARM64_ARCHITECTURE',
75
- );
76
- return (
77
- <FormGroup isInline fieldId={fieldId}>
78
- <Tooltip hidden={!disabledReason} content={disabledReason}>
79
- <Checkbox
80
- id={fieldId}
81
- name={name}
82
- isDisabled={featureSupportLevelContext.isFeatureDisabled(
83
- openshiftVersion,
84
- 'ARM64_ARCHITECTURE',
85
- )}
86
- label={<Label version={openshiftVersion} />}
87
- aria-describedby={`${fieldId}-helper`}
88
- description={
89
- <HelperText fieldId={fieldId}>
90
- {t('ai:Make sure all the hosts are using arm64 CPU architecture.')}
91
- </HelperText>
92
- }
93
- isChecked={value === CpuArchitecture.ARM}
94
- onChange={handleChange}
95
- />
96
- </Tooltip>
97
- </FormGroup>
98
- );
99
- };
100
-
101
- export default ArmCheckbox;
@@ -1,14 +0,0 @@
1
- import React from 'react';
2
- import { Redirect } from 'react-router-dom';
3
- import { History } from 'history';
4
- import { routeBasePath } from '../../config';
5
-
6
- export const redirectToCluster = (history: History, id: string) => {
7
- history.push(`${routeBasePath}/clusters/${id}`);
8
- };
9
-
10
- const RedirectToCluster: React.FC<{ id: string }> = ({ id }) => (
11
- <Redirect to={`${routeBasePath}/clusters/${id}`} />
12
- );
13
-
14
- export default RedirectToCluster;