-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PlacementGroupsAffinityEnforcementRadioGroup
- Loading branch information
1 parent
ac59492
commit 210fa42
Showing
3 changed files
with
71 additions
and
48 deletions.
There are no files selected for viewing
65 changes: 65 additions & 0 deletions
65
...ges/manager/src/features/PlacementGroups/PlacementGroupsAffinityEnforcementRadioGroup.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import * as React from 'react'; | ||
|
||
import { Box } from 'src/components/Box'; | ||
import { FormControlLabel } from 'src/components/FormControlLabel'; | ||
import { FormLabel } from 'src/components/FormLabel'; | ||
import { Notice } from 'src/components/Notice/Notice'; | ||
import { Radio } from 'src/components/Radio/Radio'; | ||
import { RadioGroup } from 'src/components/RadioGroup'; | ||
import { Typography } from 'src/components/Typography'; | ||
|
||
import type { FormikHelpers } from 'formik'; | ||
|
||
interface Props { | ||
handleChange: (e: React.ChangeEvent<HTMLInputElement>) => void; | ||
setFieldValue: FormikHelpers<any>['setFieldValue']; | ||
value: boolean; | ||
} | ||
|
||
export const PlacementGroupsAffinityEnforcementRadioGroup = (props: Props) => { | ||
const { handleChange, setFieldValue, value } = props; | ||
return ( | ||
<Box sx={{ pt: 2 }}> | ||
<Notice | ||
text="Once you create a placement group, you cannot change its Affinity Enforcement setting." | ||
variant="warning" | ||
/> | ||
<FormLabel htmlFor="affinity-enforcement-radio-group"> | ||
Affinity Enforcement | ||
</FormLabel> | ||
<RadioGroup | ||
onChange={(event) => { | ||
handleChange(event); | ||
setFieldValue('is_strict', event.target.value === 'true'); | ||
}} | ||
id="affinity-enforcement-radio-group" | ||
name="is_strict" | ||
value={value} | ||
> | ||
<FormControlLabel | ||
label={ | ||
<Typography> | ||
<strong>Strict.</strong> You cannot assign a Linode to your | ||
placement group if it will violate the policy of your selected | ||
Affinity Type (best practice). | ||
</Typography> | ||
} | ||
control={<Radio />} | ||
value={true} | ||
/> | ||
<FormControlLabel | ||
label={ | ||
<Typography> | ||
<strong>Flexible.</strong> You can assign a Linode to your | ||
placement group, even if it violates the policy of your selected | ||
Affinity Type. | ||
</Typography> | ||
} | ||
control={<Radio />} | ||
sx={{ mt: 2 }} | ||
value={false} | ||
/> | ||
</RadioGroup> | ||
</Box> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters