From 1dbb6e0d3facdccda308738c05601064496951d4 Mon Sep 17 00:00:00 2001 From: yuneng-jiang Date: Fri, 23 Jan 2026 22:11:49 -0800 Subject: [PATCH] fixing build --- .../src/components/policies/index.tsx | 2 +- .../src/components/team/team_info.tsx | 10 ++++++--- .../components/templates/key_info_view.tsx | 22 ++++++++++--------- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/ui/litellm-dashboard/src/components/policies/index.tsx b/ui/litellm-dashboard/src/components/policies/index.tsx index f24d2e2c11..717a6ff612 100644 --- a/ui/litellm-dashboard/src/components/policies/index.tsx +++ b/ui/litellm-dashboard/src/components/policies/index.tsx @@ -279,7 +279,7 @@ const PoliciesPanel: React.FC = ({ description={

- Policy attachments control where your policies apply. Policies don't do anything until you attach them to specific teams, keys, models, or globally. + Policy attachments control where your policies apply. Policies don't do anything until you attach them to specific teams, keys, models, or globally.

Attachment Scopes:

    diff --git a/ui/litellm-dashboard/src/components/team/team_info.tsx b/ui/litellm-dashboard/src/components/team/team_info.tsx index 34a47a2495..193d056fdd 100644 --- a/ui/litellm-dashboard/src/components/team/team_info.tsx +++ b/ui/litellm-dashboard/src/components/team/team_info.tsx @@ -96,6 +96,8 @@ export interface TeamData { model_aliases: Record; } | null; created_at: string; + guardrails?: string[]; + policies?: string[]; object_permission?: { object_permission_id: string; mcp_servers: string[]; @@ -270,7 +272,7 @@ const TeamInfoView: React.FC = ({ // Fetch resolved guardrails for all policies useEffect(() => { const fetchPolicyGuardrails = async () => { - if (!accessToken || !info?.policies || info.policies.length === 0) { + if (!accessToken || !teamData?.team_info?.policies || teamData.team_info.policies.length === 0) { return; } @@ -279,7 +281,7 @@ const TeamInfoView: React.FC = ({ try { await Promise.all( - info.policies.map(async (policyName: string) => { + teamData.team_info.policies.map(async (policyName: string) => { try { const policyInfo = await getPolicyInfoWithGuardrails(accessToken, policyName); guardrailsMap[policyName] = policyInfo.resolved_guardrails || []; @@ -298,7 +300,7 @@ const TeamInfoView: React.FC = ({ }; fetchPolicyGuardrails(); - }, [accessToken, info?.policies]); + }, [accessToken, teamData?.team_info?.policies]); const handleMemberCreate = async (values: any) => { try { @@ -462,6 +464,7 @@ const TeamInfoView: React.FC = ({ logging: values.logging_settings || [], ...(secretManagerSettings !== undefined ? { secret_manager_settings: secretManagerSettings } : {}), }, + policies: values.policies || [], organization_id: values.organization_id, }; @@ -757,6 +760,7 @@ const TeamInfoView: React.FC = ({ team_member_budget: info.team_member_budget_table?.max_budget, team_member_budget_duration: info.team_member_budget_table?.budget_duration, guardrails: info.metadata?.guardrails || [], + policies: info.policies || [], disable_global_guardrails: info.metadata?.disable_global_guardrails || false, metadata: info.metadata ? JSON.stringify( diff --git a/ui/litellm-dashboard/src/components/templates/key_info_view.tsx b/ui/litellm-dashboard/src/components/templates/key_info_view.tsx index f3739a53bd..d9d4bf5338 100644 --- a/ui/litellm-dashboard/src/components/templates/key_info_view.tsx +++ b/ui/litellm-dashboard/src/components/templates/key_info_view.tsx @@ -73,7 +73,8 @@ export default function KeyInfoView({ // Fetch resolved guardrails for all policies useEffect(() => { const fetchPolicyGuardrails = async () => { - if (!accessToken || !currentKeyData?.metadata?.policies || currentKeyData.metadata.policies.length === 0) { + const policies = currentKeyData?.metadata?.policies; + if (!accessToken || !policies || !Array.isArray(policies) || policies.length === 0) { return; } @@ -82,7 +83,7 @@ export default function KeyInfoView({ try { await Promise.all( - currentKeyData.metadata.policies.map(async (policyName: string) => { + policies.map(async (policyName: string) => { try { const policyInfo = await getPolicyInfoWithGuardrails(accessToken, policyName); guardrailsMap[policyName] = policyInfo.resolved_guardrails || []; @@ -521,9 +522,9 @@ export default function KeyInfoView({ Guardrails - {currentKeyData.guardrails && currentKeyData.guardrails.length > 0 ? ( + {Array.isArray(currentKeyData.metadata?.guardrails) && currentKeyData.metadata.guardrails.length > 0 ? (
    - {currentKeyData.guardrails.map((guardrail, index) => ( + {currentKeyData.metadata.guardrails.map((guardrail: string, index: number) => ( {guardrail} @@ -532,16 +533,17 @@ export default function KeyInfoView({ ) : ( No guardrails configured )} - {currentKeyData.metadata?.disable_global_guardrails && ( -
    - Global Guardrails Disabled -
    - )} + {typeof currentKeyData.metadata?.disable_global_guardrails === "boolean" && + currentKeyData.metadata.disable_global_guardrails === true && ( +
    + Global Guardrails Disabled +
    + )} Policies - {currentKeyData.metadata?.policies && currentKeyData.metadata.policies.length > 0 ? ( + {Array.isArray(currentKeyData.metadata?.policies) && currentKeyData.metadata.policies.length > 0 ? (
    {currentKeyData.metadata.policies.map((policy: string, index: number) => (