feat: 品牌统一 LokiStack + 全站中英 i18n + 用户批量删除 + 主题定时切换与浅色侧栏

- 品牌: Go 模块/数据文件/二进制/构建部署资产全部 opsx→lokistack;前端 localStorage 命名空间迁移(读旧写新,含按用户 id 前缀迁移);修复 nginx upstream 与 Makefile 引用已改名服务的断裂
- i18n: react-i18next 落地,common + 11 个页面域命名空间全站中英(菜单/顶栏/登录/列表页/表单/确认弹窗/状态徽章);设置页语言即时切换;修复词典自注册导致的循环导入白屏
- 用户管理: 批量删除(POST /users/batch-delete,不删自己/最后管理员,部分失败不阻断)+ 行复选/全选/批量工具条
- 主题: 浅色侧栏(中性灰激活态)、四态模式(浅色/深色/跟随系统/定时切换,按时区判定)、顶栏太阳月亮二态、设置页紧凑分段选择器
- UI: 登录记住用户名、CardActionButton 统一五页卡片操作钮、shadcn Badge 替换手写徽章、语义色修正
- 清理: 移除主机 Web 终端(前后端)、k8s-helm/Helm 遗留代码与字段、README 重写精简
- 修复: 侧栏与日志告警 order 重复、路由标题 i18n key 未翻译、词典双逗号等
This commit is contained in:
opsx committed 2026-10-27 17:11:38 +08:00
1 parent 02d1bd87a7
commit f3733f0bfc
201 files changed
+5438 -2388

No files matched your search

@@ -1,5 +1,6 @@
import { memo, useEffect, useState } from 'react'
import { Dice5 } from 'lucide-react'
import { useTranslation } from 'react-i18next'
import { Button } from '@/components/ui/button'
import {
Dialog,
@@ -39,6 +40,7 @@ export const ResetPasswordDialog = memo(function ResetPasswordDialog({
onClose,
onReset,
}: ResetPasswordDialogProps) {
const { t } = useTranslation('users')
const [password, setPassword] = useState('')
const [submitting, setSubmitting] = useState(false)
const [error, setError] = useState('')
@@ -53,7 +55,7 @@ export const ResetPasswordDialog = memo(function ResetPasswordDialog({
const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault()
if (password.length < 6) {
setError('密码至少需要 6 位')
setError(t('form.passwordMin'))
return
}
if (!user) return
@@ -63,7 +65,7 @@ export const ResetPasswordDialog = memo(function ResetPasswordDialog({
onClose()
onReset()
} catch (err) {
toast.error(err instanceof Error ? err.message : '重置密码失败')
toast.error(err instanceof Error ? err.message : t('resetFailed'))
} finally {
setSubmitting(false)
}
@@ -73,19 +75,19 @@ export const ResetPasswordDialog = memo(function ResetPasswordDialog({
<Dialog open={user !== null} onOpenChange={(open) => !open && onClose()}>
<DialogContent className="max-w-md">
<DialogHeader>
<DialogTitle>重置密码</DialogTitle>
<DialogTitle>{t('resetPassword')}</DialogTitle>
<DialogDescription>
重置「{user?.username}」的密码后,该用户的所有登录会话将立即失效。
{t('resetDesc', { name: user?.username ?? '' })}
</DialogDescription>
</DialogHeader>
<form onSubmit={handleSubmit} className="space-y-4">
<div className="space-y-2">
<Label htmlFor="reset-password">新密码 *</Label>
<Label htmlFor="reset-password">{t('newPassword')}</Label>
<div className="flex gap-2">
<PasswordInput
id="reset-password"
className="flex-1"
placeholder="至少 6 位"
placeholder={t('form.passwordPlaceholder')}
value={password}
onChange={(e) => {
setPassword(e.target.value)
@@ -97,8 +99,8 @@ export const ResetPasswordDialog = memo(function ResetPasswordDialog({
<Button
type="button"
variant="outline"
aria-label="随机生成密码"
title="随机生成密码"
aria-label={t('randomPassword')}
title={t('randomPassword')}
onClick={() => {
setPassword(randomPassword())
setError('')
@@ -111,10 +113,10 @@ export const ResetPasswordDialog = memo(function ResetPasswordDialog({
</div>
<div className="flex justify-end gap-2">
<Button type="button" variant="outline" onClick={onClose} disabled={submitting}>
取消
{t('dialog.cancel', { ns: 'common' })}
</Button>
<Button type="submit" disabled={submitting || password.length < 6}>
{submitting ? '重置中...' : '重置密码'}
{submitting ? t('resetting') : t('resetPassword')}
</Button>
</div>
</form>