From 8e1223e39a28554a207163aba5f505a340ca2aa7 Mon Sep 17 00:00:00 2001 From: moe-berri Date: Thu, 5 Nov 2026 12:19:47 +0800 Subject: [PATCH] fix(ui): keep Activity views within dashboard lint limits --- .../(dashboard)/models-and-endpoints/page.tsx | 8 ++++--- .../users/_components/user_edit_data.ts | 23 +++++++++++++++++++ .../_components/view_users/user_info_view.tsx | 21 ++--------------- 3 files changed, 30 insertions(+), 22 deletions(-) create mode 100644 ui/litellm-dashboard/src/app/(dashboard)/users/_components/user_edit_data.ts diff --git a/ui/litellm-dashboard/src/app/(dashboard)/models-and-endpoints/page.tsx b/ui/litellm-dashboard/src/app/(dashboard)/models-and-endpoints/page.tsx index 74de74fae2c..3981b04d86d 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/models-and-endpoints/page.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/models-and-endpoints/page.tsx @@ -208,7 +208,7 @@ export default function ModelsAndEndpointsPage() { {!isViewOnly && } - {activityModel ? ( + {activityModel && (
- ) : modelId ? ( + )} + {!activityModel && modelId && ( - ) : ( + )} + {!activityModel && !modelId && (
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/users/_components/user_edit_data.ts b/ui/litellm-dashboard/src/app/(dashboard)/users/_components/user_edit_data.ts new file mode 100644 index 00000000000..4b4e5191781 --- /dev/null +++ b/ui/litellm-dashboard/src/app/(dashboard)/users/_components/user_edit_data.ts @@ -0,0 +1,23 @@ +import type { UserInfoV2Response } from "@/components/networking"; + +/** Build the legacy-compatible shape consumed by UserEditView. */ +export function toUserEditData(userData: UserInfoV2Response) { + return { + user_id: userData.user_id, + user_info: { + user_email: userData.user_email, + user_alias: userData.user_alias, + user_role: userData.user_role, + models: userData.models, + max_budget: userData.max_budget, + tpm_limit: userData.tpm_limit, + rpm_limit: userData.rpm_limit, + budget_duration: userData.budget_duration, + metadata: userData.metadata, + // Without these the per-model budget editor mounts empty and a save + // replaces the user's existing budgets with whatever was typed. + model_max_budget: userData.model_max_budget, + model_max_budget_usage: userData.model_max_budget_usage, + }, + }; +} diff --git a/ui/litellm-dashboard/src/app/(dashboard)/users/_components/view_users/user_info_view.tsx b/ui/litellm-dashboard/src/app/(dashboard)/users/_components/view_users/user_info_view.tsx index 6d884f86448..87aab530da3 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/users/_components/view_users/user_info_view.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/users/_components/view_users/user_info_view.tsx @@ -36,6 +36,7 @@ import { hasProxyWideSpendView, rolesWithWriteAccess } from "@/utils/roles"; import { teamDetailHref } from "@/utils/entityLinks"; import { BadgeLink } from "@/components/shared/BadgeLink"; import { UserEditView } from "../user_edit_view"; +import { toUserEditData } from "../user_edit_data"; import OnboardingModal, { InvitationLink } from "@/components/onboarding_link"; import { formatNumberWithCommas, copyToClipboard as utilCopyToClipboard } from "@/utils/dataUtils"; import { ArrowLeft, CheckIcon, CopyIcon, Plus, RefreshCw, Trash2 } from "lucide-react"; @@ -410,25 +411,7 @@ export default function UserInfoView({ userData.max_budget !== null ? `$${formatNumberWithCommas(userData.max_budget, 2)}` : unlimitedLabel; const teamPickerPlaceholder = t("users.userInfo.addTeamDialog.teamPlaceholder"); - // Build a legacy-compatible shape for UserEditView - const userDataForEdit = { - user_id: userData.user_id, - user_info: { - user_email: userData.user_email, - user_alias: userData.user_alias, - user_role: userData.user_role, - models: userData.models, - max_budget: userData.max_budget, - tpm_limit: userData.tpm_limit, - rpm_limit: userData.rpm_limit, - budget_duration: userData.budget_duration, - metadata: userData.metadata, - // Without these the per-model budget editor mounts empty and a save - // replaces the user's existing budgets with whatever was typed. - model_max_budget: userData.model_max_budget, - model_max_budget_usage: userData.model_max_budget_usage, - }, - }; + const userDataForEdit = toUserEditData(userData); return (