diff --git a/ui/litellm-dashboard/src/components/SCIM.tsx b/ui/litellm-dashboard/src/components/SCIM.tsx index 4a9260a79e..fa083c4381 100644 --- a/ui/litellm-dashboard/src/components/SCIM.tsx +++ b/ui/litellm-dashboard/src/components/SCIM.tsx @@ -21,7 +21,7 @@ import { PlusCircleOutlined } from "@ant-design/icons"; import { parseErrorMessage } from "./shared/errorUtils"; -import NotificationManager from "./molecules/notifications_manager"; +import NotificationsManager from "./molecules/notifications_manager"; interface SCIMConfigProps { accessToken: string | null; @@ -52,7 +52,7 @@ const SCIMConfig: React.FC = ({ accessToken, userID, proxySetti const handleCreateSCIMToken = async (values: any) => { if (!accessToken || !userID) { - NotificationManager.fromBackend("You need to be logged in to create a SCIM token"); + NotificationsManager.fromBackend("You need to be logged in to create a SCIM token"); return; } @@ -68,10 +68,10 @@ const SCIMConfig: React.FC = ({ accessToken, userID, proxySetti const response = await keyCreateCall(accessToken, userID, formData); setTokenData(response); - message.success("SCIM token created successfully"); + NotificationsManager.success("SCIM token created successfully"); } catch (error: any) { console.error("Error creating SCIM token:", error); - NotificationManager.fromBackend("Failed to create SCIM token: " + parseErrorMessage(error)); + NotificationsManager.fromBackend("Failed to create SCIM token: " + parseErrorMessage(error)); } finally { setIsCreatingToken(false); } @@ -112,7 +112,7 @@ const SCIMConfig: React.FC = ({ accessToken, userID, proxySetti /> message.success("URL copied to clipboard")} + onCopy={() => NotificationsManager.success("URL copied to clipboard")} > @@ -183,7 +183,7 @@ const SCIMConfig: React.FC = ({ accessToken, userID, proxySetti /> message.success("Token copied to clipboard")} + onCopy={() => NotificationsManager.success("Token copied to clipboard")} > diff --git a/ui/litellm-dashboard/src/components/SSOModals.tsx b/ui/litellm-dashboard/src/components/SSOModals.tsx index 24984774d6..4920cec03b 100644 --- a/ui/litellm-dashboard/src/components/SSOModals.tsx +++ b/ui/litellm-dashboard/src/components/SSOModals.tsx @@ -2,7 +2,7 @@ import React, { useEffect, useState } from "react"; import { Modal, Form, Input, Button as Button2, Select, message } from "antd"; import { Text, TextInput } from "@tremor/react"; import { getSSOSettings, updateSSOSettings } from "./networking"; -import NotificationManager from "./molecules/notifications_manager"; +import NotificationsManager from "./molecules/notifications_manager"; interface SSOModalsProps { isAddSSOModalVisible: boolean; @@ -162,7 +162,7 @@ const SSOModals: React.FC = ({ // Enhanced form submission handler const handleFormSubmit = async (formValues: Record) => { if (!accessToken) { - NotificationManager.fromBackend("No access token available"); + NotificationsManager.fromBackend("No access token available"); return; } @@ -174,14 +174,14 @@ const SSOModals: React.FC = ({ handleShowInstructions(formValues); } catch (error) { console.error("Failed to save SSO settings:", error); - NotificationManager.fromBackend("Failed to save SSO settings"); + NotificationsManager.fromBackend("Failed to save SSO settings"); } }; // Handle clearing SSO settings const handleClearSSO = async () => { if (!accessToken) { - NotificationManager.fromBackend("No access token available"); + NotificationsManager.fromBackend("No access token available"); return; } @@ -214,10 +214,10 @@ const SSOModals: React.FC = ({ // Close the main SSO modal and trigger refresh handleAddSSOOk(); - message.success("SSO settings cleared successfully"); + NotificationsManager.success("SSO settings cleared successfully"); } catch (error) { console.error("Failed to clear SSO settings:", error); - NotificationManager.fromBackend("Failed to clear SSO settings"); + NotificationsManager.fromBackend("Failed to clear SSO settings"); } }; diff --git a/ui/litellm-dashboard/src/components/TeamSSOSettings.tsx b/ui/litellm-dashboard/src/components/TeamSSOSettings.tsx index 3c62f0b67e..79f02d93f1 100644 --- a/ui/litellm-dashboard/src/components/TeamSSOSettings.tsx +++ b/ui/litellm-dashboard/src/components/TeamSSOSettings.tsx @@ -4,7 +4,7 @@ import { Typography, Spin, message, Switch, Select, Form } from "antd"; import { getDefaultTeamSettings, updateDefaultTeamSettings, modelAvailableCall } from "./networking"; import BudgetDurationDropdown, { getBudgetDurationLabel } from "./common_components/budget_duration_dropdown"; import { getModelDisplayName } from "./key_team_helpers/fetch_available_models_team_key"; -import NotificationManager from "./molecules/notifications_manager"; +import NotificationsManager from "./molecules/notifications_manager"; interface TeamSSOSettingsProps { accessToken: string | null; @@ -48,7 +48,7 @@ const TeamSSOSettings: React.FC = ({ accessToken, userID, } } catch (error) { console.error("Error fetching team SSO settings:", error); - NotificationManager.fromBackend("Failed to fetch team settings"); + NotificationsManager.fromBackend("Failed to fetch team settings"); } finally { setLoading(false); } @@ -65,10 +65,10 @@ const TeamSSOSettings: React.FC = ({ accessToken, userID, const updatedSettings = await updateDefaultTeamSettings(accessToken, editedValues); setSettings({...settings, values: updatedSettings.settings}); setIsEditing(false); - message.success("Default team settings updated successfully"); + NotificationsManager.success("Default team settings updated successfully"); } catch (error) { console.error("Error updating team settings:", error); - NotificationManager.fromBackend("Failed to update team settings"); + NotificationsManager.fromBackend("Failed to update team settings"); } finally { setSaving(false); } diff --git a/ui/litellm-dashboard/src/components/add_model/model_connection_test.tsx b/ui/litellm-dashboard/src/components/add_model/model_connection_test.tsx index d6263c4702..79b354ed51 100644 --- a/ui/litellm-dashboard/src/components/add_model/model_connection_test.tsx +++ b/ui/litellm-dashboard/src/components/add_model/model_connection_test.tsx @@ -3,7 +3,7 @@ import { Typography, Space, Button, Divider, message } from 'antd'; import { WarningOutlined, InfoCircleOutlined, CopyOutlined } from '@ant-design/icons'; import { testConnectionRequest } from "../networking"; import { prepareModelAddRequest } from "./handle_add_model_submit"; - +import NotificationsManager from '../molecules/notifications_manager'; const { Text } = Typography; interface ModelConnectionTestProps { @@ -59,7 +59,7 @@ const ModelConnectionTest: React.FC = ({ const response = await testConnectionRequest(accessToken, litellmParamsObj, modelInfoObj?.mode); if (response.status === "success") { - message.success("Connection test successful!"); + NotificationsManager.success("Connection test successful!"); setError(null); setIsSuccess(true); } else { @@ -231,7 +231,7 @@ ${formattedBody} icon={} onClick={() => { navigator.clipboard.writeText(curlCommand || ''); - message.success('Copied to clipboard'); + NotificationsManager.success('Copied to clipboard'); }} > Copy to Clipboard diff --git a/ui/litellm-dashboard/src/components/add_pass_through.tsx b/ui/litellm-dashboard/src/components/add_pass_through.tsx index 21f828e26d..1f4159424c 100644 --- a/ui/litellm-dashboard/src/components/add_pass_through.tsx +++ b/ui/litellm-dashboard/src/components/add_pass_through.tsx @@ -28,7 +28,7 @@ import { list } from "postcss"; import KeyValueInput from "./key_value_input"; import { passThroughItem } from "./pass_through_settings"; import RoutePreview from "./route_preview"; -import NotificationManager from "./molecules/notifications_manager"; +import NotificationsManager from "./molecules/notifications_manager"; const { Option } = Select2; interface AddFallbacksProps { @@ -81,14 +81,14 @@ const AddPassThroughEndpoint: React.FC = ({ const updatedPassThroughSettings = [...passThroughItems, createdEndpoint] setPassThroughItems(updatedPassThroughSettings) - message.success("Pass-through endpoint created successfully"); + NotificationsManager.success("Pass-through endpoint created successfully"); form.resetFields(); setPathValue(""); setTargetValue(""); setIncludeSubpath(true); setIsModalVisible(false); } catch (error) { - NotificationManager.fromBackend("Error creating pass-through endpoint: " + error); + NotificationsManager.fromBackend("Error creating pass-through endpoint: " + error); } finally { setIsLoading(false); } @@ -96,7 +96,7 @@ const AddPassThroughEndpoint: React.FC = ({ const copyToClipboard = (text: string) => { navigator.clipboard.writeText(text); - message.success('Copied to clipboard!'); + NotificationsManager.success('Copied to clipboard!'); }; diff --git a/ui/litellm-dashboard/src/components/admins.tsx b/ui/litellm-dashboard/src/components/admins.tsx index ef6f49900a..0d93b3645e 100644 --- a/ui/litellm-dashboard/src/components/admins.tsx +++ b/ui/litellm-dashboard/src/components/admins.tsx @@ -46,7 +46,7 @@ import { ssoProviderConfigs } from './SSOModals'; import SCIMConfig from "./SCIM"; import UIAccessControlForm from "./UIAccessControlForm"; import UsefulLinksManagement from "./useful_links_management"; -import NotificationManager from "./molecules/notifications_manager"; +import NotificationsManager from "./molecules/notifications_manager"; interface AdminPanelProps { searchParams: any; @@ -151,7 +151,7 @@ const AdminPanel: React.FC = ({ const handleShowAllowedIPs = async () => { try { if (premiumUser !== true) { - NotificationManager.fromBackend( + NotificationsManager.fromBackend( "This feature is only available for premium users. Please upgrade your account." ) return @@ -164,7 +164,7 @@ const AdminPanel: React.FC = ({ } } catch (error) { console.error("Error fetching allowed IPs:", error); - NotificationManager.fromBackend(`Failed to fetch allowed IPs ${error}`); + NotificationsManager.fromBackend(`Failed to fetch allowed IPs ${error}`); setAllowedIPs([all_ip_address_allowed]); } finally { if (premiumUser === true) { @@ -180,11 +180,11 @@ const AdminPanel: React.FC = ({ // Fetch the updated list of IPs const updatedIPs = await getAllowedIPs(accessToken); setAllowedIPs(updatedIPs); - message.success('IP address added successfully'); + NotificationsManager.success('IP address added successfully'); } } catch (error) { console.error("Error adding IP:", error); - NotificationManager.fromBackend(`Failed to add IP address ${error}`); + NotificationsManager.fromBackend(`Failed to add IP address ${error}`); } finally { setIsAddIPModalVisible(false); } @@ -202,10 +202,10 @@ const AdminPanel: React.FC = ({ // Fetch the updated list of IPs const updatedIPs = await getAllowedIPs(accessToken); setAllowedIPs(updatedIPs.length > 0 ? updatedIPs : [all_ip_address_allowed]); - message.success('IP address deleted successfully'); + NotificationsManager.success('IP address deleted successfully'); } catch (error) { console.error("Error deleting IP:", error); - NotificationManager.fromBackend(`Failed to delete IP address ${error}`); + NotificationsManager.fromBackend(`Failed to delete IP address ${error}`); } finally { setIsDeleteIPModalVisible(false); setIPToDelete(null); @@ -426,7 +426,7 @@ const AdminPanel: React.FC = ({ const handleMemberUpdate = async (formValues: Record) => { try { if (accessToken != null && admins != null) { - message.info("Making API Call"); + NotificationsManager.info("Making API Call"); const response: any = await userUpdateUserCall( accessToken, formValues, @@ -447,7 +447,7 @@ const AdminPanel: React.FC = ({ // If new user is found, update it setAdmins(admins); // Set the new state } - message.success("Refresh tab to see updated user role"); + NotificationsManager.success("Refresh tab to see updated user role"); setIsUpdateModalModalVisible(false); } } catch (error) { @@ -458,7 +458,7 @@ const AdminPanel: React.FC = ({ const handleMemberCreate = async (formValues: Record) => { try { if (accessToken != null && admins != null) { - message.info("Making API Call"); + NotificationsManager.info("Making API Call"); const response: any = await userUpdateUserCall( accessToken, formValues, @@ -497,7 +497,7 @@ const AdminPanel: React.FC = ({ const handleAdminCreate = async (formValues: Record) => { try { if (accessToken != null && admins != null) { - message.info("Making API Call"); + NotificationsManager.info("Making API Call"); const user_role: Member = { role: "user", user_email: formValues.user_email, @@ -565,7 +565,7 @@ const AdminPanel: React.FC = ({
@@ -581,7 +581,7 @@ const AdminPanel: React.FC = ({
@@ -691,7 +691,7 @@ const AdminPanel: React.FC = ({ accessToken={accessToken} onSuccess={() => { handleUIAccessControlOk(); - message.success("UI Access Control settings updated successfully"); + NotificationsManager.success("UI Access Control settings updated successfully"); }} /> diff --git a/ui/litellm-dashboard/src/components/alerting/alerting_settings.tsx b/ui/litellm-dashboard/src/components/alerting/alerting_settings.tsx index 1d0ec677d9..1ce5a9f564 100644 --- a/ui/litellm-dashboard/src/components/alerting/alerting_settings.tsx +++ b/ui/litellm-dashboard/src/components/alerting/alerting_settings.tsx @@ -18,6 +18,7 @@ import { InputNumber, message } from "antd"; import { alertingSettingsCall, updateConfigFieldSetting } from "../networking"; import { TrashIcon, CheckCircleIcon } from "@heroicons/react/outline"; import DynamicForm from "./dynamic_form"; +import NotificationsManager from "../molecules/notifications_manager"; interface alertingSettingsItem { field_name: string; field_type: string; @@ -96,7 +97,7 @@ const AlertingSettings: React.FC = ({ } } // update value in state - message.success("Wait 10s for proxy to update."); + NotificationsManager.success("Wait 10s for proxy to update."); } catch (error) { // do something } diff --git a/ui/litellm-dashboard/src/components/budgets/budget_modal.tsx b/ui/litellm-dashboard/src/components/budgets/budget_modal.tsx index 31eb650420..69308eec93 100644 --- a/ui/litellm-dashboard/src/components/budgets/budget_modal.tsx +++ b/ui/litellm-dashboard/src/components/budgets/budget_modal.tsx @@ -18,7 +18,7 @@ import { message, } from "antd"; import { budgetCreateCall } from "../networking"; -import NotificationManager from "../molecules/notifications_manager"; +import NotificationsManager from "../molecules/notifications_manager"; interface BudgetModalProps { isModalVisible: boolean; @@ -48,18 +48,18 @@ const BudgetModal: React.FC = ({ return; } try { - message.info("Making API Call"); + NotificationsManager.info("Making API Call"); // setIsModalVisible(true); const response = await budgetCreateCall(accessToken, formValues); console.log("key create Response:", response); setBudgetList((prevData) => prevData ? [...prevData, response] : [response] ); // Check if prevData is null - message.success("Budget Created"); + NotificationsManager.success("Budget Created"); form.resetFields(); } catch (error) { console.error("Error creating the key:", error); - NotificationManager.fromBackend(`Error creating the key: ${error}`); + NotificationsManager.fromBackend(`Error creating the key: ${error}`); } }; diff --git a/ui/litellm-dashboard/src/components/budgets/budget_panel.tsx b/ui/litellm-dashboard/src/components/budgets/budget_panel.tsx index 604134575d..ad6cef9a83 100644 --- a/ui/litellm-dashboard/src/components/budgets/budget_panel.tsx +++ b/ui/litellm-dashboard/src/components/budgets/budget_panel.tsx @@ -39,7 +39,8 @@ import { } from "@heroicons/react/outline"; import { Prism as SyntaxHighlighter } from "react-syntax-highlighter"; import { getBudgetList, budgetDeleteCall } from "../networking"; -import { message } from "antd"; +import NotificationsManager from "../molecules/notifications_manager"; + interface BudgetSettingsPageProps { accessToken: string | null; } @@ -84,7 +85,7 @@ const BudgetPanel: React.FC = ({ accessToken }) => { return; } - message.info("Request made"); + NotificationsManager.info("Request made"); await budgetDeleteCall(accessToken, budget_id); @@ -92,7 +93,7 @@ const BudgetPanel: React.FC = ({ accessToken }) => { newBudgetList.splice(index, 1); setBudgetList(newBudgetList); - message.success("Budget Deleted."); + NotificationsManager.success("Budget Deleted."); }; const handleUpdateCall = async () => { diff --git a/ui/litellm-dashboard/src/components/budgets/edit_budget_modal.tsx b/ui/litellm-dashboard/src/components/budgets/edit_budget_modal.tsx index 37df33e8a4..f70f679bcd 100644 --- a/ui/litellm-dashboard/src/components/budgets/edit_budget_modal.tsx +++ b/ui/litellm-dashboard/src/components/budgets/edit_budget_modal.tsx @@ -19,7 +19,7 @@ import { } from "antd"; import { budgetUpdateCall } from "../networking"; import { budgetItem } from "./budget_panel"; -import NotificationManager from "../molecules/notifications_manager"; +import NotificationsManager from "../molecules/notifications_manager"; interface BudgetModalProps { isModalVisible: boolean; @@ -59,18 +59,18 @@ const EditBudgetModal: React.FC = ({ return; } try { - message.info("Making API Call"); + NotificationsManager.info("Making API Call"); setIsModalVisible(true); const response = await budgetUpdateCall(accessToken, formValues); setBudgetList((prevData) => prevData ? [...prevData, response] : [response] ); // Check if prevData is null - message.success("Budget Updated"); + NotificationsManager.success("Budget Updated"); form.resetFields(); handleUpdateCall(); } catch (error) { console.error("Error creating the key:", error); - NotificationManager.fromBackend(`Error creating the key: ${error}`); + NotificationsManager.fromBackend(`Error creating the key: ${error}`); } }; diff --git a/ui/litellm-dashboard/src/components/bulk_create_users_button.tsx b/ui/litellm-dashboard/src/components/bulk_create_users_button.tsx index f98b175bec..1663719011 100644 --- a/ui/litellm-dashboard/src/components/bulk_create_users_button.tsx +++ b/ui/litellm-dashboard/src/components/bulk_create_users_button.tsx @@ -14,7 +14,7 @@ import Papa from "papaparse" import { CheckCircleIcon, XCircleIcon, ExclamationIcon } from "@heroicons/react/outline" import { CopyToClipboard } from "react-copy-to-clipboard" import { InvitationLink } from "./onboarding_link" -import NotificationManager from "./molecules/notifications_manager" +import NotificationsManager from "./molecules/notifications_manager" interface BulkCreateUsersProps { accessToken: string @@ -111,7 +111,7 @@ const BulkCreateUsersButton: React.FC = ({ // Check file type if (file.type !== "text/csv" && !file.name.endsWith(".csv")) { setFileError(`Invalid file type: ${file.name}. Please upload a CSV file (.csv extension).`) - NotificationManager.fromBackend("Invalid file type. Please upload a CSV file.") + NotificationsManager.fromBackend("Invalid file type. Please upload a CSV file.") return false } @@ -265,7 +265,7 @@ const BulkCreateUsersButton: React.FC = ({ `Found ${userData.length - validData.length} row(s) with errors out of ${userData.length} total rows. Please correct them before proceeding.`, ) } else { - message.success(`Successfully parsed ${validData.length} users`) + NotificationsManager.success(`Successfully parsed ${validData.length} users`) } } catch (error: unknown) { const errorMessage = error instanceof Error ? error.message : "Unknown error" @@ -514,7 +514,7 @@ const BulkCreateUsersButton: React.FC = ({ {record.invitation_link} message.success("Invitation link copied!")} + onCopy={() => NotificationsManager.success("Invitation link copied!")} > diff --git a/ui/litellm-dashboard/src/components/bulk_edit_user.tsx b/ui/litellm-dashboard/src/components/bulk_edit_user.tsx index 25b70b9f49..cfe4a29723 100644 --- a/ui/litellm-dashboard/src/components/bulk_edit_user.tsx +++ b/ui/litellm-dashboard/src/components/bulk_edit_user.tsx @@ -16,7 +16,7 @@ import { import { Button } from '@tremor/react'; import { userBulkUpdateUserCall, teamBulkMemberAddCall, Member } from "./networking"; import { UserEditView } from "./user_edit_view"; -import NotificationManager from "./molecules/notifications_manager"; +import NotificationsManager from "./molecules/notifications_manager"; const { Text, Title } = Typography; @@ -81,7 +81,7 @@ const BulkEditUserModal: React.FC = ({ const handleSubmit = async (formValues: any) => { console.log("formValues", formValues); if (!accessToken) { - NotificationManager.fromBackend("Access token not found"); + NotificationsManager.fromBackend("Access token not found"); return; } @@ -117,7 +117,7 @@ const BulkEditUserModal: React.FC = ({ const hasTeamAdditions = addToTeams && selectedTeams.length > 0; if (!hasUserUpdates && !hasTeamAdditions) { - NotificationManager.fromBackend("Please modify at least one field or select teams to add users to"); + NotificationsManager.fromBackend("Please modify at least one field or select teams to add users to"); return; } @@ -193,7 +193,7 @@ const BulkEditUserModal: React.FC = ({ } if (successMessages.length > 0) { - message.success(successMessages.join('. ')); + NotificationsManager.success(successMessages.join('. ')); } // Reset team management state @@ -206,7 +206,7 @@ const BulkEditUserModal: React.FC = ({ onCancel(); } catch (error) { console.error("Bulk operation failed:", error); - NotificationManager.fromBackend("Failed to perform bulk operations"); + NotificationsManager.fromBackend("Failed to perform bulk operations"); } finally { setLoading(false); } diff --git a/ui/litellm-dashboard/src/components/cache_dashboard.tsx b/ui/litellm-dashboard/src/components/cache_dashboard.tsx index 2db37622d9..5c58bd3927 100644 --- a/ui/litellm-dashboard/src/components/cache_dashboard.tsx +++ b/ui/litellm-dashboard/src/components/cache_dashboard.tsx @@ -23,6 +23,7 @@ import { Text, } from "@tremor/react"; import UsageDatePicker from "./shared/usage_date_picker"; +import NotificationsManager from "./molecules/notifications_manager"; import { Button as Button2, @@ -265,7 +266,7 @@ const handleRefreshClick = () => { const runCachingHealthCheck = async () => { try { - message.info("Running cache health check..."); + NotificationsManager.info("Running cache health check..."); setHealthCheckResponse(""); const response = await cachingHealthCheckCall(accessToken !== null ? accessToken : ""); console.log("CACHING HEALTH CHECK RESPONSE", response); diff --git a/ui/litellm-dashboard/src/components/chat_ui.tsx b/ui/litellm-dashboard/src/components/chat_ui.tsx index 22e9f0149d..19029a01f1 100644 --- a/ui/litellm-dashboard/src/components/chat_ui.tsx +++ b/ui/litellm-dashboard/src/components/chat_ui.tsx @@ -72,7 +72,7 @@ import { FilePdfOutlined, ArrowUpOutlined } from "@ant-design/icons"; -import NotificationManager from "./molecules/notifications_manager"; +import NotificationsManager from "./molecules/notifications_manager"; const { TextArea } = Input; const { Dragger } = Upload; @@ -463,7 +463,7 @@ const ChatUI: React.FC = ({ abortControllerRef.current.abort(); abortControllerRef.current = null; setIsLoading(false); - message.info("Request cancelled"); + NotificationsManager.info("Request cancelled"); } }; @@ -517,7 +517,7 @@ const ChatUI: React.FC = ({ // For image edits, require both image and prompt if (endpointType === EndpointType.IMAGE_EDITS && !uploadedImage) { - NotificationManager.fromBackend("Please upload an image for editing"); + NotificationsManager.fromBackend("Please upload an image for editing"); return; } @@ -528,7 +528,7 @@ const ChatUI: React.FC = ({ const effectiveApiKey = apiKeySource === 'session' ? accessToken : apiKey; if (!effectiveApiKey) { - NotificationManager.fromBackend("Please provide an API key or select Current UI Session"); + NotificationsManager.fromBackend("Please provide an API key or select Current UI Session"); return; } @@ -544,7 +544,7 @@ const ChatUI: React.FC = ({ try { newUserMessage = await createMultimodalMessage(inputMessage, responsesUploadedImage); } catch (error) { - NotificationManager.fromBackend("Failed to process image. Please try again."); + NotificationsManager.fromBackend("Failed to process image. Please try again."); return; } } @@ -553,7 +553,7 @@ const ChatUI: React.FC = ({ try { newUserMessage = await createChatMultimodalMessage(inputMessage, chatUploadedImage); } catch (error) { - NotificationManager.fromBackend("Failed to process image. Please try again."); + NotificationsManager.fromBackend("Failed to process image. Please try again."); return; } } else { @@ -714,7 +714,7 @@ const ChatUI: React.FC = ({ sessionStorage.removeItem('chatHistory'); sessionStorage.removeItem('messageTraceId'); sessionStorage.removeItem('responsesSessionId'); - message.success("Chat history cleared."); + NotificationsManager.success("Chat history cleared."); }; if (userRole && userRole === "Admin Viewer") { @@ -1273,7 +1273,7 @@ const ChatUI: React.FC = ({
diff --git a/ui/litellm-dashboard/src/components/ui_theme_settings.tsx b/ui/litellm-dashboard/src/components/ui_theme_settings.tsx index bcc09a36ba..fabe482d62 100644 --- a/ui/litellm-dashboard/src/components/ui_theme_settings.tsx +++ b/ui/litellm-dashboard/src/components/ui_theme_settings.tsx @@ -9,7 +9,7 @@ import { import { message } from "antd" import { useTheme } from "@/contexts/ThemeContext" import { getProxyBaseUrl } from "@/components/networking" -import NotificationManager from "./molecules/notifications_manager"; +import NotificationsManager from "./molecules/notifications_manager"; interface UIThemeSettingsProps { userID: string | null; @@ -73,14 +73,14 @@ const UIThemeSettings: React.FC = ({ }); if (response.ok) { - message.success("Logo settings updated successfully!"); + NotificationsManager.success("Logo settings updated successfully!"); setLogoUrl(logoUrlInput || null); } else { throw new Error("Failed to update settings"); } } catch (error) { console.error("Error updating logo settings:", error); - NotificationManager.fromBackend("Failed to update logo settings"); + NotificationsManager.fromBackend("Failed to update logo settings"); } finally { setLoading(false); } @@ -107,13 +107,13 @@ const UIThemeSettings: React.FC = ({ }); if (response.ok) { - message.success("Logo reset to default!"); + NotificationsManager.success("Logo reset to default!"); } else { throw new Error("Failed to reset logo"); } } catch (error) { console.error("Error resetting logo:", error); - NotificationManager.fromBackend("Failed to reset logo"); + NotificationsManager.fromBackend("Failed to reset logo"); } finally { setLoading(false); } diff --git a/ui/litellm-dashboard/src/components/useful_links_management.tsx b/ui/litellm-dashboard/src/components/useful_links_management.tsx index 5e7e4d6fac..929560885a 100644 --- a/ui/litellm-dashboard/src/components/useful_links_management.tsx +++ b/ui/litellm-dashboard/src/components/useful_links_management.tsx @@ -14,7 +14,7 @@ import { TableRow, TableCell } from "@tremor/react"; -import NotificationManager from "./molecules/notifications_manager"; +import NotificationsManager from "./molecules/notifications_manager"; interface UsefulLinksManagementProps { accessToken: string | null; @@ -118,7 +118,7 @@ const UsefulLinksManagement: React.FC = ({ return true; } catch (error) { console.error("Error saving links:", error); - NotificationManager.fromBackend(`Failed to save links - ${error}`); + NotificationsManager.fromBackend(`Failed to save links - ${error}`); return false; } }; @@ -130,13 +130,13 @@ const UsefulLinksManagement: React.FC = ({ try { new URL(newLink.url); } catch { - NotificationManager.fromBackend("Please enter a valid URL"); + NotificationsManager.fromBackend("Please enter a valid URL"); return; } // Check for duplicate display names if (links.some(link => link.displayName === newLink.displayName)) { - NotificationManager.fromBackend("A link with this display name already exists"); + NotificationsManager.fromBackend("A link with this display name already exists"); return; } @@ -151,7 +151,7 @@ const UsefulLinksManagement: React.FC = ({ if (await saveLinksToBackend(updatedLinks)) { setLinks(updatedLinks); setNewLink({ url: "", displayName: "" }); - message.success("Link added successfully"); + NotificationsManager.success("Link added successfully"); } }; @@ -166,13 +166,13 @@ const UsefulLinksManagement: React.FC = ({ try { new URL(editingLink.url); } catch { - NotificationManager.fromBackend("Please enter a valid URL"); + NotificationsManager.fromBackend("Please enter a valid URL"); return; } // Check for duplicate display names (excluding current link) if (links.some(link => link.id !== editingLink.id && link.displayName === editingLink.displayName)) { - NotificationManager.fromBackend("A link with this display name already exists"); + NotificationsManager.fromBackend("A link with this display name already exists"); return; } @@ -183,7 +183,7 @@ const UsefulLinksManagement: React.FC = ({ if (await saveLinksToBackend(updatedLinks)) { setLinks(updatedLinks); setEditingLink(null); - message.success("Link updated successfully"); + NotificationsManager.success("Link updated successfully"); } }; @@ -196,7 +196,7 @@ const UsefulLinksManagement: React.FC = ({ if (await saveLinksToBackend(updatedLinks)) { setLinks(updatedLinks); - message.success("Link deleted successfully"); + NotificationsManager.success("Link deleted successfully"); } }; diff --git a/ui/litellm-dashboard/src/components/vector_store_management/VectorStoreForm.tsx b/ui/litellm-dashboard/src/components/vector_store_management/VectorStoreForm.tsx index bf0687c9e5..6e695d08e5 100644 --- a/ui/litellm-dashboard/src/components/vector_store_management/VectorStoreForm.tsx +++ b/ui/litellm-dashboard/src/components/vector_store_management/VectorStoreForm.tsx @@ -17,7 +17,7 @@ import { import { InfoCircleOutlined } from '@ant-design/icons'; import { CredentialItem, vectorStoreCreateCall } from "../networking"; import { VectorStoreProviders, vectorStoreProviderLogoMap, vectorStoreProviderMap, getProviderSpecificFields, VectorStoreFieldConfig } from "../vector_store_providers"; -import NotificationManager from "../molecules/notifications_manager"; +import NotificationsManager from "../molecules/notifications_manager"; interface VectorStoreFormProps { isVisible: boolean; @@ -46,7 +46,7 @@ const VectorStoreForm: React.FC = ({ try { metadata = metadataJson.trim() ? JSON.parse(metadataJson) : {}; } catch (e) { - NotificationManager.fromBackend("Invalid JSON in metadata field"); + NotificationsManager.fromBackend("Invalid JSON in metadata field"); return; } @@ -70,13 +70,13 @@ const VectorStoreForm: React.FC = ({ payload["litellm_params"] = litellmParams; await vectorStoreCreateCall(accessToken, payload); - message.success("Vector store created successfully"); + NotificationsManager.success("Vector store created successfully"); form.resetFields(); setMetadataJson("{}"); onSuccess(); } catch (error) { console.error("Error creating vector store:", error); - NotificationManager.fromBackend("Error creating vector store: " + error); + NotificationsManager.fromBackend("Error creating vector store: " + error); } }; diff --git a/ui/litellm-dashboard/src/components/vector_store_management/VectorStoreTester.tsx b/ui/litellm-dashboard/src/components/vector_store_management/VectorStoreTester.tsx index b066cfc4eb..0e263bc2f2 100644 --- a/ui/litellm-dashboard/src/components/vector_store_management/VectorStoreTester.tsx +++ b/ui/litellm-dashboard/src/components/vector_store_management/VectorStoreTester.tsx @@ -2,7 +2,7 @@ import React, { useState } from "react"; import { Button, Input, Card, Typography, Spin, message, Divider } from "antd"; import { SendOutlined, DatabaseOutlined, LoadingOutlined, DownOutlined, RightOutlined } from "@ant-design/icons"; import { vectorStoreSearchCall } from "../networking"; -import NotificationManager from "../molecules/notifications_manager"; +import NotificationsManager from "../molecules/notifications_manager"; const { TextArea } = Input; const { Text, Title } = Typography; @@ -67,7 +67,7 @@ export const VectorStoreTester: React.FC = ({ setQuery(""); } catch (error) { console.error("Error searching vector store:", error); - NotificationManager.fromBackend("Failed to search vector store"); + NotificationsManager.fromBackend("Failed to search vector store"); } finally { setIsLoading(false); } @@ -87,7 +87,7 @@ export const VectorStoreTester: React.FC = ({ const clearHistory = () => { setSearchHistory([]); setExpandedResults({}); - message.success("Search history cleared"); + NotificationsManager.success("Search history cleared"); }; const toggleResultExpansion = (historyIndex: number, resultIndex: number) => { diff --git a/ui/litellm-dashboard/src/components/vector_store_management/index.tsx b/ui/litellm-dashboard/src/components/vector_store_management/index.tsx index 18fa8c24bd..db1fe5c6b9 100644 --- a/ui/litellm-dashboard/src/components/vector_store_management/index.tsx +++ b/ui/litellm-dashboard/src/components/vector_store_management/index.tsx @@ -19,7 +19,7 @@ import VectorStoreForm from "./VectorStoreForm"; import DeleteModal from "./DeleteModal"; import VectorStoreInfoView from "./vector_store_info"; import { isAdminRole } from "@/utils/roles"; -import NotificationManager from "../molecules/notifications_manager"; +import NotificationsManager from "../molecules/notifications_manager"; interface VectorStoreProps { accessToken: string | null; @@ -49,7 +49,7 @@ const VectorStoreManagement: React.FC = ({ setVectorStores(response.data || []); } catch (error) { console.error("Error fetching vector stores:", error); - NotificationManager.fromBackend("Error fetching vector stores: " + error); + NotificationsManager.fromBackend("Error fetching vector stores: " + error); } }; @@ -61,7 +61,7 @@ const VectorStoreManagement: React.FC = ({ setCredentials(response.credentials || []); } catch (error) { console.error("Error fetching credentials:", error); - NotificationManager.fromBackend("Error fetching credentials: " + error); + NotificationsManager.fromBackend("Error fetching credentials: " + error); } }; @@ -97,11 +97,11 @@ const VectorStoreManagement: React.FC = ({ if (!accessToken || !vectorStoreToDelete) return; try { await vectorStoreDeleteCall(accessToken, vectorStoreToDelete); - message.success("Vector store deleted successfully"); + NotificationsManager.success("Vector store deleted successfully"); fetchVectorStores(); } catch (error) { console.error("Error deleting vector store:", error); - NotificationManager.fromBackend("Error deleting vector store: " + error); + NotificationsManager.fromBackend("Error deleting vector store: " + error); } setIsDeleteModalOpen(false); setVectorStoreToDelete(null); diff --git a/ui/litellm-dashboard/src/components/vector_store_management/vector_store_info.tsx b/ui/litellm-dashboard/src/components/vector_store_management/vector_store_info.tsx index f7c34679b7..4bc6aafc51 100644 --- a/ui/litellm-dashboard/src/components/vector_store_management/vector_store_info.tsx +++ b/ui/litellm-dashboard/src/components/vector_store_management/vector_store_info.tsx @@ -25,7 +25,7 @@ import { vectorStoreInfoCall, vectorStoreUpdateCall, credentialListCall, Credent import { VectorStore } from "./types"; import { Providers, providerLogoMap, provider_map } from "../provider_info_helpers"; import VectorStoreTester from "./VectorStoreTester"; -import NotificationManager from "../molecules/notifications_manager"; +import NotificationsManager from "../molecules/notifications_manager"; interface VectorStoreInfoViewProps { vectorStoreId: string; @@ -75,7 +75,7 @@ const VectorStoreInfoView: React.FC = ({ } } catch (error) { console.error("Error fetching vector store details:", error); - NotificationManager.fromBackend("Error fetching vector store details: " + error); + NotificationsManager.fromBackend("Error fetching vector store details: " + error); } }; @@ -103,7 +103,7 @@ const VectorStoreInfoView: React.FC = ({ try { metadata = metadataString ? JSON.parse(metadataString) : {}; } catch (e) { - NotificationManager.fromBackend("Invalid JSON in metadata field"); + NotificationsManager.fromBackend("Invalid JSON in metadata field"); return; } @@ -116,12 +116,12 @@ const VectorStoreInfoView: React.FC = ({ }; await vectorStoreUpdateCall(accessToken, updateData); - message.success("Vector store updated successfully"); + NotificationsManager.success("Vector store updated successfully"); setIsEditing(false); fetchVectorStoreDetails(); } catch (error) { console.error("Error updating vector store:", error); - NotificationManager.fromBackend("Error updating vector store: " + error); + NotificationsManager.fromBackend("Error updating vector store: " + error); } }; diff --git a/ui/litellm-dashboard/src/components/view_logs/RequestResponsePanel.tsx b/ui/litellm-dashboard/src/components/view_logs/RequestResponsePanel.tsx index 939c0ce62f..4aaaabba58 100644 --- a/ui/litellm-dashboard/src/components/view_logs/RequestResponsePanel.tsx +++ b/ui/litellm-dashboard/src/components/view_logs/RequestResponsePanel.tsx @@ -1,6 +1,6 @@ import { LogEntry } from "./columns"; import { message } from "antd"; -import NotificationManager from "../molecules/notifications_manager"; +import NotificationsManager from "../molecules/notifications_manager"; interface RequestResponsePanelProps { row: { @@ -56,18 +56,18 @@ export function RequestResponsePanel({ const handleCopyRequest = async () => { const success = await copyToClipboard(JSON.stringify(getRawRequest(), null, 2)); if (success) { - message.success('Request copied to clipboard'); + NotificationsManager.success('Request copied to clipboard'); } else { - NotificationManager.fromBackend('Failed to copy request'); + NotificationsManager.fromBackend('Failed to copy request'); } }; const handleCopyResponse = async () => { const success = await copyToClipboard(JSON.stringify(formattedResponse(), null, 2)); if (success) { - message.success('Response copied to clipboard'); + NotificationsManager.success('Response copied to clipboard'); } else { - NotificationManager.fromBackend('Failed to copy response'); + NotificationsManager.fromBackend('Failed to copy response'); } }; diff --git a/ui/litellm-dashboard/src/components/view_users.tsx b/ui/litellm-dashboard/src/components/view_users.tsx index 55d0fd4e01..27421d70fc 100644 --- a/ui/litellm-dashboard/src/components/view_users.tsx +++ b/ui/litellm-dashboard/src/components/view_users.tsx @@ -29,7 +29,7 @@ import { useQuery, useQueryClient } from "@tanstack/react-query" import { updateExistingKeys } from "@/utils/dataUtils" import { useDebouncedState } from "@tanstack/react-pacer/debouncer" import { isAdminRole } from "@/utils/roles" -import NotificationManager from "./molecules/notifications_manager" +import NotificationsManager from "./molecules/notifications_manager" interface ViewUserDashboardProps { accessToken: string | null @@ -139,16 +139,16 @@ const ViewUserDashboard: React.FC = ({ accessToken, toke const handleResetPassword = async (userId: string) => { if (!accessToken) { - NotificationManager.fromBackend("Access token not found") + NotificationsManager.fromBackend("Access token not found") return } try { - message.success("Generating password reset link...") + NotificationsManager.success("Generating password reset link...") const data = await invitationCreateCall(accessToken, userId) setInvitationLinkData(data) setIsInvitationLinkModalVisible(true) } catch (error) { - NotificationManager.fromBackend("Failed to generate password reset link") + NotificationsManager.fromBackend("Failed to generate password reset link") } } @@ -164,10 +164,10 @@ const ViewUserDashboard: React.FC = ({ accessToken, toke return { ...previousData, users: updatedUsers } }) - message.success("User deleted successfully") + NotificationsManager.success("User deleted successfully") } catch (error) { console.error("Error deleting user:", error) - NotificationManager.fromBackend("Failed to delete user") + NotificationsManager.fromBackend("Failed to delete user") } } setIsDeleteModalOpen(false) @@ -205,7 +205,7 @@ const ViewUserDashboard: React.FC = ({ accessToken, toke return { ...previousData, users: updatedUsers } }) - message.success(`User ${editedUser.user_id} updated successfully`) + NotificationsManager.success(`User ${editedUser.user_id} updated successfully`) } catch (error) { console.error("There was an error updating the user", error) } @@ -229,7 +229,7 @@ const ViewUserDashboard: React.FC = ({ accessToken, toke const handleBulkEdit = () => { if (selectedUsers.length === 0) { - NotificationManager.fromBackend("Please select users to edit") + NotificationsManager.fromBackend("Please select users to edit") return } diff --git a/ui/litellm-dashboard/src/components/view_users/user_info_view.tsx b/ui/litellm-dashboard/src/components/view_users/user_info_view.tsx index 5147ba8b88..d416df2d9b 100644 --- a/ui/litellm-dashboard/src/components/view_users/user_info_view.tsx +++ b/ui/litellm-dashboard/src/components/view_users/user_info_view.tsx @@ -15,7 +15,7 @@ import { UserEditView } from "../user_edit_view" import OnboardingModal, { InvitationLink } from "../onboarding_link" import { formatNumberWithCommas, copyToClipboard as utilCopyToClipboard } from "@/utils/dataUtils" import { CopyIcon, CheckIcon } from "lucide-react"; -import NotificationManager from "../molecules/notifications_manager"; +import NotificationsManager from "../molecules/notifications_manager"; import { getBudgetDurationLabel } from "../common_components/budget_duration_dropdown"; interface UserInfoViewProps { @@ -86,7 +86,7 @@ export default function UserInfoView({ setUserModels(availableModels) } catch (error) { console.error("Error fetching user data:", error) - NotificationManager.fromBackend("Failed to fetch user data") + NotificationsManager.fromBackend("Failed to fetch user data") } finally { setIsLoading(false) } @@ -97,16 +97,16 @@ export default function UserInfoView({ const handleResetPassword = async () => { if (!accessToken) { - NotificationManager.fromBackend("Access token not found") + NotificationsManager.fromBackend("Access token not found") return } try { - message.success("Generating password reset link...") + NotificationsManager.success("Generating password reset link...") const data = await invitationCreateCall(accessToken, userId) setInvitationLinkData(data) setIsInvitationLinkModalVisible(true) } catch (error) { - NotificationManager.fromBackend("Failed to generate password reset link") + NotificationsManager.fromBackend("Failed to generate password reset link") } } @@ -114,14 +114,14 @@ export default function UserInfoView({ try { if (!accessToken) return await userDeleteCall(accessToken, [userId]) - message.success("User deleted successfully") + NotificationsManager.success("User deleted successfully") if (onDelete) { onDelete() } onClose() } catch (error) { console.error("Error deleting user:", error) - NotificationManager.fromBackend("Failed to delete user") + NotificationsManager.fromBackend("Failed to delete user") } } @@ -144,11 +144,11 @@ export default function UserInfoView({ }, }) - message.success("User updated successfully") + NotificationsManager.success("User updated successfully") setIsEditing(false) } catch (error) { console.error("Error updating user:", error) - NotificationManager.fromBackend("Failed to update user") + NotificationsManager.fromBackend("Failed to update user") } } diff --git a/ui/litellm-dashboard/src/utils/dataUtils.ts b/ui/litellm-dashboard/src/utils/dataUtils.ts index b908c0b2c8..29ffd8eec0 100644 --- a/ui/litellm-dashboard/src/utils/dataUtils.ts +++ b/ui/litellm-dashboard/src/utils/dataUtils.ts @@ -1,4 +1,4 @@ -import NotificationManager from "@/components/molecules/notifications_manager"; +import NotificationsManager from "@/components/molecules/notifications_manager"; import { message } from "antd"; export function updateExistingKeys( @@ -33,10 +33,10 @@ export const copyToClipboard = async ( if (!text) return false; try { await navigator.clipboard.writeText(text); - message.success(messageText); + NotificationsManager.success(messageText); return true; } catch (err) { - NotificationManager.fromBackend("Failed to copy to clipboard"); + NotificationsManager.fromBackend("Failed to copy to clipboard"); console.error("Failed to copy: ", err); return false; }