-
Guardrails Settings
+
+ Guardrails Settings
{content}
);
diff --git a/ui/litellm-dashboard/src/components/common_components/DurationSelect.test.tsx b/ui/litellm-dashboard/src/components/common_components/DurationSelect.test.tsx
index 296ef1ae632..bce1093d211 100644
--- a/ui/litellm-dashboard/src/components/common_components/DurationSelect.test.tsx
+++ b/ui/litellm-dashboard/src/components/common_components/DurationSelect.test.tsx
@@ -1,5 +1,5 @@
import { render, screen } from "@testing-library/react";
-import userEvent from "@testing-library/user-event";
+import userEvent, { PointerEventsCheckLevel } from "@testing-library/user-event";
import { describe, it, expect, vi } from "vitest";
import DurationSelect from "./DurationSelect";
@@ -19,6 +19,9 @@ describe("DurationSelect", () => {
expect(screen.getByText("Daily")).toBeInTheDocument();
expect(screen.getByText("Weekly")).toBeInTheDocument();
expect(screen.getByText("Monthly")).toBeInTheDocument();
+ const dailyLabel = screen.getByText("Daily");
+ const dailyOption = dailyLabel.closest('[role="option"]') ?? dailyLabel;
+ await user.click(dailyOption);
});
it("should apply className prop", () => {
@@ -28,14 +31,15 @@ describe("DurationSelect", () => {
});
it("should call onChange when an option is selected", async () => {
- const user = userEvent.setup();
+ const user = userEvent.setup({ pointerEventsCheck: PointerEventsCheckLevel.Never });
const onChange = vi.fn();
render(
);
const select = screen.getByRole("combobox");
await user.click(select);
- const dailyOption = screen.getByText("Daily");
+ const dailyLabel = screen.getByText("Daily");
+ const dailyOption = dailyLabel.closest('[role="option"]') ?? dailyLabel;
await user.click(dailyOption);
expect(onChange).toHaveBeenCalledWith("24h", expect.any(Object));
diff --git a/ui/litellm-dashboard/src/components/common_components/DurationSelect.tsx b/ui/litellm-dashboard/src/components/common_components/DurationSelect.tsx
index a84e8aeb110..cd5f6f4ffdc 100644
--- a/ui/litellm-dashboard/src/components/common_components/DurationSelect.tsx
+++ b/ui/litellm-dashboard/src/components/common_components/DurationSelect.tsx
@@ -1,17 +1,38 @@
-import { Select } from "antd";
+import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
interface DurationSelectProps {
className?: string;
value?: string;
- onChange?: (value: string) => void;
+ onChange?: (value: string, option: { value: string; label: string }) => void;
}
+const DURATION_OPTIONS = [
+ { value: "24h", label: "Daily" },
+ { value: "7d", label: "Weekly" },
+ { value: "30d", label: "Monthly" },
+];
+
export default function DurationSelect({ className, value, onChange }: DurationSelectProps) {
return (
-