forked from phoenix/litellm-mirror
show users tab on user
This commit is contained in:
parent
e28120a7cc
commit
522f119c83
2 changed files with 5 additions and 7 deletions
|
@ -297,7 +297,7 @@ export const userInfoCall = async (
|
||||||
url = `${url}?user_id=${userID}`;
|
url = `${url}?user_id=${userID}`;
|
||||||
}
|
}
|
||||||
console.log("in userInfoCall viewAll=", viewAll);
|
console.log("in userInfoCall viewAll=", viewAll);
|
||||||
if (viewAll && page && page_size) {
|
if (viewAll && page_size && (page != null) && (page != undefined)) {
|
||||||
url = `${url}?view_all=true&page=${page}&page_size=${page_size}`;
|
url = `${url}?view_all=true&page=${page}&page_size=${page_size}`;
|
||||||
}
|
}
|
||||||
//message.info("Requesting user data");
|
//message.info("Requesting user data");
|
||||||
|
|
|
@ -45,7 +45,7 @@ const ViewUserDashboard: React.FC<ViewUserDashboardProps> = ({
|
||||||
}) => {
|
}) => {
|
||||||
const [userData, setUserData] = useState<null | any[]>(null);
|
const [userData, setUserData] = useState<null | any[]>(null);
|
||||||
const [endUsers, setEndUsers] = useState<null | any[]>(null);
|
const [endUsers, setEndUsers] = useState<null | any[]>(null);
|
||||||
const [currentPage, setCurrentPage] = useState(1);
|
const [currentPage, setCurrentPage] = useState(0);
|
||||||
const defaultPageSize = 25;
|
const defaultPageSize = 25;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -113,19 +113,17 @@ const ViewUserDashboard: React.FC<ViewUserDashboardProps> = ({
|
||||||
function renderPagination() {
|
function renderPagination() {
|
||||||
if (!userData) return null;
|
if (!userData) return null;
|
||||||
|
|
||||||
// const totalPages = Math.ceil(userData.length / defaultPageSize);
|
const totalPages = Math.ceil(userData.length / defaultPageSize);
|
||||||
const startItem = (currentPage - 1) * defaultPageSize + 1;
|
|
||||||
const endItem = Math.min(currentPage * defaultPageSize, userData.length);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex justify-between items-center">
|
<div className="flex justify-between items-center">
|
||||||
<div>
|
<div>
|
||||||
Showing {startItem} – {endItem} of {userData.length}
|
Showing Page {currentPage+1} of {totalPages}
|
||||||
</div>
|
</div>
|
||||||
<div className="flex">
|
<div className="flex">
|
||||||
<button
|
<button
|
||||||
className="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-l focus:outline-none"
|
className="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-l focus:outline-none"
|
||||||
disabled={currentPage === 1}
|
disabled={currentPage === 0}
|
||||||
onClick={() => setCurrentPage(currentPage - 1)}
|
onClick={() => setCurrentPage(currentPage - 1)}
|
||||||
>
|
>
|
||||||
← Prev
|
← Prev
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue