fix(i18n): U30 修复 8 处批量 i18n 转换损坏的调用 — DeploymentEditContainers/DeploymentEditStorage/AgentRuleDialog/LogFieldSidebar
损坏原因: 早期批量正则 i18n 转换 (U20 记录的 i18n.t() 损坏模式遗留) 将模板表达式/JSX
碎片错误包裹进 i18n.t() 调用, 产生运行时垃圾文本渲染.
修复清单:
- DeploymentEditContainers.tsx:85 — toast 调用 description 字段损坏 (i18n.t('), description: ...'))
- DeploymentEditStorage.tsx:175 — !manifest 空状态文案损坏
- DeploymentEditStorage.tsx:202 — 数据卷卡片副标题损坏
- AgentRuleDialog.tsx:111 — DialogDescription 损坏 (i18n.t('>阈值 {ruleForm.metric !== '))
- AgentRuleDialog.tsx:157 — 操作符 Label 损坏
- AgentRuleDialog.tsx:183 — 端口 Label 损坏
- AgentRuleDialog.tsx:195 — 持续时间 Label 损坏
- LogFieldSidebar.tsx:68 — 搜索框 placeholder 损坏
新增 i18n 键 (zh/en 对齐 7370→7376 +6):
- agent.ruleDialog.description / operator / port / duration
- kubernetes.storage.volumeDesc
- monitor.lbl.searchFields
验证: tsc -b=0, npm build✓ (17.99s), ESLint=0/53/0, go build=0, 17/17 测试通过
This commit is contained in:
1 parent
064b6c4ec2
commit
3039b76cb5
6 files changed
+29
-17
No files matched your search
@@ -108,7 +108,7 @@ export function AgentRuleDialog({ open, onOpenChange, editingRule, onSuccess }:
|
|||||||
<DialogContent className="max-w-md dg-card text-[var(--dg-text-primary)]">
|
<DialogContent className="max-w-md dg-card text-[var(--dg-text-primary)]">
|
||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
<DialogTitle className="text-[var(--dg-text-primary)]">{editingRule ? i18n.t('monitor.editRule') : i18n.t('agent.ruleDialog.editRule')}</DialogTitle>
|
<DialogTitle className="text-[var(--dg-text-primary)]">{editingRule ? i18n.t('monitor.editRule') : i18n.t('agent.ruleDialog.editRule')}</DialogTitle>
|
||||||
<DialogDescription className="dg-text-secondary"> {i18n.t('>阈值 {ruleForm.metric !== ')} </DialogDescription>
|
<DialogDescription className="dg-text-secondary"> {i18n.t('agent.ruleDialog.description')} </DialogDescription>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
|
|
||||||
<div className="space-y-3">
|
<div className="space-y-3">
|
||||||
@@ -154,7 +154,7 @@ export function AgentRuleDialog({ open, onOpenChange, editingRule, onSuccess }:
|
|||||||
{ruleForm.metric !== 'offline' && (
|
{ruleForm.metric !== 'offline' && (
|
||||||
<div className="grid grid-cols-2 gap-3">
|
<div className="grid grid-cols-2 gap-3">
|
||||||
<div className="space-y-1.5">
|
<div className="space-y-1.5">
|
||||||
<Label className="text-[var(--dg-text-secondary)] text-xs"> {i18n.t('>阈值 {ruleForm.metric !== ')} </Label>
|
<Label className="text-[var(--dg-text-secondary)] text-xs"> {i18n.t('agent.ruleDialog.operator')} </Label>
|
||||||
<Select value={ruleForm.operator} onValueChange={(v) => setRuleForm({ ...ruleForm, operator: v })}>
|
<Select value={ruleForm.operator} onValueChange={(v) => setRuleForm({ ...ruleForm, operator: v })}>
|
||||||
<SelectTrigger className="h-9 dg-input">
|
<SelectTrigger className="h-9 dg-input">
|
||||||
<SelectValue />
|
<SelectValue />
|
||||||
@@ -180,10 +180,10 @@ export function AgentRuleDialog({ open, onOpenChange, editingRule, onSuccess }:
|
|||||||
|
|
||||||
{ruleForm.metric === 'port_down' && (
|
{ruleForm.metric === 'port_down' && (
|
||||||
<div className="space-y-1.5">
|
<div className="space-y-1.5">
|
||||||
<Label className="text-[var(--dg-text-secondary)] text-xs"> {i18n.t('>阈值 {ruleForm.metric !== ')} </Label>
|
<Label className="text-[var(--dg-text-secondary)] text-xs"> {i18n.t('agent.ruleDialog.port')} </Label>
|
||||||
<Input
|
<Input
|
||||||
type="number"
|
type="number"
|
||||||
value={ruleForm.port}
|
value={ruleForm.port}
|
||||||
onChange={(e) => setRuleForm({ ...ruleForm, port: e.target.value })}
|
onChange={(e) => setRuleForm({ ...ruleForm, port: e.target.value })}
|
||||||
placeholder={i18n.t('agent.ruleDialog.portPlaceholder')}
|
placeholder={i18n.t('agent.ruleDialog.portPlaceholder')}
|
||||||
className="h-9 dg-input"
|
className="h-9 dg-input"
|
||||||
@@ -192,7 +192,7 @@ export function AgentRuleDialog({ open, onOpenChange, editingRule, onSuccess }:
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
<div className="space-y-1.5">
|
<div className="space-y-1.5">
|
||||||
<Label className="text-[var(--dg-text-secondary)] text-xs"> {i18n.t('>阈值 {ruleForm.metric !== ')} </Label>
|
<Label className="text-[var(--dg-text-secondary)] text-xs"> {i18n.t('agent.ruleDialog.duration')} </Label>
|
||||||
<Input
|
<Input
|
||||||
type="number"
|
type="number"
|
||||||
value={ruleForm.duration}
|
value={ruleForm.duration}
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ export function DeploymentEditContainers({ clusterCode, namespace, deploymentNam
|
|||||||
// validate
|
// validate
|
||||||
for (const c of [...initContainers, ...containers]) {
|
for (const c of [...initContainers, ...containers]) {
|
||||||
if (!c.name.trim()) {
|
if (!c.name.trim()) {
|
||||||
toast({ title: i18n.t('kubernetes.msg.saveFailed'), description: i18n.t('), description: `容器 ${c.name} 的镜像不能为空`, variant: '), variant: 'destructive' });
|
toast({ title: i18n.t('kubernetes.msg.saveFailed'), description: '容器名称不能为空', variant: 'destructive' });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!c.image.trim()) {
|
if (!c.image.trim()) {
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ export function DeploymentEditStorage({ clusterCode, namespace, deploymentName,
|
|||||||
if (!manifest) {
|
if (!manifest) {
|
||||||
return (
|
return (
|
||||||
<Card className="dg-card">
|
<Card className="dg-card">
|
||||||
<CardContent className="p-8 text-center dg-text-muted"> {i18n.t('), description: `请为「${entry.volume.name}」${hint}`, variant: ')} </CardContent>
|
<CardContent className="p-8 text-center dg-text-muted"> {i18n.t('kubernetes.storage.noManifest')} </CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -199,7 +199,7 @@ export function DeploymentEditStorage({ clusterCode, namespace, deploymentName,
|
|||||||
数据卷
|
数据卷
|
||||||
<Badge variant="outline" className="border-[var(--dg-border)] dg-text-secondary">{entries.length}</Badge>
|
<Badge variant="outline" className="border-[var(--dg-border)] dg-text-secondary">{entries.length}</Badge>
|
||||||
</CardTitle>
|
</CardTitle>
|
||||||
<p className="text-[11px] dg-text-muted mt-1"> {i18n.t('), description: `请为「${entry.volume.name}」${hint}`, variant: ')} </p>
|
<p className="text-[11px] dg-text-muted mt-1"> {i18n.t('kubernetes.storage.volumeDesc')} </p>
|
||||||
</div>
|
</div>
|
||||||
<Button size="sm" variant="outline" className="h-7 border-[var(--dg-border)] text-[var(--dg-text-secondary)] text-xs shrink-0" onClick={addEntry}>
|
<Button size="sm" variant="outline" className="h-7 border-[var(--dg-border)] text-[var(--dg-text-secondary)] text-xs shrink-0" onClick={addEntry}>
|
||||||
<Plus className="h-3 w-3 mr-1" />添加数据卷
|
<Plus className="h-3 w-3 mr-1" />添加数据卷
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ export function LogFieldSidebar({
|
|||||||
<input
|
<input
|
||||||
value={search}
|
value={search}
|
||||||
onChange={e => setSearch(e.target.value)}
|
onChange={e => setSearch(e.target.value)}
|
||||||
placeholder={i18n.t('})${f.count ? ` · ${f.count} 个值` : ')}
|
placeholder={i18n.t('monitor.lbl.searchFields')}
|
||||||
className="w-full h-7 pl-7 pr-2 text-xs rounded-md dg-input"
|
className="w-full h-7 pl-7 pr-2 text-xs rounded-md dg-input"
|
||||||
style={{ background: 'var(--dg-bg-tertiary)', border: '1px solid var(--dg-border)', color: 'var(--dg-text-primary)' }}
|
style={{ background: 'var(--dg-bg-tertiary)', border: '1px solid var(--dg-border)', color: 'var(--dg-text-primary)' }}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -4907,7 +4907,8 @@
|
|||||||
"siteRequestFailed": "Request Failed",
|
"siteRequestFailed": "Request Failed",
|
||||||
"siteRequestTimeout": "Request Timeout",
|
"siteRequestTimeout": "Request Timeout",
|
||||||
"siteConnFailed": "Connection Failed",
|
"siteConnFailed": "Connection Failed",
|
||||||
"noProbeHint": "No health probes. Click \"{{action}}\" to create one."
|
"noProbeHint": "No health probes. Click \"{{action}}\" to create one.",
|
||||||
|
"searchFields": "Search fields"
|
||||||
},
|
},
|
||||||
"alertRuleDialog2": {
|
"alertRuleDialog2": {
|
||||||
"editRule": "Edit Alert Rule",
|
"editRule": "Edit Alert Rule",
|
||||||
@@ -5624,7 +5625,8 @@
|
|||||||
"expanded": "Expanded",
|
"expanded": "Expanded",
|
||||||
"expandFailed": "Expand failed",
|
"expandFailed": "Expand failed",
|
||||||
"provisioner": "Provisioner",
|
"provisioner": "Provisioner",
|
||||||
"parameters": "Parameters"
|
"parameters": "Parameters",
|
||||||
|
"volumeDesc": "Mount persistent storage volumes for containers"
|
||||||
},
|
},
|
||||||
"event": {
|
"event": {
|
||||||
"title": "Events",
|
"title": "Events",
|
||||||
@@ -6886,7 +6888,11 @@
|
|||||||
"enterName": "Please enter rule name",
|
"enterName": "Please enter rule name",
|
||||||
"editRule": "Edit Rule",
|
"editRule": "Edit Rule",
|
||||||
"namePlaceholder": "e.g., CPU Usage Alert",
|
"namePlaceholder": "e.g., CPU Usage Alert",
|
||||||
"portPlaceholder": "e.g., 8080"
|
"portPlaceholder": "e.g., 8080",
|
||||||
|
"description": "Configure alert thresholds and notification rules for monitoring metrics",
|
||||||
|
"operator": "Operator",
|
||||||
|
"port": "Port",
|
||||||
|
"duration": "Duration (seconds)"
|
||||||
},
|
},
|
||||||
"monitor2": {
|
"monitor2": {
|
||||||
"commandPlaceholder2": "e.g., free -m && df -h"
|
"commandPlaceholder2": "e.g., free -m && df -h"
|
||||||
|
|||||||
@@ -4907,7 +4907,8 @@
|
|||||||
"siteRequestFailed": "请求失败",
|
"siteRequestFailed": "请求失败",
|
||||||
"siteRequestTimeout": "请求超时",
|
"siteRequestTimeout": "请求超时",
|
||||||
"siteConnFailed": "连接失败",
|
"siteConnFailed": "连接失败",
|
||||||
"noProbeHint": "暂无健康探针,点击「{{action}}」创建"
|
"noProbeHint": "暂无健康探针,点击「{{action}}」创建",
|
||||||
|
"searchFields": "搜索字段"
|
||||||
},
|
},
|
||||||
"alertRuleDialog2": {
|
"alertRuleDialog2": {
|
||||||
"editRule": "编辑告警规则",
|
"editRule": "编辑告警规则",
|
||||||
@@ -5624,7 +5625,8 @@
|
|||||||
"expanded": "已扩容",
|
"expanded": "已扩容",
|
||||||
"expandFailed": "扩容失败",
|
"expandFailed": "扩容失败",
|
||||||
"provisioner": "供应器",
|
"provisioner": "供应器",
|
||||||
"parameters": "参数"
|
"parameters": "参数",
|
||||||
|
"volumeDesc": "为容器挂载持久化存储卷"
|
||||||
},
|
},
|
||||||
"event": {
|
"event": {
|
||||||
"title": "事件",
|
"title": "事件",
|
||||||
@@ -6886,7 +6888,11 @@
|
|||||||
"enterName": "请输入规则名称",
|
"enterName": "请输入规则名称",
|
||||||
"editRule": "编辑规则",
|
"editRule": "编辑规则",
|
||||||
"namePlaceholder": "例如:CPU 使用率告警",
|
"namePlaceholder": "例如:CPU 使用率告警",
|
||||||
"portPlaceholder": "例如:8080"
|
"portPlaceholder": "例如:8080",
|
||||||
|
"description": "配置监控指标的告警阈值和通知规则",
|
||||||
|
"operator": "操作符",
|
||||||
|
"port": "端口",
|
||||||
|
"duration": "持续时间(秒)"
|
||||||
},
|
},
|
||||||
"monitor2": {
|
"monitor2": {
|
||||||
"commandPlaceholder2": "例如:free -m && df -h"
|
"commandPlaceholder2": "例如:free -m && df -h"
|
||||||
|
|||||||
Reference in new issue
Block a user