feat(web): unified task stream with plan tab, task detail drawer and audit links (FE-1)

Tasks page merges engine runs (with W9-I business fields) into one stream:
all / active / failed / plan tabs, filters for source, business kind, status
and time; detail drawer with business summary, timeline, collapsed engine
steps, cancel/retry and related audit links. The schedule board moves into
the plan tab; card history jumps to the stream filtered by schedule key.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
rootandClaude Opus 5.5 committed 2026-09-28 16:10:29 +08:00
1 parent f8362a3f4c
commit d8b9bd9662
10 files changed
+1189 -30

No files matched your search

+15 -5
View File
@@ -1,4 +1,5 @@
import { AuditAction, type AuditEvent } from "@umt/contracts";
import { X } from "lucide-react";
import { useEffect, useState } from "react";
import { useSearchParams } from "react-router";
import { useAuditEvents } from "~/api/audit.ts";
@@ -8,10 +9,11 @@ import { FilterBar, FilterSelect } from "~/components/console/filter-bar.tsx";
import { JsonView } from "~/components/console/json-view.tsx";
import { KvList } from "~/components/console/kv-list.tsx";
import { PageHeader } from "~/components/console/page-header.tsx";
import { Button } from "~/components/ui/button.tsx";
import { ACTOR_TYPES, actorTypeLabel, formatRelative } from "~/lib/labels.ts";
import { formatDateTime } from "~/lib/utils.ts";
export const meta = () => [{ title: "审计日志 · UHD 媒体自动化控制台" }];
export const meta = () => [{ title: "审计 · UHD 媒体自动化控制台" }];
const actorLabel = actorTypeLabel;
@@ -30,14 +32,14 @@ const ACTION_LABEL: Record<string, string> = {
"secret.rotate": "轮换凭证",
"secret.delete": "删除凭证",
"site_account.credentials_set": "录入站点凭证",
"engine.run_cancel": "取消引擎运行",
"engine.run_cancel": "取消任务",
"pi_upstream.oauth_start": "开始订阅登录",
"pi_upstream.oauth_login": "完成订阅登录",
"pi_upstream.oauth_logout": "退出订阅登录",
"schedule.run_now": "立即执行定时任务",
"schedule.skip": "跳过定时任务",
"acquisition_plan.manual_submit": "手动提交下载计划",
"engine.run_retry": "重跑引擎运行",
"engine.run_retry": "重跑任务",
"capability.invoke": "Agent 调用能力",
"site.created": "登记站点",
"site.updated": "修改站点",
@@ -88,6 +90,7 @@ export default function AuditPage() {
const [params, setParams] = useSearchParams();
const actorType = params.get("actorType") ?? "";
const action = params.get("action") ?? "";
const targetId = params.get("targetId") ?? "";
const [target, setTarget] = useState(params.get("targetType") ?? "");
const [targetType, setTargetType] = useState(target);
const [selected, setSelected] = useState<AuditEvent | null>(null);
@@ -122,13 +125,14 @@ export default function AuditPage() {
actorType: actorType || undefined,
action: action || undefined,
targetType: targetType || undefined,
targetId: targetId || undefined,
});
const rows = q.data?.pages.flatMap((p) => p.items);
const filtered = !!(actorType || action || targetType);
const filtered = !!(actorType || action || targetType || targetId);
return (
<>
<PageHeader title="审计日志" description="登录、设置、密钥与实例变更,新的在前。不记录凭证内容。" />
<PageHeader title="审计" description="登录、设置、密钥与实例变更,新的在前。不记录凭证内容。" />
<FilterBar
search={{ value: target, onChange: setTarget, placeholder: "对象类型,如 downloader_instance" }}
onReset={
@@ -147,6 +151,12 @@ export default function AuditPage() {
options={ACTOR_TYPES}
/>
<FilterSelect label="动作" value={action} onChange={(v) => setParam("action", v)} options={ACTION_OPTIONS} />
{targetId ? (
<Button variant="outline" size="sm" onClick={() => setParam("targetId", "")} title={targetId}>
对象 <span className="max-w-40 truncate font-mono">{targetId}</span>
<X />
</Button>
) : null}
</FilterBar>
<DataTable<AuditEvent>
rows={rows}