From d50c62cd1ca04f5a6eede61968b2286602324d1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sedat=20=C3=96zt=C3=BCrk?= Date: Mon, 25 May 2026 21:30:08 +0300 Subject: [PATCH] =?UTF-8?q?AuditLogDetail=20k=C4=B1sm=C4=B1=20=C3=A7al?= =?UTF-8?q?=C4=B1=C5=9Fm=C4=B1yordu=20d=C3=BCzeltildi.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AuditLogs/AuditLogActionDto.cs | 12 +- .../AuditLogs/AuditLogDto.cs | 30 ++-- .../AuditLogs/EntityChangeDto.cs | 14 +- .../AuditLogs/EntityPropertyChangeDto.cs | 10 +- ui/src/proxy/auditLog/audit-log.ts | 7 + .../views/admin/auditLog/AuditLogDetail.tsx | 135 +++++++++++++----- 6 files changed, 142 insertions(+), 66 deletions(-) diff --git a/api/src/Sozsoft.Platform.Application.Contracts/AuditLogs/AuditLogActionDto.cs b/api/src/Sozsoft.Platform.Application.Contracts/AuditLogs/AuditLogActionDto.cs index df1cec1..707f949 100644 --- a/api/src/Sozsoft.Platform.Application.Contracts/AuditLogs/AuditLogActionDto.cs +++ b/api/src/Sozsoft.Platform.Application.Contracts/AuditLogs/AuditLogActionDto.cs @@ -5,11 +5,11 @@ namespace Sozsoft.Platform.AuditLogs; public class AuditLogActionDto : EntityDto { - public virtual Guid AuditLogId { get; protected set; } - public virtual string ServiceName { get; protected set; } - public virtual string MethodName { get; protected set; } - public virtual string Parameters { get; protected set; } - public virtual DateTime ExecutionTime { get; protected set; } - public virtual int ExecutionDuration { get; protected set; } + public virtual Guid AuditLogId { get; set; } + public virtual string ServiceName { get; set; } + public virtual string MethodName { get; set; } + public virtual string Parameters { get; set; } + public virtual DateTime ExecutionTime { get; set; } + public virtual int ExecutionDuration { get; set; } } diff --git a/api/src/Sozsoft.Platform.Application.Contracts/AuditLogs/AuditLogDto.cs b/api/src/Sozsoft.Platform.Application.Contracts/AuditLogs/AuditLogDto.cs index 9da1912..05982fe 100644 --- a/api/src/Sozsoft.Platform.Application.Contracts/AuditLogs/AuditLogDto.cs +++ b/api/src/Sozsoft.Platform.Application.Contracts/AuditLogs/AuditLogDto.cs @@ -13,24 +13,24 @@ public class AuditLogDto : EntityDto } public string ApplicationName { get; set; } - public Guid? UserId { get; protected set; } - public string UserName { get; protected set; } - public Guid? TenantId { get; protected set; } - public string TenantName { get; protected set; } - public DateTime ExecutionTime { get; protected set; } - public int ExecutionDuration { get; protected set; } - public string ClientIpAddress { get; protected set; } - public string ClientName { get; protected set; } + public Guid? UserId { get; set; } + public string UserName { get; set; } + public Guid? TenantId { get; set; } + public string TenantName { get; set; } + public DateTime ExecutionTime { get; set; } + public int ExecutionDuration { get; set; } + public string ClientIpAddress { get; set; } + public string ClientName { get; set; } public string ClientId { get; set; } public string CorrelationId { get; set; } - public string BrowserInfo { get; protected set; } - public string HttpMethod { get; protected set; } - public string Url { get; protected set; } - public string Exceptions { get; protected set; } - public string Comments { get; protected set; } + public string BrowserInfo { get; set; } + public string HttpMethod { get; set; } + public string Url { get; set; } + public string Exceptions { get; set; } + public string Comments { get; set; } public int? HttpStatusCode { get; set; } - public ICollection EntityChanges { get; protected set; } - public ICollection Actions { get; protected set; } + public ICollection EntityChanges { get; set; } + public ICollection Actions { get; set; } public int? EntityChangeCount { get; set; } diff --git a/api/src/Sozsoft.Platform.Application.Contracts/AuditLogs/EntityChangeDto.cs b/api/src/Sozsoft.Platform.Application.Contracts/AuditLogs/EntityChangeDto.cs index b3884b4..fd9fc21 100644 --- a/api/src/Sozsoft.Platform.Application.Contracts/AuditLogs/EntityChangeDto.cs +++ b/api/src/Sozsoft.Platform.Application.Contracts/AuditLogs/EntityChangeDto.cs @@ -12,12 +12,12 @@ public class EntityChangeDto : EntityDto PropertyChanges = new List(); } - public virtual Guid AuditLogId { get; protected set; } - public virtual DateTime ChangeTime { get; protected set; } - public virtual EntityChangeType ChangeType { get; protected set; } - public virtual Guid? EntityTenantId { get; protected set; } - public virtual string EntityId { get; protected set; } - public virtual string EntityTypeFullName { get; protected set; } - public virtual ICollection PropertyChanges { get; protected set; } + public virtual Guid AuditLogId { get; set; } + public virtual DateTime ChangeTime { get; set; } + public virtual EntityChangeType ChangeType { get; set; } + public virtual Guid? EntityTenantId { get; set; } + public virtual string EntityId { get; set; } + public virtual string EntityTypeFullName { get; set; } + public virtual ICollection PropertyChanges { get; set; } } diff --git a/api/src/Sozsoft.Platform.Application.Contracts/AuditLogs/EntityPropertyChangeDto.cs b/api/src/Sozsoft.Platform.Application.Contracts/AuditLogs/EntityPropertyChangeDto.cs index 643a25c..a652c3f 100644 --- a/api/src/Sozsoft.Platform.Application.Contracts/AuditLogs/EntityPropertyChangeDto.cs +++ b/api/src/Sozsoft.Platform.Application.Contracts/AuditLogs/EntityPropertyChangeDto.cs @@ -5,10 +5,10 @@ namespace Sozsoft.Platform.AuditLogs; public class EntityPropertyChangeDto : EntityDto { - public virtual Guid EntityChangeId { get; protected set; } - public virtual string NewValue { get; protected set; } - public virtual string OriginalValue { get; protected set; } - public virtual string PropertyName { get; protected set; } - public virtual string PropertyTypeFullName { get; protected set; } + public virtual Guid EntityChangeId { get; set; } + public virtual string NewValue { get; set; } + public virtual string OriginalValue { get; set; } + public virtual string PropertyName { get; set; } + public virtual string PropertyTypeFullName { get; set; } } diff --git a/ui/src/proxy/auditLog/audit-log.ts b/ui/src/proxy/auditLog/audit-log.ts index 9f430b3..9effb1a 100644 --- a/ui/src/proxy/auditLog/audit-log.ts +++ b/ui/src/proxy/auditLog/audit-log.ts @@ -1,4 +1,6 @@ export interface AuditLogActionDto { + id: string + auditLogId: string serviceName: string methodName: string executionTime: string // Date string @@ -7,6 +9,8 @@ export interface AuditLogActionDto { } export interface EntityPropertyChangeDto { + id: string + entityChangeId: string propertyName: string propertyTypeFullName: string originalValue: string | null @@ -14,8 +18,11 @@ export interface EntityPropertyChangeDto { } export interface EntityChangeDto { + id: string + auditLogId: string changeTime: string // Date string changeType: number + entityTenantId?: string entityId: string entityTypeFullName: string propertyChanges: EntityPropertyChangeDto[] diff --git a/ui/src/views/admin/auditLog/AuditLogDetail.tsx b/ui/src/views/admin/auditLog/AuditLogDetail.tsx index bc3f49b..09e9c7d 100644 --- a/ui/src/views/admin/auditLog/AuditLogDetail.tsx +++ b/ui/src/views/admin/auditLog/AuditLogDetail.tsx @@ -69,10 +69,40 @@ function AuditLogs({ } const formatDuration = (ms: number) => { + if (ms === undefined || ms === null) return 'Unknown' if (ms < 1000) return `${ms}ms` return `${(ms / 1000).toFixed(2)}s` } + const formatDateTime = (value?: string) => { + if (!value) return 'Unknown' + + const date = new Date(value) + if (Number.isNaN(date.getTime()) || date.getFullYear() <= 1) return 'Unknown' + + return date.toLocaleString('tr-TR', { + day: '2-digit', + month: '2-digit', + year: 'numeric', + hour: '2-digit', + minute: '2-digit', + second: '2-digit', + }) + } + + const formatValue = (value?: string | number | null) => { + if (value === undefined || value === null || value === '') return 'Unknown' + return value + } + + const formatJson = (value: string) => { + try { + return JSON.stringify(JSON.parse(value), null, 2) + } catch { + return value + } + } + const InfoRow = ({ icon: Icon, label, value, valueClassName = '' }: any) => (
@@ -86,7 +116,7 @@ function AuditLogs({ return ( {/* Header */} -
+

Audit Log Details

{selectedLog?.id &&

ID: {selectedLog.id}

} @@ -113,7 +143,7 @@ function AuditLogs({
) : ( - + Overview @@ -145,7 +175,7 @@ function AuditLogs({
{/* Request Information */} -
+
Request Information
@@ -153,20 +183,13 @@ function AuditLogs({ + + +
{/* HTTP Details */} -
+
HTTP Details
@@ -197,20 +239,24 @@ function AuditLogs({ icon={FaCode} label="Method" value={ - + selectedLog.httpMethod ? ( + + ) : ( + 'Unknown' + ) } /> } /> +
@@ -291,13 +343,25 @@ function AuditLogs({

Service Name

- {action.serviceName} + {formatValue(action.serviceName)} +

+
+
+

Method Name

+

+ {formatValue(action.methodName)}

Execution Time

- {new Date(action.executionTime).toLocaleString('tr-TR')} + {formatDateTime(action.executionTime)} +

+
+
+

Action ID

+

+ {formatValue(action.id)}

@@ -306,7 +370,7 @@ function AuditLogs({

Parameters

-                          {JSON.stringify(JSON.parse(action.parameters), null, 2)}
+                          {formatJson(action.parameters)}
                         
)} @@ -338,12 +402,17 @@ function AuditLogs({ {change.entityTypeFullName}

ID: {change.entityId}

+ {change.entityTenantId && ( +

+ Tenant ID: {change.entityTenantId} +

+ )}
{getChangeTypeBadge(change.changeType)} - {new Date(change.changeTime).toLocaleTimeString('tr-TR')} + {formatDateTime(change.changeTime)}