diff --git a/src/app/(dashboard)/dashboard/audit/ConfigAuditViewer.tsx b/src/app/(dashboard)/dashboard/audit/ConfigAuditViewer.tsx index 728897e1a7..298c09b60a 100644 --- a/src/app/(dashboard)/dashboard/audit/ConfigAuditViewer.tsx +++ b/src/app/(dashboard)/dashboard/audit/ConfigAuditViewer.tsx @@ -3,25 +3,18 @@ import { useState, useEffect } from "react"; import { useTranslations } from "next-intl"; -interface ConfigDiff { - added: string[]; - removed: string[]; - changed: Array<{ key: string; from: any; to: any }>; - isEmpty: boolean; -} - interface AuditEntry { - id: string; + id: number; timestamp: string; action: string; - target: string; - targetId: string; - targetName: string; - source: string; - before: any; - after: any; - diff: ConfigDiff; - note: string | null; + actor: string; + target?: string; + resource_type?: string; + ip_address?: string; + status?: string; + request_id?: string; + details?: any; + metadata?: any; } export default function ConfigAuditViewer() { @@ -48,16 +41,17 @@ export default function ConfigAuditViewer() { }; const getActionColor = (action: string) => { - switch (action) { - case "create": - return "text-green-400 bg-green-400/10 border-green-500/20"; - case "update": - return "text-blue-400 bg-blue-400/10 border-blue-500/20"; - case "delete": - return "text-red-400 bg-red-400/10 border-red-500/20"; - default: - return "text-gray-400 bg-gray-400/10 border-gray-500/20"; + const act = action.toLowerCase(); + if (act.includes("success") || act.includes("create")) { + return "text-green-400 bg-green-400/10 border-green-500/20"; } + if (act.includes("update") || act.includes("modify")) { + return "text-blue-400 bg-blue-400/10 border-blue-500/20"; + } + if (act.includes("failed") || act.includes("delete")) { + return "text-red-400 bg-red-400/10 border-red-500/20"; + } + return "text-gray-400 bg-gray-400/10 border-gray-500/20"; }; if (loading) { @@ -98,8 +92,8 @@ export default function ConfigAuditViewer() { Timestamp Action Target - Resource - Source + Actor + Resource/IP Details @@ -120,20 +114,20 @@ export default function ConfigAuditViewer() { - {entry.target} - - - {entry.targetName} + {entry.target || "-"} - {entry.source} + {entry.actor} + + + {entry.resource_type || entry.ip_address || "-"} @@ -149,10 +143,10 @@ export default function ConfigAuditViewer() {

- {selectedEntry.action} {selectedEntry.target} + {selectedEntry.action}

- ID: {selectedEntry.targetId} • {selectedEntry.targetName} + Actor: {selectedEntry.actor} • Target: {selectedEntry.target || "N/A"}