Add AST cache for AdminLogsTest.php with extracted nodes and edges

This commit is contained in:
hamed
2026-07-10 09:48:45 +03:30
parent 9d2023a72f
commit 11efed4100
13 changed files with 1133 additions and 791 deletions
+32 -9
View File
@@ -1,6 +1,6 @@
import React, { useState } from 'react';
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
import { TrashIcon } from '@heroicons/react/24/outline';
import { TrashIcon, ArrowDownTrayIcon } from '@heroicons/react/24/outline';
import { api } from '../lib/api';
import type { PaginatedResponse, ApiResponse } from '../lib/api';
import type { AppLog } from '../types';
@@ -38,9 +38,22 @@ export default function LogsPage() {
const [search, setSearch] = useState('');
const [viewLog, setViewLog] = useState<AppLog | null>(null);
const [confirmClear, setConfirmClear] = useState(false);
const [downloading, setDownloading] = useState(false);
const limit = 25;
const queryClient = useQueryClient();
const handleDownload = async () => {
setDownloading(true);
try {
const qs =
(level ? `&level=${level}` : '') +
(search ? `&search=${encodeURIComponent(search)}` : '');
await api.download(`/api/v1/admin/logs/export?${qs}`);
} finally {
setDownloading(false);
}
};
const logsQuery = useQuery({
queryKey: ['admin-logs', page, level, search],
queryFn: () =>
@@ -95,14 +108,24 @@ export default function LogsPage() {
<div className="muted">رویدادهای ثبتشدهی سیستم (اخطار و بالاتر)</div>
</div>
{tab === 'logs' && (
<button
className="btn danger sm"
onClick={() => setConfirmClear(true)}
disabled={(logsQuery.data?.meta?.totalRecords ?? 0) === 0}
>
<TrashIcon style={{ width: 16, height: 16 }} />
حذف همه لاگها
</button>
<div style={{ display: 'flex', gap: 8 }}>
<button
className="btn ghost sm"
onClick={handleDownload}
disabled={downloading || (logsQuery.data?.meta?.totalRecords ?? 0) === 0}
>
<ArrowDownTrayIcon style={{ width: 16, height: 16 }} />
{downloading ? 'در حال دانلود...' : 'دانلود همه لاگ‌ها'}
</button>
<button
className="btn danger sm"
onClick={() => setConfirmClear(true)}
disabled={(logsQuery.data?.meta?.totalRecords ?? 0) === 0}
>
<TrashIcon style={{ width: 16, height: 16 }} />
حذف همه لاگها
</button>
</div>
)}
</div>