feat(web): 日志页——任务 / 定时与自动 / 登录 / 审计合一,实时追加与暂停,勾选后问智能体;计划并入「定时任务」页签,侧栏系统组只留日志、运行状态、设置
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Cxwgnn2pbzQ7rXv3rq7fei
This commit is contained in:
1 parent
2ce1841628
commit
805ba33ddf
21 files changed
+1693
-846
No files matched your search
@@ -24,24 +24,32 @@ const matchesRoute = (pathname: string) => {
|
||||
};
|
||||
|
||||
describe("控制台导航", () => {
|
||||
it("IA-2:4 组,任务归系统,站点 / 订阅 / 规则合为「获取」,没有独立 RSS 项", () => {
|
||||
it("IA-2:4 组,站点 / 订阅 / 规则合为「获取」,没有独立 RSS 项;系统组只有日志、运行状态、设置", () => {
|
||||
expect(NAV_GROUPS.map((g) => g.title)).toEqual(["概览", ACQUIRE_GROUP_TITLE, "整理", "系统"]);
|
||||
expect(ACQUIRE_GROUP_TITLE).toBe("获取");
|
||||
expect(NAV_GROUPS.map((g) => g.items.map((i) => i.label))).toEqual([
|
||||
["首页", "计划", "智能体会话"],
|
||||
["首页", "智能体会话"],
|
||||
["站点", "发现", "订阅", "规则"],
|
||||
["下载面板", "整理记录", "文件管理", "媒体库"],
|
||||
["任务", "设置", "审计", "运行状态"],
|
||||
["日志", "运行状态", "设置"],
|
||||
]);
|
||||
expect(NAV_ITEMS).toHaveLength(15);
|
||||
expect(NAV_ITEMS).toHaveLength(13);
|
||||
expect(NAV_ITEMS.map((i) => i.to)).not.toContain("/console/sources");
|
||||
expect(new Set(NAV_ITEMS.map((i) => i.to)).size).toBe(NAV_ITEMS.length);
|
||||
expect(NAV_ITEMS.every((i) => i.to.startsWith("/console"))).toBe(true);
|
||||
});
|
||||
|
||||
it("取消的入口不在侧栏:没有待处理(问题回到发生处),引擎面板 / 身份并入别处", () => {
|
||||
it("取消的入口不在侧栏:没有待处理(问题回到发生处),引擎面板 / 身份 / 任务 / 审计 / 计划并入别处", () => {
|
||||
const paths = NAV_ITEMS.map((i) => i.to);
|
||||
for (const p of ["/console/inbox", "/console/engine", "/console/identity"]) expect(paths).not.toContain(p);
|
||||
for (const p of [
|
||||
"/console/inbox",
|
||||
"/console/engine",
|
||||
"/console/identity",
|
||||
"/console/tasks",
|
||||
"/console/audit",
|
||||
"/console/schedules",
|
||||
])
|
||||
expect(paths).not.toContain(p);
|
||||
expect(NAV_ITEMS.map((i) => i.label)).not.toContain("待处理");
|
||||
expect(pageTitle("/console/inbox")).toBeUndefined();
|
||||
});
|
||||
@@ -61,8 +69,10 @@ describe("控制台导航", () => {
|
||||
expect(findNavItem("/console")?.label).toBe("首页");
|
||||
expect(findNavItem("/console/")?.label).toBe("首页");
|
||||
expect(findNavItem("/console/library/abc")?.label).toBe("媒体库");
|
||||
expect(findNavItem("/console/tasks/r1")?.label).toBe("任务");
|
||||
expect(findNavItem("/console/schedules")?.label).toBe("计划");
|
||||
// 任务详情独立页归日志
|
||||
expect(findNavItem("/console/tasks/r1")?.label).toBe("日志");
|
||||
expect(pageTitle("/console/tasks/r1")).toBe("日志");
|
||||
expect(findNavItem("/console/logs")?.label).toBe("日志");
|
||||
expect(findNavItem("/console/downloads")?.label).toBe("下载面板");
|
||||
expect(findNavItem("/console/downloads/plans")?.label).toBe("下载面板");
|
||||
expect(findNavItem("/console/downloads/abc")?.label).toBe("下载面板");
|
||||
@@ -97,10 +107,14 @@ describe("旧链接重定向", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("任务 / 审计 / 计划的旧地址一律落到日志页;任务详情独立页不跳", () => {
|
||||
expect(legacyRedirect("/console/tasks", "?kind=submitDownload")).toBe("/console/logs?type=task");
|
||||
expect(legacyRedirect("/console/tasks", "?tab=failed")).toBe("/console/logs?type=task&level=error");
|
||||
expect(legacyRedirect("/console/tasks/r1", "")).toBeNull();
|
||||
expect(legacyRedirect("/console/logs", "?type=task")).toBeNull();
|
||||
});
|
||||
|
||||
it("不相关的 query 不跳转", () => {
|
||||
expect(legacyRedirect("/console/tasks", "?kind=submitDownload")).toBeNull();
|
||||
expect(legacyRedirect("/console/schedules", "?job=trash.purge")).toBeNull();
|
||||
expect(legacyRedirect("/console/tasks", "?tab=failed")).toBeNull();
|
||||
expect(legacyRedirect("/console/library", "?filter=unidentified")).toBeNull();
|
||||
expect(legacyRedirect("/console/subscriptions", "")).toBeNull();
|
||||
// 旧 RSS 页的 ?feed= 由 sources.tsx 查所属站点后跳转
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import {
|
||||
Bot,
|
||||
CalendarClock,
|
||||
CalendarCog,
|
||||
Compass,
|
||||
Download,
|
||||
FileStack,
|
||||
@@ -11,7 +10,6 @@ import {
|
||||
House,
|
||||
Library,
|
||||
ListChecks,
|
||||
ListTodo,
|
||||
type LucideIcon,
|
||||
ScrollText,
|
||||
Settings,
|
||||
@@ -40,9 +38,10 @@ export function consolePath(...segments: (string | number)[]): string {
|
||||
export const ACQUIRE_GROUP_TITLE = "获取";
|
||||
|
||||
/**
|
||||
* 侧栏 4 组 14 项(IA-2,docs/design/console-ia.md):概览 → 获取 → 整理 → 系统。
|
||||
* 任务归系统;RSS 属于站点(站点详情的 RSS Tab),不再单独占一项。
|
||||
* 侧栏 4 组 13 项(IA-2,docs/design/console-ia.md):概览 → 获取 → 整理 → 系统。
|
||||
* RSS 属于站点(站点详情的 RSS Tab),不再单独占一项。
|
||||
* 没有「待处理」(2026-10-06 取消):问题在发生处处理,铃铛只放等你批准的智能体操作与系统健康;移动端抽屉用同一份表。
|
||||
* 系统组只有三项(界面第二轮):日志(任务、定时与自动、登录、审计合一,定时任务设置是其中一个页签)、运行状态、设置。
|
||||
*/
|
||||
export const NAV_GROUPS: NavGroup[] = [
|
||||
{
|
||||
@@ -54,12 +53,6 @@ export const NAV_GROUPS: NavGroup[] = [
|
||||
icon: House,
|
||||
description: "在忙什么、要我处理什么、最近入库了什么",
|
||||
},
|
||||
{
|
||||
to: "/console/schedules",
|
||||
label: "计划",
|
||||
icon: CalendarCog,
|
||||
description: "智能体巡检与自动任务的开关和间隔",
|
||||
},
|
||||
{
|
||||
to: "/console/agent",
|
||||
label: "智能体会话",
|
||||
@@ -110,10 +103,16 @@ export const NAV_GROUPS: NavGroup[] = [
|
||||
title: "系统",
|
||||
items: [
|
||||
{
|
||||
to: "/console/tasks",
|
||||
label: "任务",
|
||||
icon: ListTodo,
|
||||
description: "最近处理了什么、有没有失败",
|
||||
to: "/console/logs",
|
||||
label: "日志",
|
||||
icon: ScrollText,
|
||||
description: "任务、定时与自动任务、登录与操作留痕,可实时查看",
|
||||
},
|
||||
{
|
||||
to: "/console/status",
|
||||
label: "运行状态",
|
||||
icon: Gauge,
|
||||
description: "服务是否正常、CPU 与内存、磁盘与数据库",
|
||||
},
|
||||
{
|
||||
to: "/console/settings",
|
||||
@@ -121,22 +120,15 @@ export const NAV_GROUPS: NavGroup[] = [
|
||||
icon: Settings,
|
||||
description: "下载器、媒体服务器、媒体库目录、站点账号、模型服务与自动化",
|
||||
},
|
||||
{
|
||||
to: "/console/audit",
|
||||
label: "审计",
|
||||
icon: ScrollText,
|
||||
description: "登录、设置、密钥、任务操作的留痕",
|
||||
},
|
||||
{
|
||||
to: "/console/status",
|
||||
label: "运行状态",
|
||||
icon: Gauge,
|
||||
description: "服务是否正常、磁盘与数据库",
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
/** 并进别的导航项的旧页面:按前缀归到对应项(任务详情独立页属于日志) */
|
||||
const NAV_ALIASES: Record<string, string> = {
|
||||
"/console/tasks": "/console/logs",
|
||||
};
|
||||
|
||||
/** 不在侧栏但有页面的路由:顶栏标题用 */
|
||||
const EXTRA_TITLES: Record<string, string> = {
|
||||
"/console/preferences": "偏好标签",
|
||||
@@ -162,6 +154,8 @@ export function settingsPath(section: SettingsSection, anchor?: string): string
|
||||
|
||||
/** 按路径找当前导航项(最长前缀匹配) */
|
||||
export function findNavItem(pathname: string): NavItem | undefined {
|
||||
const alias = Object.entries(NAV_ALIASES).find(([from]) => pathname === from || pathname.startsWith(`${from}/`));
|
||||
if (alias) return NAV_ITEMS.find((i) => i.to === alias[1]);
|
||||
return (
|
||||
NAV_ITEMS.find((i) => i.to === pathname.replace(/\/+$/, "")) ??
|
||||
NAV_ITEMS.filter((i) => i.to !== CONSOLE_BASE && pathname.startsWith(`${i.to}/`)).sort(
|
||||
|
||||
Reference in new issue
Block a user