Files
aiops/frontend/src/components/server/ServerStatsStrip.tsx
T
attacker 55f216cfbb feat(i18n): 安全批量转换 135 文件 — 覆盖率 34%→62%
使用 i18n.t() 全局方式(避免 hook 定位问题):
- 288 目标文件中 135 个成功转换
- 2228 处中文替换为 i18n.t() 调用
- 1006 个新翻译 key 添加到 zh-CN.json + en-US.json
- 词典总量: 3554 keys (22 namespaces)
- tsc 零错误 + Vite 构建成功
- 6 个含代码示例/数据字符串的文件安全回退
2026-07-03 02:14:20 +08:00

26 lines
1009 B
TypeScript

// 服务器统计条 — 紧凑型替代 4 张大卡片
import { StatStrip } from '@/components/ui/stat-strip';
import type { JsonData } from '@/types/common';
import i18n from '@/i18n';
interface ServerStatsStripProps {
servers: JsonData[];
}
export function ServerStatsStrip({ servers }: ServerStatsStripProps) {
const runningCount = servers.filter((s) => s.status === 'running').length;
const maintenanceCount = servers.filter((s) => s.status === 'maintenance').length;
const stoppedCount = servers.filter((s) => s.status === 'stopped').length;
return (
<StatStrip
items={[
{ label: i18n.t('system.terminalServer'), value: servers.length, color: 'blue' },
{ label: i18n.t('agent.agentServiceRunning'), value: runningCount, color: 'emerald' },
{ label: i18n.t('dashboard.serversStatus.maintenance'), value: maintenanceCount, color: 'amber' },
{ label: i18n.t('agent.agentServiceStopped'), value: stoppedCount, color: 'muted' },
]}
/>
);
}