feat(web): split plan page from tasks (FE-6)

- Nav overview group: 首页 / 任务 / 计划 / Agent 会话; tasks page drops the plan tab
- /console/tasks?tab=plan[&job=] redirects to /console/schedules[?job=]
- Plan page: 自动任务 compact grouped list (switch, interval preset/custom, last result,
  countdown, failure reason, run now/skip/run records) and Agent 巡检 cards (goal,
  allowlist, budget, upstream/model, trigger, cost per run, recent sessions); split stats
- Home plan band: two counts linking to #auto / #checks
- Docs: console-ia §7.4a, glossary, schedules runbook; smoke routes

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
rootandClaude Opus 5.5 committed 2026-09-29 17:13:54 +08:00
1 parent c3aaf901ad
commit baf2d6ea04
22 files changed
+1030 -417

No files matched your search

@@ -10,6 +10,19 @@ import type { StatusTone } from "~/components/console/status-badge.tsx";
// 定时任务看板的标签映射(只在本页用,不放 lib/labels.ts)
export const GROUP_ORDER: ScheduleGroup[] = ["collect", "download", "organize", "maintain", "agent"];
/** 计划页「自动任务」一节的分组(Agent 巡检单独一节) */
export const TASK_GROUPS: ScheduleGroup[] = ["collect", "download", "organize", "maintain"];
/** 计划页两节的锚点:/console/schedules#auto、#checks */
export type PlanSection = "auto" | "checks";
export const PLAN_PATH = "/console/schedules";
export function planPath(opts: { section?: PlanSection; job?: string } = {}): string {
const q = opts.job ? `?job=${encodeURIComponent(opts.job)}` : "";
return `${PLAN_PATH}${q}${opts.section ? `#${opts.section}` : ""}`;
}
/** 任务页里某个定时任务触发的任务(businessKind=schedule) */
export const scheduleStreamPath = (id: string) => `/console/tasks?tab=all&kind=schedule&ref=${encodeURIComponent(id)}`;
export const GROUP_LABEL: Record<ScheduleGroup, string> = {
collect: "采集",
@@ -43,6 +56,27 @@ export type IntervalUnit = "s" | "m" | "h";
export const UNIT_MS: Record<IntervalUnit, number> = { s: 1000, m: 60_000, h: 3600_000 };
export const UNIT_LABEL: Record<IntervalUnit, string> = { s: "秒", m: "分钟", h: "小时" };
/** 间隔下拉的常用选项(毫秒);当前值不在其中时下拉另列一项 */
export const INTERVAL_PRESETS: number[] = [
30_000,
60_000,
5 * 60_000,
10 * 60_000,
30 * 60_000,
3600_000,
6 * 3600_000,
12 * 3600_000,
24 * 3600_000,
7 * 24 * 3600_000,
];
/** 美元费用:"$0.0031" / "$0.12";空值 "—" */
export function formatUsd(v: number | null | undefined): string {
if (v === null || v === undefined) return "—";
if (v === 0) return "$0";
return `$${v < 0.1 ? v.toFixed(4) : v.toFixed(2)}`;
}
/** 毫秒 → 最大整除单位 */
export function splitInterval(ms: number): { value: number; unit: IntervalUnit } {
if (ms % UNIT_MS.h === 0) return { value: ms / UNIT_MS.h, unit: "h" };