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]

Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_hide_admin_tabs_view_only

mateo-berria4e8e0c801ca
diff --cc ui/litellm-dashboard/src/app/(dashboard)/models-and-endpoints/page.test.tsx
index a53e8167636,a504d75bb63..1871c7cbc84
--- a/ui/litellm-dashboard/src/app/(dashboard)/models-and-endpoints/page.test.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/models-and-endpoints/page.test.tsx
@@@ -105,40 -94,11 +105,40 @@@ describe("ModelsAndEndpointsPage", () =
it("hides admin-only tabs for a non-admin user", () => {
mockUseAuthorized.mockReturnValue(NON_ADMIN);
- const { queryByRole } = renderPage();
- expect(queryByRole("tab", { name: "LLM Credentials" })).not.toBeInTheDocument();
- expect(queryByRole("tab", { name: "Health Status" })).not.toBeInTheDocument();
+ renderPage();
+ expect(screen.queryByRole("tab", { name: "LLM Credentials" })).not.toBeInTheDocument();
+ expect(screen.queryByRole("tab", { name: "Health Status" })).not.toBeInTheDocument();
});
+ it("keeps the full admin tab order for a real admin", () => {
+ const { getAllByRole } = renderPage();
+ expect(getAllByRole("tab").map((tab) => tab.textContent)).toEqual([
+ "All Models",
+ "Add Model",
+ "Auto-Routers Beta",
+ "LLM Credentials",
+ "Pass-Through Endpoints",
+ "Health Status",
+ "Model Retry Settings",
+ "Model Group Alias",
+ "Model Access Group Budgets Beta",
+ "Price Data Reload",
+ ]);
+ });
+
+ it("hides the admin write-form tabs from a view-only admin, keeping the read views", () => {
+ mockUseAuthorized.mockReturnValue(VIEW_ONLY_ADMIN);
+ const { getByRole, queryByRole } = renderPage();
+ expect(getByRole("tab", { name: "All Models" })).toBeInTheDocument();
+ expect(getByRole("tab", { name: "Health Status" })).toBeInTheDocument();
+ expect(queryByRole("tab", { name: "LLM Credentials" })).not.toBeInTheDocument();
+ expect(queryByRole("tab", { name: "Pass-Through Endpoints" })).not.toBeInTheDocument();
+ expect(queryByRole("tab", { name: "Model Retry Settings" })).not.toBeInTheDocument();
+ expect(queryByRole("tab", { name: "Model Group Alias" })).not.toBeInTheDocument();
+ expect(queryByRole("tab", { name: /Model Access Group Budgets/ })).not.toBeInTheDocument();
+ expect(queryByRole("tab", { name: "Price Data Reload" })).not.toBeInTheDocument();
+ });
+
// Auto-routers are excluded from the All Models table, so this tab is their home: the only
// place in the product to list, create, edit or delete one.
describe("Auto-Routers tab", () => {