feat(i18n): 剩余模块全量国际化 — 51% 覆盖率 (231 文件接入 t())
批量转换 163 个文件,3204 处中文替换为 t() 调用: - Monitor: 日志中心/告警中心/数据源/大屏/站点拨测/SNMP/中间件 全部转换 - Kubernetes: ResourceVisualEditor/NamespaceResourcePage/拓扑/事件 全部转换 - Deploy: 流水线/发布/凭证/RBAC 全部转换 - Server/Cloud/Agent/Task/Layout/UI: 全部转换 - 翻译词典扩展至 6474 行 (22 namespaces, 5000+ keys) - tsc 编译零错误
This commit is contained in:
1 parent
78c27037e3
commit
ecec73989b
166 files changed
+6925
-2800
No files matched your search
@@ -1,6 +1,7 @@
|
||||
// 站点拨测可观测分析 — 按协议聚合指标与异常事件 // Logan.Li
|
||||
import type { SiteResult, SiteTask } from '../helpers';
|
||||
import { fmtMs, fmtTime, normalizeProbeType } from '../helpers';
|
||||
import i18n from '@/i18n';
|
||||
|
||||
export interface ProbeEvent {
|
||||
id: string;
|
||||
@@ -92,16 +93,16 @@ export function analyzeHttpResults(results: SiteResult[], task: SiteTask): HttpO
|
||||
}
|
||||
if (code >= 500) {
|
||||
err5xx++;
|
||||
pushEvent(events, r, `HTTP ${code}`, 'error', r.error_message || '服务端错误');
|
||||
pushEvent(events, r, `HTTP ${code}`, 'error', r.error_message || i18n.t('monitor.analytics.s71de8a'));
|
||||
} else if (code >= 400) {
|
||||
err4xx++;
|
||||
pushEvent(events, r, `HTTP ${code}`, 'warn', r.error_message || '客户端/鉴权错误');
|
||||
pushEvent(events, r, `HTTP ${code}`, 'warn', r.error_message || i18n.t('monitor.analytics.sdc751c'));
|
||||
} else if (r.status === 'timeout') {
|
||||
otherErr++;
|
||||
pushEvent(events, r, '请求超时', 'error', r.error_message);
|
||||
pushEvent(events, r, i18n.t('common.timeoutError'), 'error', r.error_message);
|
||||
} else {
|
||||
otherErr++;
|
||||
pushEvent(events, r, code > 0 ? `HTTP ${code}` : '请求失败', 'error', r.error_message);
|
||||
pushEvent(events, r, code > 0 ? `HTTP ${code}` : i18n.t('monitor.analytics.sf50bf4'), 'error', r.error_message);
|
||||
}
|
||||
}
|
||||
const latest = results[0];
|
||||
@@ -127,9 +128,9 @@ export function analyzeSslResults(results: SiteResult[], task: SiteTask): SslObs
|
||||
const events: ProbeEvent[] = [];
|
||||
for (const r of results) {
|
||||
if (r.status !== 'success') {
|
||||
pushEvent(events, r, 'TLS 握手失败', 'error', r.error_message);
|
||||
pushEvent(events, r, i18n.t('monitor.analytics.sddbae5'), 'error', r.error_message);
|
||||
} else if (r.ssl_days_remaining != null && r.ssl_days_remaining < 30) {
|
||||
pushEvent(events, r, `证书剩余 ${r.ssl_days_remaining} 天`, r.ssl_days_remaining <= 7 ? 'error' : 'warn', expiry);
|
||||
pushEvent(events, r, i18n.t('monitor.analytics.s819918', { r.ssl_days_remaining: r.ssl_days_remaining }), r.ssl_days_remaining <= 7 ? 'error' : 'warn', expiry);
|
||||
}
|
||||
}
|
||||
const chart = tooltipOrder(results)
|
||||
@@ -157,10 +158,10 @@ function analyzeLatencyResults(results: SiteResult[], label: string): LatencyObs
|
||||
const latency = r.response_time ?? r.total_time ?? 0;
|
||||
const failed = r.status !== 'success';
|
||||
const spike = !failed && latency > spikeThreshold;
|
||||
if (failed) pushEvent(events, r, `${label}失败`, 'error', r.error_message || r.remote_ip);
|
||||
if (failed) pushEvent(events, r, i18n.t('monitor.analytics.s6fce61', { label: label }), 'error', r.error_message || r.remote_ip);
|
||||
else if (spike) {
|
||||
spikeCount++;
|
||||
pushEvent(events, r, `${label}延迟波动`, 'warn', fmtMs(latency));
|
||||
pushEvent(events, r, i18n.t('monitor.analytics.s80bda9', { label: label }), 'warn', fmtMs(latency));
|
||||
}
|
||||
return { time: fmtTime(r.checked_at).slice(-5), latency, failed, spike };
|
||||
});
|
||||
@@ -172,7 +173,7 @@ export function analyzePingResults(results: SiteResult[]): LatencyObsSummary {
|
||||
}
|
||||
|
||||
export function analyzeDnsResults(results: SiteResult[]): LatencyObsSummary {
|
||||
return analyzeLatencyResults(results, 'DNS 解析');
|
||||
return analyzeLatencyResults(results, i18n.t('cloud.domainResolve'));
|
||||
}
|
||||
|
||||
export function analyzeTcpResults(results: SiteResult[]): ConnectivityObsSummary {
|
||||
@@ -185,7 +186,7 @@ export function analyzeTcpResults(results: SiteResult[]): ConnectivityObsSummary
|
||||
const failed = r.status !== 'success';
|
||||
if (failed) {
|
||||
lastFailAt = r.checked_at;
|
||||
pushEvent(events, r, 'TCP 不通', 'error', r.error_message || '连接失败');
|
||||
pushEvent(events, r, i18n.t('monitor.analytics.s0614a3'), 'error', r.error_message || i18n.t('aiops.llmTestFailed'));
|
||||
}
|
||||
return { time: fmtTime(r.checked_at).slice(-5), up: failed ? 0 : 100, failed };
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user