@openshift-assisted/ui-lib 2.14.2-cim → 2.14.4-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 (121) hide show
  1. package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentDetailsForm.d.ts.map +1 -1
  2. package/build/@types/cim/components/ClusterDeployment/ClusterDetailsFormFields.d.ts +4 -2
  3. package/build/@types/cim/components/ClusterDeployment/ClusterDetailsFormFields.d.ts.map +1 -1
  4. package/build/@types/cim/components/Hypershift/types.d.ts +1 -1
  5. package/build/@types/cim/components/InfraEnv/InfraEnvOpenShiftVersionDropdown.d.ts +7 -0
  6. package/build/@types/cim/components/InfraEnv/InfraEnvOpenShiftVersionDropdown.d.ts.map +1 -0
  7. package/build/@types/cim/components/common/CpuArchitectureDropdown.d.ts +2 -1
  8. package/build/@types/cim/components/common/CpuArchitectureDropdown.d.ts.map +1 -1
  9. package/build/@types/cim/components/helpers/versions.d.ts +2 -2
  10. package/build/@types/cim/components/helpers/versions.d.ts.map +1 -1
  11. package/build/@types/common/components/clusterConfiguration/ControlPlaneNodesDropdown.d.ts +2 -2
  12. package/build/@types/common/components/clusterConfiguration/ControlPlaneNodesDropdown.d.ts.map +1 -1
  13. package/build/@types/common/components/ui/{OpenshiftSelectWithSearch.d.ts → OpenShiftSelectWithSearch.d.ts} +3 -3
  14. package/build/@types/common/components/ui/OpenShiftSelectWithSearch.d.ts.map +1 -0
  15. package/build/@types/common/components/ui/OpenShiftVersionDropdown.d.ts +2 -2
  16. package/build/@types/common/components/ui/OpenShiftVersionDropdown.d.ts.map +1 -1
  17. package/build/@types/common/components/ui/OpenShiftVersionModal.d.ts +12 -0
  18. package/build/@types/common/components/ui/OpenShiftVersionModal.d.ts.map +1 -0
  19. package/build/@types/common/components/ui/formik/RichInputField.d.ts.map +1 -1
  20. package/build/@types/common/components/ui/index.d.ts +2 -0
  21. package/build/@types/common/components/ui/index.d.ts.map +1 -1
  22. package/build/@types/ocm/components/clusterConfiguration/OcmOpenShiftVersionSelect.d.ts.map +1 -1
  23. package/build/@types/ocm/components/clusterWizard/{OpenshiftVersionsContext.d.ts → OpenShiftVersionsContext.d.ts} +4 -4
  24. package/build/@types/ocm/components/clusterWizard/{OpenshiftVersionsContext.d.ts.map → OpenShiftVersionsContext.d.ts.map} +1 -1
  25. package/build/@types/ocm/components/clusterWizard/index.d.ts +1 -0
  26. package/build/@types/ocm/components/clusterWizard/index.d.ts.map +1 -1
  27. package/build/@types/ocm/services/OperatorsService.d.ts +1 -1
  28. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentDetailsForm.js +17 -16
  29. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentDetailsForm.js.map +1 -1
  30. package/build/cjs/cim/components/ClusterDeployment/ClusterDetailsFormFields.js +24 -9
  31. package/build/cjs/cim/components/ClusterDeployment/ClusterDetailsFormFields.js.map +1 -1
  32. package/build/cjs/cim/components/Hypershift/DetailsPage/HypershiftKubeconfigDownload.js +2 -2
  33. package/build/cjs/cim/components/InfraEnv/InfraEnvFormPage.js +2 -2
  34. package/build/cjs/cim/components/InfraEnv/InfraEnvFormPage.js.map +1 -1
  35. package/build/cjs/cim/components/InfraEnv/{OpenshiftVersionDropdown.js → InfraEnvOpenShiftVersionDropdown.js} +3 -3
  36. package/build/cjs/cim/components/InfraEnv/InfraEnvOpenShiftVersionDropdown.js.map +1 -0
  37. package/build/cjs/cim/components/common/CpuArchitectureDropdown.js +14 -19
  38. package/build/cjs/cim/components/common/CpuArchitectureDropdown.js.map +1 -1
  39. package/build/cjs/cim/components/helpers/versions.js +19 -11
  40. package/build/cjs/cim/components/helpers/versions.js.map +1 -1
  41. package/build/cjs/common/components/clusterConfiguration/ControlPlaneNodesDropdown.js +11 -9
  42. package/build/cjs/common/components/clusterConfiguration/ControlPlaneNodesDropdown.js.map +1 -1
  43. package/build/cjs/common/components/ui/{OpenshiftSelectWithSearch.js → OpenShiftSelectWithSearch.js} +6 -6
  44. package/build/cjs/common/components/ui/{OpenshiftSelectWithSearch.js.map → OpenShiftSelectWithSearch.js.map} +1 -1
  45. package/build/cjs/common/components/ui/OpenShiftVersionDropdown.css +9 -0
  46. package/build/cjs/common/components/ui/OpenShiftVersionDropdown.js +2 -2
  47. package/build/cjs/common/components/ui/OpenShiftVersionDropdown.js.map +1 -1
  48. package/build/cjs/{ocm/components/clusterConfiguration → common/components/ui}/OpenShiftVersionModal.js +4 -6
  49. package/build/cjs/common/components/ui/OpenShiftVersionModal.js.map +1 -0
  50. package/build/cjs/common/components/ui/formik/RichInputField.js +3 -2
  51. package/build/cjs/common/components/ui/formik/RichInputField.js.map +1 -1
  52. package/build/cjs/common/components/ui/index.js +2 -0
  53. package/build/cjs/common/components/ui/index.js.map +1 -1
  54. package/build/cjs/ocm/components/AddHosts/day2Wizard/Day2ClusterDetails.js +2 -2
  55. package/build/cjs/ocm/components/HostsClusterDetailTab/HostsClusterDetailTabContent.js +2 -2
  56. package/build/cjs/ocm/components/HostsClusterDetailTab/HostsClusterDetailTabMock.js +2 -2
  57. package/build/cjs/ocm/components/clusterConfiguration/OcmClusterDetailsFormFields.js +2 -2
  58. package/build/cjs/ocm/components/clusterConfiguration/OcmOpenShiftVersion.js +1 -1
  59. package/build/cjs/ocm/components/clusterConfiguration/OcmOpenShiftVersionSelect.js +5 -6
  60. package/build/cjs/ocm/components/clusterConfiguration/OcmOpenShiftVersionSelect.js.map +1 -1
  61. package/build/cjs/ocm/components/clusterConfiguration/review/ReviewPreflightChecks.js +2 -2
  62. package/build/cjs/ocm/components/clusterDetail/AssistedInstallerDetailCard.js +2 -2
  63. package/build/cjs/ocm/components/clusterDetail/AssistedInstallerExtraDetailCard.js +2 -2
  64. package/build/cjs/ocm/components/clusterDetail/OpenShiftVersionDetail.js +2 -2
  65. package/build/cjs/ocm/components/clusterWizard/ClusterDetails.js +2 -2
  66. package/build/cjs/ocm/components/clusterWizard/{OpenshiftVersionsContext.js → OpenShiftVersionsContext.js} +10 -10
  67. package/build/cjs/ocm/components/clusterWizard/{OpenshiftVersionsContext.js.map → OpenShiftVersionsContext.js.map} +1 -1
  68. package/build/cjs/ocm/components/clusterWizard/index.js +3 -1
  69. package/build/cjs/ocm/components/clusterWizard/index.js.map +1 -1
  70. package/build/cjs/ocm/components/clusters/ClusterPage.js +3 -3
  71. package/build/cjs/ocm/components/clusters/NewClusterPage.js +2 -2
  72. package/build/cjs/ocm/components/featureSupportLevels/FeatureSupportLevelProvider.js +2 -2
  73. package/build/cjs/ocm/components/featureSupportLevels/ReviewClusterFeatureSupportLevels.js +2 -2
  74. package/build/cjs/ocm/components/featureSupportLevels/featureStateUtils.js +1 -1
  75. package/build/cjs/ocm/services/OperatorsService.js +2 -2
  76. package/lib/cim/components/ClusterDeployment/ClusterDeploymentDetailsForm.tsx +35 -29
  77. package/lib/cim/components/ClusterDeployment/ClusterDetailsFormFields.tsx +54 -13
  78. package/lib/cim/components/Hypershift/DetailsPage/HypershiftKubeconfigDownload.tsx +2 -2
  79. package/lib/cim/components/Hypershift/types.ts +1 -1
  80. package/lib/cim/components/InfraEnv/InfraEnvFormPage.tsx +2 -2
  81. package/lib/cim/components/InfraEnv/{OpenshiftVersionDropdown.tsx → InfraEnvOpenShiftVersionDropdown.tsx} +2 -2
  82. package/lib/cim/components/common/CpuArchitectureDropdown.tsx +51 -40
  83. package/lib/cim/components/helpers/versions.ts +20 -6
  84. package/lib/common/components/clusterConfiguration/ControlPlaneNodesDropdown.tsx +14 -14
  85. package/lib/common/components/ui/{OpenshiftSelectWithSearch.tsx → OpenShiftSelectWithSearch.tsx} +4 -4
  86. package/lib/common/components/ui/OpenShiftVersionDropdown.css +9 -0
  87. package/lib/common/components/ui/OpenShiftVersionDropdown.tsx +3 -3
  88. package/lib/{ocm/components/clusterConfiguration → common/components/ui}/OpenShiftVersionModal.tsx +9 -9
  89. package/lib/common/components/ui/formik/RichInputField.tsx +4 -2
  90. package/lib/common/components/ui/index.ts +3 -0
  91. package/lib/ocm/components/AddHosts/day2Wizard/Day2ClusterDetails.tsx +2 -2
  92. package/lib/ocm/components/HostsClusterDetailTab/HostsClusterDetailTabContent.tsx +3 -3
  93. package/lib/ocm/components/HostsClusterDetailTab/HostsClusterDetailTabMock.tsx +3 -3
  94. package/lib/ocm/components/clusterConfiguration/OcmClusterDetailsFormFields.tsx +2 -2
  95. package/lib/ocm/components/clusterConfiguration/OcmOpenShiftVersion.tsx +1 -1
  96. package/lib/ocm/components/clusterConfiguration/OcmOpenShiftVersionSelect.tsx +9 -5
  97. package/lib/ocm/components/clusterConfiguration/review/ReviewPreflightChecks.tsx +2 -2
  98. package/lib/ocm/components/clusterDetail/AssistedInstallerDetailCard.tsx +3 -3
  99. package/lib/ocm/components/clusterDetail/AssistedInstallerExtraDetailCard.tsx +3 -3
  100. package/lib/ocm/components/clusterDetail/OpenShiftVersionDetail.tsx +2 -2
  101. package/lib/ocm/components/clusterWizard/ClusterDetails.tsx +2 -2
  102. package/lib/ocm/components/clusterWizard/{OpenshiftVersionsContext.tsx → OpenShiftVersionsContext.tsx} +8 -8
  103. package/lib/ocm/components/clusterWizard/index.ts +1 -0
  104. package/lib/ocm/components/clusters/ClusterPage.tsx +5 -5
  105. package/lib/ocm/components/clusters/NewClusterPage.tsx +3 -3
  106. package/lib/ocm/components/featureSupportLevels/FeatureSupportLevelProvider.tsx +2 -2
  107. package/lib/ocm/components/featureSupportLevels/ReviewClusterFeatureSupportLevels.tsx +2 -2
  108. package/lib/ocm/components/featureSupportLevels/featureStateUtils.ts +1 -1
  109. package/lib/ocm/services/OperatorsService.tsx +2 -2
  110. package/package.json +3 -3
  111. package/build/@types/cim/components/InfraEnv/OpenshiftVersionDropdown.d.ts +0 -7
  112. package/build/@types/cim/components/InfraEnv/OpenshiftVersionDropdown.d.ts.map +0 -1
  113. package/build/@types/common/components/ui/OpenshiftSelectWithSearch.d.ts.map +0 -1
  114. package/build/@types/ocm/components/clusterConfiguration/OpenShiftVersionModal.d.ts +0 -10
  115. package/build/@types/ocm/components/clusterConfiguration/OpenShiftVersionModal.d.ts.map +0 -1
  116. package/build/cjs/cim/components/InfraEnv/OpenshiftVersionDropdown.js.map +0 -1
  117. package/build/cjs/common/components/ui/OpenshiftVersionDropdown.css +0 -4
  118. package/build/cjs/ocm/components/clusterConfiguration/OpenShiftVersionModal.js.map +0 -1
  119. package/lib/common/components/ui/OpenshiftVersionDropdown.css +0 -4
  120. /package/build/cjs/{ocm/components/clusterConfiguration/OpenshiftVersionModal.css → common/components/ui/OpenShiftVersionModal.css} +0 -0
  121. /package/lib/{ocm/components/clusterConfiguration/OpenshiftVersionModal.css → common/components/ui/OpenShiftVersionModal.css} +0 -0
@@ -1,6 +1,5 @@
1
1
  import * as React from 'react';
2
- import { FormGroup } from '@patternfly/react-core';
3
- import { Dropdown, DropdownItem, DropdownToggle } from '@patternfly/react-core/deprecated';
2
+ import { Dropdown, DropdownItem, FormGroup, MenuToggle } from '@patternfly/react-core';
4
3
  import { useTranslation } from '../../../common/hooks/use-translation-wrapper';
5
4
  import {
6
5
  architectureData,
@@ -12,30 +11,18 @@ import {
12
11
  import { useField } from 'formik';
13
12
  import { useFormikHelpers } from '../../../common/hooks/useFormikHelpers';
14
13
 
15
- const allDropdownItems = {
16
- [CpuArchitecture.x86]: (
17
- <DropdownItem key={'x86_64'} id="x86_64" description={architectureData['x86_64'].description}>
18
- {architectureData['x86_64'].label}
19
- </DropdownItem>
20
- ),
21
- [CpuArchitecture.ARM]: (
22
- <DropdownItem key={'arm64'} id="arm64" description={architectureData['arm64'].description}>
23
- {architectureData['arm64'].label}
24
- </DropdownItem>
25
- ),
26
- [CpuArchitecture.s390x]: (
27
- <DropdownItem key={'s390x'} id="s390x" description={architectureData['s390x'].description}>
28
- {architectureData['s390x'].label}
29
- </DropdownItem>
30
- ),
31
- };
14
+ const cimCpuArchitectures = [
15
+ CpuArchitecture.x86,
16
+ CpuArchitecture.ARM,
17
+ CpuArchitecture.s390x,
18
+ ] as SupportedCpuArchitecture[];
32
19
 
33
20
  const CpuArchitectureDropdown = ({
34
21
  isDisabled = false,
35
22
  cpuArchitectures,
36
23
  }: {
37
24
  isDisabled?: boolean;
38
- cpuArchitectures?: string[];
25
+ cpuArchitectures?: SupportedCpuArchitecture[];
39
26
  }) => {
40
27
  const { t } = useTranslation();
41
28
  const [{ name, value }, , { setValue }] = useField<SupportedCpuArchitecture | ''>(
@@ -45,7 +32,7 @@ const CpuArchitectureDropdown = ({
45
32
  const fieldId = getFieldId(name, 'input');
46
33
  const { setValue: setUserManagedNetworking } = useFormikHelpers<boolean>('userManagedNetworking');
47
34
 
48
- const onCpuArchSelect = (e?: React.SyntheticEvent<HTMLDivElement>) => {
35
+ const onCpuArchSelect = (e?: React.MouseEvent<Element, MouseEvent>) => {
49
36
  const val = e?.currentTarget.id as SupportedCpuArchitecture;
50
37
  setValue(val);
51
38
  setUserManagedNetworking(val === CpuArchitecture.s390x);
@@ -53,36 +40,60 @@ const CpuArchitectureDropdown = ({
53
40
  setCpuArchOpen(false);
54
41
  };
55
42
 
56
- const dropdownItems = React.useMemo(() => {
57
- if (!cpuArchitectures) {
58
- return Object.values(allDropdownItems);
59
- } else {
60
- return Object.entries(allDropdownItems)
61
- .filter(([key, _]) => cpuArchitectures.includes(key))
62
- .map(([_, val]) => val);
63
- }
64
- }, [cpuArchitectures]);
43
+ const dropdownItems = React.useMemo(
44
+ () =>
45
+ cimCpuArchitectures.map((arch) => {
46
+ const isItemEnabled = !cpuArchitectures || cpuArchitectures.includes(arch);
47
+ const disabledReason = t(
48
+ 'ai:This option is not available with the selected OpenShift version',
49
+ );
50
+ return (
51
+ <DropdownItem
52
+ key={arch}
53
+ id={arch}
54
+ isAriaDisabled={!isItemEnabled}
55
+ selected={arch === value}
56
+ description={architectureData[arch].description}
57
+ tooltipProps={{ content: disabledReason, position: 'top' }}
58
+ onClick={(e: React.MouseEvent) => e.preventDefault()}
59
+ >
60
+ {architectureData[arch].label}
61
+ </DropdownItem>
62
+ );
63
+ }),
64
+ [cpuArchitectures, t, value],
65
+ );
65
66
 
66
67
  React.useEffect(() => {
67
68
  if (!isDisabled && value !== '' && cpuArchitectures && !cpuArchitectures?.includes(value)) {
68
- setValue('');
69
+ const defaultVal = cpuArchitectures?.[0] || CpuArchitecture.x86;
70
+ setValue(defaultVal);
69
71
  }
70
72
  }, [cpuArchitectures, isDisabled, setValue, value]);
71
73
 
72
74
  return !isDisabled ? (
73
- <FormGroup isInline fieldId={fieldId} label={t('ai:CPU architecture')} isRequired>
75
+ <FormGroup
76
+ isInline
77
+ fieldId={fieldId}
78
+ label={t('ai:CPU architecture')}
79
+ isRequired
80
+ name={'cpuArchiteture'}
81
+ >
74
82
  <Dropdown
75
- toggle={
76
- <DropdownToggle onToggle={() => setCpuArchOpen(!cpuArchOpen)} className="pf-u-w-100">
83
+ toggle={(toggleRef) => (
84
+ <MenuToggle
85
+ ref={toggleRef}
86
+ onClick={() => setCpuArchOpen(!cpuArchOpen)}
87
+ className="pf-u-w-100"
88
+ >
77
89
  {value ? architectureData[value].label : t('ai:CPU architecture')}
78
- </DropdownToggle>
79
- }
80
- name="cpuArchitecture"
90
+ </MenuToggle>
91
+ )}
81
92
  isOpen={cpuArchOpen}
82
93
  onSelect={onCpuArchSelect}
83
- dropdownItems={dropdownItems}
84
- className="pf-u-w-100"
85
- />
94
+ >
95
+ {dropdownItems}
96
+ </Dropdown>
86
97
  </FormGroup>
87
98
  ) : (
88
99
  <StaticField name={'cpuArchitecture'} label={t('ai:CPU architecture')} isRequired>
@@ -6,11 +6,18 @@ import {
6
6
  ClusterVersionK8sResource,
7
7
  OsImage,
8
8
  } from '../../types';
9
- import { OpenshiftVersionOptionType } from '../../../common';
9
+ import { CpuArchitecture, OpenshiftVersionOptionType } from '../../../common';
10
10
  import { OpenshiftVersion } from '@openshift-assisted/types/assisted-installer-service';
11
11
 
12
12
  export const getVersionFromReleaseImage = (releaseImage = '') => {
13
- const match = /.+:(.*)-/gm.exec(releaseImage);
13
+ const match = /.+:(.*)/gm.exec(releaseImage);
14
+ if (match && match.length > 1 && match[1]) {
15
+ return match[1];
16
+ }
17
+ };
18
+
19
+ const getCPUArchFromReleaseImage = (releaseImage = '') => {
20
+ const match = /.+:.*-(.*)/gm.exec(releaseImage);
14
21
  if (match && match.length > 1 && match[1]) {
15
22
  return match[1];
16
23
  }
@@ -37,8 +44,12 @@ const getSupportLevelFromChannel = (
37
44
 
38
45
  export const supportedNutanixPlatforms = ['x86_64', 'x86-64'];
39
46
 
40
- export const isValidImageSet = (cis: ClusterImageSetK8sResource, architectures?: string[]) => {
41
- if (cis.metadata?.labels?.visible !== 'true') {
47
+ export const isValidImageSet = (
48
+ cis: ClusterImageSetK8sResource,
49
+ architectures?: string[],
50
+ extended?: boolean,
51
+ ) => {
52
+ if (!extended && cis.metadata?.labels?.visible !== 'true') {
42
53
  return false;
43
54
  }
44
55
  if (!architectures) {
@@ -53,6 +64,7 @@ export const getOCPVersions = (
53
64
  clusterImageSets: ClusterImageSetK8sResource[],
54
65
  isNutanix?: boolean | undefined,
55
66
  osImages?: OsImage[],
67
+ extended?: boolean,
56
68
  ): OpenshiftVersionOptionType[] => {
57
69
  const ocpImageVersions = Array.from(
58
70
  new Set(osImages?.map((osImage) => osImage.openshiftVersion)),
@@ -60,10 +72,11 @@ export const getOCPVersions = (
60
72
 
61
73
  const versions = clusterImageSets
62
74
  .filter((clusterImageSet) =>
63
- isValidImageSet(clusterImageSet, isNutanix ? supportedNutanixPlatforms : undefined),
75
+ isValidImageSet(clusterImageSet, isNutanix ? supportedNutanixPlatforms : undefined, extended),
64
76
  )
65
77
  .map((clusterImageSet): OpenshiftVersionOptionType => {
66
78
  const version = getVersionFromReleaseImage(clusterImageSet.spec?.releaseImage);
79
+ const cpuArch = getCPUArchFromReleaseImage(clusterImageSet.spec?.releaseImage);
67
80
  return {
68
81
  label: `OpenShift ${version ? version : (clusterImageSet.metadata?.name as string)}`,
69
82
  version: version || clusterImageSet.metadata?.name || '',
@@ -71,6 +84,7 @@ export const getOCPVersions = (
71
84
  default: false,
72
85
  // (rawagner) ACM does not have the warning so changing to 'production'
73
86
  supportLevel: 'production', // getSupportLevelFromChannel(clusterImageSet.metadata?.labels?.channel),
87
+ cpuArchitectures: cpuArch ? [cpuArch as CpuArchitecture] : undefined,
74
88
  };
75
89
  })
76
90
  .filter((ocpVersion) => {
@@ -99,7 +113,7 @@ export const getSelectedVersion = (
99
113
  );
100
114
 
101
115
  return selectedClusterImage
102
- ? getOCPVersions([selectedClusterImage])?.[0]?.version
116
+ ? getOCPVersions([selectedClusterImage], undefined, undefined, true)?.[0]?.version
103
117
  : agentClusterInstall?.spec?.imageSetRef?.name;
104
118
  };
105
119
 
@@ -11,21 +11,17 @@ interface ControlPlaneNodesOption {
11
11
  label: string;
12
12
  }
13
13
 
14
- const isDropdownItemEnabled = (controlPlaneNodeCount: number, isNutanix?: boolean): boolean => {
15
- return (controlPlaneNodeCount === 1 && !isNutanix) || controlPlaneNodeCount !== 1;
16
- };
17
-
18
14
  const ControlPlaneNodesDropdown = ({
19
15
  isDisabled = false,
20
- isNutanix,
16
+ allowHighlyAvailable,
21
17
  }: {
22
18
  isDisabled?: boolean;
23
- isNutanix?: boolean;
19
+ allowHighlyAvailable?: boolean;
24
20
  }) => {
25
21
  const { t } = useTranslation();
26
- const [{ name, value: selectedValue }, , { setValue }] = useField<number | 3>(
27
- 'controlPlaneCount',
28
- );
22
+ const [{ name, value: selectedValue }, , { setValue }] = useField<number>('controlPlaneCount');
23
+ const [controlPlanelOpen, setControlPlanelOpen] = React.useState(false);
24
+ const fieldId = getFieldId(name, 'input');
29
25
 
30
26
  const options: ControlPlaneNodesOption[] = [
31
27
  { value: 1, label: t('ai:1 (Single Node OpenShift - not highly available cluster)') },
@@ -34,14 +30,21 @@ const ControlPlaneNodesDropdown = ({
34
30
  { value: 5, label: t('ai:5 (highly available cluster++)') },
35
31
  ];
36
32
 
33
+ React.useEffect(() => {
34
+ if (!allowHighlyAvailable && [4, 5].includes(selectedValue)) {
35
+ setValue(3);
36
+ }
37
+ }, [allowHighlyAvailable, selectedValue, setValue]);
38
+
37
39
  const dropdownItems = options.map(({ value, label }) => {
38
- const isItemEnabled = isDropdownItemEnabled(value, isNutanix);
39
- const disabledReason = t('ai:This option is not available for Nutanix platform');
40
+ const isItemEnabled = [1, 3].includes(value) || allowHighlyAvailable;
41
+ const disabledReason = t('ai:This option is not available with the selected OpenShift version');
40
42
  return (
41
43
  <DropdownItem
42
44
  key={value}
43
45
  id={value.toString()}
44
46
  isAriaDisabled={!isItemEnabled}
47
+ isDisabled={!isItemEnabled}
45
48
  selected={selectedValue === value}
46
49
  value={value}
47
50
  >
@@ -52,9 +55,6 @@ const ControlPlaneNodesDropdown = ({
52
55
  );
53
56
  });
54
57
 
55
- const [controlPlanelOpen, setControlPlanelOpen] = React.useState(false);
56
- const fieldId = getFieldId(name, 'input');
57
-
58
58
  const onControlPlaneSelect = (e?: React.SyntheticEvent<HTMLDivElement>) => {
59
59
  const val = e?.currentTarget.id as string;
60
60
  setValue(toNumber(val));
@@ -22,11 +22,11 @@ import { useTranslation } from '../../hooks/use-translation-wrapper';
22
22
 
23
23
  type OpenshiftSelectWithSearchProps = {
24
24
  versions: OpenshiftVersionOptionType[];
25
- getHelperText: HelperTextType;
25
+ getHelperText?: HelperTextType;
26
26
  setCustomOpenshiftSelect: Dispatch<SetStateAction<OpenshiftVersionOptionType | undefined>>;
27
27
  };
28
28
 
29
- export const OpenshiftSelectWithSearch: React.FunctionComponent<OpenshiftSelectWithSearchProps> = ({
29
+ export const OpenShiftSelectWithSearch: React.FunctionComponent<OpenshiftSelectWithSearchProps> = ({
30
30
  versions,
31
31
  getHelperText,
32
32
  setCustomOpenshiftSelect,
@@ -232,7 +232,7 @@ export const OpenshiftSelectWithSearch: React.FunctionComponent<OpenshiftSelectW
232
232
  </MenuToggle>
233
233
  );
234
234
 
235
- const helperText = getHelperText(selected, true);
235
+ const helperText = getHelperText && getHelperText(selected, true);
236
236
 
237
237
  return (
238
238
  <>
@@ -285,7 +285,7 @@ export const OpenshiftSelectWithSearch: React.FunctionComponent<OpenshiftSelectW
285
285
  <HelperText>
286
286
  <HelperTextItem variant="default">
287
287
  {helperText ??
288
- 'Select an Openshift version from the list or use the type ahead to narrow down the list.'}
288
+ 'Select an OpenShift version from the list or use the type ahead to narrow down the list.'}
289
289
  </HelperTextItem>
290
290
  </HelperText>
291
291
  </FormHelperText>
@@ -0,0 +1,9 @@
1
+ #form-input-openshiftVersion-field .pf-v5-c-dropdown__menu {
2
+ max-height: 22vh;
3
+ overflow: auto;
4
+ }
5
+
6
+ #form-input-openshiftVersion-field .pf-v5-c-dropdown__menu ul {
7
+ list-style: none;
8
+ padding-left: 0;
9
+ }
@@ -22,7 +22,7 @@ import { getFieldId } from './formik';
22
22
  import ExternalLink from './ExternalLink';
23
23
  import { OCP_RELEASES_PAGE } from '../../config';
24
24
  import { ClusterDetailsValues, ItemDropdown } from '../clusterWizard';
25
- import './OpenshiftVersionDropdown.css';
25
+ import './OpenShiftVersionDropdown.css';
26
26
 
27
27
  export type HelperTextType = (value: string | undefined, inModal?: boolean) => JSX.Element | null;
28
28
 
@@ -30,7 +30,7 @@ type OpenShiftVersionDropdownProps = {
30
30
  name: string;
31
31
  items: ItemDropdown;
32
32
  versions: OpenshiftVersionOptionType[];
33
- getHelperText: HelperTextType;
33
+ getHelperText?: HelperTextType;
34
34
  showReleasesLink: boolean;
35
35
  showOpenshiftVersionModal: () => void;
36
36
  customItems: ItemDropdown;
@@ -159,7 +159,7 @@ export const OpenShiftVersionDropdown = ({
159
159
  [setOpen, current, isDisabled],
160
160
  );
161
161
 
162
- const helperText = getHelperText(field.value);
162
+ const helperText = getHelperText && getHelperText(field.value);
163
163
 
164
164
  return (
165
165
  <FormGroup
@@ -1,23 +1,23 @@
1
1
  import React, { useState } from 'react';
2
2
  import { Button, ButtonVariant, FormGroup, Modal, ModalVariant } from '@patternfly/react-core';
3
- import './OpenshiftVersionModal.css';
4
- import { OpenshiftSelectWithSearch } from '../../../common/components/ui/OpenshiftSelectWithSearch';
5
- import { useOpenshiftVersionsContext } from '../clusterWizard/OpenshiftVersionsContext';
6
- import { HelperTextType } from '../../../common/components/ui/OpenShiftVersionDropdown';
3
+ import { OpenShiftSelectWithSearch } from './OpenShiftSelectWithSearch';
4
+ import { HelperTextType } from './OpenShiftVersionDropdown';
7
5
  import { useFormikContext } from 'formik';
8
- import { ClusterDetailsValues, OpenshiftVersionOptionType } from '../../../common';
6
+ import { ClusterDetailsValues, OpenshiftVersionOptionType } from '../..';
7
+ import './OpenShiftVersionModal.css';
9
8
 
10
9
  type OpenShiftVersionModalProps = {
10
+ allVersions: OpenshiftVersionOptionType[];
11
11
  setOpenshiftVersionModalOpen: (isOpen: boolean) => void;
12
- getHelperText: HelperTextType;
12
+ getHelperText?: HelperTextType;
13
13
  };
14
14
 
15
15
  export const OpenShiftVersionModal = ({
16
+ allVersions,
16
17
  setOpenshiftVersionModalOpen,
17
18
  getHelperText,
18
19
  }: OpenShiftVersionModalProps) => {
19
20
  const { setFieldValue } = useFormikContext<ClusterDetailsValues>();
20
- const { allVersions: versions } = useOpenshiftVersionsContext();
21
21
  const onClose = () => setOpenshiftVersionModalOpen(false);
22
22
  const [customOpenshiftSelect, setCustomOpenshiftSelect] = useState<OpenshiftVersionOptionType>(); // Cambiar el tipo según lo que esperes aquí
23
23
 
@@ -50,8 +50,8 @@ export const OpenShiftVersionModal = ({
50
50
  label={'OpenShift version'}
51
51
  isRequired
52
52
  >
53
- <OpenshiftSelectWithSearch
54
- versions={versions}
53
+ <OpenShiftSelectWithSearch
54
+ versions={allVersions}
55
55
  getHelperText={getHelperText}
56
56
  setCustomOpenshiftSelect={setCustomOpenshiftSelect}
57
57
  />
@@ -101,6 +101,7 @@ const RichInputField: React.FC<RichInputFieldPropsProps> = React.forwardRef(
101
101
  const fieldId = getFieldId(props.name, 'input', idPostfix);
102
102
  const isValid = !(touched && error?.length);
103
103
 
104
+ const errorMessage = isValid ? '' : error[0];
104
105
  return (
105
106
  <FormGroup
106
107
  id={`form-control__${fieldId}`}
@@ -163,14 +164,15 @@ const RichInputField: React.FC<RichInputFieldPropsProps> = React.forwardRef(
163
164
  </Popover>
164
165
  </InputGroupItem>
165
166
  </InputGroup>
166
- {helperText && (
167
+ {(errorMessage || helperText) && (
167
168
  <FormHelperText>
168
169
  <HelperText>
169
170
  <HelperTextItem
171
+ icon={errorMessage && <ExclamationCircleIcon />}
170
172
  variant={isValid ? 'default' : 'error'}
171
173
  id={isValid ? `${fieldId}-helper` : `${fieldId}-helper-error`}
172
174
  >
173
- {helperText}
175
+ {errorMessage ? errorMessage : helperText}
174
176
  </HelperTextItem>
175
177
  </HelperText>
176
178
  </FormHelperText>
@@ -12,6 +12,9 @@ export * from './PreviewBadge';
12
12
  export * from './TechnologyPreview';
13
13
  export * from './DeveloperPreview';
14
14
 
15
+ export * from './OpenShiftVersionDropdown';
16
+ export * from './OpenShiftVersionModal';
17
+
15
18
  export * from './utils';
16
19
 
17
20
  export { default as PopoverIcon } from './PopoverIcon';
@@ -24,7 +24,7 @@ import Day2HostStaticIpConfigurations from './Day2StaticIpHostConfigurations';
24
24
  import { mapClusterCpuArchToInfraEnvCpuArch } from '../../../services/CpuArchitectureService';
25
25
  import CpuArchitectureDropdown from '../../clusterConfiguration/CpuArchitectureDropdown';
26
26
  import { usePullSecret } from '../../../hooks';
27
- import { useOpenshiftVersionsContext } from '../../clusterWizard/OpenshiftVersionsContext';
27
+ import { useOpenShiftVersionsContext } from '../../clusterWizard/OpenShiftVersionsContext';
28
28
  import {
29
29
  Cluster,
30
30
  InfraEnv,
@@ -87,7 +87,7 @@ const Day2ClusterDetails = () => {
87
87
  const [initialValues, setInitialValues] = React.useState<Day2ClusterDetailValues | null>(null);
88
88
  const [isSubmitting, setSubmitting] = React.useState(false);
89
89
  const [isAlternativeCpuSelected, setIsAlternativeCpuSelected] = React.useState(false);
90
- const { getCpuArchitectures } = useOpenshiftVersionsContext();
90
+ const { getCpuArchitectures } = useOpenShiftVersionsContext();
91
91
  const cpuArchitecturesByVersionImage = getCpuArchitectures(day2Cluster.openshiftVersion);
92
92
  const day1CpuArchitecture = mapClusterCpuArchToInfraEnvCpuArch(day2Cluster.cpuArchitecture);
93
93
  const [errorState, setErrorState] = React.useState<Error | null>(null);
@@ -23,7 +23,7 @@ import {
23
23
  import useInfraEnv from '../../hooks/useInfraEnv';
24
24
  import { mapOcmArchToCpuArchitecture } from '../../services/CpuArchitectureService';
25
25
  import { Cluster } from '@openshift-assisted/types/assisted-installer-service';
26
- import { OpenshiftVersionsContextProvider } from '../clusterWizard/OpenshiftVersionsContext';
26
+ import { OpenShiftVersionsContextProvider } from '../clusterWizard/OpenShiftVersionsContext';
27
27
 
28
28
  export const HostsClusterDetailTabContent = ({
29
29
  cluster: ocmCluster,
@@ -156,7 +156,7 @@ export const HostsClusterDetailTabContent = ({
156
156
  ocpConsoleUrl={ocmCluster?.console?.url}
157
157
  canEdit={ocmCluster.canEdit}
158
158
  >
159
- <OpenshiftVersionsContextProvider>
159
+ <OpenShiftVersionsContextProvider>
160
160
  <NewFeatureSupportLevelProvider
161
161
  loadingUi={<LoadingState />}
162
162
  cluster={day2Cluster}
@@ -166,7 +166,7 @@ export const HostsClusterDetailTabContent = ({
166
166
  >
167
167
  <AddHosts />
168
168
  </NewFeatureSupportLevelProvider>
169
- </OpenshiftVersionsContextProvider>
169
+ </OpenShiftVersionsContextProvider>
170
170
  </AddHostsContextProvider>
171
171
  );
172
172
  };
@@ -16,7 +16,7 @@ import {
16
16
  import { OcmClusterType } from '../AddHosts';
17
17
  import HostsClusterDetailTab from './HostsClusterDetailTab';
18
18
  import clustersAPI from '../../../common/api/assisted-service/ClustersAPI';
19
- import { OpenshiftVersionsContextProvider } from '../clusterWizard/OpenshiftVersionsContext';
19
+ import { OpenShiftVersionsContextProvider } from '../clusterWizard/OpenShiftVersionsContext';
20
20
 
21
21
  const clusterWithoutMetrics = {
22
22
  id: 'ocm-cluster-id',
@@ -78,13 +78,13 @@ export const HostsClusterDetailTabMock = () => {
78
78
  return (
79
79
  <PageSection variant={PageSectionVariants.light} isFilled>
80
80
  {tabShown ? (
81
- <OpenshiftVersionsContextProvider>
81
+ <OpenShiftVersionsContextProvider>
82
82
  <HostsClusterDetailTab
83
83
  cluster={getCluster(tabShown)}
84
84
  allEnabledFeatures={STANDALONE_DEPLOYMENT_ENABLED_FEATURES}
85
85
  isVisible
86
86
  />
87
- </OpenshiftVersionsContextProvider>
87
+ </OpenShiftVersionsContextProvider>
88
88
  ) : (
89
89
  <Grid hasGutter>
90
90
  <ToolbarButton variant={ButtonVariant.primary} onClick={() => onAddHosts('no-metrics')}>
@@ -26,7 +26,7 @@ import CpuArchitectureDropdown from './CpuArchitectureDropdown';
26
26
  import { OcmBaseDomainField } from './OcmBaseDomainField';
27
27
  import OcmSNOControlGroup from './OcmSNOControlGroup';
28
28
  import useSupportLevelsAPI from '../../hooks/useSupportLevelsAPI';
29
- import { useOpenshiftVersionsContext } from '../clusterWizard/OpenshiftVersionsContext';
29
+ import { useOpenShiftVersionsContext } from '../clusterWizard/OpenShiftVersionsContext';
30
30
  import { ExternalPlatformDropdown } from './platformIntegration/ExternalPlatformDropdown';
31
31
  import { HostsNetworkConfigurationType } from '../../services/types';
32
32
  import { useNewFeatureSupportLevel } from '../../../common/components/newFeatureSupportLevels';
@@ -65,7 +65,7 @@ export const OcmClusterDetailsFormFields = ({
65
65
  const { t } = useTranslation();
66
66
  const isSingleClusterFeatureEnabled = useFeature('ASSISTED_INSTALLER_SINGLE_CLUSTER_FEATURE');
67
67
  const { openshiftVersion, platform } = values;
68
- const { getCpuArchitectures } = useOpenshiftVersionsContext();
68
+ const { getCpuArchitectures } = useOpenShiftVersionsContext();
69
69
  const cpuArchitecturesByVersionImage = getCpuArchitectures(openshiftVersion);
70
70
  const clusterWizardContext = useClusterWizardContext();
71
71
  const featureSupportLevelData = useSupportLevelsAPI(
@@ -23,7 +23,7 @@ const OcmOpenShiftVersion = ({
23
23
  }: OcmOpenShiftVersionProps) => {
24
24
  return (
25
25
  <StaticTextField name="openshiftVersion" label="OpenShift version" isRequired>
26
- Openshift{' '}
26
+ OpenShift{' '}
27
27
  {getOpenshiftVersionText({
28
28
  openshiftVersion,
29
29
  cpuArchitecture: clusterCpuArchitecture as ClusterCpuArchitecture,
@@ -1,12 +1,15 @@
1
1
  import React from 'react';
2
2
  import { useTranslation } from '../../../common/hooks/use-translation-wrapper';
3
- import { OpenshiftVersionOptionType, ClusterDetailsValues } from '../../../common';
3
+ import {
4
+ OpenshiftVersionOptionType,
5
+ ClusterDetailsValues,
6
+ OpenShiftVersionDropdown,
7
+ OpenShiftVersionModal,
8
+ } from '../../../common';
4
9
  import { isInOcm } from '../../../common/api';
5
- import { OpenShiftVersionDropdown } from '../../../common/components/ui/OpenShiftVersionDropdown';
6
- import { OpenShiftVersionModal } from './OpenShiftVersionModal';
7
10
  import { useFormikContext } from 'formik';
8
11
  import { getOpenshiftVersionHelperText } from './OpenshiftVersionHelperText';
9
- import { useOpenshiftVersionsContext } from '../clusterWizard/OpenshiftVersionsContext';
12
+ import { useOpenShiftVersionsContext } from '../clusterWizard/OpenShiftVersionsContext';
10
13
 
11
14
  type OcmOpenShiftVersionSelectProps = {
12
15
  versions: OpenshiftVersionOptionType[];
@@ -50,7 +53,7 @@ const OcmOpenShiftVersionSelect = ({ versions }: OcmOpenShiftVersionSelectProps)
50
53
  return [];
51
54
  }, [selectOptions, customOpenshiftSelect]);
52
55
 
53
- const { allVersions } = useOpenshiftVersionsContext();
56
+ const { allVersions } = useOpenShiftVersionsContext();
54
57
 
55
58
  const getHelperText = (value: string | undefined, inModal?: boolean) => {
56
59
  return getOpenshiftVersionHelperText(allVersions, value, t, inModal);
@@ -69,6 +72,7 @@ const OcmOpenShiftVersionSelect = ({ versions }: OcmOpenShiftVersionSelectProps)
69
72
  />
70
73
  {isOpenshiftVersionModalOpen && (
71
74
  <OpenShiftVersionModal
75
+ allVersions={allVersions}
72
76
  setOpenshiftVersionModalOpen={setIsOpenshiftVersionModalOpen}
73
77
  getHelperText={getHelperText}
74
78
  />
@@ -22,7 +22,7 @@ import {
22
22
  UiIcon,
23
23
  } from '../../../../common';
24
24
  import { useClusterWizardContext } from '../../clusterWizard/ClusterWizardContext';
25
- import { useOpenshiftVersionsContext } from '../../clusterWizard/OpenshiftVersionsContext';
25
+ import { useOpenShiftVersionsContext } from '../../clusterWizard/OpenShiftVersionsContext';
26
26
  import { wizardStepNames } from '../../clusterWizard/constants';
27
27
  import {
28
28
  ClusterWizardStepsType,
@@ -118,7 +118,7 @@ const getCheckIcon = (validationStatuses: string[]) => {
118
118
  const PreflightChecksDetailCollapsed = ({ cluster }: { cluster: Cluster }) => {
119
119
  const { t } = useTranslation();
120
120
  const featureSupportLevelData = useNewFeatureSupportLevel();
121
- const { isSupportedOpenShiftVersion } = useOpenshiftVersionsContext();
121
+ const { isSupportedOpenShiftVersion } = useOpenShiftVersionsContext();
122
122
 
123
123
  const { isFullySupported } = React.useMemo<SupportLevelMemo>(
124
124
  () => getSupportLevelInfo(cluster, featureSupportLevelData, isSupportedOpenShiftVersion, t),
@@ -28,7 +28,7 @@ import { NewFeatureSupportLevelProvider } from '../featureSupportLevels';
28
28
  import { usePullSecret } from '../../hooks';
29
29
  import { Cluster } from '@openshift-assisted/types/assisted-installer-service';
30
30
  import { useFeatureDetection } from '../../hooks/use-feature-detection';
31
- import { OpenshiftVersionsContextProvider } from '../clusterWizard/OpenshiftVersionsContext';
31
+ import { OpenShiftVersionsContextProvider } from '../clusterWizard/OpenShiftVersionsContext';
32
32
  import {
33
33
  unstable_HistoryRouter as HistoryRouter,
34
34
  HistoryRouterProps,
@@ -148,7 +148,7 @@ const AssistedInstallerDetailCard = ({
148
148
  return (
149
149
  <HistoryRouter history={history} basename={basename}>
150
150
  <AlertsContextProvider>
151
- <OpenshiftVersionsContextProvider>
151
+ <OpenShiftVersionsContextProvider>
152
152
  <SentryErrorMonitorContextProvider>
153
153
  <ModalDialogsContextProvider>
154
154
  <ClusterDefaultConfigurationProvider
@@ -171,7 +171,7 @@ const AssistedInstallerDetailCard = ({
171
171
  </ClusterDefaultConfigurationProvider>
172
172
  </ModalDialogsContextProvider>
173
173
  </SentryErrorMonitorContextProvider>
174
- </OpenshiftVersionsContextProvider>
174
+ </OpenShiftVersionsContextProvider>
175
175
  </AlertsContextProvider>
176
176
  </HistoryRouter>
177
177
  );
@@ -11,7 +11,7 @@ import useInfraEnv from '../../hooks/useInfraEnv';
11
11
  import { usePullSecret } from '../../hooks';
12
12
  import { selectCurrentClusterState } from '../../store/slices/current-cluster/selectors';
13
13
  import { useFeatureDetection } from '../../hooks/use-feature-detection';
14
- import { OpenshiftVersionsContextProvider } from '../clusterWizard/OpenshiftVersionsContext';
14
+ import { OpenShiftVersionsContextProvider } from '../clusterWizard/OpenShiftVersionsContext';
15
15
 
16
16
  type AssistedInstallerExtraDetailCardProps = {
17
17
  allEnabledFeatures: FeatureListType;
@@ -58,9 +58,9 @@ const Wrapper: React.FC<AssistedInstallerExtraDetailCardProps> = (props) => {
58
58
  return (
59
59
  <Provider store={storeDay1}>
60
60
  <AlertsContextProvider>
61
- <OpenshiftVersionsContextProvider>
61
+ <OpenShiftVersionsContextProvider>
62
62
  <AssistedInstallerExtraDetailCard {...props} />
63
- </OpenshiftVersionsContextProvider>
63
+ </OpenShiftVersionsContextProvider>
64
64
  </AlertsContextProvider>
65
65
  </Provider>
66
66
  );
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { UiIcon, getOpenshiftVersionText } from '../../../common';
3
- import { useOpenshiftVersionsContext } from '../clusterWizard/OpenshiftVersionsContext';
3
+ import { useOpenShiftVersionsContext } from '../clusterWizard/OpenShiftVersionsContext';
4
4
  import { ExclamationTriangleIcon } from '@patternfly/react-icons/dist/js/icons/exclamation-triangle-icon';
5
5
  import { Popover, Text, TextContent, TextVariants } from '@patternfly/react-core';
6
6
  import { useTranslation } from '../../../common/hooks/use-translation-wrapper';
@@ -28,7 +28,7 @@ const UnsupportedVersion = ({ version }: { version: string }) => {
28
28
 
29
29
  const OpenShiftVersionDetail = ({ cluster }: { cluster: Cluster }) => {
30
30
  const { openshiftVersion } = cluster;
31
- const { isSupportedOpenShiftVersion, latestVersions: versions } = useOpenshiftVersionsContext();
31
+ const { isSupportedOpenShiftVersion, latestVersions: versions } = useOpenShiftVersionsContext();
32
32
  const isSupported = isSupportedOpenShiftVersion(openshiftVersion);
33
33
 
34
34
  const version = React.useMemo(() => {