feat: 添加访问日志分页功能,优化相关接口和前端组件

This commit is contained in:
ryan
2026-03-14 23:18:49 +08:00
parent b7d38590ba
commit 8d406f5ade
8 changed files with 184 additions and 23 deletions
@@ -1,11 +1,15 @@
import { apiRequest } from '@/lib/api/client';
import type { AccessLogItem } from '@/features/access-logs/types';
import type { AccessLogList } from '@/features/access-logs/types';
export function getAccessLogs(nodeId?: string) {
export function getAccessLogs(page: number, nodeId?: string, pageSize = 50) {
const normalizedNodeId = nodeId?.trim();
const query = normalizedNodeId
? `?node_id=${encodeURIComponent(normalizedNodeId)}`
: '';
return apiRequest<AccessLogItem[]>(`/access-logs/${query}`);
const searchParams = new URLSearchParams({
p: String(Math.max(page, 0)),
page_size: String(pageSize),
});
if (normalizedNodeId) {
searchParams.set('node_id', normalizedNodeId);
}
return apiRequest<AccessLogList>(`/access-logs/?${searchParams.toString()}`);
}