Skip to content

Commit 3a9eecf

Browse files
committed
feat: go gin refactor
1 parent af5700c commit 3a9eecf

File tree

31 files changed

+1250
-10997
lines changed

31 files changed

+1250
-10997
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# 🚀 NodePassDash
1+
<div align="center">
2+
<img src="docs/nodepassdash-logo.svg" alt="NodePassDash" height="80">
3+
</div>
24

35
![Version](https://img.shields.io/badge/version-2.2.1-blue.svg)
46
![GitHub license](https://img.shields.io/github/license/NodePassProject/NodePassDash)

app/dashboard/page.tsx

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ export default function DashboardPage() {
181181
if (operationLogs.length === 0) return;
182182
setClearingLogs(true);
183183
try {
184-
const response = await fetch(buildApiUrl('/api/dashboard/logs'), {
184+
const response = await fetch(buildApiUrl('/api/dashboard/operate_logs'), {
185185
method: 'DELETE',
186186
});
187187
const data = await response.json();
@@ -264,28 +264,6 @@ export default function DashboardPage() {
264264
{ key: "status", label: "状态" },
265265
];
266266

267-
// 获取总体统计数据
268-
const fetchOverallStats = useCallback(async () => {
269-
try {
270-
const response = await fetch(buildApiUrl('/api/dashboard/overall-stats'));
271-
272-
if (!response.ok) throw new Error('获取总体统计数据失败');
273-
const data = await response.json();
274-
275-
if (data.success && data.data) {
276-
console.log('[仪表盘] 总体统计数据:', data.data);
277-
setOverallStats(data.data);
278-
}
279-
} catch (error) {
280-
console.error('获取总体统计数据失败:', error);
281-
addToast({
282-
title: '错误',
283-
description: '获取总体统计数据失败',
284-
color: 'danger'
285-
});
286-
}
287-
}, []);
288-
289267
// 获取主控数据
290268
const fetchEndpoints = useCallback(async () => {
291269
try {
@@ -307,7 +285,7 @@ export default function DashboardPage() {
307285
// 获取操作日志数据
308286
const fetchOperationLogs = useCallback(async () => {
309287
try {
310-
const response = await fetch(buildApiUrl('/api/dashboard/logs?limit=1000'));
288+
const response = await fetch(buildApiUrl('/api/dashboard/operate_logs?limit=1000'));
311289

312290
if (!response.ok) throw new Error('获取操作日志失败');
313291
const data: OperationLog[] = await response.json();
@@ -436,7 +414,6 @@ export default function DashboardPage() {
436414

437415
try {
438416
await Promise.all([
439-
fetchOverallStats(),
440417
fetchEndpoints(),
441418
fetchTunnelStats(),
442419
fetchOperationLogs(),
@@ -464,7 +441,7 @@ export default function DashboardPage() {
464441
return () => {
465442
abortController.abort();
466443
};
467-
}, [fetchOverallStats, fetchEndpoints, fetchTunnelStats, fetchOperationLogs, fetchTrafficTrend]);
444+
}, [ fetchEndpoints, fetchTunnelStats, fetchOperationLogs, fetchTrafficTrend]);
468445

469446
return (
470447
<div className="space-y-4 md:space-y-6 p-4 md:p-0">

0 commit comments

Comments
 (0)