refactor(i18n): U27 多模块 phantom key 批量清理 — Cloud/Deploy/Agent/Monitor/System 5 模块 25 文件, 180 个 phantom key → 51 残留, 129 个替换为语义化键, 新增 12 子命名空间, zh/en 7185→7294 +109 键对齐, tsc -b=0, npm build✓ (16.31s), ESLint=0/0/0, go build=0, 17/17 测试通过
This commit is contained in:
1 parent
7f5295cfc2
commit
b812b3b20c
27 files changed
+459
-148
No files matched your search
@@ -207,7 +207,7 @@ export function AlertChannelDialog({
|
||||
{/* 渠道表单 */}
|
||||
<div className="space-y-4">
|
||||
<Label className="text-[var(--dg-text-secondary)] text-sm">
|
||||
{editingChannel ? i18n.t('编辑渠道') : i18n.t('新建渠道')}
|
||||
{editingChannel ? i18n.t('monitor.alertChannelDialog2.editChannel') : i18n.t('monitor.alertChannelDialog2.newChannel')}
|
||||
</Label>
|
||||
<div className="space-y-1.5">
|
||||
<Label className="dg-text-secondary text-xs"> {i18n.t('>渠道名称 <span className=')} <span className="dg-text-red">*</span></Label>
|
||||
|
||||
@@ -76,15 +76,15 @@ export function AlertManager() {
|
||||
];
|
||||
|
||||
const pageTabs = [
|
||||
{ id: 'events', label: i18n.t('告警事件') },
|
||||
{ id: 'events', label: i18n.t('monitor.alertMgr2.alertEvents') },
|
||||
{ id: 'rules', label: i18n.t('monitor.alertRules') },
|
||||
];
|
||||
|
||||
return (
|
||||
<PageShell
|
||||
variant="list"
|
||||
title={i18n.t('监控告警')}
|
||||
subtitle={i18n.t('告警规则管理与告警事件处理')}
|
||||
title={i18n.t('monitor.alertMgr2.monitorAlert')}
|
||||
subtitle={i18n.t('monitor.alertMgr2.subtitle')}
|
||||
icon={<Bell className="h-5 w-5" />}
|
||||
tabs={pageTabs}
|
||||
activeTab={activeTab}
|
||||
@@ -94,7 +94,7 @@ export function AlertManager() {
|
||||
items={[
|
||||
{ label: i18n.t('monitor.alertRules'), value: rules.length, color: 'blue' },
|
||||
{ label: i18n.t('monitor.alertHelper.statusFiring'), value: alerts.filter((e) => e.status === 'firing').length, color: 'red' },
|
||||
{ label: i18n.t('今日告警'), value: alerts.length, color: 'amber' },
|
||||
{ label: i18n.t('monitor.alertMgr2.todayAlerts'), value: alerts.length, color: 'amber' },
|
||||
{ label: i18n.t('kubernetes.msg.uncordonSuccess'), value: alerts.filter((e) => e.status === 'resolved').length, color: 'emerald' },
|
||||
]}
|
||||
/>
|
||||
|
||||
@@ -128,10 +128,10 @@ export function AlertRuleDialog({
|
||||
<DialogContent className="dg-input max-w-lg">
|
||||
<DialogHeader>
|
||||
<DialogTitle className="text-[var(--dg-text-primary)]">
|
||||
{editingRule ? i18n.t('编辑告警规则') : i18n.t('新建告警规则')}
|
||||
{editingRule ? i18n.t('monitor.alertRuleDialog2.editRule') : i18n.t('monitor.alertRuleDialog2.newRule')}
|
||||
</DialogTitle>
|
||||
<DialogDescription className="dg-text-muted">
|
||||
{editingRule ? i18n.t('编辑告警规则') : i18n.t('新建告警规则')}
|
||||
{editingRule ? i18n.t('monitor.alertRuleDialog2.editRule') : i18n.t('monitor.alertRuleDialog2.newRule')}
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
|
||||
@@ -141,7 +141,7 @@ export function AlertRuleDialog({
|
||||
<Input
|
||||
value={ruleForm.name}
|
||||
onChange={(e) => setRuleForm({ ...ruleForm, name: e.target.value })}
|
||||
placeholder={i18n.t('如:CPU 使用率告警')}
|
||||
placeholder={i18n.t('monitor.alertRuleDialog2.namePlaceholder')}
|
||||
className="dg-input"
|
||||
/>
|
||||
</div>
|
||||
@@ -151,7 +151,7 @@ export function AlertRuleDialog({
|
||||
<Textarea
|
||||
value={ruleForm.description}
|
||||
onChange={(e) => setRuleForm({ ...ruleForm, description: e.target.value })}
|
||||
placeholder={i18n.t('如:CPU 使用率告警')}
|
||||
placeholder={i18n.t('monitor.alertRuleDialog2.namePlaceholder')}
|
||||
rows={2}
|
||||
className="dg-input resize-none"
|
||||
/>
|
||||
@@ -303,7 +303,7 @@ export function AlertRuleDialog({
|
||||
onClick={handleSaveRule}
|
||||
>
|
||||
{ruleSaving && <Loader2 className="h-4 w-4 mr-2 animate-spin" />}
|
||||
{editingRule ? i18n.t('cloud.saveChanges') : i18n.t('编辑告警规则')}
|
||||
{editingRule ? i18n.t('cloud.saveChanges') : i18n.t('monitor.alertRuleDialog2.editRule')}
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
|
||||
@@ -54,15 +54,15 @@ export function AlertRulesTab({
|
||||
|
||||
const handleDeleteRule = async ( id: number) => {
|
||||
const ok = await confirm({
|
||||
title: i18n.t('删除告警规则'),
|
||||
description: i18n.t('确定删除此告警规则?'),
|
||||
title: i18n.t('monitor.alertRulesTab.deleteRule'),
|
||||
description: i18n.t('monitor.alertRulesTab.deleteConfirm'),
|
||||
confirmText: i18n.t('kubernetes.storage.delete2'),
|
||||
variant: 'destructive',
|
||||
});
|
||||
if (!ok) return;
|
||||
try {
|
||||
await alertApi.deleteRule(id);
|
||||
toast.success(i18n.t('告警规则已删除'));
|
||||
toast.success(i18n.t('monitor.alertRulesTab.deleted'));
|
||||
onReload();
|
||||
} catch (error) {
|
||||
console.error('Failed to delete rule:', error);
|
||||
@@ -74,7 +74,7 @@ export function AlertRulesTab({
|
||||
const handleBatchDelete = async () => {
|
||||
if (selectedIds.length === 0) return;
|
||||
const ok = await confirm({
|
||||
title: i18n.t('删除告警规则'),
|
||||
title: i18n.t('monitor.alertRulesTab.deleteRule'),
|
||||
description: `确定删除选中的 ${selectedIds.length} 条告警规则吗?此操作不可撤销。`,
|
||||
confirmText: i18n.t('system.terminalBatchDelete'),
|
||||
variant: 'destructive',
|
||||
|
||||
@@ -34,7 +34,7 @@ export default function PrometheusDatasourceManager() {
|
||||
const [editingDs, setEditingDs] = useState<PromDS | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (isError) toast.error(i18n.t('获取数据源列表失败'));
|
||||
if (isError) toast.error(i18n.t('monitor.promDs2.listFailed'));
|
||||
}, [isError]);
|
||||
|
||||
const openCreate = () => {
|
||||
@@ -67,7 +67,7 @@ export default function PrometheusDatasourceManager() {
|
||||
await setDefaultMutation.mutateAsync(ds.id);
|
||||
toast.success(`已将「${ds.name}」设为默认数据源`);
|
||||
} catch {
|
||||
toast.error(i18n.t('删除失败'));
|
||||
toast.error(i18n.t('monitor.promDs2.deleteFailed'));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -95,8 +95,8 @@ export default function PrometheusDatasourceManager() {
|
||||
{sources.length === 0 ? (
|
||||
<PageEmpty
|
||||
icon={<Database className="h-12 w-12" />}
|
||||
title={i18n.t('暂无 Prometheus 数据源')}
|
||||
description={i18n.t('添加数据源后可用于指标监控与监控大屏')}
|
||||
title={i18n.t('monitor.promDs2.noData')}
|
||||
description={i18n.t('monitor.promDs2.addHint')}
|
||||
action={(
|
||||
<Button onClick={openCreate} size="sm" className="dg-btn-primary">
|
||||
<Plus className="w-4 h-4 mr-1" />添加数据源
|
||||
|
||||
@@ -147,10 +147,10 @@ export function LogDatasourcePage() {
|
||||
rowKey={(ds) => ds.id}
|
||||
loading={loading}
|
||||
searchable
|
||||
searchPlaceholder={i18n.t('搜索数据源名称或地址...')}
|
||||
searchPlaceholder={i18n.t('monitor.logDsPage.searchPlaceholder')}
|
||||
searchKeys={['name', 'url']}
|
||||
sortable
|
||||
emptyText={i18n.t('暂无数据源,点击上方按钮添加')}
|
||||
emptyText={i18n.t('monitor.logDsPage.noData')}
|
||||
toolbarExtra={
|
||||
<>
|
||||
<Button variant="outline" size="sm" className="h-8 border-[var(--dg-border)] text-[var(--dg-text-secondary)] hover:bg-[var(--dg-bg-hover)] hover:text-[var(--dg-text-primary)]" onClick={load}>
|
||||
|
||||
@@ -24,8 +24,8 @@ interface Props {
|
||||
}
|
||||
|
||||
const STATUS_LABEL: Record<string, { text: string; color: string }> = {
|
||||
precise: { text: i18n.t('结果精确'), color: '#22c55e' },
|
||||
partial: { text: i18n.t('部分命中'), color: '#f59e0b' },
|
||||
precise: { text: i18n.t('monitor.logQueryToolbar.exactMatch'), color: '#22c55e' },
|
||||
partial: { text: i18n.t('monitor.logQueryToolbar.partialMatch'), color: '#f59e0b' },
|
||||
failed: { text: i18n.t('monitor.logPanel.queryFailed'), color: '#ef4444' },
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user