-
Notifications
You must be signed in to change notification settings - Fork 357
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
upcoming: [M3-7613] - Grants and Permissions for Placement Groups #10257
Changes from 6 commits
7a4c300
d3d113d
8060b48
8ac092d
fcfb59e
eddd2d8
030bcd8
58d55b8
2a8c030
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@linode/manager": Upcoming Features | ||
--- | ||
|
||
Set up grants and permissions for Placement Groups ([#10257](https://github.com/linode/manager/pull/10257)) |
mjac0bs marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ import { RegionSelect } from 'src/components/RegionSelect/RegionSelect'; | |
import { Stack } from 'src/components/Stack'; | ||
import { TextField } from 'src/components/TextField'; | ||
import { Typography } from 'src/components/Typography'; | ||
import { getRestrictedResourceText } from 'src/features/Account/utils'; | ||
import { useFormValidateOnChange } from 'src/hooks/useFormValidateOnChange'; | ||
import { useCreatePlacementGroup } from 'src/queries/placementGroups'; | ||
import { useRegionsQuery } from 'src/queries/regions'; | ||
|
@@ -30,6 +31,7 @@ export const PlacementGroupsCreateDrawer = ( | |
) => { | ||
const { | ||
allPlacementGroups, | ||
disabledCreateButton, | ||
onClose, | ||
onPlacementGroupCreate, | ||
open, | ||
|
@@ -131,6 +133,17 @@ export const PlacementGroupsCreateDrawer = ( | |
open={open} | ||
title="Create Placement Group" | ||
> | ||
{disabledCreateButton && ( | ||
<Notice | ||
text={getRestrictedResourceText({ | ||
action: 'edit', | ||
resourceType: 'Placement Groups', | ||
})} | ||
important | ||
spacingTop={16} | ||
variant="error" | ||
/> | ||
)} | ||
<form onSubmit={handleSubmit}> | ||
<Stack spacing={1}> | ||
{generalError && <Notice text={generalError} variant="error" />} | ||
|
@@ -146,7 +159,7 @@ export const PlacementGroupsCreateDrawer = ( | |
autoFocus: true, | ||
}} | ||
aria-label="Label for the Placement Group" | ||
disabled={false} | ||
disabled={disabledCreateButton || false} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here - the naming convention could lead to confusion. How about renaming There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as the other comment. |
||
errorText={errors.label} | ||
label="Label" | ||
name="label" | ||
|
@@ -165,25 +178,30 @@ export const PlacementGroupsCreateDrawer = ( | |
handleRegionSelect(selection); | ||
}} | ||
currentCapability="Placement Group" | ||
disabled={Boolean(selectedRegionId)} | ||
disabled={Boolean(selectedRegionId) || disabledCreateButton} | ||
helperText="Only regions supporting Placement Groups are listed." | ||
regions={regions ?? []} | ||
selectedId={selectedRegionId ?? values.region} | ||
/> | ||
)} | ||
<PlacementGroupsAffinityTypeSelect | ||
disabledCreateButton={disabledCreateButton} | ||
error={errors.affinity_type} | ||
setFieldValue={setFieldValue} | ||
/> | ||
<PlacementGroupsAffinityEnforcementRadioGroup | ||
disabledCreateButton={disabledCreateButton} | ||
handleChange={handleChange} | ||
setFieldValue={setFieldValue} | ||
value={values.is_strict} | ||
/> | ||
<ActionsPanel | ||
primaryButtonProps={{ | ||
'data-testid': 'submit', | ||
disabled: isSubmitting || hasRegionReachedPGCapacity, | ||
disabled: | ||
isSubmitting || | ||
hasRegionReachedPGCapacity || | ||
disabledCreateButton, | ||
label: 'Create Placement Group', | ||
loading: isSubmitting, | ||
onClick: () => setHasFormBeenSubmitted(true), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should read
disabledBreadcrumbEditButton
for clarity since Landing header has other CTAsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call. The recent code push reflects this change.