mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 01:10:23 +08:00
refactor(proxy): 移除 unhealthy 状态、前端展示失败率替换连接数、命令提示修正
- 移除 ProxyNodeStatus.UNHEALTHY 枚举值,仅保留 online/offline - 迁移脚本将已有 unhealthy 数据迁移为 offline,upgrade/downgrade 均有幂等性保护 - 前端代理节点列表用失败率列替换连接数列,超过 5% 高亮显示 - 节点列表排序从 updated_at DESC 改为 name ASC - Rust 端命令行提示从 aether-proxy 改为 ./aether-proxy
This commit is contained in:
@@ -172,7 +172,7 @@ async def unregister_proxy_node(request: Request, db: Session = Depends(get_db))
|
||||
@router.get("")
|
||||
async def list_proxy_nodes(
|
||||
request: Request,
|
||||
status: str | None = Query(None, description="按状态筛选:online/unhealthy/offline"),
|
||||
status: str | None = Query(None, description="按状态筛选:online/offline"),
|
||||
skip: int = Query(0, ge=0),
|
||||
limit: int = Query(100, ge=1, le=1000),
|
||||
db: Session = Depends(get_db),
|
||||
|
||||
@@ -224,7 +224,6 @@ class ProxyNodeStatus(PyEnum):
|
||||
"""代理节点状态"""
|
||||
|
||||
ONLINE = "online"
|
||||
UNHEALTHY = "unhealthy"
|
||||
OFFLINE = "offline"
|
||||
|
||||
|
||||
|
||||
@@ -392,13 +392,13 @@ class ProxyNodeService:
|
||||
query = db.query(ProxyNode)
|
||||
if status:
|
||||
normalized = status.strip().lower()
|
||||
allowed = {"online", "unhealthy", "offline"}
|
||||
allowed = {"online", "offline"}
|
||||
if normalized not in allowed:
|
||||
raise InvalidRequestException(f"status 必须是以下之一: {sorted(allowed)}", "status")
|
||||
query = query.filter(ProxyNode.status == ProxyNodeStatus(normalized))
|
||||
|
||||
total = query.count()
|
||||
nodes = query.order_by(ProxyNode.updated_at.desc()).offset(skip).limit(limit).all()
|
||||
nodes = query.order_by(ProxyNode.name.asc()).offset(skip).limit(limit).all()
|
||||
return nodes, total
|
||||
|
||||
@staticmethod
|
||||
|
||||
Reference in New Issue
Block a user