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
refactor(ui): conform license banner to new eslint rules
Yuneng Jiang641396762ac8
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/hooks/license/useLicenseInfo.ts b/ui/litellm-dashboard/src/app/(dashboard)/hooks/license/useLicenseInfo.tsindex f4574c36ef6..3ea0bd20e40 100644--- a/ui/litellm-dashboard/src/app/(dashboard)/hooks/license/useLicenseInfo.ts+++ b/ui/litellm-dashboard/src/app/(dashboard)/hooks/license/useLicenseInfo.ts@@ -5,11 +5,12 @@ import { createQueryKeys } from "../common/queryKeysFactory";const licenseInfoKeys = createQueryKeys("licenseInfo");export const useLicenseInfo = (accessToken: string | null | undefined): UseQueryResult<LicenseInfo | null> => {- return useQuery<LicenseInfo | null>({+ const options = {queryKey: licenseInfoKeys.detail("license"),queryFn: () => getLicenseInfo(accessToken!),enabled: Boolean(accessToken),staleTime: 5 * 60 * 1000,retry: false,- });+ };+ return useQuery<LicenseInfo | null>(options);};diff --git a/ui/litellm-dashboard/src/components/LicenseExpiryBanner.tsx b/ui/litellm-dashboard/src/components/LicenseExpiryBanner.tsxindex e5b8a65168a..c3b20b5fac0 100644--- a/ui/litellm-dashboard/src/components/LicenseExpiryBanner.tsx+++ b/ui/litellm-dashboard/src/components/LicenseExpiryBanner.tsx@@ -29,6 +29,16 @@ const describeCountdown = (days: number): string => {return `expires in ${days} days`;};+const expiryDescription = (tier: "warning" | "critical" | "expired"): React.ReactNode => {+ if (tier === "expired") {+ return <>Enterprise features are now disabled. Reach out to {salesLink} to restore access</>;+ }+ if (tier === "critical") {+ return <>Renew now to avoid losing enterprise features. Reach out to {salesLink}</>;+ }+ return <>Renew before it lapses to keep enterprise features. Reach out to {salesLink}</>;+};+export const LicenseExpiryBannerView: React.FC<LicenseExpiryBannerViewProps> = ({ licenseInfo }) => {const [locallyDismissed, setLocallyDismissed] = useState(false);@@ -56,14 +66,7 @@ export const LicenseExpiryBannerView: React.FC<LicenseExpiryBannerViewProps> = (? `Your LiteLLM Enterprise license expired on ${formattedDate}`: `Your LiteLLM Enterprise license ${describeCountdown(days)} (${formattedDate})`;- const description =- tier === "expired" ? (- <>Enterprise features are now disabled. Reach out to {salesLink} to restore access</>- ) : tier === "critical" ? (- <>Renew now to avoid losing enterprise features. Reach out to {salesLink}</>- ) : (- <>Renew before it lapses to keep enterprise features. Reach out to {salesLink}</>- );+ const description = expiryDescription(tier);const handleClose = () => {if (typeof window !== "undefined") {diff --git a/ui/litellm-dashboard/src/utils/licenseUtils.ts b/ui/litellm-dashboard/src/utils/licenseUtils.tsindex b2681664c56..57acad85508 100644--- a/ui/litellm-dashboard/src/utils/licenseUtils.ts+++ b/ui/litellm-dashboard/src/utils/licenseUtils.ts@@ -35,15 +35,17 @@ export const getLicenseExpiryTier = (expirationDate: string | null, now: Date =return "none";};+const EXPIRY_DATE_FORMAT: Intl.DateTimeFormatOptions = {+ year: "numeric",+ month: "short",+ day: "numeric",+ timeZone: "UTC",+};+export const formatExpiryDate = (expirationDate: string): string => {const date = new Date(`${expirationDate}T00:00:00Z`);if (Number.isNaN(date.getTime())) {return expirationDate;}- return date.toLocaleDateString("en-US", {- year: "numeric",- month: "short",- day: "numeric",- timeZone: "UTC",- });+ return date.toLocaleDateString("en-US", EXPIRY_DATE_FORMAT);};