forked from openshift-assisted/assisted-installer-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAmdGpuCheckbox.tsx
63 lines (57 loc) · 1.78 KB
/
AmdGpuCheckbox.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import React from 'react';
import { FormGroup, HelperText, HelperTextItem, Tooltip } from '@patternfly/react-core';
import { getFieldId, PopoverIcon } from '../../../../common';
import { OcmCheckboxField } from '../../ui/OcmFormFields';
import NewFeatureSupportLevelBadge from '../../../../common/components/newFeatureSupportLevels/NewFeatureSupportLevelBadge';
import { SupportLevel } from '@openshift-assisted/types/./assisted-installer-service';
const AMDGPU_FIELD_NAME = 'useAmdGpu';
const AmdGpuLabel = ({
disabledReason,
supportLevel,
}: {
disabledReason?: string;
supportLevel?: SupportLevel;
}) => {
return (
<>
<Tooltip hidden={!disabledReason} content={disabledReason}>
<span>Install AMD GPU </span>
</Tooltip>
<PopoverIcon
id={AMDGPU_FIELD_NAME}
component={'a'}
bodyContent={'Requires at least one supported AMD GPU'}
/>
<NewFeatureSupportLevelBadge featureId="AMD_GPU" supportLevel={supportLevel} />
</>
);
};
const AmdGpuHelperText = () => {
return (
<HelperText>
<HelperTextItem variant="indeterminate">
Automate the management of AMD software components needed to provision and monitor GPUs.{' '}
</HelperTextItem>
</HelperText>
);
};
const AmdGpuCheckbox = ({
disabledReason,
supportLevel,
}: {
disabledReason?: string;
supportLevel?: SupportLevel | undefined;
}) => {
const fieldId = getFieldId(AMDGPU_FIELD_NAME, 'input');
return (
<FormGroup isInline fieldId={fieldId}>
<OcmCheckboxField
name={AMDGPU_FIELD_NAME}
label={<AmdGpuLabel disabledReason={disabledReason} supportLevel={supportLevel} />}
helperText={<AmdGpuHelperText />}
isDisabled={!!disabledReason}
/>
</FormGroup>
);
};
export default AmdGpuCheckbox;