Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix(ui): match the Team ID selector to the backend's proxy-admin-only bypass and show its placeholder

Devin AI6db76b5f3959
diff --git a/ui/litellm-dashboard/src/components/ModelInfoEditForm.tsx b/ui/litellm-dashboard/src/components/ModelInfoEditForm.tsx
index 7fa51d73b32..d76d7c88437 100644
--- a/ui/litellm-dashboard/src/components/ModelInfoEditForm.tsx
+++ b/ui/litellm-dashboard/src/components/ModelInfoEditForm.tsx
@@ -818,7 +818,7 @@ const ModelInfoEditForm: React.FC<ModelInfoEditFormProps> = ({
return (
<Select
items={items}
- value={(value as string) ?? ""}
+ value={(value as string | undefined) || null}
onValueChange={(selected: string | null) => onChange(selected ?? "")}
>
<SelectTrigger id={id} className="w-full" onBlur={onBlur}>
diff --git a/ui/litellm-dashboard/src/components/model_info_view.test.tsx b/ui/litellm-dashboard/src/components/model_info_view.test.tsx
index c5a03b0eed1..7abbcf91fc6 100644
--- a/ui/litellm-dashboard/src/components/model_info_view.test.tsx
+++ b/ui/litellm-dashboard/src/components/model_info_view.test.tsx
@@ -1668,7 +1668,19 @@ describe("ModelInfoView", () => {
expect(payload.model_info.team_id).toBe("team-2");
});
- it("only offers a team admin the teams they administer", async () => {
+ it("shows the Team ID placeholder for a model with no team", async () => {
+ mockUseTeams.mockReturnValue({
+ data: [{ team_id: "team-1", team_alias: "alpha" }],
+ isLoading: false,
+ error: null,
+ });
+ const user = userEvent.setup();
+ await enterEditMode(user);
+
+ expect(screen.getByText("Select a team")).toBeInTheDocument();
+ });
+
+ it.each(["Internal User", "Org Admin"])("only offers a %s the teams they administer", async (userRole) => {
mockUseTeams.mockReturnValue({
data: [
{ team_id: "team-1", team_alias: "alpha", members_with_roles: [{ user_id: "123", role: "admin" }] },
@@ -1685,7 +1697,7 @@ describe("ModelInfoView", () => {
mockUseModelsInfo.mockReturnValue({ data: { data: [teamModel] }, isLoading: false, error: null });
mockModelInfoV1Call.mockResolvedValue({ data: [teamModel] });
const user = userEvent.setup();
- render(<ModelInfoView {...DEFAULT_ADMIN_PROPS} userRole="Internal User" />, { wrapper });
+ render(<ModelInfoView {...DEFAULT_ADMIN_PROPS} userRole={userRole} />, { wrapper });
await user.click(await screen.findByRole("button", { name: /edit settings/i }));
await user.click(await screen.findByText("alpha (team-1)"));
diff --git a/ui/litellm-dashboard/src/utils/roles.ts b/ui/litellm-dashboard/src/utils/roles.ts
index 785f6ff78f4..bab44c29dc1 100644
--- a/ui/litellm-dashboard/src/utils/roles.ts
+++ b/ui/litellm-dashboard/src/utils/roles.ts
@@ -51,7 +51,7 @@ export const teamsUserCanAssign = (
userRole: string | null,
userID: string | null,
): Team[] | null => {
- if (teams == null || all_admin_roles.includes(userRole ?? "") || isOrgAdminSessionRole(userRole)) {
+ if (teams == null || isProxyAdminRole(userRole ?? "")) {
return teams;
}
return teams.filter((team) => isUserTeamAdminForSingleTeam(team.members_with_roles, userID ?? ""));