'use client'; import {RankChart} from '@/components/data/rank-chart'; import { Card, CardContent, CardHeader, CardTitle, } from '@/components/ui/card'; import type {DashboardNodeHealth} from '@/lib/services/openflare'; function buildNodeRankItems( nodes: DashboardNodeHealth[], selector: (node: DashboardNodeHealth) => number, limit = 5, ) { return [...nodes] .sort((left, right) => { const leftValue = selector(left); const rightValue = selector(right); if (leftValue === rightValue) { return left.name.localeCompare(right.name, 'zh-CN'); } return rightValue - leftValue; }) .slice(0, limit) .filter((node) => selector(node) > 0) .map((node) => ({ label: node.name, value: selector(node), })); } export function NodeRankPanel({nodes}: {nodes: DashboardNodeHealth[]}) { return ( Top 节点榜单

流量最高节点

node.request_count)} color="#38bdf8" emptyMessage="暂无流量榜单" />

容量压力节点

Math.round( Math.max( node.cpu_usage_percent, node.memory_usage_percent, node.storage_usage_percent, ), ), )} color="#ef4444" valueFormatter={(value) => `${value}%`} emptyMessage="暂无容量压力数据" />
); }