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]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix(ui): toggle unlimited budget when its text is clicked (#37547)
yuneng-jiang94374beb6d70
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/users/_components/user_edit_view.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/users/_components/user_edit_view.test.tsxindex f1a7f5e42d0..d06267ffed6 100644--- a/ui/litellm-dashboard/src/app/(dashboard)/users/_components/user_edit_view.test.tsx+++ b/ui/litellm-dashboard/src/app/(dashboard)/users/_components/user_edit_view.test.tsx@@ -231,10 +231,25 @@ describe("UserEditView", () => {renderWithProviders(<UserEditView {...defaultProps} />);await waitFor(() => {- expect(screen.getByLabelText("Unlimited Budget")).toBeInTheDocument();+ expect(screen.getByRole("checkbox", { name: "Unlimited Budget" })).toBeInTheDocument();});});+ it("should check unlimited budget when clicking its visible text", async () => {+ renderWithProviders(<UserEditView {...defaultProps} />);++ await waitFor(() => {+ expect(screen.getByRole("spinbutton", { name: /max budget/i })).toBeEnabled();+ });++ await userEvent.click(screen.getByText("Unlimited Budget"));++ await waitFor(() => {+ expect(screen.getByRole("checkbox", { name: "Unlimited Budget" })).toBeChecked();+ });+ expect(screen.getByRole("spinbutton", { name: /max budget/i })).toBeDisabled();+ });+it("should set unlimited budget checkbox when max_budget is null", async () => {const userDataWithNullBudget = {...MOCK_USER_DATA,@@ -247,7 +262,7 @@ describe("UserEditView", () => {renderWithProviders(<UserEditView {...defaultProps} userData={userDataWithNullBudget} />);await waitFor(() => {- const checkbox = screen.getByLabelText("Unlimited Budget");+ const checkbox = screen.getByRole("checkbox", { name: "Unlimited Budget" });expect(checkbox).toBeChecked();});});@@ -282,10 +297,10 @@ describe("UserEditView", () => {renderWithProviders(<UserEditView {...defaultProps} />);await waitFor(() => {- expect(screen.getByLabelText("Unlimited Budget")).toBeInTheDocument();+ expect(screen.getByRole("checkbox", { name: "Unlimited Budget" })).toBeInTheDocument();});- const checkbox = screen.getByLabelText("Unlimited Budget");+ const checkbox = screen.getByRole("checkbox", { name: "Unlimited Budget" });await userEvent.click(checkbox);await waitFor(() => {@@ -400,7 +415,7 @@ describe("UserEditView", () => {const budgetInput = screen.getByRole("spinbutton", { name: /max budget/i });await userEvent.clear(budgetInput);- const checkbox = screen.getByLabelText("Unlimited Budget");+ const checkbox = screen.getByRole("checkbox", { name: "Unlimited Budget" });expect(checkbox).not.toBeChecked();const submitButton = screen.getByRole("button", { name: /save changes/i });@@ -416,10 +431,10 @@ describe("UserEditView", () => {renderWithProviders(<UserEditView {...defaultProps} onSubmit={onSubmitMock} />);await waitFor(() => {- expect(screen.getByLabelText("Unlimited Budget")).toBeInTheDocument();+ expect(screen.getByRole("checkbox", { name: "Unlimited Budget" })).toBeInTheDocument();});- const checkbox = screen.getByLabelText("Unlimited Budget");+ const checkbox = screen.getByRole("checkbox", { name: "Unlimited Budget" });await userEvent.click(checkbox);await waitFor(() => {@@ -494,7 +509,7 @@ describe("UserEditView", () => {renderWithProviders(<UserEditView {...defaultProps} userData={userDataWithUndefinedBudget} />);await waitFor(() => {- const checkbox = screen.getByLabelText("Unlimited Budget");+ const checkbox = screen.getByRole("checkbox", { name: "Unlimited Budget" });expect(checkbox).toBeChecked();});});diff --git a/ui/litellm-dashboard/src/app/(dashboard)/users/_components/user_edit_view.tsx b/ui/litellm-dashboard/src/app/(dashboard)/users/_components/user_edit_view.tsxindex 0aebdf69575..5612f5cd5f6 100644--- a/ui/litellm-dashboard/src/app/(dashboard)/users/_components/user_edit_view.tsx+++ b/ui/litellm-dashboard/src/app/(dashboard)/users/_components/user_edit_view.tsx@@ -256,14 +256,10 @@ export function UserEditView({label={<>Max Budget (USD)- <span className="ml-3 inline-flex items-center gap-2 font-normal">- <Checkbox- aria-label="Unlimited Budget"- checked={unlimitedBudget}- onCheckedChange={handleUnlimitedBudgetChange}- />+ <label className="ml-3 inline-flex items-center gap-2 font-normal">+ <Checkbox checked={unlimitedBudget} onCheckedChange={handleUnlimitedBudgetChange} />Unlimited Budget- </span>+ </label></>}>