From 1d97ebdddac17eed3d504208b7481e384d98fc36 Mon Sep 17 00:00:00 2001 From: ryan Date: Mon, 14 Sep 2026 18:44:16 +0000 Subject: [PATCH 1/2] Revert "Merge pull request #40831 from BerriAI/litellm_dismissible_env_credential_banner" This reverts commit c1aaaae4e31e8c74917691acd9955a4642a0266d, reversing changes made to 55c34951e3fb8dfa92a09efc7ddbbd10a3e78a1a. --- .../EnvCredentialLoginWarningBanner.test.tsx | 18 +-------------- .../EnvCredentialLoginWarningBanner.tsx | 22 ++++--------------- 2 files changed, 5 insertions(+), 35 deletions(-) diff --git a/ui/litellm-dashboard/src/components/EnvCredentialLoginWarningBanner.test.tsx b/ui/litellm-dashboard/src/components/EnvCredentialLoginWarningBanner.test.tsx index f4c9cc7c44c..535694f14da 100644 --- a/ui/litellm-dashboard/src/components/EnvCredentialLoginWarningBanner.test.tsx +++ b/ui/litellm-dashboard/src/components/EnvCredentialLoginWarningBanner.test.tsx @@ -1,4 +1,4 @@ -import { fireEvent, renderWithProviders, screen } from "../../tests/test-utils"; +import { renderWithProviders, screen } from "../../tests/test-utils"; import { vi } from "vitest"; import { EnvCredentialLoginWarningBanner } from "./EnvCredentialLoginWarningBanner"; import type { HealthReadinessDetailsResponse } from "@/app/(dashboard)/hooks/healthReadiness/useHealthReadinessDetails"; @@ -23,22 +23,6 @@ const mockRole = (userRole: string) => { }; describe("EnvCredentialLoginWarningBanner", () => { - beforeEach(() => { - localStorage.clear(); - }); - - it("should hide the banner when dismissed and stay hidden on remount", () => { - mockRole("Admin"); - mockDetails({ status: "healthy", show_env_credential_login_warning: true }); - const first = renderWithProviders(); - fireEvent.click(screen.getByRole("button", { name: "Dismiss banner" })); - expect(first.container).toBeEmptyDOMElement(); - - first.unmount(); - const second = renderWithProviders(); - expect(second.container).toBeEmptyDOMElement(); - }); - it("should warn an admin when env-credential login is enabled", () => { mockRole("Admin"); mockDetails({ status: "healthy", show_env_credential_login_warning: true }); diff --git a/ui/litellm-dashboard/src/components/EnvCredentialLoginWarningBanner.tsx b/ui/litellm-dashboard/src/components/EnvCredentialLoginWarningBanner.tsx index a2cd531759e..3a9d50011f1 100644 --- a/ui/litellm-dashboard/src/components/EnvCredentialLoginWarningBanner.tsx +++ b/ui/litellm-dashboard/src/components/EnvCredentialLoginWarningBanner.tsx @@ -1,37 +1,26 @@ "use client"; -import React, { useState } from "react"; -import { TriangleAlert, X } from "lucide-react"; -import { Button } from "@/components/ui/button"; +import React from "react"; +import { TriangleAlert } from "lucide-react"; import { useHealthReadinessDetails } from "@/app/(dashboard)/hooks/healthReadiness/useHealthReadinessDetails"; import { useAuth } from "@/contexts/AuthContext"; import { isAdminRole } from "@/utils/roles"; -const DISMISS_STORAGE_KEY = "litellm:envCredentialLoginWarningDismissed"; - export const EnvCredentialLoginWarningBanner: React.FC<{ accessToken: string | null }> = ({ accessToken }) => { const { userRole } = useAuth(); const { data: healthData } = useHealthReadinessDetails(accessToken); - const [dismissed, setDismissed] = useState( - () => typeof window !== "undefined" && localStorage.getItem(DISMISS_STORAGE_KEY) === "true", - ); - if (dismissed || !isAdminRole(userRole) || !healthData?.show_env_credential_login_warning) { + if (!isAdminRole(userRole) || !healthData?.show_env_credential_login_warning) { return null; } - const handleDismiss = () => { - localStorage.setItem(DISMISS_STORAGE_KEY, "true"); - setDismissed(true); - }; - return (