Skip to content

refactor(ui): colocate admin-panel, organizations, router-settings, and old-usage views into _components/ - #32700

Closed
ryan-crabbe-berri wants to merge 1 commit into
litellm_internal_stagingfrom
litellm_colocate_extracts_1
Closed

refactor(ui): colocate admin-panel, organizations, router-settings, and old-usage views into _components/#32700
ryan-crabbe-berri wants to merge 1 commit into
litellm_internal_stagingfrom
litellm_colocate_extracts_1

Conversation

@ryan-crabbe-berri

Copy link
Copy Markdown
Contributor

Relevant issues

Linear ticket

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have added meaningful tests
  • My PR passes all CI/CD checks (e.g., lint, format, unit tests)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have received a Greptile Confidence Score of at least 4/5 before requesting a maintainer review (Greptile reviews automatically once the PR is opened; only comment @greptileai to 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:

  1. http://localhost:4000/ui/admin-panel renders admin settings (SSO / IP access / SCIM tabs)
  2. http://localhost:4000/ui/organizations renders the organizations table (create/edit org modal opens; org info view opens)
  3. http://localhost:4000/ui/router-settings renders general/router settings
  4. http://localhost:4000/ui/old-usage renders the legacy usage report

Local checks: npx vitest run on the moved suites (AdminPanel, organizations) plus the legacy CreateKeyPage test pass with 25 tests, npm run build compiles every route, and make pre-commit passes.

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/ folder

The 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.mock stubs 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 ./x to @/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's vi.mock paths rewritten to keep matching the source's now-absolute imports

Grandfathered 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) and settings (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

…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-apps

greptile-apps Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR colocates four route-owned view components (AdminPanel, organizations, general_settings, usage) from the flat src/components/ dump into their owning route's _components/ folder, continuing the App Router migration clean-up. It is a pure file relocation — no logic, props, or exported interfaces are changed.

  • Each moved file has its ./ relative imports rewritten to @/components/ absolute aliases, and its owning page.tsx updated to import from the new relative path.
  • The two colocated test files (AdminPanel.test.tsx, organizations.test.tsx) move alongside their sources with vi.mock paths updated to match; the legacy CreateKeyPage.expiredToken.test.tsx has three dead-stub mocks repointed to the new paths with identical stub shapes.
  • eslint-suppressions.json is rekeyed for all four files, preserving existing violation counts.

Confidence Score: 5/5

Safe 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.

Important Files Changed

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

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@ryan-crabbe-berri

Copy link
Copy Markdown
Contributor Author

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.

@codspeed-hq

codspeed-hq Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing litellm_colocate_extracts_1 (c9d96ed) with litellm_internal_staging (68a4ca7)

Open in CodSpeed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant