refactor(ui): migrate cost-tracking and users to shadcn - #34605
refactor(ui): migrate cost-tracking and users to shadcn#34605yuneng-berri wants to merge 2 commits into
Conversation
…dcn migration Covers the boolean switch and the teams editor through the save payload, so the behaviour is pinned by assertions that pass against the current antd/Tremor component and are library-agnostic.
Replaces antd and Tremor markup in the four route-exclusive components with installed shadcn primitives from @/components/ui plus token utilities. Markup only; no data flow, request or props contract changes. The route tests were not touched by this commit and stay green, which is what makes them evidence: they were written against the antd/Tremor markup.
Greptile SummaryMigrates the Cost Tracking and Internal Users interfaces from Ant Design and Tremor components to local shadcn/Base UI primitives.
Confidence Score: 5/5The PR appears safe to merge, with no concrete changed-code regression identified. The migrated controls use supported local component APIs, preserve the existing settings and export flows, and the added tests exercise the newly migrated boolean and team-editing interactions.
|
| Filename | Overview |
|---|---|
| ui/litellm-dashboard/src/app/(dashboard)/users/_components/DefaultUserSettings.tsx | Migrates settings controls to local UI primitives while retaining the existing data-fetching and save-payload flow. |
| ui/litellm-dashboard/src/app/(dashboard)/users/_components/DefaultUserSettings.test.tsx | Adds focused coverage for boolean toggling and adding or removing teams without weakening existing assertions. |
| ui/litellm-dashboard/src/app/(dashboard)/users/_components/view_users.tsx | Replaces Tremor tabs and Ant Design controls with compatible local primitives without changing the existing tab lifecycle behavior. |
| ui/litellm-dashboard/src/app/(dashboard)/cost-tracking/_components/how_it_works.tsx | Replaces Tremor typography and inputs with semantic markup and standard controlled inputs while preserving calculation behavior. |
| ui/litellm-dashboard/src/app/(dashboard)/cost-tracking/_components/pricing_calculator/multi_export_dropdown.tsx | Migrates the export button and icons while preserving the existing menu and export handlers. |
| ui/litellm-dashboard/eslint-suppressions.json | Removes restricted-import suppressions made obsolete by the component migration. |
Reviews (1): Last reviewed commit: "refactor(ui): migrate cost-tracking and ..." | Re-trigger Greptile
|
Ran the full runbook against a local proxy (:4000 with Postgres) and dashboard dev server (:3000) as admin, plus the scoped frontend unit tests. Everything passes; no visual regressions, broken interactions, or console errors attributable to the migration Default User Settings edit flow (the large DefaultUserSettings.tsx migration)Add Team, controlled Team ID / Max Budget Inputs, the per-team role Select, and the Models Combobox all update in place. The adversarial check for the Save returns to the shadcn Badge/Card read-only render, and the values survive a full page reload, which proves the migrated controls actually fed the PATCH payload rather than only local state Editing Team 1's id to Discount Calculator (how_it_works.tsx)Entering Export dropdown (multi_export_dropdown.tsx)The dropdown mounts only once results exist and shows exactly the two lucide-iconed entries. Both produce real files: a 496 B CSV and a 96 KB PDF report Users tabs, short viewport, /caching regression, unit testsTab strip is a two-pill shadcn TabsList with the table below unchanged ( At a 1200x600 window both routes scroll to their last section instead of clipping
Scoped unit tests: Console outputNo React errors or warnings from any of the four migrated files; no controlled/uncontrolled input, Select value, or key warnings. The Next.js dev overlay does show 2 issues on One unrelated nit spotted while testing, worth a separate cleanup: a team saved with no budget renders The only red CI check is Tested by this Devin session |
TLDR
Problem this solves:
How it solves it:
Relevant issues
Linear ticket
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
@greptileaito re-request a review after pushing changes)Delays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
Screenshots / Proof of Fix
Verified against
fdafcf28b2on a local proxy with the dashboard dev server. Screenshots to follow on this PR.What each step should show. On Internal Users the tab strip moves from the Tremor underline style to the shadcn pill style and the table below is unchanged. In Default User Settings the teams editor, the User Role select and the Models multi-select are the parts a page screenshot never reaches, so they need driving by hand. On Cost Tracking,
HowItWorkssits behind a collapsed accordion and a tab, andMultiExportDropdownonly mounts once the pricing calculator has results, so neither is visible on a plain page load.http://localhost:3000/users/http://localhost:3000/cost-tracking/, expand Provider Discounts, and select the Test It tab0.0171938125and0.0009049375; expect a 5.00% discount appliedType
🧹 Refactoring
Changes
cost-tracking, two route-exclusive components.
how_it_works.tsxdrops TremorTextandTextInputfor plain elements with token classes andui/input.multi_export_dropdown.tsxdrops the TremorButtonand the three@ant-design/iconsforui/buttonand lucideDownload,FileTextandFileSpreadsheet. The hand-rolled menu and its outside-click handling are deliberately left alone; they are plain markup, not antd or Tremor, and porting them toui/dropdown-menuwould change behaviour the existing test pins.users, two route-exclusive components.
view_users.tsxmoves the Tremor tab group toui/tabs, the two antd buttons toui/buttonand the antd skeletons toui/skeleton.DefaultUserSettings.tsxis the larger one: TremorCard,Title,Text,DividerandTextInputand antdButton,Typography,Spin,Switch,SelectandInputNumberbecomeui/card,ui/button,ui/input,ui/select,ui/switch,ui/separator,ui/badge,ui/comboboxandui/ui-loading-spinner, with the antd icons replaced by lucidePlusandTrash2.caching was analysed as part of the same batch and needs no changes, so no caching file is touched here.
cache_dashboard.tsxwas already migrated in #34468; its one remaining Tremor reference is theDateRangePickerValuetype, which exists solely to satisfy the props contract ofshared/usage_date_picker.tsx, a component the analyzer classifies as reached by 2 pages and therefore out of scope.cache_settings/cacheSettingsFields.tsandcoordination_redis_settings/coordinationRedisFields.tseach carry a singleimport type { FormItemProps } from "antd", used only to type validation rules that feed antd forms, and forms stay deferred. Caching is included in the verification below as a route that must stay pixel-identical, which it did.Skipped elsewhere, quoting the analyzer's buckets. Under TABLE, "hand off to /migrate-simple-table":
pricing_calculator/index.tsx,pricing_calculator/multi_cost_results.tsx,provider_discount_table.tsx,provider_margin_table.tsx,common_components/simple_table.tsxandusers/_components/BulkEditUsers.tsx. Under DEFERRED, "contains an antd Form -- do not touch until forms unblock":add_margin_form.tsx,add_provider_form.tsx,cost_tracking_settings.tsx,check_openapi_schema.tsx,edit_user.tsx,user_edit_view.tsx,view_users/user_info_view.tsx,CreateUserButton.tsx, and the four caching form files. Under SHARED, "reached by another page -- REFUSE to edit", the notable ones for this batch arebudget_duration_dropdown.tsxat 11 pages,team_dropdown.tsxat 13,DeleteResourceModal.tsxat 23 andshared/numerical_input.tsxat 14.BudgetDurationDropdownis why the Default User Settings panel still renders antd markup after this PR; it belongs to the shared-component track.Two commits, deliberately ordered. The first adds characterisation tests for the
DefaultUserSettingsboolean switch and teams editor, asserted through the save payload so they are library-agnostic, and proves them green against the antd component. The second migrates the components and touches no test file. All 342 tests across the three routes pass afterwards without a single test edit, which is what makes them evidence rather than decoration.eslint-suppressions.jsonloses the fourno-restricted-importsentries these files no longer need, viaeslint . --prune-suppressions.Final Attestation