Commit graph

5061 commits

Author SHA1 Message Date
Ryan Crabbe
c8496a2767
fix(ui): invalidate organization queries after team mutations
Team create/delete/update can change which teams belong to an organization
(via teamCreateCall, teamDeleteCall, and teamUpdateCall when organization_id
changes). Without invalidating the React Query cache for organizations, the
org info page's teams list and any useOrganizations() consumer (e.g. the
team edit form's organization dropdown) stay stale until a hard reload.

Export organizationKeys from useOrganizations and invalidate
organizationKeys.all after each successful team mutation, matching the
pattern used in hooks/projects, hooks/budgets, and hooks/accessGroups.
2026-04-15 12:55:08 -07:00
Yuneng Jiang
442a5aea0d
Move Send Invitation Email field under Metadata in both forms 2026-04-15 12:33:12 -07:00
Ryan Crabbe
35559c4d60
fix(ui): use antd Select for MCP ToolTestPanel bool inputs 2026-04-15 12:32:38 -07:00
Yuneng Jiang
a7c947f9dd
Move Send Invitation Email field directly below User Email in both forms 2026-04-15 12:31:23 -07:00
ryan-crabbe-berri
f9bffbb1b7
Merge pull request #25803 from BerriAI/litellm_guardrails-monitor-antd-layout
refactor(ui): reduce Tremor usage in Guardrails Monitor layout
2026-04-15 12:30:58 -07:00
Yuneng Jiang
55829c2254
Render Send Invitation Email as a labeled form item to align with other fields 2026-04-15 12:28:41 -07:00
Yuneng Jiang
fde7c1087a
Move Send Invitation Email checkbox into modal footer, add tests
Place the checkbox inline with the submit button (left-aligned,
vertically centered) in both the embedded and standalone forms.
Add Vitest tests verifying the /user/new payload shape: default true,
false when unchecked, in both form variants, plus an initial-state
check for the modal.
2026-04-15 12:24:41 -07:00
Yuneng Jiang
3ce67bacad
[Feature] UI - Users: add Send Invitation Email toggle to Invite User modal
The Invite User flow was calling /user/new without send_invite_email, so
the backend invitation-email hook (gated on send_invite_email is True)
was silently skipped. Add a checkbox, default on, so admins can opt
out when needed.
2026-04-15 12:16:33 -07:00
Ryan Crabbe
f04a5e7113
fix(ui): render guardrail optional_params bool defaults in Select
The bool branch of the guardrail optional params renderer was using
string values ("true"/"false") for Select.Option, so when the backend
declared a real JS boolean as default_value (e.g. Pillar
include_scanners/include_evidence, IBM block_on_detection), antd's
Form.Item initialValue did not match any Option and the Select
rendered empty. Switching to real boolean Option values lets defaults
flow through unchanged. This matches the sibling fix already applied
in guardrail_provider_fields.tsx for Noma use_v2.
2026-04-15 11:57:52 -07:00
Ryan Crabbe
48aa776032
refactor(ui): use antd grid for guardrails monitor metrics
Replace Tailwind grid wrappers with antd Row/Col in Guardrails Monitor overview and detail metric sections to keep layout primitives consistent with the ongoing antd migration.
2026-04-15 11:34:44 -07:00
Ryan Crabbe
b599c8bfd4
refactor(ui): reduce Tremor usage in Guardrails Monitor layout
Move Guardrails Monitor overview/detail layout wrappers and section heading components to antd/plain Tailwind while keeping the existing Tremor chart and date picker behavior unchanged for a smaller, low-risk migration step.
2026-04-15 10:39:25 -07:00
Yuneng Jiang
eba43b5c04
Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_migration_projects
Some checks failed
Unit Tests: Proxy DB Operations / proxy-db (auth-checks, tests/proxy_unit_tests/test_auth_checks.py tests/proxy_unit_tests/test_user_api_key_auth.py, 20, 8) (push) Has been cancelled
Unit Tests: Proxy DB Operations / proxy-db (key-generation, tests/proxy_unit_tests/test_key_generate_prisma.py, 30, 0) (push) Has been cancelled
Unit Tests: Proxy DB Operations / proxy-db (remaining, tests/proxy_unit_tests --ignore=tests/proxy_unit_tests/test_key_generate_prisma.py --ignore=tests/proxy_unit_tests/test_auth_checks.py --ignore=tests/proxy_unit_tests/test_user_api_key_auth.py, 30, 8) (push) Has been cancelled
Unit Tests: Security / security (push) Has been cancelled
2026-04-15 10:14:06 -07:00
Ryan Crabbe
3b8f651eaf
fix: default invite user modal global role to least-privilege
Pre-select "Internal User Viewer" in the Global Proxy Role dropdown
on both the standalone and embedded Invite User forms so admins don't
have to remember to pick a role, and the default lands on the least
privileged option rather than silently posting an undefined role.
2026-04-15 09:52:24 -07:00
Ryan Crabbe
a23408d937
test(ui): add getCookie to cookieUtils mock in user_dashboard test
user_dashboard.tsx imports getCookie from @/utils/cookieUtils, but the
vi.mock factory in user_dashboard.test.tsx only exports clearTokenCookies.
Vitest throws `No "getCookie" export is defined on the "@/utils/cookieUtils"
mock`, breaking all three beforeunload-listener tests.

Add getCookie to the mock factory so it matches the current imports.
2026-04-15 09:52:23 -07:00
Ryan Crabbe
27484c4a41
fix: isolate logs team filter dropdown from root teams state bleed
The Logs view's Team ID filter dropdown was reading `allTeams` from the
root `teams` state in page.tsx, which the Teams page search overwrites
with its filtered subset. Applying a team search on the Teams page made
filtered-out teams disappear from the Logs filter dropdown.

Swap the Team ID filter to use the existing `TeamDropdown` component via
a small `FilterTeamDropdown` wrapper that adapts it to the filter slot's
`FilterOptionCustomComponentProps` contract. The dropdown now drives its
own `useInfiniteTeams` query against `/v2/team/list` with server-side
search and an isolated react-query cache, unreachable from root state.

Rename the now-unused `hookAllTeams` destructure to `allTeams` so the
`KeyInfoView` passthrough receives the hook's unpolluted fetch instead
of the polluted prop, and drop the dead `allTeams` prop from
`SpendLogsTable` and both of its call sites.
2026-04-15 09:52:23 -07:00
Ryan Crabbe
f27bf8e711
fix(ui): pre-select backend default for boolean guardrail provider fields
Boolean fields in the auto-generated guardrail provider form (e.g. Noma
`use_v2`) rendered as empty Selects because the Form.Item only populated
`initialValue` for percentage fields, and the `defaultValue` passed to the
Select child was silently dropped by antd's controlled-component wrapper.
Users could not tell what the backend default was, and the visual ambiguity
made flags like `use_v2` look inoperative even though the save path worked.

Unify `initialValue` to fall back through `fieldValue → field.default_value →
(percentage ? 0.5 : undefined)`, and switch Select.Option values from
"true"/"false" strings to real booleans so the backend default flows through
without stringification.
2026-04-15 09:52:23 -07:00
Ryan Crabbe
17568e81f2
chore(ui): use antd Typography in GuardrailTestPlayground
- Replace plain text/heading tags with Typography.Text, Title, Paragraph
- Document Typography preference in CLAUDE.md UI guidelines
2026-04-15 08:45:11 -07:00
Sameer Kankute
277be4c50e
Add input + output tokens for anthropic message type 2026-04-15 21:08:34 +05:30
Yuneng Jiang
6426bc41f5
Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_yj_apr14 2026-04-14 22:40:04 -07:00
Ryan Crabbe
b28b82c105
chore(ui): migrate GuardrailTestPlayground off @tremor/react to antd
Part of the ongoing migration away from @tremor/react per CLAUDE.md.
Swaps tremor Card/Title/Text/TextInput for antd Card/Input and plain
h2/h3/span/p tags with Tailwind. Drops the redundant Checkbox avatar in
the sidebar list since row clicks already toggle selection and the
blue-border + bg-blue-50 styling already signals selected state.
2026-04-14 21:46:13 -07:00
Ishaan Jaffer
e0a988e39a
feat(ui/log-details): pass rawInputTokens, cacheReadTokens, cacheCreationTokens to CostBreakdownViewer from SpendLogs 2026-04-14 18:29:12 -07:00
Ishaan Jaffer
0148effd6e
feat(ui/cost-breakdown): show separate Input / Cache Read / Cache Write line items in cost breakdown drawer 2026-04-14 18:29:12 -07:00
Ishaan Jaffer
6b1dc1156e
fix(ui/usage): subtract cache tokens from Input Tokens summary card to avoid double-counting 2026-04-14 18:29:12 -07:00
ryan-crabbe-berri
6d2b7b76ad
Merge pull request #25721 from BerriAI/litellm_fix-invite-user-default-role
fix: default invite user modal global role to least-privilege
2026-04-14 16:34:04 -07:00
Ryan Crabbe
a428ae7599
fix: default invite user modal global role to least-privilege
Pre-select "Internal User Viewer" in the Global Proxy Role dropdown
on both the standalone and embedded Invite User forms so admins don't
have to remember to pick a role, and the default lands on the least
privileged option rather than silently posting an undefined role.
2026-04-14 15:45:35 -07:00
Ryan Crabbe
bdaaa5c187
test(ui): add getCookie to cookieUtils mock in user_dashboard test
user_dashboard.tsx imports getCookie from @/utils/cookieUtils, but the
vi.mock factory in user_dashboard.test.tsx only exports clearTokenCookies.
Vitest throws `No "getCookie" export is defined on the "@/utils/cookieUtils"
mock`, breaking all three beforeunload-listener tests.

Add getCookie to the mock factory so it matches the current imports.
2026-04-14 15:18:10 -07:00
ryan-crabbe-berri
43efe76f17
Merge pull request #25716 from BerriAI/litellm_fix-logs-team-filter-state-bleed
fix: isolate logs team filter dropdown from root teams state bleed
2026-04-14 14:44:37 -07:00
ryan-crabbe-berri
ec4ce1cc4a
Merge pull request #25700 from BerriAI/litellm_fix-guardrail-bool-select-rendering
fix(ui): pre-select backend default for boolean guardrail provider fields
2026-04-14 14:31:28 -07:00
Ryan Crabbe
1beb8037d1
fix: isolate logs team filter dropdown from root teams state bleed
The Logs view's Team ID filter dropdown was reading `allTeams` from the
root `teams` state in page.tsx, which the Teams page search overwrites
with its filtered subset. Applying a team search on the Teams page made
filtered-out teams disappear from the Logs filter dropdown.

Swap the Team ID filter to use the existing `TeamDropdown` component via
a small `FilterTeamDropdown` wrapper that adapts it to the filter slot's
`FilterOptionCustomComponentProps` contract. The dropdown now drives its
own `useInfiniteTeams` query against `/v2/team/list` with server-side
search and an isolated react-query cache, unreachable from root state.

Rename the now-unused `hookAllTeams` destructure to `allTeams` so the
`KeyInfoView` passthrough receives the hook's unpolluted fetch instead
of the polluted prop, and drop the dead `allTeams` prop from
`SpendLogsTable` and both of its call sites.
2026-04-14 14:28:53 -07:00
Ryan Crabbe
6da4e0b901
fix(ui): pre-select backend default for boolean guardrail provider fields
Boolean fields in the auto-generated guardrail provider form (e.g. Noma
`use_v2`) rendered as empty Selects because the Form.Item only populated
`initialValue` for percentage fields, and the `defaultValue` passed to the
Select child was silently dropped by antd's controlled-component wrapper.
Users could not tell what the backend default was, and the visual ambiguity
made flags like `use_v2` look inoperative even though the save path worked.

Unify `initialValue` to fall back through `fieldValue → field.default_value →
(percentage ? 0.5 : undefined)`, and switch Select.Option values from
"true"/"false" strings to real booleans so the backend default flows through
without stringification.
2026-04-14 10:13:58 -07:00
Lucas Song
9c869732a5 fix(ui): remove unused useMutation import and add React import to test 2026-04-14 10:08:18 -07:00
Lucas Song
977245c30e fix(ui): rename test file to tsx and remove unused useMutation import 2026-04-14 10:08:07 -07:00
Lucas Song
ef774a1991 Merge remote-tracking branch 'origin/main' into fix-ui-policy-attachment-delete 2026-04-14 10:02:23 -07:00
Lucas Song
53828dda76 refactor: migrate policy attachment deletion to useMutation hook with tests 2026-04-14 09:54:41 -07:00
Sameer Kankute
972e42c7fd
Merge branch 'main' into litellm_oss_staging_04_04_2026 2026-04-14 20:23:06 +05:30
Yuneng Jiang
d3a1f63af2
[Refactor] Proxy: move projects management to enterprise package
Remove the /project/* management endpoints and the enable_projects_ui
admin-settings flag from the OSS litellm package. Project endpoints now
live under litellm_enterprise and are wired through the existing
enterprise router; OSS builds return 404 for every /project/* route.

The enable_projects_ui UI flag is registered back onto UISettings via a
small extension registry when the enterprise package is imported, so the
admin toggle and downstream key/sidebar gating continue to work in
enterprise builds. On OSS, explicit PATCH attempts with the flag return
403 with a clear enterprise-only message instead of being silently
dropped.

Pydantic request/response types (NewProjectRequest, UpdateProjectRequest,
DeleteProjectRequest, NewProjectResponse) stay in litellm/proxy/_types.py
because management_endpoints/common_utils.py and pydantic-shape tests
import them. LiteLLM_ProjectTable and all FK columns in schema.prisma
are unchanged.
2026-04-13 21:41:12 -07:00
Yuneng Jiang
9b74ff3ef7
remove unnecessary cleanup helper
The database is freshly seeded on every test run via seed.sql,
so per-test cleanup is not needed.
2026-04-13 17:29:49 -07:00
Yuneng Jiang
cce7163348
fix CI: replace data-testid selectors with text/role-based selectors
The data-testid attributes added to React components are not present
in the CI-built UI output. Switch to using getByRole and getByText
selectors which work with the rendered DOM regardless of build cache.
2026-04-13 17:29:49 -07:00
Yuneng Jiang
5e07c1cbc9
address greptile review feedback (greploop iteration 1)
Add cleanup helper to delete models created during tests, preventing
stale data accumulation across repeated test runs.
2026-04-13 17:29:49 -07:00
Yuneng Jiang
4f364a8138
[Test] UI - Models: Add E2E tests for Add Model flow
Add E2E tests covering:
- Test connection with bad credentials shows failure modal
- Adding a specific model and verifying it appears in All Models table
- Adding a wildcard route and verifying it appears in All Models table
- Verifying model dropdown shows provider-specific models (existing test updated)

Added data-testid attributes to UI components to support stable test selectors.

Tests verified passing 3/3 consecutive runs with zero flakiness.
2026-04-13 17:29:49 -07:00
yuneng-jiang
c25b4b2ce8
Merge pull request #25398 from BerriAI/litellm_team_settings_router
[Feature] UI - Teams: Allow Editing Router Settings After Team Creation
2026-04-13 17:27:15 -07:00
yuneng-jiang
a306092d47
Merge pull request #25463 from BerriAI/litellm_oss_staging_04_09_2026
Litellm oss staging 04 09 2026
2026-04-13 17:25:53 -07:00
ryan-crabbe-berri
87b6b5145f
Merge pull request #25658 from BerriAI/litellm_e2e-edit-team-model-test
test(e2e): add edit team model TPM/RPM limits test
2026-04-13 17:15:56 -07:00
Ryan Crabbe
152d6898ab
test(e2e): drop cleanup from edit team model test
Reviewer flagged that cleanup failures were silently swallowed and
suggested asserting `delete.ok()`. While thinking through the fix, the
actual question turned out to be "does the cleanup matter at all?" —
and the answer is no.

The e2e runner (`run_e2e.sh`) spins up a fresh postgres container per
invocation and tears it down at the end, so every local and CI run
starts with an empty DB. Playwright retries share the same DB but each
attempt creates a new model with a unique `Date.now()` name and only
queries its own model, so orphans from failed attempts never collide
with later attempts or other tests. Nothing else in the suite reads
the all-models table.

Keeping the cleanup would also turn every write test into an implicit
delete test, coupling responsibilities and inflating runtime — which
is probably why `teams.spec.ts` (create a team), `keys.spec.ts`
(update key limits), etc. all leave their entities in place. Matching
that convention, drop the try/finally block and the `createdModelId`
tracking. 12 lines removed, no behavior change.
2026-04-13 17:05:42 -07:00
Ryan Crabbe
44614c43c6
test(e2e): add edit team model TPM/RPM limits test
Covers the full write-path flow for team-scoped models on the Models +
Endpoints page: create via /model/new, click the row to open the detail
view, click Edit Settings, change TPM/RPM, click Save Changes, assert
the new values render back. Cleans up via /model/delete in finally so
reruns stay deterministic.

Requires store_model_in_db: true in the fixture general_settings so the
proxy accepts /model/new and /model/delete. No existing test in the
dashboard e2e suite reads the all-models table or hits the model CRUD
endpoints, so enabling the flag has no cross-test impact.
2026-04-13 16:27:39 -07:00
Ryan Crabbe
004964f421
chore: remove deprecated tests/ui_e2e_tests/ suite
The suite was superseded by ui/litellm-dashboard/e2e_tests/ on 2026-04-08
and is no longer referenced by CircleCI, docs, or Makefile targets. Drop
the directory wholesale and remove the orphaned e2e:psql npm script that
pointed at its runner.
2026-04-13 15:40:34 -07:00
ryan-crabbe-berri
65d9fadf45
Merge pull request #25575 from BerriAI/litellm_feat-per-guardrail-opt-out-for-global-guardrails
feat(guardrails): per-team opt-out for specific global guardrails
2026-04-13 13:31:23 -07:00
Ryan Crabbe
2d14e4a4ed
test(ui/team): fix guardrails overview test for new component
Updates the expected header text to "Guardrails Settings" to match
GuardrailSettingsView's rendering, and moves the mock guardrails
from team_info.guardrails (legacy top-level path that nothing
reads) to team_info.metadata.guardrails where the component
actually looks. Also tightens the assertion to verify the
individual guardrail names appear, not just the section header.
2026-04-13 12:20:30 -07:00
Ryan Crabbe
842523a918
chore(ui): use antd in GuardrailSettingsView and document the rule
Converts GuardrailSettingsView from @tremor/react (Badge, Text) to
antd (Tag, plain spans) as part of the Tremor migration. Also
captures the "no new Tremor imports" rule in CLAUDE.md and expands
the existing note in AGENTS.md with the specific antd equivalents
and the yellow→gold gotcha.
2026-04-13 11:49:39 -07:00
Ryan Crabbe
84d7816bc9
refactor(ui/team): extract GuardrailSettingsView and reuse across team views
Pulls the Global / Team-specific subsection rendering out of
TeamInfo.tsx into a shared GuardrailSettingsView component with
card and inline variants, used on both the team Overview tab
(inside the existing Tremor Card) and the Team Settings tab read
view. The Global subsection header now carries a GlobalOutlined
icon, and since the icon is load-bearing the edit-form chip
coloring is simplified to a single blue instead of green/blue.
2026-04-13 11:38:23 -07:00