refactor(i18n): U26 Kubernetes 模块 phantom key 大规模清理 — 32 文件 171 phantom key → 8 残留(均为误匹配), 163 个替换为 k8s.* 语义化键, 新增 19 子命名空间 + 扩展 8 个已有, zh/en 6990→7185 +195 键对齐, tsc -b=0, npm build✓ (17.59s), ESLint=0/53/0, go build=0, 17/17 测试通过
This commit is contained in:
1 parent
c6a50216dd
commit
7f5295cfc2
31 files changed
+657
-190
No files matched your search
@@ -40,12 +40,12 @@ interface Props {
|
||||
}
|
||||
|
||||
const VOLUME_TYPES: { key: VolumeForm['type']; label: string; icon: typeof HardDrive; color: string }[] = [
|
||||
{ key: 'persistentVolumeClaim', label: i18n.t('存储卷声明'), icon: Database, color: 'dg-text-green' },
|
||||
{ key: 'emptyDir', label: i18n.t('临时目录(EmptyDir)'), icon: Disc, color: 'dg-text-secondary' },
|
||||
{ key: 'persistentVolumeClaim', label: i18n.t('k8s.nsResource.pvcDesc'), icon: Database, color: 'dg-text-green' },
|
||||
{ key: 'emptyDir', label: i18n.t('k8s.editStorage.emptyDir'), icon: Disc, color: 'dg-text-secondary' },
|
||||
{ key: 'hostPath', label: 'HostPath', icon: HardDrive, color: 'dg-text-yellow' },
|
||||
{ key: 'nfs', label: 'NFS', icon: Server, color: 'dg-text-purple' },
|
||||
{ key: 'configMap', label: i18n.t('配置字典'), icon: File, color: 'dg-text-blue' },
|
||||
{ key: 'secret', label: i18n.t('密文'), icon: Lock, color: 'text-rose-400' },
|
||||
{ key: 'configMap', label: i18n.t('k8s.nsResource.configMapDesc'), icon: File, color: 'dg-text-blue' },
|
||||
{ key: 'secret', label: i18n.t('k8s.secret.data'), icon: Lock, color: 'text-rose-400' },
|
||||
];
|
||||
|
||||
const SELECTABLE_TYPES = new Set(VOLUME_TYPES.map((t) => t.key));
|
||||
@@ -129,20 +129,20 @@ export function DeploymentEditStorage({ clusterCode, namespace, deploymentName,
|
||||
const save = async () => {
|
||||
for (const entry of entries) {
|
||||
if (!entry.volume.name.trim()) {
|
||||
toast({ title: i18n.t('请填写数据卷名称'), variant: 'destructive' });
|
||||
toast({ title: i18n.t('k8s.editStorage.volumeNameRequired'), variant: 'destructive' });
|
||||
return;
|
||||
}
|
||||
if (!formToVolume(entry.volume)) {
|
||||
const hint = entry.volume.type === 'configMap' ? i18n.t('请选择 ConfigMap')
|
||||
: entry.volume.type === 'secret' ? i18n.t('请选择 Secret')
|
||||
: entry.volume.type === 'persistentVolumeClaim' ? i18n.t('请选择 PVC')
|
||||
: i18n.t('的类型必填项');
|
||||
toast({ title: i18n.t('数据卷配置不完整'), description: `请为「${entry.volume.name}」${hint}`, variant: 'destructive' });
|
||||
const hint = entry.volume.type === 'configMap' ? i18n.t('k8s.editStorage.selectConfigMap')
|
||||
: entry.volume.type === 'secret' ? i18n.t('k8s.editStorage.selectSecret')
|
||||
: entry.volume.type === 'persistentVolumeClaim' ? i18n.t('k8s.editStorage.selectPVC')
|
||||
: i18n.t('k8s.editStorage.typeRequiredHint');
|
||||
toast({ title: i18n.t('k8s.editStorage.incompleteConfig'), description: `请为「${entry.volume.name}」${hint}`, variant: 'destructive' });
|
||||
return;
|
||||
}
|
||||
const validMounts = entry.mounts.filter((m) => m.mountPath.trim());
|
||||
if (validMounts.length === 0) {
|
||||
toast({ title: i18n.t('请填写挂载路径'), description: `数据卷「${entry.volume.name}」需至少挂载到一个容器`, variant: 'destructive' });
|
||||
toast({ title: i18n.t('k8s.editStorage.mountPathRequired'), description: `数据卷「${entry.volume.name}」需至少挂载到一个容器`, variant: 'destructive' });
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -151,7 +151,7 @@ export function DeploymentEditStorage({ clusterCode, namespace, deploymentName,
|
||||
const { volumes, mounts } = volumeEntriesToStorage(entries);
|
||||
const base = applyStorageToManifest(rawManifest, volumes, mounts, passthroughVolumes);
|
||||
await saveDeploymentManifest(clusterCode, namespace, deploymentName, base);
|
||||
toast({ title: i18n.t('存储配置已保存'), description: `${deploymentName} 更新已提交` });
|
||||
toast({ title: i18n.t('k8s.editStorage.saved'), description: `${deploymentName} 更新已提交` });
|
||||
onSaved(base);
|
||||
} catch (e) {
|
||||
toast({ title: i18n.t('kubernetes.msg.saveFailed'), description: (e as Error)?.message || String(e), variant: 'destructive' });
|
||||
@@ -234,7 +234,7 @@ export function DeploymentEditStorage({ clusterCode, namespace, deploymentName,
|
||||
if (vol.type === 'persistentVolumeClaim' && !vol.pvcName) patch.pvcName = name;
|
||||
updateVolume(i, patch);
|
||||
}}
|
||||
placeholder={i18n.t('如 app-logs / fluent-bit-config')}
|
||||
placeholder={i18n.t('k8s.editStorage.namePlaceholder')}
|
||||
className="h-8 w-44 dg-input text-sm font-mono"
|
||||
/>
|
||||
{/* 原生 select,避免 Radix Select 在 overflow 容器内无法下拉 // Logan.Li */}
|
||||
@@ -312,7 +312,7 @@ export function DeploymentEditStorage({ clusterCode, namespace, deploymentName,
|
||||
<Input
|
||||
value={mount.mountPath}
|
||||
onChange={(e) => updateMount(i, mi, { mountPath: e.target.value })}
|
||||
placeholder={i18n.t('挂载路径 /bitcloud/app/.../logs')}
|
||||
placeholder={i18n.t('k8s.editStorage.mountPathPlaceholder')}
|
||||
className="h-8 flex-1 min-w-[200px] dg-input text-sm font-mono"
|
||||
/>
|
||||
{entry.mounts.length > 1 && (
|
||||
@@ -326,7 +326,7 @@ export function DeploymentEditStorage({ clusterCode, namespace, deploymentName,
|
||||
<Input
|
||||
value={mount.subPath}
|
||||
onChange={(e) => updateMount(i, mi, { subPath: e.target.value })}
|
||||
placeholder={i18n.t('挂载路径 /bitcloud/app/.../logs')}
|
||||
placeholder={i18n.t('k8s.editStorage.mountPathPlaceholder')}
|
||||
className="h-7 flex-1 max-w-md dg-input text-[var(--dg-text-secondary)] text-xs font-mono"
|
||||
/>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user