Skip to content

Commit 50540d4

Browse files
authored
If some operators are not supported, we don't select automatically (#2820)
1 parent 607ad91 commit 50540d4

File tree

4 files changed

+17
-7
lines changed

4 files changed

+17
-7
lines changed

Diff for: libs/ui-lib/lib/ocm/components/clusterConfiguration/operators/CnvCheckbox.tsx

+5-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { OcmCheckboxField } from '../../ui/OcmFormFields';
1313
import NewFeatureSupportLevelBadge from '../../../../common/components/newFeatureSupportLevels/NewFeatureSupportLevelBadge';
1414
import { SupportLevel } from '@openshift-assisted/types/assisted-installer-service';
1515
import { useFormikContext } from 'formik';
16+
import { useNewFeatureSupportLevel } from '../../../../common/components/newFeatureSupportLevels';
1617

1718
const CNV_FIELD_NAME = 'useContainerNativeVirtualization';
1819

@@ -73,11 +74,13 @@ const CnvCheckbox = ({
7374
disabledReason?: string;
7475
supportLevel?: SupportLevel | undefined;
7576
}) => {
77+
const featureSupportLevelData = useNewFeatureSupportLevel();
7678
const { setFieldValue } = useFormikContext<OperatorsValues>();
7779
const fieldId = getFieldId(CNV_FIELD_NAME, 'input');
7880
const selectOperatorsNeeded = (checked: boolean) => {
79-
setFieldValue('useLso', checked);
80-
setFieldValue('useMigrationToolkitforVirtualization', checked);
81+
if (featureSupportLevelData.isFeatureSupported('LSO')) setFieldValue('useLso', checked);
82+
if (featureSupportLevelData.isFeatureSupported('MTV'))
83+
setFieldValue('useMigrationToolkitforVirtualization', checked);
8184
};
8285
return (
8386
<FormGroup isInline fieldId={fieldId}>

Diff for: libs/ui-lib/lib/ocm/components/clusterConfiguration/operators/MtvOperatorCheckbox.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { useFormikContext } from 'formik';
1313
import MtvRequirements from './MtvRequirements';
1414
import { SupportLevel } from '@openshift-assisted/types/./assisted-installer-service';
1515
import NewFeatureSupportLevelBadge from '../../../../common/components/newFeatureSupportLevels/NewFeatureSupportLevelBadge';
16+
import { useNewFeatureSupportLevel } from '../../../../common/components/newFeatureSupportLevels';
1617

1718
const Mtv_FIELD_NAME = 'useMigrationToolkitforVirtualization';
1819

@@ -64,9 +65,11 @@ const MtvCheckbox = ({
6465
}) => {
6566
const { setFieldValue } = useFormikContext<OperatorsValues>();
6667
const fieldId = getFieldId(Mtv_FIELD_NAME, 'input');
68+
const featureSupportLevelData = useNewFeatureSupportLevel();
6769

6870
const selectCNVOperator = (checked: boolean) => {
69-
setFieldValue('useContainerNativeVirtualization', checked);
71+
if (featureSupportLevelData.isFeatureSupported('CNV'))
72+
setFieldValue('useContainerNativeVirtualization', checked);
7073
};
7174

7275
return (

Diff for: libs/ui-lib/lib/ocm/components/clusterConfiguration/operators/OdfCheckbox.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { OcmCheckboxField } from '../../ui/OcmFormFields';
1212
import NewFeatureSupportLevelBadge from '../../../../common/components/newFeatureSupportLevels/NewFeatureSupportLevelBadge';
1313
import { SupportLevel } from '@openshift-assisted/types/./assisted-installer-service';
1414
import { useFormikContext } from 'formik';
15+
import { useNewFeatureSupportLevel } from '../../../../common/components/newFeatureSupportLevels';
1516

1617
const ODF_FIELD_NAME = 'useOpenShiftDataFoundation';
1718

@@ -60,9 +61,10 @@ const OdfCheckbox = ({
6061
supportLevel?: SupportLevel | undefined;
6162
}) => {
6263
const { setFieldValue } = useFormikContext<OperatorsValues>();
64+
const featureSupportLevelData = useNewFeatureSupportLevel();
6365
const fieldId = getFieldId(ODF_FIELD_NAME, 'input');
6466
const selectLsoOperator = (checked: boolean) => {
65-
setFieldValue('useLso', checked);
67+
if (featureSupportLevelData.isFeatureSupported('LSO')) setFieldValue('useLso', checked);
6668
};
6769
return (
6870
<FormGroup isInline fieldId={fieldId}>

Diff for: libs/ui-lib/lib/ocm/components/clusterWizard/OperatorsStep.tsx

+5-3
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ export const OperatorsStep = (props: ClusterOperatorProps) => {
164164
const fieldId = mapOperatorsToFieldIds[op]; // Obtener el ID del campo correspondiente
165165
setFieldValue(fieldId, checked);
166166
if (op === OPERATOR_NAME_CNV || op === OPERATOR_NAME_ODF) {
167-
setFieldValue('useLso', checked);
167+
if (featureSupportLevelData.isFeatureSupported('LSO')) setFieldValue('useLso', checked);
168168
}
169169
}
170170
});
@@ -176,7 +176,7 @@ export const OperatorsStep = (props: ClusterOperatorProps) => {
176176
const fieldId = mapOperatorsToFieldIds[op]; // Obtener el ID del campo correspondiente
177177
setFieldValue(fieldId, checked);
178178
if (op === OPERATOR_NAME_CNV || op === OPERATOR_NAME_ODF) {
179-
setFieldValue('useLso', checked);
179+
if (featureSupportLevelData.isFeatureSupported('LSO')) setFieldValue('useLso', checked);
180180
}
181181
});
182182
}
@@ -235,7 +235,9 @@ export const OperatorsStep = (props: ClusterOperatorProps) => {
235235
disabledReason = getCnvIncompatibleWithLvmReason(values, lvmSupport);
236236
}
237237
if (!disabledReason) {
238-
disabledReason = getCnvDisabledWithMtvReason(values);
238+
if (featureSupportLevelData.isFeatureSupported('MTV')) {
239+
disabledReason = getCnvDisabledWithMtvReason(values);
240+
}
239241
}
240242
}
241243
if (operatorKey === 'lvm') {

0 commit comments

Comments
 (0)