From 4f3d5190d6621c2b3d5f2fe9b5ceb1bf3add14d5 Mon Sep 17 00:00:00 2001 From: Yuneng Jiang Date: Wed, 12 Aug 2026 13:57:09 -0700 Subject: [PATCH] refactor(ui): migrate guardrail and duration controls --- ui/litellm-dashboard/eslint-suppressions.json | 8 --- .../src/components/GuardrailSettingsView.tsx | 50 ++++++++----------- .../common_components/DurationSelect.tsx | 22 ++++++-- 3 files changed, 39 insertions(+), 41 deletions(-) diff --git a/ui/litellm-dashboard/eslint-suppressions.json b/ui/litellm-dashboard/eslint-suppressions.json index 8a86305b4cb..4d7b0d75e76 100644 --- a/ui/litellm-dashboard/eslint-suppressions.json +++ b/ui/litellm-dashboard/eslint-suppressions.json @@ -2055,9 +2055,6 @@ "src/components/GuardrailSettingsView.tsx": { "no-nested-ternary": { "count": 1 - }, - "no-restricted-imports": { - "count": 1 } }, "src/components/GuardrailsMonitor/LogViewer.tsx": { @@ -2649,11 +2646,6 @@ "count": 1 } }, - "src/components/common_components/DurationSelect.tsx": { - "no-restricted-imports": { - "count": 1 - } - }, "src/components/common_components/Filters/FilterInput.tsx": { "react-hooks/set-state-in-effect": { "count": 1 diff --git a/ui/litellm-dashboard/src/components/GuardrailSettingsView.tsx b/ui/litellm-dashboard/src/components/GuardrailSettingsView.tsx index 95957e845d9..5510eb62bdb 100644 --- a/ui/litellm-dashboard/src/components/GuardrailSettingsView.tsx +++ b/ui/litellm-dashboard/src/components/GuardrailSettingsView.tsx @@ -1,6 +1,8 @@ import React from "react"; -import { Tag } from "antd"; -import { GlobalOutlined } from "@ant-design/icons"; +import { Globe2 } from "lucide-react"; +import { Badge } from "@/components/ui/badge"; +import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; +import { cn } from "@/lib/cva.config"; interface GuardrailSettingsViewProps { globalGuardrailNames: Set; @@ -26,40 +28,36 @@ export function GuardrailSettingsView({ const isEmpty = !killSwitchOn && globalsRunning.length === 0 && nonGlobalOptIns.length === 0; const content = isEmpty ? ( - No guardrails configured + No guardrails configured ) : (
- - + + Global {killSwitchOn ? ( - Bypassed for this team + Bypassed for this team ) : globalsRunning.length > 0 ? (
{globalsRunning.map((name) => ( - - {name} - + {name} ))}
) : ( - None configured + None configured )}
- Team-specific + Team-specific {nonGlobalOptIns.length > 0 ? (
{nonGlobalOptIns.map((name) => ( - - {name} - + {name} ))}
) : ( - None configured + None configured )}
@@ -67,23 +65,19 @@ export function GuardrailSettingsView({ if (variant === "card") { return ( -
-
-
- Guardrails Settings - - Global and team-specific guardrails applied to this team - -
-
- {content} -
+ + + Guardrails Settings + Global and team-specific guardrails applied to this team + + {content} + ); } return ( -
- Guardrails Settings +
+ Guardrails Settings {content}
); diff --git a/ui/litellm-dashboard/src/components/common_components/DurationSelect.tsx b/ui/litellm-dashboard/src/components/common_components/DurationSelect.tsx index a84e8aeb110..0ac00606355 100644 --- a/ui/litellm-dashboard/src/components/common_components/DurationSelect.tsx +++ b/ui/litellm-dashboard/src/components/common_components/DurationSelect.tsx @@ -1,4 +1,4 @@ -import { Select } from "antd"; +import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"; interface DurationSelectProps { className?: string; @@ -8,10 +8,22 @@ interface DurationSelectProps { export default function DurationSelect({ className, value, onChange }: DurationSelectProps) { return ( - { + if (nextValue !== null) { + onChange?.(nextValue); + } + }} + > + + + + + Daily + Weekly + Monthly + ); }