refactor(ui): colocate admin-panel, organizations, router-settings, and old-usage views into _components/ - #32700
Conversation
…nd old-usage page views Continues the colocation follow-up. These four segments rendered their page view out of the shared src/components dump; this moves each self-contained view (and its colocated test, where one existed) into the owning route's _components/ folder: - src/components/AdminPanel.tsx -> admin-panel/_components/ - src/components/organizations.tsx -> organizations/_components/ - src/components/general_settings.tsx -> router-settings/_components/ - src/components/usage.tsx -> old-usage/_components/ Each view was verified to have no importers other than its own page (the only other references were dead defensive mocks in the legacy CreateKeyPage test, repointed here). Relative imports inside each moved file are rewritten to absolute @/components/* since the genuinely shared dependencies (networking, selectors, settings trees) stay in @/components. The two moved tests (AdminPanel, organizations) have their vi.mock paths rewritten to match. Grandfathered lint suppressions for the four files are re-keyed to their new paths with counts unchanged.
Greptile SummaryThis PR colocates four route-owned view components (
Confidence Score: 5/5Safe to merge — this is a pure file relocation with no behavior change across all four views. Every old import path has been cleaned up — confirmed no remaining references to the four moved components anywhere in the codebase. Mock paths in test files are correctly repointed with unchanged stub shapes, and eslint suppression counts are preserved. No logic was altered in any of the moved files. No files require special attention.
|
| Filename | Overview |
|---|---|
| ui/litellm-dashboard/eslint-suppressions.json | Rekeyed four file paths in suppressions to match the new _components/ locations; counts are unchanged. |
| ui/litellm-dashboard/src/app/(dashboard)/admin-panel/_components/AdminPanel.tsx | Moved from src/components/AdminPanel.tsx; all ./ relative imports rewritten to @/components/ aliases. No logic change. |
| ui/litellm-dashboard/src/app/(dashboard)/admin-panel/_components/AdminPanel.test.tsx | Moved alongside AdminPanel.tsx; all vi.mock paths updated from relative ./ to @/components/ to match the source's new absolute imports. |
| ui/litellm-dashboard/src/app/(dashboard)/admin-panel/page.tsx | Updated import of AdminPanel from @/components/AdminPanel to the new colocated ./_components/AdminPanel. |
| ui/litellm-dashboard/src/app/(dashboard)/old-usage/_components/usage.tsx | Moved from src/components/usage.tsx; all relative imports rewritten to @/components/ aliases. No logic change. |
| ui/litellm-dashboard/src/app/(dashboard)/old-usage/page.tsx | Updated import of Usage from @/components/usage to ./_components/usage. |
| ui/litellm-dashboard/src/app/(dashboard)/organizations/_components/organizations.tsx | Moved from src/components/organizations.tsx; all relative imports rewritten to @/components/ aliases. No logic change. |
| ui/litellm-dashboard/src/app/(dashboard)/organizations/_components/organizations.test.tsx | Moved alongside organizations.tsx; vi.mock paths updated to @/components/ aliases to match the source's new imports. |
| ui/litellm-dashboard/src/app/(dashboard)/organizations/page.tsx | Updated import of OrganizationsTable from @/components/organizations to ./_components/organizations. |
| ui/litellm-dashboard/src/app/(dashboard)/router-settings/_components/general_settings.tsx | Moved from src/components/general_settings.tsx; all relative imports rewritten to @/components/ aliases. No logic change. |
| ui/litellm-dashboard/src/app/(dashboard)/router-settings/page.tsx | Updated import of GeneralSettings from @/components/general_settings to ./_components/general_settings. |
| ui/litellm-dashboard/tests/CreateKeyPage.expiredToken.test.tsx | Three vi.mock paths repointed to the new _components/ locations for organizations, general_settings, and usage. Stub shapes and behavior are unchanged. |
Reviews (1): Last reviewed commit: "refactor(ui): colocate admin-panel, orga..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Superseded by #32704, which combines all four colocation batches into one PR per request. Same commits, cherry-picked onto one branch; branch kept for now. |
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
Pure relocation with no behavior change; the proof is that each page still renders and its shared dependencies still resolve. On a live proxy, load each and screenshot:
http://localhost:4000/ui/admin-panelrenders admin settings (SSO / IP access / SCIM tabs)http://localhost:4000/ui/organizationsrenders the organizations table (create/edit org modal opens; org info view opens)http://localhost:4000/ui/router-settingsrenders general/router settingshttp://localhost:4000/ui/old-usagerenders the legacy usage reportLocal checks:
npx vitest runon the moved suites (AdminPanel, organizations) plus the legacy CreateKeyPage test pass with 25 tests,npm run buildcompiles every route, andmake pre-commitpasses.Type
🧹 Refactoring
Changes
Continues the colocation follow-up to the App Router migration, moving into the "extract from src/components" bucket. Where the earlier PRs renamed existing local component folders, these four segments rendered their page view straight out of the shared src/components dump; this pulls each self-contained view into the owning route's
_components/folderThe four views (AdminPanel, organizations, general_settings, usage) were each verified to have no importer other than their own page. The only other references were dead defensive
vi.mockstubs in the legacy CreateKeyPage test (left over from the pre-migration god-component); those are repointed to the new paths. Relative imports inside each moved file are rewritten from./xto@/components/x, because their genuinely shared dependencies (networking, the selector components, the settings trees) stay in@/components; only the page-owned view moves. The two views that had a colocated test (AdminPanel, organizations) move their test alongside them, with the test'svi.mockpaths rewritten to keep matching the source's now-absolute importsGrandfathered lint suppressions for the four files (tremor, react-hooks, and similar, all pre-existing) are re-keyed to the new paths with counts unchanged; fixing those underlying violations is a separate effort out of scope for a file move
Two larger extract candidates were left for their own PRs to keep review tractable:
UsagePage(28 files) andsettings(51 files) are mechanical but big, and several other views (view_logs, claude_code_plugins, the AIHub/model-hub pair) are genuinely shared across features and need a split decision rather than a straight move