diff --git a/components/policy-explorer/PolicyDetailSheet.tsx b/components/policy-explorer/PolicyDetailSheet.tsx index 52a1911..b9f93e8 100644 --- a/components/policy-explorer/PolicyDetailSheet.tsx +++ b/components/policy-explorer/PolicyDetailSheet.tsx @@ -11,6 +11,7 @@ import { import { Button } from '@/components/ui/button'; import { Badge } from '@/components/ui/badge'; import type { PolicySettingSearchResult } from '@/lib/actions/policySettings'; +import type { PolicySettingRow } from '@/lib/types/policy-table'; import { PolicyTypeBadge } from './PolicyTypeBadge'; import { formatDistanceToNow } from 'date-fns'; import { de } from 'date-fns/locale'; @@ -19,7 +20,7 @@ import { useCopyToClipboard } from '@/lib/hooks/useCopyToClipboard'; import { getIntunePortalLink } from '@/lib/utils/policy-table-helpers'; interface PolicyDetailSheetProps { - policy: PolicySettingSearchResult | null; + policy: PolicySettingSearchResult | PolicySettingRow | null; open: boolean; onOpenChange: (open: boolean) => void; } @@ -54,7 +55,9 @@ export function PolicyDetailSheet({ ? formatJson(policy.settingValue) : policy.settingValue; - const intuneUrl = getIntunePortalLink(policy.policyType, policy.graphPolicyId); + // Handle both PolicySettingRow (has graphPolicyId) and PolicySettingSearchResult (has id) + const policyId = 'graphPolicyId' in policy ? policy.graphPolicyId : policy.id; + const intuneUrl = getIntunePortalLink(policy.policyType, policyId); const handleCopyField = (value: string, fieldName: string) => { copy(value, `${fieldName} copied to clipboard`); @@ -65,7 +68,7 @@ export function PolicyDetailSheet({ window.open(intuneUrl, '_blank', 'noopener,noreferrer'); } else { // Fallback: copy policy ID - copy(policy.graphPolicyId, 'Policy ID copied to clipboard'); + copy(policyId, 'Policy ID copied to clipboard'); } }; @@ -212,7 +215,7 @@ export function PolicyDetailSheet({
- {policy.graphPolicyId} + {policyId}
@@ -257,7 +260,7 @@ export function PolicyDetailSheet({ ) : (