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
@@ -7,6 +7,7 @@ import { useToast } from '@/hooks/use-toast';
|
||||
import { kubernetesApi } from '@/api';
|
||||
import { YamlCodeMirror } from './YamlCodeMirror';
|
||||
import type { JsonData } from '@/types/common';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
interface YamlImportDialogProps {
|
||||
clusterCode: string;
|
||||
@@ -15,23 +16,24 @@ interface YamlImportDialogProps {
|
||||
}
|
||||
|
||||
export function YamlImportDialog({ clusterCode, onClose, onApplied }: YamlImportDialogProps) {
|
||||
const { t } = useTranslation();
|
||||
const { toast } = useToast();
|
||||
const [content, setContent] = useState('');
|
||||
const [applying, setApplying] = useState(false);
|
||||
|
||||
const apply = async () => {
|
||||
if (!content.trim()) {
|
||||
toast({ title: '请输入 YAML', variant: 'destructive' });
|
||||
toast({ title: t('kubernetes.yamlimportdialog.s81d637'), variant: 'destructive' });
|
||||
return;
|
||||
}
|
||||
setApplying(true);
|
||||
try {
|
||||
await kubernetesApi.applyYAML(clusterCode, content);
|
||||
toast({ title: '导入成功', description: 'YAML 已应用到集群' });
|
||||
toast({ title: t('system.importSuccess'), description: t('kubernetes.yamlimportdialog.sb66e8e') });
|
||||
onApplied?.();
|
||||
onClose();
|
||||
} catch (e) {
|
||||
toast({ title: '导入失败', description: (e as JsonData).message, variant: 'destructive' });
|
||||
toast({ title: t('common.importFailed'), description: (e as JsonData).message, variant: 'destructive' });
|
||||
} finally { setApplying(false); }
|
||||
};
|
||||
|
||||
@@ -45,8 +47,8 @@ export function YamlImportDialog({ clusterCode, onClose, onApplied }: YamlImport
|
||||
<div className="flex items-center gap-2">
|
||||
<Upload className="h-5 w-5 text-[var(--dg-text-muted)]" />
|
||||
<div>
|
||||
<h2 className="text-lg font-bold text-[var(--dg-text-primary)]">导入 YAML</h2>
|
||||
<p className="text-xs text-[var(--dg-text-muted)]">支持多文档(--- 分隔),适用于新建或更新资源</p>
|
||||
<h2 className="text-lg font-bold text-[var(--dg-text-primary)]">{t('kubernetes.yaml.importYaml')}</h2>
|
||||
<p className="text-xs text-[var(--dg-text-muted)]">{t('kubernetes.yamlimportdialog.s92b733')}</p>
|
||||
</div>
|
||||
</div>
|
||||
<Button variant="ghost" size="icon" className="h-8 w-8" onClick={onClose}><X className="h-4 w-4" /></Button>
|
||||
@@ -60,7 +62,7 @@ export function YamlImportDialog({ clusterCode, onClose, onApplied }: YamlImport
|
||||
/>
|
||||
</div>
|
||||
<div className="flex justify-end gap-2 p-4 border-t border-[var(--dg-border)] shrink-0">
|
||||
<Button variant="outline" onClick={onClose}>取消</Button>
|
||||
<Button variant="outline" onClick={onClose}>{t('common.cancel')}</Button>
|
||||
<Button className="bg-blue-600 hover:bg-blue-700" onClick={apply} disabled={applying}>
|
||||
{applying ? <Loader2 className="h-4 w-4 animate-spin mr-1" /> : <Upload className="h-4 w-4 mr-1" />}
|
||||
应用
|
||||
|
||||
Reference in new issue
Block a user