From 6968590dc62e9f6fcfb818e1fe80a0d78f94c3ff Mon Sep 17 00:00:00 2001 From: Canyon Robins Date: Fri, 16 May 2025 17:10:38 -0700 Subject: [PATCH] Fix View In Settings for audit logs (#23) --- src/components/dashboard/AuditLogDetails.tsx | 33 ++++++++++++++------ 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/src/components/dashboard/AuditLogDetails.tsx b/src/components/dashboard/AuditLogDetails.tsx index c494dcd264..a2384185f1 100644 --- a/src/components/dashboard/AuditLogDetails.tsx +++ b/src/components/dashboard/AuditLogDetails.tsx @@ -4,12 +4,27 @@ import { ArrowRight, Calendar, Clock, User } from 'lucide-react'; import Link from 'next/link'; import React from 'react'; -import type { AuditLogType } from '@/db/schema'; +import { AuditLogTargetType, type AuditLogType } from '@/db/schema'; +import { getBaseUrl } from '@/lib/metadata'; type AuditLogDetailsProps = { log: AuditLogType; }; +const getSettingsUrl = (type: AuditLogTargetType): string => { + const baseUrl = `${getBaseUrl()}/dashboard/org`; + switch (type) { + case AuditLogTargetType.MEMBER_CHANGE: + return `${baseUrl}/organization-members`; + case AuditLogTargetType.PROVIDER_WHITELIST: + return `${baseUrl}/provider-whitelist`; + case AuditLogTargetType.DEFAULT_PARAMETERS: + return `${baseUrl}/default-parameters`; + default: + return baseUrl; + } +}; + const formatValue = (value: unknown): React.ReactNode => { if (value === null || value === undefined) { return None; @@ -58,15 +73,13 @@ export function AuditLogDetails({ log }: AuditLogDetailsProps) { {log.userId} - {log.targetId && ( - - View in settings - - - )} + + View in settings + + {/* Change details */}