MCPcopy Create free account
hub / github.com/coder/coder / UsersPage

Function UsersPage

site/src/pages/UsersPage/UsersPage.tsx:32–302  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

30import { UsersPageView } from "./UsersPageView";
31
32const UsersPage: React.FC = () => {
33 const queryClient = useQueryClient();
34 const [searchParams, setSearchParams] = useSearchParams();
35 const { entitlements } = useDashboard();
36 const showAISeatColumn = shouldShowAISeatColumn(entitlements);
37
38 const groupsByUserIdQuery = useQuery(groupsByUserId());
39
40 const { permissions, user: me } = useAuthenticated();
41 const {
42 createUser: canCreateUser,
43 updateUsers: canEditUsers,
44 viewDeploymentConfig,
45 } = permissions;
46 const rolesQuery = useQuery(roles());
47 const { data: deploymentValues } = useQuery({
48 ...deploymentConfig(),
49 enabled: viewDeploymentConfig,
50 });
51
52 const usersQuery = usePaginatedQuery(paginatedUsers(searchParams));
53 const useFilterResult = useFilter({
54 searchParams,
55 onSearchParamsChange: setSearchParams,
56 onUpdate: usersQuery.goToFirstPage,
57 });
58
59 const statusMenu = useStatusFilterMenu({
60 value: useFilterResult.values.status,
61 onChange: (option) =>
62 useFilterResult.update({
63 ...useFilterResult.values,
64 status: option?.value,
65 }),
66 });
67
68 const [userToSuspend, setUserToSuspend] = useState<User | undefined>(
69 undefined,
70 );
71 const suspendUserMutation = useMutation(suspendUser(queryClient));
72
73 const [userToActivate, setUserToActivate] = useState<User | undefined>(
74 undefined,
75 );
76 const activateUserMutation = useMutation(activateUser(queryClient));
77
78 const [userToDelete, setUserToDelete] = useState<User | undefined>(undefined);
79 const deleteUserMutation = useMutation(deleteUser(queryClient));
80
81 const [userToEditRoles, setUserToEditRoles] = useState<User | undefined>(
82 undefined,
83 );
84 const updateUserRolesMutation = useMutation(updateRoles(queryClient));
85
86 const [confirmResetPassword, setConfirmResetPassword] = useState<{
87 user: User;
88 newPassword: string;
89 }>();

Callers

nothing calls this directly

Calls 15

useDashboardFunction · 0.90
shouldShowAISeatColumnFunction · 0.90
groupsByUserIdFunction · 0.90
useAuthenticatedFunction · 0.90
rolesFunction · 0.90
deploymentConfigFunction · 0.90
usePaginatedQueryFunction · 0.90
paginatedUsersFunction · 0.90
useFilterFunction · 0.90
useStatusFilterMenuFunction · 0.90
suspendUserFunction · 0.90
activateUserFunction · 0.90

Tested by

no test coverage detected