Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import {lightGreen, red, yellow} from '@mui/material/colors';
import AuditGroup from './pages/groups/Audit';
import AuditRole from './pages/roles/Audit';
import AuditUser from './pages/users/Audit';
import DiffUsers from './pages/users/DiffUsers';
import ExpiringGroups from './pages/groups/Expiring';
import ExpiringRoles from './pages/roles/Expiring';
import Home from './pages/Home';
Expand All @@ -53,6 +54,7 @@ import ReadUser from './pages/users/Read';
import {useCurrentUser} from './authentication';
import ReadRequest from './pages/requests/Read';
import ReadRoleRequest from './pages/role_requests/Read';

import * as Sentry from '@sentry/react';
const drawerWidth: number = 240;

Expand Down Expand Up @@ -243,6 +245,7 @@ function Dashboard({setThemeMode}: {setThemeMode: (theme: PaletteMode) => void})
<Route path="/users" element={<ListUsers />} />
<Route path="/users/:id" element={<ReadUser />} />
<Route path="/users/:id/audit" element={<AuditUser />} />
<Route path="/users/diff" element={<DiffUsers />} />
<Route path="/groups" element={<ListGroups />} />
<Route path="/groups/:id" element={<ReadGroup />} />
<Route path="/groups/:id/audit" element={<AuditGroup />} />
Expand Down
36 changes: 36 additions & 0 deletions src/api/apiComponents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1183,6 +1183,37 @@ export const useGetUsers = <TData = Schemas.UserPagination>(
});
};

export type GetAllUsersError = Fetcher.ErrorWrapper<{
status: ClientErrorStatus | ServerErrorStatus;
payload: Schemas.UserPagination;
}>;

export type GetAllUsersVariables = ApiContext['fetcherOptions'];

export const fetchGetAllUsers = (variables: GetAllUsersVariables, signal?: AbortSignal) =>
apiFetch<undefined, GetAllUsersError, undefined, {}, {}, {}>({
url: '/api/users',
method: 'get',
...variables,
signal,
});

export const useGetAllUsers = <TData = Schemas.UserPagination>(
variables: GetAllUsersVariables,
options?: Omit<
reactQuery.UseQueryOptions<undefined, GetAllUsersError, TData>,
'queryKey' | 'queryFn' | 'initialData'
>,
) => {
const {fetcherOptions, queryOptions, queryKeyFn} = useApiContext(options);
return reactQuery.useQuery<undefined, GetAllUsersError, TData>({
queryKey: queryKeyFn({path: '/api/users', operationId: 'getAllUsers', variables}),
queryFn: ({signal}) => fetchGetAllUsers({...fetcherOptions, ...variables}, signal),
...options,
...queryOptions,
});
};

export type GetUserByIdPathParams = {
userId: string;
};
Expand Down Expand Up @@ -1310,4 +1341,9 @@ export type QueryOperation =
path: '/api/users/{userId}';
operationId: 'getUserById';
variables: GetUserByIdVariables;
}
| {
path: '/api/users';
operationId: 'getAllUsers';
variables: GetAllUsersVariables;
};
3 changes: 3 additions & 0 deletions src/components/NavItems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ export default function NavItems(props: NavItemsProps) {
<ListItemLink to="/expiring-roles" displayText="All" displayIcon={<ExpiringAll />} sx={{pl: 4}} />
</List>
</Collapse>
<Divider />

<ListItemLink to="/users/diff" displayText="Diff Users" displayIcon={<GroupIcon />} />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I lean towards having this be linked from the users page as opposed to being in the navbar.

That said, all the other items in the nav bar have unique icons. If this stays here as opposed to being moved, probably change the icon to be consistent with everything else

</List>
);
}
Loading