refactor(ui): migrate guardrails-monitor, projects, logs to shadcn#34606
refactor(ui): migrate guardrails-monitor, projects, logs to shadcn#34606yuneng-berri wants to merge 2 commits into
Conversation
…onents before migration Adds role- and text-based characterisation tests for EvaluationSettingsModal, GuardrailDetail and AuditLogDrawer, which had none, and moves the remaining antd-specific assertions (.ant-spin, the icon role of an antd Spin indicator) onto library-neutral ARIA queries. Also covers the enterprise banner on the deleted keys and deleted teams pages, which no test reached. All of these pass against the current antd and Tremor components.
Replaces antd and Tremor with installed shadcn primitives across the files these three routes exclusively own. Markup only, except where noted below. Deletes AntDLoadingSpinner, an antd-only primitive living in the shadcn ui/ folder, and moves its single call site onto ui/ui-loading-spinner. Two behaviour notes. The logs tab handler previously mapped every tab past the first to "audit logs", so the audit panel kept polling while Deleted Keys or Deleted Teams was on screen; each tab now reports its own value and panels stay mounted via keepMounted. The evaluation settings dialog is bounded to the viewport and scrolls internally, which the antd Modal got from being top-anchored on a scrolling page. The tests added in the previous commit pass unedited against these components.
Greptile SummaryMigrates the guardrails monitor, projects, and logs interfaces from Ant Design and Tremor to shared shadcn primitives
Confidence Score: 5/5The PR appears safe to merge with no additional follow-up failures identified No blocking failures remain
|
| Filename | Overview |
|---|---|
| ui/litellm-dashboard/src/components/view_logs/index.tsx | Replaces Tremor tabs and the Ant Design spinner with shared shadcn primitives while preserving mounted panel state |
| ui/litellm-dashboard/src/app/(dashboard)/guardrails-monitor/_components/EvaluationSettingsModal.tsx | Migrates evaluation settings to the shared dialog, select, textarea, and button components with viewport-bounded scrolling |
| ui/litellm-dashboard/src/app/(dashboard)/guardrails-monitor/_components/GuardrailDetail.tsx | Migrates guardrail detail controls, status presentation, loading state, metrics layout, and tabs to shared primitives |
| ui/litellm-dashboard/src/app/(dashboard)/projects/_components/ProjectDetailsPage.tsx | Rebuilds the project details layout with shared cards, badges, copy controls, meters, and loading components |
| ui/litellm-dashboard/src/components/view_logs/AuditLogDrawer/AuditLogDrawer.tsx | Migrates audit-log details from an Ant Design drawer to the shared sheet implementation |
| ui/litellm-dashboard/src/components/DeletedKeysPage/DeletedKeysPage.tsx | Migrates deleted-key presentation controls to shared UI primitives |
| ui/litellm-dashboard/src/components/DeletedTeamsPage/DeletedTeamsPage.tsx | Migrates deleted-team presentation controls to shared UI primitives |
Reviews (2): Last reviewed commit: "refactor(ui): migrate guardrails-monitor..." | Re-trigger Greptile
| <TabsContent value="deleted keys" keepMounted> | ||
| <DeletedKeysPage /> | ||
| </TabsContent> | ||
| <TabsContent value="deleted teams" keepMounted> | ||
| <DeletedTeamsPage /> | ||
| </TabsContent> |
There was a problem hiding this comment.
Hidden tabs issue background queries
Using keepMounted mounts the deleted-key and deleted-team panels when the logs page opens, and those panels do not gate their queries on the active tab. This sends two unnecessary API requests even when the user never opens either tab, adding avoidable network traffic and server work.
|
@greptile this PR did not introduce the behavior and migrating it will be out of scope. Review again |
|
QA'd this live against a local proxy ( Note for anyone repeating this: the standalone dev server serves App Router paths, so it's
Audit drawer: changed fields onlyThe updated team's After panel contains just The deleted team shows the red badge, the object in Before and Evaluation Settings at 1280x600Dialog stays inside the viewport with the footer reachable, and Run Evaluation is disabled with no model After selecting Two things I could not prove and that aren't regressions from this diff. The budget meter never rendered a filled state: I pushed three real completions through a key attached to CI is green apart from Devin session: https://app.devin.ai/sessions/67fa12c8ed474130bf6266b0f57aa021 |
TLDR
Problem this solves:
ui/folderHow it solves it:
AntDLoadingSpinner, moving its one call site toui/ui-loading-spinnerRelevant 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 a live proxy with a seeded postgres, driving each migrated surface by hand at commit
bb33bdba7a. Screenshots are attached as comments below.The projects list and the logs page both moved visually. guardrails-monitor did not: its landing view is
GuardrailsOverview, which is a table and stays on the old stack in this PR, so the two files migrated for that route (the detail view and its modal) both sit behind a click and never appear in the landing screenshot. That is expected, not a missed migration.Click-through to reproduce, with a proxy on
localhost:4000:http://localhost:4000/ui/?page=logs. Confirm the four tabs read Request Logs, Audit Logs, Deleted Keys, Deleted Teams, that they sit at their natural width, and that switching tabs does not remount the panel you came fromhttp://localhost:4000/ui/?page=projects. Confirm the header, the search box with its clear button, and the tablehttp://localhost:4000/ui/?page=guardrails-monitor, click a guardrail, and confirm the detail header, the Overview and Logs tabs, and the metric cardsType
🧹 Refactoring
Changes
Migrated, grouped by the route that exclusively owns each file.
guardrails-monitor:
EvaluationSettingsModal.tsxandGuardrailDetail.tsx.GuardrailsMonitorView.tsxis listed as in scope but has nothing to migrate; its only remaining Tremor reference isimport type { DateRangePickerValue }, which is the prop type of the sharedadvanced_date_pickerand cannot move until that shared component does.projects:
ProjectDetailsPage.tsx,ProjectKeysSection.tsxandProjectsPage.tsx. antdDescriptionsbecomes a description list,Progressbecomesui/meterwith its tone variants, and the hardcoded hex strokes are gone.logs:
DeletedKeysPage.tsx,DeletedTeamsPage.tsx,AuditLogDrawer.tsxandview_logs/index.tsx. The drawer becomes aui/sheetand reuses the exportedAUDIT_TABLE_NAME_DISPLAYinstead of keeping its own copy of that map.src/components/ui/AntDLoadingSpinner.tsxis deleted along with its test. It wrapped antdSpinand lived in the shadcn primitives folder despite not being one.view_logs/index.tsxwas its only consumer repo-wide and now usesui/ui-loading-spinner; its staleeslint-suppressions.jsonentry is pruned along with the antd import suppressions the migration retires.Two changes are not purely markup, both flagged deliberately. The logs tab handler used to map every tab past the first to "audit logs", so the audit panel kept polling while Deleted Keys or Deleted Teams was on screen; each tab now reports its own value, and
keepMountedpreserves the previous mount-all behaviour so switching tabs loses no panel state. Separately, the evaluation settings dialog is now bounded to the viewport and scrolls internally: the antd Modal got that for free by being top-anchored on a scrolling page, and without it the title and the footer buttons were both unreachable below roughly 660px of window height.Not touched, quoting the scope analysis:
GuardrailsOverview.tsxis a TABLE and belongs to the simple-table migration; the project and guardrail modals pluscheck_openapi_schema.tsxare DEFERRED because they contain an antdForm; and everything under SHARED, includingLogViewer,advanced_date_picker, theLogDetailsDrawertree andDefaultProxyAdminTag, is reached by more than one route and is left alone.Final Attestation