Add product name to audit log ui

This commit is contained in:
2026-03-26 11:59:53 -04:00
parent 23b94d1c48
commit e4f5e2c4dd
2 changed files with 51 additions and 22 deletions
+31 -4
View File
@@ -26,6 +26,7 @@ interface AuditEntry {
errored_count?: number;
// Editor-specific
pid?: number;
product_name?: string | null;
action?: string;
}
@@ -323,7 +324,7 @@ function EditorTable({ entries, onView }: { entries: AuditEntry[]; onView: (id:
<TableRow>
<TableHead className="w-[140px]">Time</TableHead>
<TableHead>User</TableHead>
<TableHead>PID</TableHead>
<TableHead>Product</TableHead>
<TableHead>Action</TableHead>
<TableHead>Status</TableHead>
<TableHead>Duration</TableHead>
@@ -335,7 +336,21 @@ function EditorTable({ entries, onView }: { entries: AuditEntry[]; onView: (id:
<TableRow key={e.id}>
<TableCell className="text-xs text-muted-foreground">{formatDate(e.created_at)}</TableCell>
<TableCell>{e.username ?? `#${e.user_id}`}</TableCell>
<TableCell className="font-mono text-sm">{e.pid}</TableCell>
<TableCell>
<div className="flex flex-col">
<a
href={`https://backend.acherryontop.com/product/${e.pid}`}
target="_blank"
rel="noopener noreferrer"
className="font-mono text-sm hover:underline text-blue-600 dark:text-blue-400"
>
{e.pid}
</a>
{e.product_name && (
<span className="text-xs text-muted-foreground truncate max-w-[200px]">{e.product_name}</span>
)}
</div>
</TableCell>
<TableCell>
<Badge variant="secondary" className="font-normal">
{ACTION_LABELS[e.action ?? ""] ?? e.action}
@@ -413,8 +428,20 @@ function DetailView({ detail, logType }: { detail: AuditDetail; logType: LogType
{logType === "editor" && (
<>
<div>
<span className="text-muted-foreground">Product ID</span>
<p className="font-medium font-mono">{detail.pid}</p>
<span className="text-muted-foreground">Product</span>
<p className="font-medium">
<a
href={`https://backend.acherryontop.com/product/${detail.pid}`}
target="_blank"
rel="noopener noreferrer"
className="font-mono hover:underline text-blue-600 dark:text-blue-400"
>
{detail.pid}
</a>
{detail.product_name && (
<span className="ml-2 font-sans text-muted-foreground">{detail.product_name}</span>
)}
</p>
</div>
<div>
<span className="text-muted-foreground">Action</span>