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:
attacker committed 2026-07-03 02:02:29 +08:00
1 parent ecec73989b
commit 72bfb0e12d
191 files changed
+5057 -7592

No files matched your search

@@ -8,7 +8,6 @@ import { Search, Server, Network, Loader2, Check } from 'lucide-react';
import { cn } from '@/lib/utils';
import { serverApi, kubernetesApi } from '@/api';
import { getPublicApiBase } from '@/utils/request';
import { useTranslation } from 'react-i18next';
export interface DeployTargetValue {
deployTarget: 'ssh' | 'k8s';
@@ -50,7 +49,6 @@ interface DeploymentItem {
// 发布目标选择:SSH 关联主机 / K8s 关联 Deployment // Logan.Li
export function DeployTargetFields({ value, onChange, requireTarget = true }: DeployTargetFieldsProps) {
const { t } = useTranslation();
const [servers, setServers] = useState<ServerItem[]>([]);
const [clusters, setClusters] = useState<ClusterItem[]>([]);
const [deployments, setDeployments] = useState<DeploymentItem[]>([]);
@@ -150,8 +148,8 @@ export function DeployTargetFields({ value, onChange, requireTarget = true }: De
<div className="space-y-3">
<div className="flex gap-1 p-1 rounded-lg bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)]">
{([
{ key: 'ssh' as const, label: t('deploy.deploytargetfields.secf819'), icon: Server },
{ key: 'k8s' as const, label: t('deploy.deploytargetfields.s7ff062'), icon: Network },
{ key: 'ssh' as const, label: '主机发布', icon: Server },
{ key: 'k8s' as const, label: 'Kubernetes 发布', icon: Network },
]).map((item) => {
const active = value.deployTarget === item.key;
const Icon = item.icon;
@@ -201,7 +199,7 @@ export function DeployTargetFields({ value, onChange, requireTarget = true }: De
<Input
value={serverSearch}
onChange={(e) => setServerSearch(e.target.value)}
placeholder=t('deploy.deploytargetfields.sc76249')
placeholder="搜索主机名或 IP"
className="pl-8 h-8 text-xs dg-input"
/>
</div>
@@ -211,7 +209,7 @@ export function DeployTargetFields({ value, onChange, requireTarget = true }: De
<Loader2 className="h-4 w-4 animate-spin mr-1.5" />加载中
</div>
) : filteredServers.length === 0 ? (
<p className="text-xs text-[var(--dg-text-muted)] text-center py-8">{t('deploy.deploytargetfields.sb42401')}</p>
<p className="text-xs text-[var(--dg-text-muted)] text-center py-8">暂无可用主机</p>
) : (
<div className="p-1.5 space-y-1">
{filteredServers.map((srv) => {
@@ -243,10 +241,10 @@ export function DeployTargetFields({ value, onChange, requireTarget = true }: De
</div>
)}
</ScrollArea>
<p className="text-[10px] text-[var(--dg-text-muted)]">{t('deploy.deploytargetfields.sb2b6db')}</p>
<p className="text-[10px] text-[var(--dg-text-muted)]">构建完成后 SCP 上传 jar/tar.gz 到远程目录并执行部署命令</p>
<div className="grid grid-cols-2 gap-2">
<div className="space-y-1">
<Label className="text-xs">{t('deploy.deploytargetfields.s5ca05a')}</Label>
<Label className="text-xs">远程目录</Label>
<Input
value={value.deployRemotePath}
onChange={(e) => onChange({ deployRemotePath: e.target.value })}
@@ -255,7 +253,7 @@ export function DeployTargetFields({ value, onChange, requireTarget = true }: De
/>
</div>
<div className="space-y-1">
<Label className="text-xs">{t('deploy.deploytargetfields.s65b20b')}</Label>
<Label className="text-xs">部署命令</Label>
<Input
value={value.deployScript}
onChange={(e) => onChange({ deployScript: e.target.value })}
@@ -282,10 +280,10 @@ export function DeployTargetFields({ value, onChange, requireTarget = true }: De
})}
>
<SelectTrigger className="h-8 text-xs dg-input">
<SelectValue placeholder=t('k8s.topology.selectCluster') />
<SelectValue placeholder="选择集群" />
</SelectTrigger>
<SelectContent>
<SelectItem value="__none">{t('common.selectPlaceholder')}</SelectItem>
<SelectItem value="__none">请选择</SelectItem>
{clusters.map((c) => (
<SelectItem key={c.id} value={String(c.id)}>{c.name}</SelectItem>
))}
@@ -293,11 +291,11 @@ export function DeployTargetFields({ value, onChange, requireTarget = true }: De
</Select>
</div>
<div className="space-y-1">
<Label className="text-xs">{t('deploy.deploytargetfields.s806e4e')}</Label>
<Label className="text-xs">已选 Deployment</Label>
<Input
readOnly
value={value.k8sDeployment ? `${value.k8sNamespace}/${value.k8sDeployment}` : ''}
placeholder=t('deploy.deploytargetfields.sbb1671')
placeholder="从下方列表选择"
className="h-8 text-xs dg-input font-mono"
/>
</div>
@@ -309,7 +307,7 @@ export function DeployTargetFields({ value, onChange, requireTarget = true }: De
<Input
value={depSearch}
onChange={(e) => setDepSearch(e.target.value)}
placeholder=t('deploy.deploytargetfields.saa98b2')
placeholder="搜索 Deployment 或命名空间"
className="pl-8 h-8 text-xs dg-input"
/>
</div>
@@ -319,7 +317,7 @@ export function DeployTargetFields({ value, onChange, requireTarget = true }: De
<Loader2 className="h-4 w-4 animate-spin mr-1.5" />加载 Deployment
</div>
) : filteredDeployments.length === 0 ? (
<p className="text-xs text-[var(--dg-text-muted)] text-center py-8">{t('deploy.deploytargetfields.s5689d3')}</p>
<p className="text-xs text-[var(--dg-text-muted)] text-center py-8">暂无 Deployment</p>
) : (
<div className="p-1.5 space-y-1">
{filteredDeployments.map((dep) => {
@@ -350,11 +348,11 @@ export function DeployTargetFields({ value, onChange, requireTarget = true }: De
)}
</ScrollArea>
<div className="space-y-1">
<Label className="text-xs">{t('kubernetes.pod.containerName')} <span className="text-[var(--dg-text-muted)]">{t('deploy.deploytargetfields.s7f5a1e')}</span></Label>
<Label className="text-xs">容器名 <span className="text-[var(--dg-text-muted)]">(多容器时填写)</span></Label>
<Input
value={value.k8sContainerName}
onChange={(e) => onChange({ k8sContainerName: e.target.value })}
placeholder=t('deploy.deploytargetfields.s389076')
placeholder="默认首个容器"
className="h-8 text-xs font-mono dg-input"
/>
</div>