From 4f3671c8a6e09295bad8fb7f99cad6200f54da17 Mon Sep 17 00:00:00 2001
From: wmp <17516219072@163.com>
Date: Sat, 20 Sep 2025 17:03:16 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=B8=83=E5=B1=80=E5=92=8C?=
=?UTF-8?q?=E5=BE=AE=E8=B0=83=E6=95=B4=E9=A1=B5=E9=9D=A2=E6=A0=B7=E5=BC=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/app/api/stats/route.ts | 3 +-
.../dashboard/components/allocationStatus.tsx | 89 +++---
.../dashboard/components/cityNodeStats.tsx | 65 ++--
src/app/dashboard/components/edge.tsx | 300 +++++-------------
.../dashboard/components/gatewayConfig.tsx | 200 ++++++------
src/app/dashboard/components/gatewayinfo.tsx | 220 +++++++++----
src/app/dashboard/components/settings.tsx | 59 ++--
src/app/dashboard/page.tsx | 14 +-
src/components/ui/pagination.tsx | 222 +++++++++++--
src/components/ui/table.tsx | 8 +-
10 files changed, 636 insertions(+), 544 deletions(-)
diff --git a/src/app/api/stats/route.ts b/src/app/api/stats/route.ts
index 1cc20ef..4953426 100644
--- a/src/app/api/stats/route.ts
+++ b/src/app/api/stats/route.ts
@@ -153,9 +153,10 @@ async function getAllocationStatus() {
// 获取节点信息
async function getEdgeNodes(request: NextRequest) {
+
try {
const { searchParams } = new URL(request.url)
- const threshold = searchParams.get('threshold') || '20'
+ const threshold = searchParams.get('threshold') || '0'
const limit = searchParams.get('limit') || '100'
// 使用参数化查询防止SQL注入
diff --git a/src/app/dashboard/components/allocationStatus.tsx b/src/app/dashboard/components/allocationStatus.tsx
index 8df8df8..cd463ea 100644
--- a/src/app/dashboard/components/allocationStatus.tsx
+++ b/src/app/dashboard/components/allocationStatus.tsx
@@ -4,6 +4,7 @@ import { useEffect, useState, useCallback } from 'react'
import { formatNumber, validateNumber } from '@/lib/formatters'
import LoadingCard from '@/components/ui/loadingCard'
import ErrorCard from '@/components/ui/errorCard'
+import { Table, TableHeader, TableBody, TableHead, TableRow, TableCell } from '@/components/ui/table'
interface AllocationStatus {
city: string
@@ -66,8 +67,13 @@ export default function AllocationStatus({ detailed = false }: { detailed?: bool
return filterDate.toISOString().slice(0, 19).replace('T', ' ')
}, [timeFilter, customTime])
+ // 计算超额量
+ const calculateOverage = (assigned: number, count: number) => {
+ const overage = assigned - count;
+ return Math.max(0, overage);
+ }
- const fetchData = useCallback(async () => {
+ const fetchData = useCallback(async () => {
try {
setError(null)
setLoading(true)
@@ -86,7 +92,9 @@ export default function AllocationStatus({ detailed = false }: { detailed?: bool
assigned: validateNumber(item.assigned),
}))
- setData(validatedData)
+ const sortedData = validatedData.sort((a, b) => b.count - a.count)
+
+ setData(sortedData)
} catch (error) {
console.error('Failed to fetch allocation status:', error)
setError(error instanceof Error ? error.message : 'Unknown error')
@@ -102,10 +110,10 @@ export default function AllocationStatus({ detailed = false }: { detailed?: bool
if (loading) return
| 城市 | -可用IP量 | -分配IP量 | -
|---|
| {item.city} | -{formatNumber(item.count)} | -{formatNumber(item.assigned)} | -
| 城市 | -节点数量 | -Hash | -标签 | -轮换顺位 | -
|---|---|---|---|---|
| {item.city} | -- {item.count} - | -{item.hash} | -- - {item.label} - - | -{item.offset} | -
- 共找到 {totalItems} 个节点 - {idThreshold > 0 && ` (ID大于${idThreshold})`} -
-| ID | -MAC地址 | -城市 | -公网IP | -运营商 | -多IP节点 | -独享IP | -设备类型 | -在线时长 | -
|---|---|---|---|---|---|---|---|---|
| {item.id} | -{item.macaddr} | -{item.city} | -{item.public} | -- - {item.isp} - - | -- - {formatBoolean(item.single)} - - | -- - {formatBoolean(item.sole)} - - | -- - {item.arch} - - | -- {formatOnlineTime(item.online)} - | -
| MAC地址 | -城市 | -内部账号 | -IP地址 | -内网入口 | -配置更新 | -在线状态 | -
|---|
|
-
- {item.edge}
-
- |
- - - {item.city} - - | -- {item.user} - | -
-
- {item.public}
-
- |
-
-
- {item.inner_ip}
-
- |
- - {getStatusBadge(item.ischange, '已更新', '未更新')} - | -- {getOnlineStatus(item.isonline)} - | -
暂无数据,请输入MAC地址查询网关配置信息
-- 您可以通过上方的搜索框查询特定MAC地址的网关配置 -
-| MAC地址 | -内网IP | -配置版本 | -状态 | -
|---|---|---|---|
| - - | -{item.inner_ip} | -{item.setid} | -- - {getStatusText(item.enable)} - - | -
管理系统中的所有用户账户
+