Show 'user_email' on key table on UI (#8887)

* refactor(internal_user_endpoints.py): refactor `/user/list` to accept 'user_ids' and use prisma for db calls

enables bulk search from UI

* fix(internal_user_endpoints.py): fix linting errors

* fix(all_keys_table.tsx): show user email on create key table

make it easier for admin to know which key is associated to which user

* docs(internal_user_endpoints.py): improve docstring

* fix: sync schema with main

* fix(columns.tsx): display SSO ID on Internal User Table

make it easy to identify what the SSO ID for a user is

* fix(columns.tsx): add tooltip to header

help user understand what SSO ID means

* style: add more tooltips in the management flows

make it easier to understand what you're seeing

* style(all_keys_table.tsx): replace 'Not Set' with '-'

reduces words on table

* fix(internal_user_endpoints.py): fix user ids check

* test: fix test

* fix(internal_user_endpoints.py): maintain returning key count in `/user/list`
This commit is contained in:
Krish Dholakia 2025-02-27 21:56:14 -08:00 committed by GitHub
parent 475c1d0f99
commit bd2b6bdeb3
8 changed files with 199 additions and 67 deletions

View file

@ -651,6 +651,66 @@ export const teamDeleteCall = async (accessToken: String, teamID: String) => {
}
};
export const userListCall = async (
accessToken: String,
userIDs: string[] | null = null,
page: number | null = null,
page_size: number | null = null,
) => {
/**
* Get all available teams on proxy
*/
try {
let url = proxyBaseUrl ? `${proxyBaseUrl}/user/list` : `/user/list`;
console.log("in userListCall");
const queryParams = new URLSearchParams();
if (userIDs && userIDs.length > 0) {
// Convert array to comma-separated string
const userIDsString = userIDs.join(',');
queryParams.append('user_ids', userIDsString);
}
if (page) {
queryParams.append('page', page.toString());
}
if (page_size) {
queryParams.append('page_size', page_size.toString());
}
const queryString = queryParams.toString();
if (queryString) {
url += `?${queryString}`;
}
const response = await fetch(url, {
method: "GET",
headers: {
[globalLitellmHeaderName]: `Bearer ${accessToken}`,
"Content-Type": "application/json",
},
});
if (!response.ok) {
const errorData = await response.text();
handleError(errorData);
throw new Error("Network response was not ok");
}
const data = await response.json();
console.log("/user/list API Response:", data);
return data;
// Handle success - you might want to update some state or UI based on the created key
} catch (error) {
console.error("Failed to create key:", error);
throw error;
}
};
export const userInfoCall = async (
accessToken: String,
userID: String | null,