feat: improve operations diagnostics and channel management

This commit is contained in:
hectorzhao
2026-08-09 14:27:19 +08:00
parent 44352aeb2f
commit 4724b9db6a
65 changed files with 1211 additions and 293 deletions
+17 -1
View File
@@ -6,7 +6,7 @@ import { adminApi, type AdminChannel } from '@/api/adminApi';
const columns: Array<TableColumn<AdminChannel>> = [
{ key: 'id', title: '通道编号', render: (record) => record.id },
{ key: 'name', title: '通道名称', render: (record) => record.name },
{ key: 'carrier', title: '运营商', render: (record) => record.carrier ?? '-' },
{ key: 'carrier', title: '运营商', render: (record) => carrierLabel(record.carrier) },
{ key: 'gatewayHost', title: '网关地址', render: (record) => `${record.gatewayHost}:${record.gatewayPort}` },
{ key: 'rateLimitPerSecond', title: '限速', render: (record) => `${record.rateLimitPerSecond} 条/秒` },
{
@@ -16,6 +16,22 @@ const columns: Array<TableColumn<AdminChannel>> = [
},
];
const carrierLabels: Record<string, string> = {
mobile: '移动',
cmcc: '移动',
unicom: '联通',
cucc: '联通',
telecom: '电信',
ctcc: '电信',
all: '三网',
unknown: '未识别',
};
function carrierLabel(value?: string | null) {
if (!value) return '-';
return carrierLabels[value.trim().toLowerCase()] ?? value;
}
export function AdminMonitorPage() {
const [channels, setChannels] = useState<AdminChannel[]>([]);
const [monitor, setMonitor] = useState<Record<string, unknown>>({});