feat(web): regroup console nav into 7 groups, split downloads/plans/tasks, add legacy redirects
- Sidebar: 概览/资源/订阅/下载/整理/Agent/系统, 18 items (+ 定时任务); single active item via findNavItem; 待处理 badge; collapsed rail groups; mobile drawer shares NAV_GROUPS. - New pages: /downloads (queue + cache watermark header), /downloads/plans, /downloads/:id, /tasks (business tasks only) + /tasks/:id detail, /rules. - Legacy links: ?tab= on tasks/subscriptions/sources redirect via clientLoader; /tasks/:downloadId falls back to /downloads/:id. - List filters in URL query; settingsPath() helper for settings deep links. - Copy per glossary (待处理, 收录策略, 引擎面板, 文件管理, 版本目标). Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
5843527317
commit
909cd2ad49
31 files changed
+1247
-609
No files matched your search
@@ -30,9 +30,12 @@ const STATIC_ROUTES = [
|
||||
"/console/files",
|
||||
"/console/files/trash",
|
||||
"/console/subscriptions",
|
||||
"/console/rules",
|
||||
"/console/preferences",
|
||||
"/console/sites",
|
||||
"/console/sources",
|
||||
"/console/downloads",
|
||||
"/console/downloads/plans",
|
||||
"/console/tasks",
|
||||
"/console/agent",
|
||||
"/console/agent?mock=1",
|
||||
@@ -47,11 +50,30 @@ const DETAIL_ROUTES = [
|
||||
{ route: "/console/library/:id", list: "/api/v1/library" },
|
||||
{ route: "/console/organize/:id", list: "/api/v1/organization-records" },
|
||||
{ route: "/console/sites/:id", list: "/api/v1/sites" },
|
||||
{ route: "/console/tasks/:id", list: "/api/v1/download-tasks" },
|
||||
{ route: "/console/sites/:id", list: "/api/v1/sites", after: "?tab=snapshots" },
|
||||
{ route: "/console/sites/:id", list: "/api/v1/sites", after: "?tab=accounts" },
|
||||
{ route: "/console/downloads/:id", list: "/api/v1/download-tasks" },
|
||||
{ route: "/console/tasks/:id", list: "/api/v1/tasks" },
|
||||
{ route: "/console/agent/:id", list: "/api/v1/agent/runs", after: "?mock=0" },
|
||||
{ route: "/console/engine/:id", list: "/api/v1/engine/runs" },
|
||||
];
|
||||
|
||||
/**
|
||||
* IA 重构后的旧链接(docs/design/console-ia.md §3.3):打开旧地址,最终落到新地址且页面 200。
|
||||
* 与 app/routes/console/redirects.ts 的 LEGACY_REDIRECTS 同步;:id 从列表接口取。
|
||||
*/
|
||||
const REDIRECT_ROUTES = [
|
||||
{ from: "/console/tasks?tab=downloads", to: "/console/downloads" },
|
||||
{ from: "/console/tasks?tab=downloads&status=paused", to: "/console/downloads?status=paused" },
|
||||
{ from: "/console/tasks?tab=plans", to: "/console/downloads/plans" },
|
||||
{ from: "/console/tasks?tab=tasks", to: "/console/tasks" },
|
||||
{ from: "/console/subscriptions?tab=policies", to: "/console/rules" },
|
||||
{ from: "/console/sources?tab=snapshots", to: "/console/sources" },
|
||||
{ from: "/console/sources?tab=snapshots&siteId=:id", to: "/console/sites/:id?tab=snapshots", list: "/api/v1/sites" },
|
||||
// 旧的下载详情地址:先查业务任务(404 属预期),再跳到下载详情
|
||||
{ from: "/console/tasks/:id", to: "/console/downloads/:id", list: "/api/v1/download-tasks", expect404: true },
|
||||
];
|
||||
|
||||
/** 允许的控制台噪音(React Router 开发模式提示等,不算错误) */
|
||||
const IGNORED = [/Download the React DevTools/i, /React Router Future Flag Warning/i];
|
||||
|
||||
@@ -148,6 +170,37 @@ async function main() {
|
||||
if (SHOTS) await page.screenshot({ path: join(OUT, `${name}.png`), fullPage: true }).catch(() => {});
|
||||
results.push({ path, ms: Date.now() - t0, problems: [...new Set(problems)] });
|
||||
}
|
||||
// ── 旧链接重定向 ──
|
||||
for (const r of REDIRECT_ROUTES) {
|
||||
let from = r.from;
|
||||
let to = r.to;
|
||||
if (r.list) {
|
||||
const res = await page.request.get(`${BASE}${r.list}?limit=1`);
|
||||
const id = res.ok() ? (await res.json().catch(() => null))?.data?.items?.[0]?.id : null;
|
||||
if (!id) {
|
||||
skipped.push(`${r.from}(${r.list} 无数据)`);
|
||||
continue;
|
||||
}
|
||||
from = from.replace(":id", encodeURIComponent(id));
|
||||
to = to.replace(":id", encodeURIComponent(id));
|
||||
}
|
||||
problems = [];
|
||||
const t0 = Date.now();
|
||||
let status = 0;
|
||||
try {
|
||||
const res = await page.goto(`${BASE}${from}`, { waitUntil: "networkidle", timeout: 30_000 });
|
||||
status = res?.status() ?? 0;
|
||||
await page.waitForURL((u) => `${u.pathname}${u.search}` === to, { timeout: 10_000 });
|
||||
await page.waitForSelector("main", { timeout: 10_000 });
|
||||
} catch (err) {
|
||||
const u = new URL(page.url());
|
||||
problems.push(`没有跳到 ${to}(停在 ${u.pathname}${u.search}):${String(err?.message ?? err).split("\n")[0]}`);
|
||||
}
|
||||
if (status !== 200) problems.push(`HTTP ${status}`);
|
||||
// 旧下载详情先探测业务任务,那次 404 与浏览器随之打印的资源错误是预期内的
|
||||
const kept = r.expect404 ? problems.filter((p) => !/404/.test(p)) : problems;
|
||||
results.push({ path: `${from} → ${to}`, ms: Date.now() - t0, problems: [...new Set(kept)] });
|
||||
}
|
||||
await browser.close();
|
||||
|
||||
// ── 汇报 ──
|
||||
|
||||
Reference in new issue
Block a user