-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat: add workspace sharing page #20931
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
base: main
Are you sure you want to change the base?
Conversation
| {...props} | ||
| > | ||
| <span className="absolute right-2 flex items-center justify-center"> | ||
| <span className="absolute right-2 top-1/2 -translate-y-1/2 flex items-center justify-center"> |
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.
Vertically center the checkmark when the select takes up more vertical space
| htmlProps: HTMLAttributes<HTMLLIElement>; | ||
| } | ||
|
|
||
| export const UserOrGroupOption = ({ |
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.
Extracted from UserOrGroupAutocomplete
|
Not really happy with UserOrGroupAutocomplete.tsx and I would really prefer to replace it then add yet another variation but I think that is better saved for a separate PR. Also, stories for WorkspaceSharingPageView coming in a separate PR. |
| <p className="flex flex-row gap-1 text-sm text-content-secondary font-medium m-0"> | ||
| Workspace sharing allows you to share workspaces with other users | ||
| and groups. | ||
| {/* TODO: ADD DOCS LINK HERE <Link href={docs("/admin/users/idp-sync")}>View docs</Link> */} |
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.
just fyi, the current url proposed by jiachen is docs("/user-guides/workspaces-shared") but I proposed some alternatives that I think are a bit better
I imagine that pr will probably be merged soon one way or another
https://github.com/coder/coder/pull/21214/changes#r2611975329
| const permissionsQuery = useQuery({ | ||
| ...checkAuthorization({ checks }), | ||
| }); | ||
| const permissions = permissionsQuery.data as WorkspacePermissions | undefined; |
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.
| const permissions = permissionsQuery.data as WorkspacePermissions | undefined; | |
| const permissions = permissionsQuery.data; |
casts bad 🙅
|
|
||
| const workspaceACLQuery = useQuery(workspaceACL(workspace.id)); | ||
| const checks = workspaceChecks(workspace); | ||
| const permissionsQuery = useQuery({ |
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.
| const permissionsQuery = useQuery({ | |
| const permissionsQuery = useQuery<WorkspacePermissions>({ |
I think narrowing the type here is gonna be less error prone
| displayError( | ||
| getErrorMessage(error, "Failed to add user to workspace"), | ||
| ); |
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.
I imagine it was already like this on the template sharing page, but I really dislike the ux of error toasts :\
| workspaceACL={workspaceACL} | ||
| isLoading={isAddingUser || isAddingGroup} | ||
| onSubmit={(value, role, resetAutocomplete) => | ||
| "members" in value |
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 feels typo prone 😬 but I see that this is yet another thing taken from the old page. dang.
| onAddUser: ( | ||
| user: WorkspaceUser | ({ role: WorkspaceRole } & User), | ||
| role: WorkspaceRole, | ||
| reset: () => void, | ||
| ) => void; |
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.
| onAddUser: ( | |
| user: WorkspaceUser | ({ role: WorkspaceRole } & User), | |
| role: WorkspaceRole, | |
| reset: () => void, | |
| ) => void; | |
| onAddUser: ( | |
| user: WorkspaceUser, | |
| role: WorkspaceRole, | |
| reset: () => void, | |
| ) => void; |
what are the odds this still just works if we make this type less obnoxious? 💀
Uh oh!
There was an error while loading. Please reload this page.