refactor(ui): migrate logging-and-alerts, caching, policies to shadcn - #34468
Conversation
…re the shadcn migration Establishes the regression net for the upcoming markup migration of these three routes. Every assertion here is written against the current antd and Tremor components and passes against them, so it carries no knowledge of the markup that replaces them and stays meaningful afterwards. Adds characterisation tests for the seven components that had none, and rewrites cache_dashboard's chart-card lookup to anchor on each chart's own title instead of asserting a global count of card nodes, which would break the moment another card appears on the page. No component is touched in this commit.
Markup-only migration of the 17 files these three routes exclusively own, replacing antd and Tremor with the installed shadcn (base-vega) primitives and lucide icons. No route behaviour changes; the tests written in the previous commit are untouched here and pass against both the old and the new markup. Colour now comes from tokens rather than from hardcoded utilities, so the health-check button, the alerts and the badges no longer pin their own palette. email_settings also loses an invalid DOM nesting (a table cell inside a div, and a div inside a paragraph) that React had been warning about. Two modals on the policies page moved from the Policies panel up to the panel root. Base UI Tabs mounts only the active panel, unlike Tremor, and both are opened from the Templates tab, so leaving them nested would have made "Use Template" do nothing. Retires 53 antd import suppressions from the eslint baseline.
…itellm_/wonderful-northcutt-14b37d
Greptile SummaryThis PR migrates the caching, policies, and logging-and-alerts routes from Ant Design and Tremor components to shadcn primitives.
Confidence Score: 5/5The PR appears safe to merge based on the eligible follow-up findings. No blocking failure remains in the fixes associated with the previous review threads.
|
| Filename | Overview |
|---|---|
| ui/litellm-dashboard/src/app/(dashboard)/policies/_components/ai_suggestion_modal.tsx | Migrates the modal to shadcn components and replaces the checkbox callback involved in the previous interaction defect. |
| ui/litellm-dashboard/src/app/(dashboard)/policies/_components/template_parameter_modal.tsx | Consolidates parameter rendering so plain template parameters appear once and migrates the modal controls to shadcn. |
| ui/litellm-dashboard/src/app/(dashboard)/caching/_components/cache_dashboard.tsx | Migrates caching tabs, filters, cards, and refresh controls to shadcn primitives. |
| ui/litellm-dashboard/src/components/CloudZeroCostTracking/CloudZeroIntegrationSettings.tsx | Migrates the CloudZero integration settings and confirmation flow to shadcn components. |
| ui/litellm-dashboard/src/components/email_settings.tsx | Migrates email settings presentation while correcting invalid DOM nesting. |
Reviews (2): Last reviewed commit: "fix(ui): render each policy template par..." | Re-trigger Greptile
A template with no LLM enrichment rendered every parameter field twice: the shared list already covers them, because nonEnrichmentParams is the full parameter list when there is no enrichment, and a second no-enrichment branch mapped the same list again. Predates the shadcn migration and was carried forward by it. The test now asserts exactly one field per parameter, and fails if the duplicate branch comes back.
UI QA — shadcn / Base UI migration (caching, policies, logging-and-alerts)Ran the PR branch's dashboard dev server against a local proxy, logged in as admin, and walked all three migrated routes end to end following the runbook. Every core scenario passes and there are no visual regressions on the migrated surfaces Full walkthrough recording: Use Template -> guardrail dialog end to end (key regression)The guardrail selection dialog opens from a lazily-mounted tab panel, Select All New and Deselect All toggle the count correctly, and confirming closes the dialog, switches to the Policies tab, and lands on a pre-filled Create New Policy form Caching: analytics, Cache Health, Coordination Redis label fixAnalytics tab renders the four tabs, both filters, three stat cards, both charts and the date range control Cache Health run shows the status line plus Error Details and Cache Details with working disclosure triangles Coordination Redis closed control shows the label "Node (Single Instance)" rather than the raw value "node", and lists all three types Policies: About alert and template badgesThe About Policies alert renders with a working dismiss control, and the template cards show their complexity and tag badges Logging and Alerts: CloudZero empty state and Email Alerts layoutCloudZero Cost Tracking empty state renders with its Add CloudZero Integration button Email Alerts shows saved checkbox state and the Email Server Settings fields in a two-column grid with help text Fixed behaviorsTemplate parameter field renders exactly once (one label, one input) The AI suggestion checkbox toggle could not be verified through the UI: the "Use AI to find templates" matcher returned zero matches across models and prompts, so no suggestion cards rendered. The empty state itself renders correctly, and the checkbox fix is covered by the added unit test One item outside this PR's scope: the still-Ant/Tremor Alerting Settings tab logs a React hydration warning ( Tested by Devin: https://app.devin.ai/sessions/91b4964baa804ec48b67cda75da9095a |
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
Before is commit
64aad5877a, after is commitb2cf17d4a2. Screenshots are attached below as before/after pairs for caching and policies. logging-and-alerts is not shown as a full-page pair because the parts this PR changes live behind its CloudZero Cost Tracking and Email Alerts tabs rather than on the landing tab; those two are attached on their own.To reproduce locally, run the proxy and the dashboard dev server, then work through this list in order
python litellm/proxy/proxy_cli.py --config litellm/proxy/dev_config.yaml --detailed_debug --reload, and the dashboard withnpm run devinui/litellm-dashboardThe local visual gate photographed all 35 dashboard routes before and after. The three migrated routes were deliberately re-baselined; the other 32 stayed pixel-identical, so this change has no blast radius outside its own routes.
Type
🧹 Refactoring
🐛 Bug Fix
Changes
The analyzer scopes each route to the files it exclusively owns, and the three sets are disjoint, so this is one PR rather than three. Seventeen files moved onto shadcn primitives and lucide icons.
logging-and-alerts owns
CloudZeroCostTracking.tsx,CloudZeroEmptyPlaceholder.tsx,CloudZeroIntegrationSettings.tsx,email_events/email_event_settings.tsxandemail_settings.tsx. The antdDescriptionsandPopconfirmon the CloudZero settings panel become a definition list and a controlledAlertDialog, which also keeps the export button's in-flight state instead of dismissing on click.email_settings.tsxadditionally loses an invalid DOM nesting it had before: a TremorTableCellrendered a<td>inside a<div>, and the help text put<div>s inside a<p>, both of which React was warning about on every render.caching owns
cache_dashboard.tsx,cache_health.tsx,cache_settings/RedisTypeSelector.tsxandcoordination_redis_settings/CoordinationRedisTypeSelector.tsx. The two TremorMultiSelects become the combobox-with-chips pattern already used on the usage page. Both Redis type selectors render their label throughSelectValuerather than letting Base UI print the raw value.policies owns
ai_suggestion_modal.tsx,guardrail_selection_modal.tsx,impact_preview_alert.tsx,index.tsx,pipeline_flow_builder.tsx,policy_info.tsx,policy_templates.tsxandtemplate_parameter_modal.tsx. Two behaviours needed care rather than a straight swap.GuardrailSelectionModalandTemplateParameterModalmoved from inside the Policies tab panel up to the panel root: Base UI Tabs mounts only the active panel where Tremor mounted all of them, and both dialogs are opened from the Templates tab, so leaving them nested made Use Template silently do nothing. Separately, the competitor-names control was an antdSelect mode="tags", which accepts values the user types; Base UI's combobox only selects from a fixed item list, so that one is a small controlled tag input rather than a combobox, preserving type-to-add, comma separation and backspace-to-remove.Three files the analyzer listed are deliberately untouched, and each is worth calling out.
impact_popover.tsxstays on antd. Its existing test replaces the antd module with a stub that fabricates the popover trigger and renders the popover body eagerly, so every assertion in it is bound to antd's module shape rather than to rendered markup. Migrating the component makes all twelve of those tests fail, and the rule this migration follows is that a component's test must pass before and after without being edited. Rewriting that test needs the component to expose an accessible trigger first, which is a behaviour change and belongs in its own PR.cache_settings/cacheSettingsFields.tsandcoordination_redis_settings/coordinationRedisFields.tsare listed as migratable because they are not form files by the analyzer's definition, but their only antd surface istype CacheFieldRule = NonNullable<FormItemProps["rules"]>[number]. Those rules are consumed solely byCacheFormField.tsxand the settingsindex.tsx, both of which are deferred antd forms. There is no markup to migrate and retyping the rules would break the deferred forms.Everything the analyzer bucketed as shared is untouched, so
DeleteResourceModal.tsx(23 pages),message_manager.tsxandnotifications_manager.tsx(53 pages each) andshared/usage_date_picker.tsx(2 pages) keep their current implementation. The deferred antd forms on these routes are likewise untouched. Both of those mean these routes still import antd after this PR, which is expected.Tests come first, in their own commit that changes no component. Seven components had no test at all and now have one;
cache_dashboard's existing test asserted a global count of card nodes, which any new card would have broken, so its chart lookups are now anchored on each chart's own title. Every one of those tests was proven green against the antd and Tremor components before the migration commit, and none of them is edited by the migration commit.radio-groupis added through the shadcn CLI for the competitor-discovery mode toggle; it is the only new primitive.One bug is fixed rather than carried forward. A template with no LLM enrichment rendered every parameter field twice, because
nonEnrichmentParamsis the whole parameter list when there is no enrichment and a second no-enrichment branch mapped that same list again. It predates this migration; the field is now rendered once and the test asserts exactly one input per parameter, so the duplicate branch cannot come back unnoticed.Worth noting for reviewers comparing behaviour: clicking the checkbox on a suggested template in the AI suggestion modal used to be a no-op. antd's
Checkboxfired its own handler and also let the click bubble to the row's handler, so the two toggles cancelled. Base UI does not, so that control now works; this was measured on both versions rather than inferred.Final Attestation