-
Notifications
You must be signed in to change notification settings - Fork 887
feat: add user groups column to users table #10284
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
Conversation
sm: (theme) => ({ | ||
width: theme.spacing(3), | ||
height: theme.spacing(3), | ||
fontSize: theme.spacing(1.5), | ||
fontWeight: 600, |
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.
Noticed that as the letters for the fallback avatars got smaller, they needed to be beefed up a little to still stand out against the background properly
import { useFilter } from "components/Filter/filter"; | ||
import { useDashboard } from "components/Dashboard/DashboardProvider"; | ||
import { useMutation, useQuery, useQueryClient } from "react-query"; | ||
import { type FC, type ReactNode, useState } from "react"; |
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.
Almost all the diffs for this file are me just moving things around to group them better, and renaming some variables for clarity. The major things to look for are any code involving groupsByUserIdQuery
user.roles.length === 0 | ||
? [fallbackRole] | ||
: sortRoles(user.roles); | ||
{users?.map((user) => ( |
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.
Not too much changed here, but because the indentation level changed, it might help to view this file with whitespace changes off
I loved the design changes. +1000 for the way you reduced the role spacing. I just have one minor thing. I would remove the "See details" below the group amount, and I would make the "1 Group" the trigger directly. It is the same idea that you used for the "+3 roles" in which you didn't add an extra link or element to display the popover. Makes sense? |
site/build/tsconfig.tsbuildinfo
Outdated
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.
Lol I had to do the same in other PRs 😆
return userIdMapper as GroupsByUserId; | ||
}, | ||
} satisfies UseQueryOptions<Group[], unknown, GroupsByUserId>; | ||
} |
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.
We use lodash so maybe it can be helpful to simplify some of these logic.
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.
Yeah, I've never used Lodash before, so to be honest, I keep forgetting that we have it, but I'll see if some of their utilities can help out
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.
Tried going through the documentation, but it didn't seem like Lodash has support for Map objects, and I didn't want to "downgrade" the type by turning it into a regular JS object (which would mean losing better memory usage, easy iteration, and easy size checking)
I did refactor the code to consolidate some loops, though
@@ -5,16 +5,23 @@ import { FC } from "react"; | |||
import { css, type Interpolation, type Theme } from "@emotion/react"; | |||
|
|||
export type AvatarProps = MuiAvatarProps & { | |||
size?: "sm" | "md" | "xl"; | |||
size?: "xs" | "sm" | "md" | "xl"; |
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.
Nice added!
const activateUserMutation = useMutation(activateUser(queryClient)); | ||
|
||
const [confirmDeleteUser, setConfirmDeleteUser] = useState<User>(); | ||
const [userToDelete, setUserToDelete] = useState<User>(); |
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.
Way better names 🙏
const updateRolesMutation = useMutation(updateRoles(queryClient)); | ||
|
||
// Indicates if oidc roles are synced from the oidc idp. | ||
// Assign 'false' if unknown. | ||
const oidcRoleSyncEnabled = |
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.
Is this used somewhere?
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.
Honestly, I'm not completely sure. I didn't change the code or the comment, and I didn't dig deep enough into some of the components to see where it was actually used
const closePopover = () => setAnchorEl(null); | ||
const openPopover = (event: PointerEvent<HTMLButtonElement>) => { | ||
setAnchorEl(event.currentTarget); | ||
}; |
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 merged the <Popover>
component so maybe it can be helpful here
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.
Nice work! I just left a few comments that are not blockers. About the golang errors, you just need to update your branch with main
👍
Closes #4566
Changes made
Screen.Recording.2023-10-18.at.4.32.52.PM.mov
Changes that were out of scope
Other notes