feat(ADMIN-INFO-014): add Chinese status labels across 8 admin pages
All checks were successful
Deploy Admin Frontend / build-and-deploy (push) Successful in 13s

- labels.ts: add 15 new label maps (review, import, admin, kb, etc.)
- ReviewAdmin: status/scheduleState/difficulty + filter dropdown
- KnowledgeBases: status
- KnowledgeOps: userId + status
- BackupAdmin: status (both backup & cleanup)
- Secrets: status
- ReleaseAdmin: status
- HermesSettings: agent task + artifact status

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
wangdl 2026-06-19 13:06:57 +08:00
parent 83a7b56945
commit 7ebe092f3f
8 changed files with 124 additions and 16 deletions

View File

@ -51,3 +51,106 @@ export const parseStatusLabels: Record<string, string> = {
completed: '已解析',
failed: '解析失败',
};
// ── Review ──
export const reviewStatusLabels: Record<string, string> = {
active: '活跃',
suspended: '暂停',
completed: '已完成',
};
export const scheduleStateLabels: Record<string, string> = {
learning: '学习中',
review: '复习中',
relearning: '重新学习',
};
export const difficultyLabels: Record<string, string> = {
easy: '简单',
medium: '中等',
hard: '困难',
};
// ── Import ──
export const importStatusLabels: Record<string, string> = {
QUEUED: '排队中',
CLAIMED: '已认领',
DOWNLOADING: '下载中',
PARSING: '解析中',
OCR_PROCESSING: 'OCR 处理中',
CLEANING: '清洗中',
CHUNKING: '分段中',
EMBEDDING: '向量化中',
INDEXING: '索引中',
GENERATING_CANDIDATES: '生成候选中',
completed: '已完成',
failed: '失败',
FAILED_FINAL: '永久失败',
};
export const importStepLabels: Record<string, string> = {
completed: '已完成',
failed: '失败',
DOWNLOADING: '下载中',
PARSING: '解析中',
CLEANING: '清洗中',
CHUNKING: '分段中',
};
// ── Admin / User ──
export const adminStatusLabels: Record<string, string> = {
ACTIVE: '正常',
DISABLED: '已禁用',
LOCKED: '已锁定',
};
export const userStatusLabels: Record<string, string> = {
active: '正常',
disabled: '已禁用',
deleted: '已注销',
};
// ── Knowledge ──
export const kbStatusLabels: Record<string, string> = { active: '正常' };
export const candidateStatusLabels: Record<string, string> = {
PENDING: '待审核',
ACCEPTED: '已通过',
REJECTED: '已拒绝',
};
// ── Hermes / Agent ──
export const agentTaskStatusLabels: Record<string, string> = {
pending: '待处理',
approved: '已批准',
rejected: '已拒绝',
};
export const artifactStatusLabels: Record<string, string> = {
draft: '草稿',
published: '已发布',
};
// ── Release ──
export const releaseStatusLabels: Record<string, string> = {
proposed: '提案中',
accepted: '已通过',
};
// ── Backup ──
export const backupStatusLabels: Record<string, string> = {
RUNNING: '运行中',
COMPLETED: '已完成',
FAILED: '失败',
};
// ── Secret ──
export const secretStatusLabels: Record<string, string> = {
active: '活跃',
expired: '已过期',
rotated: '已轮换',
revoked: '已撤销',
};
// ── Compliance ──
export const complianceStatusLabels: Record<string, string> = {
pending: '待处理',
approved: '已批准',
rejected: '已拒绝',
open: '待处理',
resolved: '已解决',
};

View File

@ -3,6 +3,7 @@ import { Table, Button, Tag, Space, Typography, Tabs, message } from 'antd'
import { CloudUploadOutlined, DeleteOutlined } from '@ant-design/icons'
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
import { api } from '@/services/http-client'
import { backupStatusLabels } from '@/constants/labels'
const { Title } = Typography
@ -37,7 +38,7 @@ export default function BackupAdmin() {
const backupColumns = [
{ title: 'ID', dataIndex: 'id', width: 100, ellipsis: true },
{ title: '类型', dataIndex: 'type', width: 80 },
{ title: '状态', dataIndex: 'status', width: 80, render: (s: string) => <Tag color={statusColors[s] || 'default'}>{s}</Tag> },
{ title: '状态', dataIndex: 'status', width: 80, render: (s: string) => <Tag color={statusColors[s] || 'default'}>{backupStatusLabels[s] || s}</Tag> },
{ title: '本地路径', dataIndex: 'localPath', width: 200, ellipsis: true, render: (p: string | null) => p || '-' },
{ title: 'COS Key', dataIndex: 'cosObjectKey', width: 180, ellipsis: true, render: (k: string | null) => k || '-' },
{ title: '大小', dataIndex: 'fileSizeBytes', width: 80, render: (s: number) => s ? `${(Number(s) / 1048576).toFixed(1)} MB` : '-' },
@ -48,7 +49,7 @@ export default function BackupAdmin() {
const cleanupColumns = [
{ title: 'ID', dataIndex: 'id', width: 100, ellipsis: true },
{ title: '类型', dataIndex: 'type', width: 100 },
{ title: '状态', dataIndex: 'status', width: 80, render: (s: string) => <Tag color={statusColors[s] || 'default'}>{s}</Tag> },
{ title: '状态', dataIndex: 'status', width: 80, render: (s: string) => <Tag color={statusColors[s] || 'default'}>{backupStatusLabels[s] || s}</Tag> },
{ title: '目标', dataIndex: 'target', width: 120, ellipsis: true, render: (t: string | null) => t || '-' },
{ title: '影响行数', dataIndex: 'rowsAffected', width: 80 },
{ title: '开始时间', dataIndex: 'startedAt', width: 120, render: (d: string) => new Date(d).toLocaleString() },

View File

@ -2,6 +2,7 @@ import { Tabs, Table, Tag, Button, Space, Typography } from 'antd'
import { CheckOutlined, CloseOutlined, RobotOutlined } from '@ant-design/icons'
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
import { api } from '@/services/http-client'
import { agentTaskStatusLabels, artifactStatusLabels } from '@/constants/labels'
import { message } from 'antd'
const { Title } = Typography
@ -37,7 +38,7 @@ export default function HermesSettings() {
{ title: '类型', dataIndex: 'type', width: 90 },
{ title: '输入', dataIndex: 'input', width: 180, ellipsis: true, render: (i: string) => i ? i.slice(0, 100) : '-' },
{ title: '输出', dataIndex: 'output', width: 200, ellipsis: true, render: (o: string) => o ? o.slice(0, 120) : '-' },
{ title: '状态', dataIndex: 'status', width: 70, render: (s: string) => <Tag color={statusColors[s] || 'default'}>{s}</Tag> },
{ title: '状态', dataIndex: 'status', width: 70, render: (s: string) => <Tag color={statusColors[s] || 'default'}>{agentTaskStatusLabels[s] || s}</Tag> },
{ title: '创建时间', dataIndex: 'createdAt', width: 110, render: (d: string) => new Date(d).toLocaleString() },
{
title: '操作', width: 120,
@ -55,7 +56,7 @@ export default function HermesSettings() {
{ title: '类型', dataIndex: 'type', width: 100, render: (t: string) => artifactTypeLabels[t] || t },
{ title: '标题', dataIndex: 'title', width: 200, ellipsis: true },
{ title: '内容', dataIndex: 'content', width: 250, ellipsis: true, render: (c: string) => c ? c.slice(0, 150) : '-' },
{ title: '状态', dataIndex: 'status', width: 70, render: (s: string) => <Tag color={s === 'draft' ? 'orange' : 'green'}>{s}</Tag> },
{ title: '状态', dataIndex: 'status', width: 70, render: (s: string) => <Tag color={s === 'draft' ? 'orange' : 'green'}>{artifactStatusLabels[s] || s}</Tag> },
{ title: '创建时间', dataIndex: 'createdAt', width: 110, render: (d: string) => new Date(d).toLocaleString() },
]

View File

@ -3,6 +3,7 @@ import { useQuery, useQueryClient } from '@tanstack/react-query'
import { Table, Tag, Typography, Button, App, Drawer, Space, Descriptions } from 'antd'
import { ReloadOutlined, DeleteOutlined, EyeOutlined, FileTextOutlined, LinkOutlined } from '@ant-design/icons'
import { api } from '@/services/http-client'
import { kbStatusLabels } from '@/constants/labels'
import dayjs from 'dayjs'
const { Title, Text } = Typography
@ -71,7 +72,7 @@ function KBPage() {
{ title: '名称', dataIndex: 'title', width: 200, ellipsis: true },
{ title: '用户', width: 120, render: (_: any, r: any) => r.user?.nickname || r.user?.email || '-' },
{ title: '知识点', dataIndex: 'itemCount', width: 80, align: 'center' },
{ title: '状态', dataIndex: 'status', width: 80, render: (s: string) => <Tag color={s === 'active' ? 'green' : 'default'}>{s}</Tag> },
{ title: '状态', dataIndex: 'status', width: 80, render: (s: string) => <Tag color={s === 'active' ? 'green' : 'default'}>{kbStatusLabels[s] || s}</Tag> },
{ title: '创建时间', dataIndex: 'createdAt', width: 170, render: (d: string) => dayjs(d).format('YYYY-MM-DD HH:mm') },
{
title: '操作', width: 120, align: 'center',

View File

@ -3,6 +3,7 @@ import { useQuery, useQueryClient } from '@tanstack/react-query'
import { Table, Tag, Typography, Button, App, Tabs, Input, Card, Space } from 'antd'
import { ReloadOutlined, SearchOutlined, ExperimentOutlined } from '@ant-design/icons'
import { api } from '@/services/http-client'
import { candidateStatusLabels } from '@/constants/labels'
import dayjs from 'dayjs'
const { Title, Text } = Typography
@ -32,8 +33,8 @@ export default function KnowledgeOpsPage() {
const candidateCols = [
{ title: '标题', dataIndex: 'title', width: 200, ellipsis: true },
{ title: '用户', dataIndex: 'userId', width: 120, ellipsis: true },
{ title: '状态', dataIndex: 'status', width: 80, render: (s: string) => <Tag color={s==='PENDING'?'gold':s==='ACCEPTED'?'green':'red'}>{s}</Tag> },
{ title: '用户', dataIndex: 'userId', width: 120, ellipsis: true, render: (_: any, r: any) => r.userName || r.userId },
{ title: '状态', dataIndex: 'status', width: 80, render: (s: string) => <Tag color={s==='PENDING'?'gold':s==='ACCEPTED'?'green':'red'}>{candidateStatusLabels[s] || s}</Tag> },
{ title: '置信度', dataIndex: 'confidence', width: 80, align: 'center' as const, render: (v: any) => v ? `${(Number(v)*100).toFixed(0)}%` : '-' },
{ title: '难度', dataIndex: 'difficulty', width: 70 },
{ title: '时间', dataIndex: 'createdAt', width: 130, render: (d: string) => dayjs(d).format('MM-DD HH:mm') },

View File

@ -3,6 +3,7 @@ import { Table, Button, Modal, Form, Input, Checkbox, Tag, Space, Typography, Ta
import { PlusOutlined, EditOutlined, DeleteOutlined, RocketOutlined } from '@ant-design/icons'
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
import { api } from '@/services/http-client'
import { releaseStatusLabels } from '@/constants/labels'
import { message } from 'antd'
const { Title } = Typography
@ -83,7 +84,7 @@ export default function ReleaseAdmin() {
{ title: '标题', dataIndex: 'title', width: 200, ellipsis: true },
{ title: '上下文', dataIndex: 'context', width: 200, ellipsis: true, render: (c: string) => c?.slice(0, 100) || '-' },
{ title: '决策', dataIndex: 'decision', width: 250, ellipsis: true, render: (d: string) => d?.slice(0, 150) || '-' },
{ title: '状态', dataIndex: 'status', width: 80, render: (s: string) => <Tag color={s === 'accepted' ? 'green' : s === 'proposed' ? 'blue' : 'default'}>{s}</Tag> },
{ title: '状态', dataIndex: 'status', width: 80, render: (s: string) => <Tag color={s === 'accepted' ? 'green' : s === 'proposed' ? 'blue' : 'default'}>{releaseStatusLabels[s] || s}</Tag> },
{
title: '操作', width: 100,
render: (_: any, r: any) => (

View File

@ -4,6 +4,7 @@ import { SearchOutlined } from '@ant-design/icons'
import { useQuery } from '@tanstack/react-query'
import { api } from '@/services/http-client'
import type { ReviewCardItem, PaginatedResult } from '@/types/api'
import { reviewStatusLabels, scheduleStateLabels, difficultyLabels } from '@/constants/labels'
const { Title } = Typography
@ -29,16 +30,16 @@ export default function ReviewAdmin() {
const columns = [
{ title: 'ID', dataIndex: 'id', width: 100, ellipsis: true },
{ title: '用户', dataIndex: 'userId', width: 100, ellipsis: true },
{ title: '用户', dataIndex: 'userId', width: 100, ellipsis: true, render: (_: any, r: any) => r.userName || r.userId },
{ title: '正面', dataIndex: 'frontText', width: 200, ellipsis: true },
{ title: '难度', dataIndex: 'difficulty', width: 80 },
{ title: '难度', dataIndex: 'difficulty', width: 80, render: (v: string) => difficultyLabels[v] || v || '-' },
{
title: '状态', dataIndex: 'status', width: 80,
render: (s: string) => <Tag color={statusColors[s] || 'default'}>{s}</Tag>,
render: (s: string) => <Tag color={statusColors[s] || 'default'}>{reviewStatusLabels[s] || s}</Tag>,
},
{
title: '调度', dataIndex: 'scheduleState', width: 80,
render: (s: string) => s || '-',
render: (s: string) => scheduleStateLabels[s] || s || '-',
},
{ title: '间隔(天)', dataIndex: 'intervalDays', width: 80 },
{ title: '复习次数', dataIndex: 'repetitionCount', width: 80 },
@ -69,9 +70,7 @@ export default function ReviewAdmin() {
style={{ width: 130 }}
options={[
{ label: '全部', value: '' },
{ label: 'Active', value: 'active' },
{ label: 'Suspended', value: 'suspended' },
{ label: 'Completed', value: 'completed' },
...Object.entries(reviewStatusLabels).map(([v, l]) => ({ label: l, value: v })),
]}
/>
</Space>

View File

@ -3,6 +3,7 @@ import { useState } from 'react'
import { useQuery, useQueryClient, useMutation } from '@tanstack/react-query'
import { Table, Button, Typography, App, Modal, Input, Select, Tag, Tabs, DatePicker, InputNumber, message } from 'antd'
import { api } from '@/services/http-client'
import { secretStatusLabels } from '@/constants/labels'
import dayjs from 'dayjs'
const { Title, Text } = Typography
@ -55,7 +56,7 @@ function SecretsPage() {
{ title: '名称', dataIndex: 'name', width: 120 },
{ title: '服务商', dataIndex: 'provider', width: 90, render: (v: string) => <Tag color={v==='deepseek'?'blue':v==='siliconflow'?'green':v==='minimax'?'purple':'default'}>{v}</Tag> },
{ title: '末四位', dataIndex: 'maskLast4', width: 80, render: (v: string) => <Text code>****{v}</Text> },
{ title: '状态', dataIndex: 'status', width: 70, render: (v: string) => <Tag color={v==='active'?'green':v==='expired'?'red':v==='rotated'?'orange':v==='revoked'?'default':v}>{v}</Tag> },
{ title: '状态', dataIndex: 'status', width: 70, render: (v: string) => <Tag color={v==='active'?'green':v==='expired'?'red':v==='rotated'?'orange':v==='revoked'?'default':v}>{secretStatusLabels[v] || v}</Tag> },
{ title: '到期', dataIndex: 'expiresAt', width: 100, render: (d: string) => d ? dayjs(d).format('MM-DD') : <Text type="secondary"></Text> },
{ title: '操作', width: 150, render: (_:any, r:any) => (
<>