diff --git a/libs/ui-lib/lib/cim/components/ClusterDeployment/ClusterDetailsFormFields.tsx b/libs/ui-lib/lib/cim/components/ClusterDeployment/ClusterDetailsFormFields.tsx index b61477656f..dca6305b4e 100644 --- a/libs/ui-lib/lib/cim/components/ClusterDeployment/ClusterDetailsFormFields.tsx +++ b/libs/ui-lib/lib/cim/components/ClusterDeployment/ClusterDetailsFormFields.tsx @@ -110,12 +110,7 @@ export const ClusterDetailsFormFields: React.FC = }} /> )} - + {!isNutanix && ( )} diff --git a/libs/ui-lib/lib/common/components/clusterConfiguration/ControlPlaneNodesDropdown.tsx b/libs/ui-lib/lib/common/components/clusterConfiguration/ControlPlaneNodesDropdown.tsx index 721f73a214..8184ff068c 100644 --- a/libs/ui-lib/lib/common/components/clusterConfiguration/ControlPlaneNodesDropdown.tsx +++ b/libs/ui-lib/lib/common/components/clusterConfiguration/ControlPlaneNodesDropdown.tsx @@ -1,61 +1,31 @@ import * as React from 'react'; -import { Dropdown, DropdownItem, DropdownToggle, FormGroup, Tooltip } from '@patternfly/react-core'; +import { Dropdown, DropdownItem, DropdownToggle } from '@patternfly/react-core/deprecated'; +import { FormGroup, Tooltip } from '@patternfly/react-core'; import { useTranslation } from '../../hooks/use-translation-wrapper'; import { getFieldId, StaticField } from '../..'; import { useField } from 'formik'; import toNumber from 'lodash-es/toNumber'; -import { TFunction } from 'react-i18next'; interface ControlPlaneNodesOption { value: number; label: string; } -const isDropdownItemEnabled = ( - controlPlaneNodeCount: number, - isNutanix?: boolean, - openshiftVersion?: string, - cpuArch?: string, -): boolean => { - if (controlPlaneNodeCount === 4 || controlPlaneNodeCount === 5) { - return parseFloat(openshiftVersion || '') >= 4.18 && cpuArch === 'x86_64'; - } else if (controlPlaneNodeCount === 1) { - return !isNutanix; - } - return true; +const isDropdownItemEnabled = (controlPlaneNodeCount: number, isNutanix?: boolean): boolean => { + return (controlPlaneNodeCount === 1 && !isNutanix) || controlPlaneNodeCount !== 1; }; -const getDisabledReason = ( - controlPlaneNodeCount: number, - t: TFunction, -): string => { - if (controlPlaneNodeCount === 4 || controlPlaneNodeCount === 5) { - return t( - 'ai:This option is not available with the current configurations. Make sure that OpenShift version is 4.18 or newer and CPU architecture is x86_64. ', - ); - } else if (controlPlaneNodeCount === 1) { - return t('ai:This option is not available for Nutanix platform'); - } else { - return ''; - } -}; - -interface ControlPlaneNodesDropdownProps { - isDisabled?: boolean; - isNutanix?: boolean; - cpuArchitecture?: string; - openshiftVersion?: string; -} - const ControlPlaneNodesDropdown = ({ isDisabled = false, isNutanix, - cpuArchitecture, - openshiftVersion, -}: ControlPlaneNodesDropdownProps) => { +}: { + isDisabled?: boolean; + isNutanix?: boolean; +}) => { const { t } = useTranslation(); - const [{ name, value }, , { setValue }] = useField('controlPlaneAgents'); - const [current, setCurrent] = React.useState(3); + const [{ name, value: selectedValue }, , { setValue }] = useField( + 'controlPlaneAgents', + ); const options: ControlPlaneNodesOption[] = [ { value: 1, label: t('ai:1 (Single Node OpenShift - not highly available cluster)') }, @@ -65,19 +35,15 @@ const ControlPlaneNodesDropdown = ({ ]; const dropdownItems = options.map(({ value, label }) => { - const isItemEnabled = isDropdownItemEnabled( - value, - isNutanix, - openshiftVersion, - cpuArchitecture, - ); - const disabledReason = getDisabledReason(value, t); + const isItemEnabled = isDropdownItemEnabled(value, isNutanix); + const disabledReason = t('ai:This option is not available for Nutanix platform'); return (