Skip to content

MGMT-20103: AMD_GPU operator should follor BE feature support level #2850

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React, { useState } from 'react';
import React from 'react';
import { FormGroup, HelperText, HelperTextItem, Tooltip } from '@patternfly/react-core';
import { getFieldId, PopoverIcon } from '../../../../common';
import { OcmCheckboxField } from '../../ui/OcmFormFields';
import { useNewFeatureSupportLevel } from '../../../../common/components/newFeatureSupportLevels';
import NewFeatureSupportLevelBadge from '../../../../common/components/newFeatureSupportLevels/NewFeatureSupportLevelBadge';
import { SupportLevel } from '@openshift-assisted/types/./assisted-installer-service';

Expand Down Expand Up @@ -40,28 +39,22 @@ const AmdGpuHelperText = () => {
);
};

const AmdGpuCheckbox = ({ disabledReason }: { disabledReason?: string }) => {
const AmdGpuCheckbox = ({
disabledReason,
supportLevel,
}: {
disabledReason?: string;
supportLevel?: SupportLevel | undefined;
}) => {
const fieldId = getFieldId(AMDGPU_FIELD_NAME, 'input');
const featureSupportLevel = useNewFeatureSupportLevel();
const [disabledReasonAmdGpu, setDisabledReason] = useState<string | undefined>();

React.useEffect(() => {
const reason = featureSupportLevel.getFeatureDisabledReason('AMD_GPU');
setDisabledReason(reason);
}, [featureSupportLevel]);

return (
<FormGroup isInline fieldId={fieldId}>
<OcmCheckboxField
name={AMDGPU_FIELD_NAME}
label={
<AmdGpuLabel
disabledReason={disabledReason ? disabledReason : disabledReasonAmdGpu}
supportLevel={featureSupportLevel.getFeatureSupportLevel('AMD_GPU')}
/>
}
label={<AmdGpuLabel disabledReason={disabledReason} supportLevel={supportLevel} />}
helperText={<AmdGpuHelperText />}
isDisabled={!!disabledReason || !!disabledReasonAmdGpu}
isDisabled={!!disabledReason}
/>
</FormGroup>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,6 @@ export const mapOperatorIdToFeatureId: { [key: string]: FeatureId } = {
[OPERATOR_NAME_PIPELINES]: 'PIPELINES',
[OPERATOR_NAME_SERVICEMESH]: 'SERVICEMESH',
[OPERATOR_NAME_NVIDIA_GPU]: 'NVIDIA_GPU',
[OPERATOR_NAME_AMD_GPU]: 'AMD_GPU',
[OPERATOR_NAME_KMM]: 'KMM',
};
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,11 @@ export const getNewFeatureDisabledReason = (
return `Service mesh is not available with the selected CPU architecture.`;
}
}
case 'AMD_GPU': {
if (!isSupported) {
return `AMD GPU is not available with the selected CPU architecture.`;
}
}
default: {
return undefined;
}
Expand Down
Loading