refactor: organize admin menu into categories
All checks were successful
Deploy Admin Frontend / build-and-deploy (push) Successful in 8s

Before: 17 flat first-level items, 14 under single "系统运维"
After:  5 groups — 总览/用户管理/知识库/学习数据/系统

- AdminMenuItem.path → optional for group headers
- Breadcrumb map updated to match new structure
- Removed unused entries (hermes/servers/billing/git/etc.)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
wangdl 2026-06-15 22:06:11 +08:00
parent d697877056
commit 699f9012e0
2 changed files with 54 additions and 53 deletions

View File

@ -1,10 +1,10 @@
import type React from 'react'
import { DashboardOutlined, RobotOutlined, UserOutlined, DollarOutlined, BookOutlined, ImportOutlined, FileOutlined, SafetyOutlined, CodeOutlined, CloudServerOutlined, SettingOutlined, RocketOutlined } from '@ant-design/icons'
import { DashboardOutlined, UserOutlined, BookOutlined, ReadOutlined, SettingOutlined } from '@ant-design/icons'
import type { AdminRole } from '@/types/admin'
import { hasRole } from '@/constants/roles'
export interface AdminMenuItem {
path: string
path?: string
name: string
icon?: React.ReactNode
requiredRole?: AdminRole
@ -13,44 +13,46 @@ export interface AdminMenuItem {
export const adminMenuItems: AdminMenuItem[] = [
{ path: '/', name: '总览', icon: <DashboardOutlined /> },
{ path: '/hermes', name: 'Hermes 设置', icon: <RobotOutlined />, requiredRole: 'SUPER_ADMIN' },
{ path: '/users', name: '用户管理', icon: <UserOutlined />, children: [
{
name: '用户管理', icon: <UserOutlined />, children: [
{ path: '/users/admins', name: '管理员', requiredRole: 'SUPER_ADMIN' },
{ path: '/users/members', name: '普通用户' },
]},
{ path: '/membership', name: '会员与额度', icon: <DollarOutlined />, requiredRole: 'ADMIN' },
{ path: '/knowledge', name: '知识库管理', icon: <BookOutlined />, children: [
{ path: '/membership', name: '会员与额度', requiredRole: 'ADMIN' },
],
},
{
name: '知识库', icon: <BookOutlined />, children: [
{ path: '/knowledge/bases', name: '知识库列表' },
{ path: '/knowledge/sources', name: '知识源列表' },
{ path: '/knowledge/ops', name: '知识运维' },
]},
{ path: '/release', name: '发布决策', icon: <RocketOutlined />, requiredRole: 'ADMIN' },
{ path: '/imports', name: '文档导入', icon: <ImportOutlined /> },
{ path: '/files', name: '文件与 COS', icon: <FileOutlined /> },
{ path: '/reporting', name: '报表导出', icon: <FileOutlined />, requiredRole: 'ADMIN' },
{ path: '/compliance', name: '合规安全', icon: <SafetyOutlined />, requiredRole: 'ADMIN' },
{ path: '/audit', name: '审计日志', icon: <SafetyOutlined />, requiredRole: 'ADMIN' },
{ path: '/billing', name: 'API 用量', icon: <DollarOutlined />, requiredRole: 'SUPER_ADMIN' },
{ path: '/git', name: '项目中心', icon: <CodeOutlined /> },
{ path: '/ops', name: '系统运维', icon: <CloudServerOutlined />, requiredRole: 'SUPER_ADMIN', children: [
{ path: '/throttle', name: '限流管理' },
{ path: '/security-events', name: '安全事件' },
{ path: '/secrets', name: '密钥管理' },
{ path: '/metrics', name: '接口监控' },
{ path: '/ai-gateway', name: 'AI Gateway' },
{ path: '/servers', name: '服务器' },
{ path: '/chat-logs', name: '对话日志' },
{ path: '/events', name: '事件队列' },
{ path: '/vector', name: '向量检索' },
{ path: '/config', name: '配置管理' },
{ path: '/backup', name: '备份清理' },
{ path: '/cache', name: '缓存管理' },
{ path: '/notification-admin', name: '通知管理' },
{ path: '/safety', name: '内容安全' },
]},
{ path: '/reviews', name: '复习数据', icon: <BookOutlined />, requiredRole: 'ADMIN' },
{ path: '/learning-data', name: '学习数据', icon: <BookOutlined />, requiredRole: 'ADMIN' },
{ path: '/settings', name: '系统配置', icon: <SettingOutlined />, requiredRole: 'ADMIN' },
{ path: '/imports', name: '文档导入' },
{ path: '/files', name: '文件与 COS' },
],
},
{
name: '学习数据', icon: <ReadOutlined />, children: [
{ path: '/learning', name: '学习 Dashboard' },
{ path: '/learning/events', name: '阅读事件' },
{ path: '/learning/sessions', name: '学习会话' },
{ path: '/learning/progress', name: '阅读进度' },
{ path: '/learning/daily', name: '每日活动' },
{ path: '/learning/records', name: '学习记录' },
{ path: '/learning/timeline', name: '用户时间线' },
{ path: '/learning/anomalies', name: '异常数据' },
{ path: '/learning/user-diagnose', name: '用户诊断' },
{ path: '/learning/material-diagnose', name: '资料诊断' },
],
},
{
name: '系统', icon: <SettingOutlined />, children: [
{ path: '/settings', name: '系统配置', requiredRole: 'ADMIN' },
{ path: '/audit', name: '审计日志', requiredRole: 'ADMIN' },
{ path: '/ai-costs', name: 'AI 调用与成本' },
],
},
]
export function filterMenuByRole(items: AdminMenuItem[], role?: AdminRole): AdminMenuItem[] {

View File

@ -9,29 +9,28 @@ import type { AdminRole } from '@/types/admin'
const breadcrumbMap: Record<string, string> = {
'/': '总览',
'/hermes': 'Hermes 设置',
'/users': '用户管理',
'/users/admins': '管理员',
'/users/members': '普通用户',
'/membership': '会员与额度',
'/knowledge': '知识库管理',
'/knowledge': '知识库',
'/knowledge/bases': '知识库列表',
'/knowledge/sources': '知识源列表',
'/imports': '文档导入',
'/files': '文件与 COS',
'/learning': '学习数据',
'/learning/events': '阅读事件',
'/learning/sessions': '学习会话',
'/learning/progress': '阅读进度',
'/learning/daily': '每日活动',
'/learning/records': '学习记录',
'/learning/timeline': '用户时间线',
'/learning/anomalies': '异常数据',
'/learning/user-diagnose': '用户诊断',
'/learning/material-diagnose': '资料诊断',
'/settings': '系统配置',
'/billing': 'API 用量',
'/git': '代码仓库',
'/servers': '服务器运维',
'/config': '配置管理',
'/throttle': '限流管理',
'/security-events': '安全事件',
'/secrets': '密钥管理',
'/metrics': '接口监控',
'/ai-gateway': 'AI Gateway',
'/safety': '内容安全',
'/events': '事件队列',
'/audit': '审计日志',
'/ai-costs': 'AI 调用与成本',
}
export default function AdminLayout() {