From c1e21c20d8d9d88a5c933d8fe6826dc32ed505af Mon Sep 17 00:00:00 2001 From: Codex Date: Wed, 28 Oct 2026 21:47:25 +0800 Subject: [PATCH] =?UTF-8?q?fix(frontend):=20login=20P0=20=E2=80=94=20?= =?UTF-8?q?=E5=8E=BB=E5=8D=A1=E5=A4=B4=E9=87=8D=E5=A4=8D=E3=80=81offline?= =?UTF-8?q?=20=E6=96=87=E6=A1=88=E3=80=81=E6=98=BE=E5=AF=86=E5=8F=AF?= =?UTF-8?q?=E9=94=AE=E7=9B=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 去掉卡内盾牌标题;后端不可用改为「服务暂不可用」并禁用登录钮;显密切换可 Tab 聚焦。 --- frontend/src/i18n/locales/en/common.ts | 18 ++++++++++++++++-- frontend/src/i18n/locales/zh/common.ts | 17 +++++++++++++++-- frontend/src/pages/login/index.tsx | 14 +++----------- 3 files changed, 34 insertions(+), 15 deletions(-) diff --git a/frontend/src/i18n/locales/en/common.ts b/frontend/src/i18n/locales/en/common.ts index 435d69d..226e40f 100644 --- a/frontend/src/i18n/locales/en/common.ts +++ b/frontend/src/i18n/locales/en/common.ts @@ -11,6 +11,7 @@ export default { collectors: 'Log Collectors', logs: 'Log Query', alerts: 'Alerts', + analysis: 'Log Analysis', settings: 'Settings', users: 'Users', login: 'Sign In', @@ -42,8 +43,10 @@ export default { errCredential: 'Invalid username or password', errConn: 'Cannot reach the backend. Make sure it is running on port 8080.', errFallback: 'Sign-in failed', - backendDown: 'Backend is not running', - backendDownHint: 'Cannot reach the API service. Start the backend first:', + backendDown: 'Service temporarily unavailable', + showPassword: 'Show password', + hidePassword: 'Hide password', + backendDownHint: 'Cannot reach the service. Try again later or contact an admin.', }, dialog: { confirmTitle: 'Confirm Deletion', @@ -92,6 +95,17 @@ export default { spinner: { default: 'Loading...', }, + range: { + lastMinutes: 'Last {{count}} minutes', + lastHours: 'Last {{count}} hours', + lastHours_one: 'Last {{count}} hour', + custom: 'Custom time', + title: 'Select time range', + start: 'Start time', + end: 'End time', + apply: 'Apply', + recent: 'Recently used', + }, password: { hide: 'Hide password', show: 'Show password', diff --git a/frontend/src/i18n/locales/zh/common.ts b/frontend/src/i18n/locales/zh/common.ts index 0180612..756ddcd 100644 --- a/frontend/src/i18n/locales/zh/common.ts +++ b/frontend/src/i18n/locales/zh/common.ts @@ -11,6 +11,7 @@ export default { collectors: '日志采集', logs: '日志查询', alerts: '日志告警', + analysis: '日志分析', settings: '系统设置', users: '用户管理', login: '登录', @@ -42,8 +43,10 @@ export default { errCredential: '用户名或密码错误', errConn: '无法连接后端服务,请确认后端已启动(端口 8080)。', errFallback: '登录失败', - backendDown: '后端服务未启动', - backendDownHint: '无法连接 API 服务,请先启动后端:', + backendDown: '服务暂不可用', + showPassword: '显示密码', + hidePassword: '隐藏密码', + backendDownHint: '暂时连不上服务,请稍后再试或联系管理员。', }, dialog: { confirmTitle: '确认删除', @@ -92,6 +95,16 @@ export default { spinner: { default: '加载中...', }, + range: { + lastMinutes: '最近 {{count}} 分钟', + lastHours: '最近 {{count}} 小时', + custom: '自定义时间', + title: '选择时间范围', + start: '开始时间', + end: '结束时间', + apply: '应用时间', + recent: '最近使用', + }, password: { hide: '隐藏密码', show: '显示密码', diff --git a/frontend/src/pages/login/index.tsx b/frontend/src/pages/login/index.tsx index 1f3d929..ef705e8 100644 --- a/frontend/src/pages/login/index.tsx +++ b/frontend/src/pages/login/index.tsx @@ -1,7 +1,7 @@ import { memo, useCallback, useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' import { useLocation, useNavigate } from 'react-router' -import { Activity, Eye, EyeOff, Shield, ServerOff } from 'lucide-react' +import { Activity, Eye, EyeOff, ServerOff } from 'lucide-react' import { Button } from '@/components/ui/button' import { Checkbox } from '@/components/ui/checkbox' import { Input } from '@/components/ui/input' @@ -106,20 +106,12 @@ const Login = memo(function Login() {

{t('login.backendDown')}

{t('login.backendDownHint')}

- - ./run.sh -
)} {/* Login Card */}
-
- -

{t('login.heading')}

-
- {error && (
{error} @@ -157,7 +149,7 @@ const Login = memo(function Login() { type="button" onClick={togglePassword} className="absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground" - tabIndex={-1} + aria-label={showPassword ? t('login.hidePassword') : t('login.showPassword')} > {showPassword ? ( @@ -182,7 +174,7 @@ const Login = memo(function Login() {