From 913030c3f5404beb1e5fed014780f229f70651c2 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Fri, 24 Apr 2026 13:45:11 +0000 Subject: [PATCH] feat(ui): migrate per_user_usage tremor table/tabs to shadcn; keep BarChart Co-authored-by: yuneng-jiang --- ui/litellm-dashboard/.eslintrc.json | 3 +- .../src/components/per_user_usage.tsx | 66 +++++++++---------- 2 files changed, 34 insertions(+), 35 deletions(-) diff --git a/ui/litellm-dashboard/.eslintrc.json b/ui/litellm-dashboard/.eslintrc.json index a8fb65b91b0..af3c2d39ba8 100644 --- a/ui/litellm-dashboard/.eslintrc.json +++ b/ui/litellm-dashboard/.eslintrc.json @@ -182,7 +182,8 @@ "src/components/EntityUsageExport/UsageExportHeader.tsx", "src/components/EntityUsageExport/ExportSummary.tsx", "src/components/UsagePage/components/EntityUsage/TopModelView.tsx", - "src/components/UsagePage/components/KeyModelUsageView.tsx" + "src/components/UsagePage/components/KeyModelUsageView.tsx", + "src/components/per_user_usage.tsx" ], "rules": { "litellm-ui/no-banned-ui-imports": "off", diff --git a/ui/litellm-dashboard/src/components/per_user_usage.tsx b/ui/litellm-dashboard/src/components/per_user_usage.tsx index 48f225256f5..624c2957f56 100644 --- a/ui/litellm-dashboard/src/components/per_user_usage.tsx +++ b/ui/litellm-dashboard/src/components/per_user_usage.tsx @@ -1,19 +1,19 @@ import React, { useCallback, useState, useEffect } from "react"; -// eslint-disable-next-line litellm-ui/no-banned-ui-imports +import { BarChart } from "@tremor/react"; import { Table, - TableHead, - TableRow, - TableHeaderCell, TableBody, TableCell, - BarChart, - Tab, - TabGroup, - TabList, - TabPanel, - TabPanels, -} from "@tremor/react"; + TableHead, + TableHeader, + TableRow, +} from "@/components/ui/table"; +import { + Tabs, + TabsContent, + TabsList, + TabsTrigger, +} from "@/components/ui/tabs"; import { Button } from "@/components/ui/button"; import { perUserAnalyticsCall } from "./networking"; @@ -99,27 +99,26 @@ const PerUserUsage: React.FC = ({ accessToken, selectedTags, Individual developer usage metrics

- - - User Details - Usage Distribution - + + + User Details + Usage Distribution + - - {/* Tab 1: Existing User Details Table */} - + {/* Tab 1: Existing User Details Table */} + - + - User ID - User Email - User Agent - Success Generations - Total Tokens - Failed Requests - Total Cost + User ID + User Email + User Agent + Success Generations + Total Tokens + Failed Requests + Total Cost - + {perUserData.results .slice(0, 10) @@ -184,10 +183,10 @@ const PerUserUsage: React.FC = ({ accessToken, selectedTags, )} - + - {/* Tab 2: Usage Distribution Histogram */} - + {/* Tab 2: Usage Distribution Histogram */} +

User Usage Distribution @@ -277,9 +276,8 @@ const PerUserUsage: React.FC = ({ accessToken, selectedTags, showLegend={true} stack={true} /> - - - + +

); };