fix(i18n): 回退到稳定的 32% 覆盖率状态 (tsc + Vite 构建通过)
批量转换脚本引入的语法错误已回退,保留稳定的 i18n 转换: - 翻译词典: 22 namespaces, 3600+ keys - 已接入: 145+ 文件 (Dashboard/Login/K8s 主页面/Monitor/System/Deploy) - 语言切换器在 Header 中可用 (🇨🇳/🇺🇸) - tsc 零错误, Vite 构建成功
This commit is contained in:
1 parent
ecec73989b
commit
72bfb0e12d
191 files changed
+5057
-7592
No files matched your search
@@ -14,6 +14,7 @@ import { Loader2, Maximize2, Minimize2, Monitor, X } from 'lucide-react';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { attachTerminalResize, mountXterm } from '@/lib/xterm-utils';
|
||||
import { useUserStore } from '@/store';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
interface SessionInfo {
|
||||
session_id: number;
|
||||
@@ -32,6 +33,7 @@ interface LiveMonitorProps {
|
||||
}
|
||||
|
||||
export function LiveMonitorDialog({ open, onOpenChange, sessionId, sessionInfo }: LiveMonitorProps) {
|
||||
const { t } = useTranslation();
|
||||
const containerRef = useRef<HTMLDivElement>(null);
|
||||
const termRef = useRef<XTerm | null>(null);
|
||||
const fitRef = useRef<FitAddon | null>(null);
|
||||
@@ -124,11 +126,11 @@ export function LiveMonitorDialog({ open, onOpenChange, sessionId, sessionInfo }
|
||||
}
|
||||
};
|
||||
|
||||
ws.onerror = () => setConnectError('WebSocket 连接失败');
|
||||
ws.onerror = () => setConnectError(t('aiops.wsConnectFailed'));
|
||||
|
||||
ws.onclose = (e) => {
|
||||
if (!didOpen) {
|
||||
setConnectError(`连接失败 (code=${e.code}): ${e.reason || '认证失败或网络问题'}`);
|
||||
setConnectError(`连接失败 (code=${e.code}): ${e.reason || t('aiops.authOrNetwork')}`);
|
||||
}
|
||||
setConnected(false);
|
||||
term.writeln('\r\n\x1b[33m[审计监控] 连接已断开\x1b[0m');
|
||||
@@ -136,7 +138,7 @@ export function LiveMonitorDialog({ open, onOpenChange, sessionId, sessionInfo }
|
||||
|
||||
const timeout = setTimeout(() => {
|
||||
if (!didOpen) {
|
||||
setConnectError('连接超时 — 请确认已登录且有活跃会话');
|
||||
setConnectError(t('aiops.connectTimeoutActive'));
|
||||
ws.close();
|
||||
}
|
||||
}, 5000);
|
||||
@@ -194,14 +196,14 @@ export function LiveMonitorDialog({ open, onOpenChange, sessionId, sessionInfo }
|
||||
: { maxWidth: '960px', width: '92vw' }
|
||||
}
|
||||
>
|
||||
<DialogTitle className="sr-only">终端实时监控</DialogTitle>
|
||||
<DialogDescription className="sr-only">审计在线 WebSSH 会话</DialogDescription>
|
||||
<DialogTitle className="sr-only">{t('system.terminalLiveMonitor')}</DialogTitle>
|
||||
<DialogDescription className="sr-only">{t('system.auditWebssh')}</DialogDescription>
|
||||
|
||||
{/* 工具栏 — 与 TerminalDialog 一致 // Logan.Li */}
|
||||
<div className="flex items-center justify-between px-4 py-2 border-b border-[var(--dg-border)]">
|
||||
<div className="flex items-center gap-2 text-sm min-w-0 flex-wrap">
|
||||
<Monitor className="h-4 w-4 dg-text-green shrink-0" />
|
||||
<span className="text-[var(--dg-text-primary)] font-medium">终端实时监控</span>
|
||||
<span className="text-[var(--dg-text-primary)] font-medium">{t('system.terminalLiveMonitor')}</span>
|
||||
{meta && (
|
||||
<span className="text-[var(--dg-text-muted)] truncate">
|
||||
{meta.username} · {meta.server_name} ({meta.server_ip}) · {formatTime(meta.start_time)}
|
||||
@@ -215,12 +217,12 @@ export function LiveMonitorDialog({ open, onOpenChange, sessionId, sessionInfo }
|
||||
{!connected && !connectError && (
|
||||
<Badge variant="outline" className="border-yellow-500/30 dg-text-yellow bg-yellow-500/10 text-xs">
|
||||
<Loader2 className="h-3 w-3 animate-spin mr-1" />
|
||||
连接中
|
||||
{t('common.connecting')}
|
||||
</Badge>
|
||||
)}
|
||||
{connectError && (
|
||||
<Badge variant="outline" className="border-red-500/30 dg-text-red bg-red-500/10 text-xs">
|
||||
连接失败
|
||||
{t('system.ldapTestFailed')}
|
||||
</Badge>
|
||||
)}
|
||||
</div>
|
||||
@@ -229,7 +231,7 @@ export function LiveMonitorDialog({ open, onOpenChange, sessionId, sessionInfo }
|
||||
type="button"
|
||||
onClick={() => setFullscreen(!fullscreen)}
|
||||
className="p-1.5 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-secondary)]"
|
||||
title={fullscreen ? '退出全屏' : '全屏'}
|
||||
title={fullscreen ? t('common.exitFullscreen') : t('common.fullscreen')}
|
||||
>
|
||||
{fullscreen ? <Minimize2 className="h-4 w-4" /> : <Maximize2 className="h-4 w-4" />}
|
||||
</button>
|
||||
|
||||
Reference in new issue
Block a user