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
@@ -18,7 +18,6 @@ import { toast } from 'sonner';
|
||||
import { alertApi } from '@/api';
|
||||
import { renderRuleChannels } from './alertShared';
|
||||
import type { AlertChannel, AlertRuleRecord } from '@/types';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
const COL_SPAN = 9; // 复选框 + 7 数据列 + 操作列 // Logan.Li
|
||||
|
||||
@@ -33,7 +32,6 @@ export function AlertRulesTab({
|
||||
onReload: () => void;
|
||||
onEditRule: ( rule: AlertRuleRecord) => void;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const confirm = useConfirm();
|
||||
const [selectedIds, setSelectedIds] = useState<number[]>([]);
|
||||
|
||||
@@ -55,19 +53,19 @@ export function AlertRulesTab({
|
||||
|
||||
const handleDeleteRule = async ( id: number) => {
|
||||
const ok = await confirm({
|
||||
title: t('monitor.alertrulestab.sfa5bfd'),
|
||||
description: t('monitor.alertrulestab.sd30155'),
|
||||
confirmText: t('common.delete'),
|
||||
title: '删除告警规则',
|
||||
description: '确定删除此告警规则?',
|
||||
confirmText: '删除',
|
||||
variant: 'destructive',
|
||||
});
|
||||
if (!ok) return;
|
||||
try {
|
||||
await alertApi.deleteRule(id);
|
||||
toast.success(t('monitor.alertrulestab.s20b3fd'));
|
||||
toast.success('告警规则已删除');
|
||||
onReload();
|
||||
} catch (error) {
|
||||
console.error('Failed to delete rule:', error);
|
||||
toast.error(t('common.deleteFailed'));
|
||||
toast.error('删除失败');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -75,20 +73,20 @@ export function AlertRulesTab({
|
||||
const handleBatchDelete = async () => {
|
||||
if (selectedIds.length === 0) return;
|
||||
const ok = await confirm({
|
||||
title: t('monitor.alertrulestab.sbb457b'),
|
||||
description: t('monitor.alertrulestab.s12d681', { selectedIds.length: selectedIds.length }),
|
||||
confirmText: t('common.batchDelete'),
|
||||
title: '批量删除告警规则',
|
||||
description: `确定删除选中的 ${selectedIds.length} 条告警规则吗?此操作不可撤销。`,
|
||||
confirmText: '批量删除',
|
||||
variant: 'destructive',
|
||||
});
|
||||
if (!ok) return;
|
||||
try {
|
||||
await alertApi.batchDeleteRules(selectedIds);
|
||||
toast.success(t('monitor.alertrulestab.s327a78', { selectedIds.length: selectedIds.length }));
|
||||
toast.success(`已删除 ${selectedIds.length} 条告警规则`);
|
||||
setSelectedIds([]);
|
||||
onReload();
|
||||
} catch (error) {
|
||||
console.error('Failed to batch delete rules:', error);
|
||||
toast.error(t('cloud.batchDeleteFailed'));
|
||||
toast.error('批量删除失败');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -134,14 +132,14 @@ export function AlertRulesTab({
|
||||
className="border-[var(--dg-border-hover)]"
|
||||
/>
|
||||
</TableHead>
|
||||
<TableHead className="dg-text-secondary">{t('monitor.ruleName')}</TableHead>
|
||||
<TableHead className="dg-text-secondary">{t('menu.datasources')}</TableHead>
|
||||
<TableHead className="dg-text-secondary">{t('monitor.alertrulestab.s65939c')}</TableHead>
|
||||
<TableHead className="dg-text-secondary">{t('common.level')}</TableHead>
|
||||
<TableHead className="dg-text-secondary">{t('monitor.alertDuration')}</TableHead>
|
||||
<TableHead className="dg-text-secondary">{t('monitor.notificationChannel')}</TableHead>
|
||||
<TableHead className="dg-text-secondary">{t('common.status')}</TableHead>
|
||||
<TableHead className="dg-text-secondary text-right">{t('common.actions')}</TableHead>
|
||||
<TableHead className="dg-text-secondary">规则名称</TableHead>
|
||||
<TableHead className="dg-text-secondary">数据源</TableHead>
|
||||
<TableHead className="dg-text-secondary">触发条件</TableHead>
|
||||
<TableHead className="dg-text-secondary">级别</TableHead>
|
||||
<TableHead className="dg-text-secondary">持续时间</TableHead>
|
||||
<TableHead className="dg-text-secondary">通知渠道</TableHead>
|
||||
<TableHead className="dg-text-secondary">状态</TableHead>
|
||||
<TableHead className="dg-text-secondary text-right">操作</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
|
||||
Reference in new issue
Block a user