260322:1648 Correct Coresspondence / Doing RFA / Correct CI
CI Pipeline / build (push) Failing after 12m41s
Build and Deploy / deploy (push) Failing after 2m44s

This commit is contained in:
admin
2026-03-22 16:48:12 +07:00
parent e5deedb42e
commit 11984bfa29
683 changed files with 105251 additions and 29068 deletions
@@ -1,10 +1,10 @@
"use client";
'use client';
import { useAuditLogs } from "@/hooks/use-audit-logs";
import { Card } from "@/components/ui/card";
import { Badge } from "@/components/ui/badge";
import { formatDistanceToNow } from "date-fns";
import { Loader2 } from "lucide-react";
import { useAuditLogs } from '@/hooks/use-audit-logs';
import { Card } from '@/components/ui/card';
import { Badge } from '@/components/ui/badge';
import { formatDistanceToNow } from 'date-fns';
import { Loader2 } from 'lucide-react';
export default function AuditLogsPage() {
const { data: logs, isLoading } = useAuditLogs();
@@ -18,43 +18,48 @@ export default function AuditLogsPage() {
{isLoading ? (
<div className="flex justify-center p-8">
<Loader2 className="animate-spin" />
<Loader2 className="animate-spin" />
</div>
) : (
<div className="space-y-2">
{!logs || logs.length === 0 ? (
<div className="text-center text-muted-foreground py-10">No logs found</div>
) : (
logs.map((log: import("@/lib/services/audit-log.service").AuditLog) => (
<Card key={log.auditId} className="p-4">
<div className="flex items-start justify-between">
<div className="flex-1">
<div className="flex items-center gap-3 mb-2">
<span className="font-medium text-sm">
{log.user?.fullName || log.user?.username || `User #${log.userId || 'System'}`}
</span>
<Badge variant={log.severity === 'ERROR' ? 'destructive' : 'outline'} className="uppercase text-[10px]">
{log.action}
</Badge>
<Badge variant="secondary" className="uppercase text-[10px]">{log.entityType || 'General'}</Badge>
</div>
<p className="text-sm text-foreground">
{typeof log.detailsJson === 'string' ? log.detailsJson : JSON.stringify(log.detailsJson || {})}
</p>
<p className="text-xs text-muted-foreground mt-2">
{log.createdAt && formatDistanceToNow(new Date(log.createdAt), { addSuffix: true })}
</p>
{!logs || logs.length === 0 ? (
<div className="text-center text-muted-foreground py-10">No logs found</div>
) : (
logs.map((log: import('@/lib/services/audit-log.service').AuditLog) => (
<Card key={log.auditId} className="p-4">
<div className="flex items-start justify-between">
<div className="flex-1">
<div className="flex items-center gap-3 mb-2">
<span className="font-medium text-sm">
{log.user?.fullName || log.user?.username || `User #${log.userId || 'System'}`}
</span>
<Badge
variant={log.severity === 'ERROR' ? 'destructive' : 'outline'}
className="uppercase text-[10px]"
>
{log.action}
</Badge>
<Badge variant="secondary" className="uppercase text-[10px]">
{log.entityType || 'General'}
</Badge>
</div>
{/* Only show IP if available */}
{log.ipAddress && (
<span className="text-xs text-muted-foreground font-mono bg-muted px-2 py-1 rounded hidden md:inline-block">
{log.ipAddress}
</span>
)}
</div>
</Card>
))
)}
<p className="text-sm text-foreground">
{typeof log.detailsJson === 'string' ? log.detailsJson : JSON.stringify(log.detailsJson || {})}
</p>
<p className="text-xs text-muted-foreground mt-2">
{log.createdAt && formatDistanceToNow(new Date(log.createdAt), { addSuffix: true })}
</p>
</div>
{/* Only show IP if available */}
{log.ipAddress && (
<span className="text-xs text-muted-foreground font-mono bg-muted px-2 py-1 rounded hidden md:inline-block">
{log.ipAddress}
</span>
)}
</div>
</Card>
))
)}
</div>
)}
</div>
@@ -50,7 +50,11 @@ export default function SessionManagementPage() {
}
if (error) {
return <div className="p-8 text-center text-red-500">{getApiErrorMessage(error, 'Failed to load sessions. Please try again.')}</div>;
return (
<div className="p-8 text-center text-red-500">
{getApiErrorMessage(error, 'Failed to load sessions. Please try again.')}
</div>
);
}
return (
@@ -1,12 +1,12 @@
"use client";
'use client';
import { useQuery } from "@tanstack/react-query";
import apiClient from "@/lib/api/client";
import { DataTable } from "@/components/common/data-table";
import { ColumnDef } from "@tanstack/react-table";
import { RefreshCw } from "lucide-react";
import { format } from "date-fns";
import { Button } from "@/components/ui/button";
import { useQuery } from '@tanstack/react-query';
import apiClient from '@/lib/api/client';
import { DataTable } from '@/components/common/data-table';
import { ColumnDef } from '@tanstack/react-table';
import { RefreshCw } from 'lucide-react';
import { format } from 'date-fns';
import { Button } from '@/components/ui/button';
interface NumberingError {
id: number;
@@ -14,41 +14,45 @@ interface NumberingError {
errorMessage: string;
stackTrace?: string;
createdAt: string;
context?: any;
context?: unknown;
}
const logService = {
getNumberingErrors: async () => {
const response = await apiClient.get("/document-numbering/logs/errors");
const response = await apiClient.get('/document-numbering/logs/errors');
return response.data.data || response.data;
},
};
export default function NumberingLogsPage() {
const { data: errors = [], isLoading, refetch } = useQuery<NumberingError[]>({
queryKey: ["numbering-errors"],
const {
data: errors = [],
isLoading,
refetch,
} = useQuery<NumberingError[]>({
queryKey: ['numbering-errors'],
queryFn: logService.getNumberingErrors,
});
const columns: ColumnDef<NumberingError>[] = [
{
accessorKey: "createdAt",
header: "Timestamp",
cell: ({ row }) => format(new Date(row.original.createdAt), "dd MMM yyyy, HH:mm:ss"),
accessorKey: 'createdAt',
header: 'Timestamp',
cell: ({ row }) => format(new Date(row.original.createdAt), 'dd MMM yyyy, HH:mm:ss'),
},
{
accessorKey: "context.projectId", // Accessing nested property
header: "Project ID",
accessorKey: 'context.projectId', // Accessing nested property
header: 'Project ID',
cell: ({ row }) => <span className="font-mono">{row.original.context?.projectId || 'N/A'}</span>,
},
{
accessorKey: "errorMessage",
header: "Message",
accessorKey: 'errorMessage',
header: 'Message',
cell: ({ row }) => <span className="text-destructive font-medium">{row.original.errorMessage}</span>,
},
{
accessorKey: "stackTrace",
header: "Details",
accessorKey: 'stackTrace',
header: 'Details',
cell: ({ row }) => (
<div className="max-w-[400px] truncate text-xs text-muted-foreground font-mono" title={row.original.stackTrace}>
{row.original.stackTrace}
@@ -65,7 +69,7 @@ export default function NumberingLogsPage() {
<p className="text-muted-foreground">Diagnostics for document numbering issues</p>
</div>
<Button variant="outline" size="icon" onClick={() => refetch()} disabled={isLoading}>
<RefreshCw className={`h-4 w-4 ${isLoading ? "animate-spin" : ""}`} />
<RefreshCw className={`h-4 w-4 ${isLoading ? 'animate-spin' : ''}`} />
</Button>
</div>