-
Notifications
You must be signed in to change notification settings - Fork 878
feat: enable editing of IDP sync configuration for groups and roles in the UI #16098
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
Changes from 1 commit
96b0c09
a88b72f
cb00c73
4b15a2a
0befeca
f8349de
7124c11
30c8a9c
a7c954b
c09a3f3
8714f5e
b558f35
aa0e53c
7635856
91ca380
328ce2f
52d563c
b1d7649
b3812f1
d19a0dc
43159ff
528f2d8
d283fa1
ad2fc45
c99e009
31cd599
2354883
3c63c8c
623a50e
5779c8d
395fdc8
79ce400
854684a
50c12db
16665e2
3dbcee3
9b709ae
bee5783
d3b64b2
0362c16
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -104,6 +104,7 @@ export const IdpOrgSyncPageView: FC<IdpSyncPageViewProps> = ({ | |
const SYNC_FIELD_ID = "sync-field"; | ||
const ORGANIZATION_ASSIGN_DEFAULT_ID = "organization-assign-default"; | ||
const IDP_ORGANIZATION_NAME_ID = "idp-organization-name"; | ||
const CODER_ORG_ID = "coder-org"; | ||
|
||
return ( | ||
<div className="flex flex-col gap-2"> | ||
|
@@ -183,10 +184,13 @@ export const IdpOrgSyncPageView: FC<IdpSyncPageViewProps> = ({ | |
/> | ||
</div> | ||
<div className="grid items-center gap-1 flex-1"> | ||
<Label className="text-sm" htmlFor=":r1d:"> | ||
<Label className="text-sm" htmlFor={CODER_ORG_ID}> | ||
Coder organization | ||
</Label> | ||
<MultiSelectCombobox | ||
inputProps={{ | ||
id: CODER_ORG_ID, | ||
}} | ||
className="min-w-60 max-w-3xl" | ||
value={coderOrgs} | ||
onChange={setCoderOrgs} | ||
|
@@ -204,9 +208,8 @@ export const IdpOrgSyncPageView: FC<IdpSyncPageViewProps> = ({ | |
/> | ||
</div> | ||
<div className="grid grid-rows-[28px_auto]"> | ||
| ||
<div /> | ||
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. This is an improvement for screen readers, but I'm still not sure why the alignment couldn't be set up with pure CSS? 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. I am definitely not an expert with css grid as I usually use flexbox but I wanted to try to make this work with a grid. I thought something needs to exist in each cell of the grid for it to display correctly. Is there something better to use than a div or a nbsp? 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. Now that I'm writing this out, I'm realizng that I've never used this grid property before, but I would imagine that If that doesn't work with grid, it should definitely work with flexbox. Either way, the approach I've been thinking about is having the element be aligned to the end bound of the cross-axis 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. I went through every combination of align-items and align-self on the row and each cell and none of these resolved the alignment issue. |
||
<Button | ||
className="mb-px" | ||
type="submit" | ||
disabled={!idpOrgName || coderOrgs.length === 0} | ||
onClick={async () => { | ||
|
@@ -233,7 +236,7 @@ export const IdpOrgSyncPageView: FC<IdpSyncPageViewProps> = ({ | |
<IdpMappingTable isEmpty={organizationMappingCount === 0}> | ||
{form.values.mapping && | ||
Object.entries(form.values.mapping) | ||
.sort() | ||
.sort(([a], [b]) => a.toLowerCase().localeCompare(b.toLowerCase())) | ||
.map(([idpOrg, organizations]) => ( | ||
<OrganizationRow | ||
key={idpOrg} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -96,6 +96,7 @@ export const IdpGroupSyncForm = ({ | |
const REGEX_FILTER_ID = "regex-filter"; | ||
const AUTO_CREATE_MISSING_GROUPS_ID = "auto-create-missing-groups"; | ||
const IDP_GROUP_NAME_ID = "idp-group-name"; | ||
const CODER_GROUP_ID = "coder-group"; | ||
|
||
return ( | ||
<form onSubmit={form.handleSubmit}> | ||
|
@@ -116,7 +117,7 @@ export const IdpGroupSyncForm = ({ | |
<Label className="text-sm" htmlFor={SYNC_FIELD_ID}> | ||
Group sync field | ||
</Label> | ||
<Label className="text-sm" htmlFor={SYNC_FIELD_ID}> | ||
<Label className="text-sm" htmlFor={REGEX_FILTER_ID}> | ||
Regex filter | ||
</Label> | ||
<Input | ||
|
@@ -188,10 +189,13 @@ export const IdpGroupSyncForm = ({ | |
/> | ||
</div> | ||
<div className="grid items-center gap-1 flex-1"> | ||
<Label className="text-sm" htmlFor=":r1d:"> | ||
<Label className="text-sm" htmlFor={CODER_GROUP_ID}> | ||
Coder group | ||
</Label> | ||
<MultiSelectCombobox | ||
inputProps={{ | ||
id: CODER_GROUP_ID, | ||
}} | ||
className="min-w-60 max-w-3xl" | ||
value={coderGroups} | ||
onChange={setCoderGroups} | ||
|
@@ -209,9 +213,8 @@ export const IdpGroupSyncForm = ({ | |
/> | ||
</div> | ||
<div className="grid grid-rows-[28px_auto]"> | ||
| ||
<div /> | ||
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. Flagging this empty div, too – not sure why this couldn't be CSS |
||
<Button | ||
className="mb-px" | ||
type="submit" | ||
disabled={!idpGroupName || coderGroups.length === 0} | ||
onClick={async () => { | ||
jaaydenh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
@@ -240,7 +243,7 @@ export const IdpGroupSyncForm = ({ | |
<IdpMappingTable type="Group" rowCount={groupMappingCount}> | ||
{groupSyncSettings?.mapping && | ||
Object.entries(groupSyncSettings.mapping) | ||
.sort() | ||
.sort(([a], [b]) => a.toLowerCase().localeCompare(b.toLowerCase())) | ||
.map(([idpGroup, groups]) => ( | ||
<GroupRow | ||
key={idpGroup} | ||
|
@@ -256,10 +259,10 @@ export const IdpGroupSyncForm = ({ | |
<LegacyGroupSyncHeader /> | ||
<IdpMappingTable type="Group" rowCount={legacyGroupMappingCount}> | ||
{Object.entries(groupSyncSettings.legacy_group_name_mapping) | ||
.sort() | ||
.sort(([a], [b]) => a.toLowerCase().localeCompare(b.toLowerCase())) | ||
.map(([idpGroup, groupId]) => ( | ||
<GroupRow | ||
key={idpGroup} | ||
key={groupId} | ||
idpGroup={idpGroup} | ||
coderGroup={getGroupNames([groupId])} | ||
onDelete={handleDelete} | ||
|
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.
What is this effect call trying to sync? I would think that you would normally be able to pass the ID down to the base element directly via props
With this current setup, React's reconciler might get out of sync with the DOM:
I don't see anything complicated enough that would require this kind of risk, and I would hope the component primitive would let you bind the ID to the element directly in the render step
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.
moved this logic outside of the useEffect