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
@@ -19,6 +19,7 @@ import {
|
||||
import { User } from 'lucide-react';
|
||||
import { userApi } from '@/api';
|
||||
import type { JsonData } from '@/types/common';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
export interface UserFormData {
|
||||
username: string;
|
||||
@@ -49,6 +50,7 @@ export function UserFormDialog({
|
||||
saving,
|
||||
onSubmit,
|
||||
}: UserFormDialogProps) {
|
||||
const { t } = useTranslation();
|
||||
const [roles, setRoles] = useState<{ id: string; name: string }[]>([]);
|
||||
|
||||
// 对话框打开时拉取角色列表 // Logan.Li
|
||||
@@ -81,36 +83,36 @@ export function UserFormDialog({
|
||||
<DialogHeader>
|
||||
<DialogTitle className="text-[var(--dg-text-primary)] flex items-center gap-2">
|
||||
<User className="h-5 w-5 dg-text-blue" />
|
||||
{editingUser ? '编辑用户' : '新建用户'}
|
||||
{editingUser ? t('system.editUser') : '新建用户'}
|
||||
</DialogTitle>
|
||||
<DialogDescription className="dg-text-muted">
|
||||
{editingUser ? '修改用户信息' : '创建新的系统用户'}
|
||||
{editingUser ? t('system.editUserDesc') : t('system.createUserDesc')}
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
|
||||
<div className="space-y-4">
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<div className="space-y-2">
|
||||
<label className="text-xs dg-text-muted">用户名</label>
|
||||
<label className="text-xs dg-text-muted">{t('system.userName')}</label>
|
||||
<Input
|
||||
value={form.username}
|
||||
onChange={(e) => setForm({ ...form, username: e.target.value })}
|
||||
disabled={!!editingUser}
|
||||
className="dg-input"
|
||||
placeholder="登录用户名"
|
||||
placeholder={t('system.loginUsername')}
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<label className="text-xs dg-text-muted">昵称</label>
|
||||
<label className="text-xs dg-text-muted">{t('system.userNickname')}</label>
|
||||
<Input
|
||||
value={form.nickname}
|
||||
onChange={(e) => setForm({ ...form, nickname: e.target.value })}
|
||||
className="dg-input"
|
||||
placeholder="显示昵称"
|
||||
placeholder={t('system.userShowNickname')}
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<label className="text-xs dg-text-muted">邮箱</label>
|
||||
<label className="text-xs dg-text-muted">{t('system.userEmail')}</label>
|
||||
<Input
|
||||
value={form.email}
|
||||
onChange={(e) => setForm({ ...form, email: e.target.value })}
|
||||
@@ -119,19 +121,19 @@ export function UserFormDialog({
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<label className="text-xs dg-text-muted">手机号</label>
|
||||
<label className="text-xs dg-text-muted">{t('system.userPhone')}</label>
|
||||
<Input
|
||||
value={form.phone}
|
||||
onChange={(e) => setForm({ ...form, phone: e.target.value })}
|
||||
className="dg-input"
|
||||
placeholder="可选"
|
||||
placeholder={t('common.optional')}
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<label className="text-xs dg-text-muted">角色</label>
|
||||
<label className="text-xs dg-text-muted">{t('system.userRole')}</label>
|
||||
<Select value={form.role} onValueChange={(v) => setForm({ ...form, role: v })}>
|
||||
<SelectTrigger className="dg-input">
|
||||
<SelectValue placeholder="选择角色" />
|
||||
<SelectValue placeholder={t('deploy.rbac.selectRole')} />
|
||||
</SelectTrigger>
|
||||
<SelectContent className="dg-input">
|
||||
{roles.map((role) => (
|
||||
@@ -143,7 +145,7 @@ export function UserFormDialog({
|
||||
</Select>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<label className="text-xs dg-text-muted">状态</label>
|
||||
<label className="text-xs dg-text-muted">{t('system.userStatus')}</label>
|
||||
<Select
|
||||
value={String(form.status)}
|
||||
onValueChange={(v) => setForm({ ...form, status: Number(v) })}
|
||||
@@ -152,32 +154,32 @@ export function UserFormDialog({
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent className="dg-input">
|
||||
<SelectItem value="1">正常</SelectItem>
|
||||
<SelectItem value="0">禁用</SelectItem>
|
||||
<SelectItem value="1">{t('common.normal')}</SelectItem>
|
||||
<SelectItem value="0">{t('system.userInactive')}</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<label className="text-xs dg-text-muted">
|
||||
密码{editingUser ? '(留空则不修改)' : ''}
|
||||
密码{editingUser ? t('system.leaveBlankNoModify2') : ''}
|
||||
</label>
|
||||
<Input
|
||||
type="password"
|
||||
value={form.password}
|
||||
onChange={(e) => setForm({ ...form, password: e.target.value })}
|
||||
className="dg-input"
|
||||
placeholder={editingUser ? '留空则不修改' : '设置初始密码'}
|
||||
placeholder={editingUser ? t('system.passwordLeaveBlank') : t('system.setInitialPassword')}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<DialogFooter>
|
||||
<Button variant="outline" className="border-[var(--dg-border)] text-[var(--dg-text-secondary)]" onClick={() => onOpenChange(false)}>
|
||||
取消
|
||||
{t('common.cancel')}
|
||||
</Button>
|
||||
<Button className="bg-blue-600 hover:bg-blue-700 text-white" onClick={onSubmit} disabled={saving}>
|
||||
{saving ? '保存中...' : '保存'}
|
||||
{saving ? t('k8s.topology.saving') : t('common.save')}
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
|
||||
Reference in new issue
Block a user