refactor(admin): 导航按心智模型三组重排(数据/预测/系统)

- 预测历史/回测/评估移出「数据流水线」,组成「预测」组(生命周期闭环)
- 「评估与监控」拆开:评估归预测,监控归系统
- 删除 SIDEBAR_GROUP_TITLES 别名映射(分组名与面板名统一)
- 预测历史图标改 target(靶心),数据完整性改 eval(核对文档),不再与仪表盘共用 chart
This commit is contained in:
WorkBuddy
2026-09-22 12:34:18 +08:00
parent 1cdc6411f5
commit 9cedb874f7
+18 -17
View File
@@ -20,18 +20,25 @@ export interface NavItem {
hideFromSidebar?: boolean hideFromSidebar?: boolean
} }
/** 唯一的导航配置源。顺序 = 侧栏渲染顺序(命令面板分组内顺序与之相同)。 */ /** 唯一的导航配置源。顺序 = 侧栏渲染顺序(命令面板分组内顺序与之相同)。
*
* 分组按用户心智模型: 数据(往里灌) → 预测(算出来) → 系统(保证它活着)。
* 「预测历史/回测/评估」同属预测生命周期,不再挂在「数据流水线」名下。
*/
export const NAV_ITEMS: NavItem[] = [ export const NAV_ITEMS: NavItem[] = [
{ to: '/admin', label: '仪表盘', group: '概览', icon: 'chart' }, { to: '/admin', label: '仪表盘', group: '概览', icon: 'chart' },
{ to: '/admin/collection', label: '数据采集', group: '数据流水线', icon: 'collection' }, // ── 数据:采集、核对、管线内部视图 ──
{ to: '/admin/data-completeness', label: '数据完整性', group: '数据流水线', icon: 'chart' }, { to: '/admin/collection', label: '数据采集', group: '数据', icon: 'collection' },
{ to: '/admin/data-pipeline', label: '数据管线', group: '数据流水线', icon: 'chart', hideFromSidebar: true }, { to: '/admin/data-completeness', label: '数据完整性', group: '数据', icon: 'eval' },
{ to: '/admin/predictions', label: '预测历史', group: '数据流水线', icon: 'logs' }, { to: '/admin/data-pipeline', label: '数据管线', group: '数据', icon: 'chart', hideFromSidebar: true },
{ to: '/admin/backtest', label: '回测', group: '数据流水线', icon: 'repeat' }, // ── 预测:历史 → 回测 → 评估闭环 ──
{ to: '/admin/eval', label: '评估', group: '评估与监控', icon: 'eval' }, { to: '/admin/predictions', label: '预测历史', group: '预测', icon: 'target' },
{ to: '/admin/monitoring', label: '监控', group: '评估与监控', icon: 'monitor' }, { to: '/admin/backtest', label: '回测', group: '预测', icon: 'repeat' },
{ to: '/admin/settings', label: '设置', group: '系统', icon: 'settings' }, { to: '/admin/eval', label: '评估', group: '预测', icon: 'eval' },
// ── 系统:活着吗、发生了什么、怎么调 ──
{ to: '/admin/monitoring', label: '监控', group: '系统', icon: 'monitor' },
{ to: '/admin/logs', label: '日志', group: '系统', icon: 'logs' }, { to: '/admin/logs', label: '日志', group: '系统', icon: 'logs' },
{ to: '/admin/settings', label: '设置', group: '系统', icon: 'settings' },
] ]
/** 命令面板条目(原 NAV_PAGES 的唯一来源) */ /** 命令面板条目(原 NAV_PAGES 的唯一来源) */
@@ -42,11 +49,6 @@ export const ROUTE_LABELS: Record<string, string> = Object.fromEntries(
NAV_ITEMS.map(i => [i.to, i.label]), NAV_ITEMS.map(i => [i.to, i.label]),
) )
/** 侧栏分组标题的历史显示名(仅侧栏使用;与面板分组名不同时在此映射) */
const SIDEBAR_GROUP_TITLES: Record<string, string> = {
: '系统设置',
}
/** /**
* 侧栏分组(原 NAV_SECTIONS 的唯一来源)。 * 侧栏分组(原 NAV_SECTIONS 的唯一来源)。
* 仪表盘(group=概览)在 AdminLayout 中独立渲染于顶部,不进分组循环。 * 仪表盘(group=概览)在 AdminLayout 中独立渲染于顶部,不进分组循环。
@@ -55,13 +57,12 @@ export const NAV_SECTIONS = (() => {
const sidebarItems = NAV_ITEMS.filter(i => !i.hideFromSidebar && i.group !== '概览') const sidebarItems = NAV_ITEMS.filter(i => !i.hideFromSidebar && i.group !== '概览')
const titles: string[] = [] const titles: string[] = []
for (const i of sidebarItems) { for (const i of sidebarItems) {
const title = SIDEBAR_GROUP_TITLES[i.group] ?? i.group if (!titles.includes(i.group)) titles.push(i.group)
if (!titles.includes(title)) titles.push(title)
} }
return titles.map(title => ({ return titles.map(title => ({
title, title,
items: sidebarItems items: sidebarItems
.filter(i => (SIDEBAR_GROUP_TITLES[i.group] ?? i.group) === title) .filter(i => i.group === title)
.map(({ to, label, icon }) => ({ to, label, icon })), .map(({ to, label, icon }) => ({ to, label, icon })),
})) }))
})() })()