refactor(web): 技术信息折叠铺到媒体库 / 审计 / 运行状态,清理正常态徽章与解释型页描述(DEAI-2)

- 媒体库详情:作品 UUID 进技术信息;「实际路径与库根」改「文件位置」,正常态(已核验、
  可访问、主位置)不加徽章;外部身份显示「TMDB 90228 · 你确认的 / 自动匹配」,修订号进悬停;
  元数据字段来源默认收起(「显示来源」,跟随界面设置);别名默认只列中英文与手动加的;
  「内容单元」→「季与集」,「临时单元」→「编号待确认」;侧栏与页标题统一「媒体库」
- 审计:动作列不再重复英文码,对象列显示中文类型 / 能力名,ID 只在详情;补 capability.denied
- 运行状态:进程、已下线实例、趋势图与最大表收进折叠区;图例同名序列加序号,不再拼接
- 站点卡:账号正常与登录方式不加徽章,健康不显示毫秒,限流移出卡片
- 文件管理:目录「正常」徽章与重复的剩余空间去掉;已登记 → 已入库,临时文件 → 未完成
- 规则:「修订」列改「最后修改」;不支持的关键字合成一行;页签改「默认规则 / 自动收新作品 / 已忽略」;
  默认规则说明去掉「带层」等算法描述
- 站点 Passkey 与登录用通行密钥区分命名;命令面板提示去重
- 删解释型页描述(审计、搜索、下载、下载计划、RSS、规则、媒体库、运行状态、站点、任务、计划、整理)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
rootandClaude Opus 5.5 committed 2026-09-29 20:58:38 +08:00
1 parent 5a717e414c
commit 57ce40168d
31 files changed
+253 -209

No files matched your search

+1 -1
View File
@@ -34,7 +34,7 @@ export const SEARCH_ACTIONS: readonly SearchAction[] = [
page("organize", "整理", "整理记录", "/console/organize", ["organize", "入库", "历史"]), page("organize", "整理", "整理记录", "/console/organize", ["organize", "入库", "历史"]),
page("files", "整理", "文件管理", "/console/files", ["files", "文件"]), page("files", "整理", "文件管理", "/console/files", ["files", "文件"]),
page("trash", "整理", "回收站", "/console/files/trash", ["trash", "删除"]), page("trash", "整理", "回收站", "/console/files/trash", ["trash", "删除"]),
page("library", "整理", "媒体概览", "/console/library", ["library", "媒体库", "作品"]), page("library", "整理", "媒体库", "/console/library", ["library", "媒体库", "作品"]),
page("settings", "系统", "设置", "/console/settings", ["settings", "配置", "tmdb", "下载器"]), page("settings", "系统", "设置", "/console/settings", ["settings", "配置", "tmdb", "下载器"]),
page("schedules", "概览", "定时任务", "/console/tasks?tab=plan", ["schedule", "cron", "巡检", "计划"]), page("schedules", "概览", "定时任务", "/console/tasks?tab=plan", ["schedule", "cron", "巡检", "计划"]),
page("audit", "系统", "审计", "/console/audit", ["audit", "日志"]), page("audit", "系统", "审计", "/console/audit", ["audit", "日志"]),
+2 -2
View File
@@ -22,7 +22,7 @@ describe("控制台导航", () => {
["首页", "任务", "计划", "智能体会话"], ["首页", "任务", "计划", "智能体会话"],
["站点", "RSS"], ["站点", "RSS"],
["订阅", "规则"], ["订阅", "规则"],
["下载面板", "整理记录", "文件管理", "媒体概览"], ["下载面板", "整理记录", "文件管理", "媒体库"],
["设置", "审计", "运行状态"], ["设置", "审计", "运行状态"],
]); ]);
// IA-3 逐项清单 14 项 + FE-6 计划页 // IA-3 逐项清单 14 项 + FE-6 计划页
@@ -44,7 +44,7 @@ describe("控制台导航", () => {
it("按最长前缀匹配当前项", () => { it("按最长前缀匹配当前项", () => {
expect(findNavItem("/console")?.label).toBe("首页"); expect(findNavItem("/console")?.label).toBe("首页");
expect(findNavItem("/console/")?.label).toBe("首页"); expect(findNavItem("/console/")?.label).toBe("首页");
expect(findNavItem("/console/library/abc")?.label).toBe("媒体概览"); expect(findNavItem("/console/library/abc")?.label).toBe("媒体库");
expect(findNavItem("/console/tasks/r1")?.label).toBe("任务"); expect(findNavItem("/console/tasks/r1")?.label).toBe("任务");
expect(findNavItem("/console/schedules")?.label).toBe("计划"); expect(findNavItem("/console/schedules")?.label).toBe("计划");
expect(findNavItem("/console/downloads")?.label).toBe("下载面板"); expect(findNavItem("/console/downloads")?.label).toBe("下载面板");
+9 -9
View File
@@ -46,19 +46,19 @@ export const NAV_GROUPS: NavGroup[] = [
to: "/console", to: "/console",
label: "首页", label: "首页",
icon: House, icon: House,
description: "正在进行、需要处理、计划、最近结果与运行状态", description: "在忙什么、要我处理什么、最近入库了什么",
}, },
{ {
to: "/console/tasks", to: "/console/tasks",
label: "任务", label: "任务",
icon: ListTodo, icon: ListTodo,
description: "每次运行都是一条任务:定时、事件、手动、智能体触发都在这里", description: "最近处理了什么、有没有失败",
}, },
{ {
to: "/console/schedules", to: "/console/schedules",
label: "计划", label: "计划",
icon: CalendarCog, icon: CalendarCog,
description: "定时任务的开关、间隔和下次运行:自动任务与智能体巡检", description: "智能体巡检与自动任务的开关和间隔",
}, },
{ {
to: "/console/agent", to: "/console/agent",
@@ -75,7 +75,7 @@ export const NAV_GROUPS: NavGroup[] = [
to: "/console/sites", to: "/console/sites",
label: "站点", label: "站点",
icon: Globe, icon: Globe,
description: "站点、凭证、账号数据与健康;资源、抓取与 RSS", description: "站点账号、资源与 RSS",
}, },
{ to: "/console/sources", label: "RSS", icon: Rss, description: "全部 RSS 与抓取状态" }, { to: "/console/sources", label: "RSS", icon: Rss, description: "全部 RSS 与抓取状态" },
], ],
@@ -90,7 +90,7 @@ export const NAV_GROUPS: NavGroup[] = [
{ {
title: "整理", title: "整理",
items: [ items: [
{ to: "/console/downloads", label: "下载面板", icon: Download, description: "下载任务、下载计划与缓存水位" }, { to: "/console/downloads", label: "下载面板", icon: Download, description: "下载任务、下载计划与下载盘" },
{ {
to: "/console/organize", to: "/console/organize",
label: "整理记录", label: "整理记录",
@@ -101,13 +101,13 @@ export const NAV_GROUPS: NavGroup[] = [
to: "/console/files", to: "/console/files",
label: "文件管理", label: "文件管理",
icon: FolderTree, icon: FolderTree,
description: "浏览登记目录,改名、移动、删除与整理", description: "浏览下载目录和媒体库,改名、移动、删除与整理",
}, },
{ {
to: "/console/library", to: "/console/library",
label: "媒体概览", label: "媒体库",
icon: Library, icon: Library,
description: "作品、季 / 集、收录版本、外部身份与未识别资源", description: "作品、季与集、未识别资源",
}, },
], ],
}, },
@@ -130,7 +130,7 @@ export const NAV_GROUPS: NavGroup[] = [
to: "/console/status", to: "/console/status",
label: "运行状态", label: "运行状态",
icon: Gauge, icon: Gauge,
description: "进程心跳、事件循环、数据库、磁盘与挂载根", description: "服务是否正常、磁盘与数据库",
}, },
], ],
}, },
+1 -1
View File
@@ -1049,7 +1049,7 @@ export function RefreshMetadataDialog({ items, onClose }: { items: FileEntry[];
{s.reason === "not_registered" {s.reason === "not_registered"
? "没有已入库文件" ? "没有已入库文件"
: s.reason === "no_entity" : s.reason === "no_entity"
? "不属于任何已登记作品" ? "不属于媒体库里的作品"
: s.reason === "not_found" : s.reason === "not_found"
? "作品不存在" ? "作品不存在"
: s.reason} : s.reason}
+2 -8
View File
@@ -2,7 +2,7 @@ import { ChevronRight, Download, Folder, FolderOpen, HardDrive, LoaderCircle, Tr
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { type FileRoot, useDirChildren } from "~/api/files.ts"; import { type FileRoot, useDirChildren } from "~/api/files.ts";
import { healthLabel } from "~/lib/labels.ts"; import { healthLabel } from "~/lib/labels.ts";
import { cn, formatBytes } from "~/lib/utils.ts"; import { cn } from "~/lib/utils.ts";
import { groupRoots, joinRel, segments } from "./model.ts"; import { groupRoots, joinRel, segments } from "./model.ts";
type Loc = { root: string; path: string }; type Loc = { root: string; path: string };
@@ -140,19 +140,13 @@ function RootNode({
{h.tone !== "neutral" ? <TriangleAlert className="h-3 w-3" /> : null} {h.tone !== "neutral" ? <TriangleAlert className="h-3 w-3" /> : null}
{h.label} {h.label}
</span> </span>
) : ( ) : null}
<span className="inline-flex items-center gap-1 text-success">
<span aria-hidden className="h-1.5 w-1.5 rounded-full bg-success" />
正常
</span>
)}
{root.pendingCount ? ( {root.pendingCount ? (
<span className="shrink-0 text-warning"> <span className="shrink-0 text-warning">
未识别 {root.pendingCount} 未识别 {root.pendingCount}
{root.pendingPartial ? "+" : ""} {root.pendingPartial ? "+" : ""}
</span> </span>
) : null} ) : null}
{root.usage ? <span className="truncate">剩余 {formatBytes(root.usage.freeBytes, 1)}</span> : null}
{!root.writable && root.kind === "library" ? <span>只读</span> : null} {!root.writable && root.kind === "library" ? <span>只读</span> : null}
</span> </span>
</span> </span>
@@ -123,7 +123,7 @@ export function FileDetail({
value: value:
e.type === "dir" e.type === "dir"
? e.dirSummary ? e.dirSummary
? `${e.dirSummary.videoCount}${e.dirSummary.partial ? "+" : ""} 个视频 · ${e.dirSummary.registeredCount} 个已登记` ? `${e.dirSummary.videoCount}${e.dirSummary.partial ? "+" : ""} 个视频 · ${e.dirSummary.registeredCount} 个已入库`
: "—" : "—"
: formatBytes(e.size, 2), : formatBytes(e.size, 2),
}, },
+2 -2
View File
@@ -89,7 +89,7 @@ const base = {
describe("状态与禁用原因", () => { describe("状态与禁用原因", () => {
it("状态徽标带文字,H&R 未满足为 warning,逃逸为 destructive", () => { it("状态徽标带文字,H&R 未满足为 warning,逃逸为 destructive", () => {
expect(entryStatusView({ ...base, status: "registered" })?.label).toBe("已登记"); expect(entryStatusView({ ...base, status: "registered" })?.label).toBe("已入库");
expect( expect(
entryStatusView({ entryStatusView({
...base, ...base,
@@ -228,7 +228,7 @@ describe("v2 菜单与副行", () => {
type: "dir" as const, type: "dir" as const,
dirSummary: { videoCount: 13, registeredCount: 0, partial: false }, dirSummary: { videoCount: 13, registeredCount: 0, partial: false },
})?.text, })?.text,
).toBe("13 视频 · 0 已登记"); ).toBe("13 个视频 · 未入库");
// 没有 parsedHint(服务端解析不出标题)时不显示副行,前端不自己解析 // 没有 parsedHint(服务端解析不出标题)时不显示副行,前端不自己解析
expect(entrySubline({ ...video, parsedHint: null })).toBeNull(); expect(entrySubline({ ...video, parsedHint: null })).toBeNull();
}); });
+10 -7
View File
@@ -19,14 +19,14 @@ export function entryStatusView(e: Pick<FileEntry, "status" | "download" | "esca
const s: FileStatus = e.status; const s: FileStatus = e.status;
switch (s) { switch (s) {
case "temp": case "temp":
return { label: "临时文件", tone: "neutral", hint: "下载器或整理过程中的未完成文件" }; return { label: "未完成", tone: "neutral", hint: "下载器或整理过程中的未完成文件" };
case "downloading": case "downloading":
return { return {
label: e.download?.progress != null ? `下载中 ${Math.floor(e.download.progress * 100)}%` : "下载中", label: e.download?.progress != null ? `下载中 ${Math.floor(e.download.progress * 100)}%` : "下载中",
tone: "neutral", tone: "neutral",
}; };
case "registered": case "registered":
return { label: "已登记", tone: "success" }; return { label: "已入库", tone: "success" };
case "seeding": case "seeding":
return e.download?.hnr === "unsatisfied" return e.download?.hnr === "unsatisfied"
? { label: "做种中·H&R 未满足", tone: "warning", hint: "H&R 满足前不能改名、删除或移动" } ? { label: "做种中·H&R 未满足", tone: "warning", hint: "H&R 满足前不能改名、删除或移动" }
@@ -42,9 +42,9 @@ export const FILTER_CHIPS = [
{ value: "", label: "全部" }, { value: "", label: "全部" },
{ value: "video", label: "视频" }, { value: "video", label: "视频" },
{ value: "unidentified", label: "未识别" }, { value: "unidentified", label: "未识别" },
{ value: "registered", label: "已登记" }, { value: "registered", label: "已入库" },
{ value: "downloading", label: "下载中" }, { value: "downloading", label: "下载中" },
{ value: "temp", label: "临时文件" }, { value: "temp", label: "未完成下载" },
] as const; ] as const;
export const SORT_OPTIONS = [ export const SORT_OPTIONS = [
@@ -81,7 +81,7 @@ export function opDisabledReason(op: FileOp, e: FileEntry, root: Pick<FileRoot,
case "rename": case "rename":
if (!rootWritable) return "只读目录,不能改名"; if (!rootWritable) return "只读目录,不能改名";
if (seeding) return "做种中,H&R 满足前不能改名"; if (seeding) return "做种中,H&R 满足前不能改名";
if (e.status === "temp") return "临时文件不能改名"; if (e.status === "temp") return "未完成的文件不能改名";
return null; return null;
case "move": case "move":
if (!rootWritable) return "只读目录,不能移出。可以复制"; if (!rootWritable) return "只读目录,不能移出。可以复制";
@@ -93,7 +93,7 @@ export function opDisabledReason(op: FileOp, e: FileEntry, root: Pick<FileRoot,
return null; return null;
case "organize": case "organize":
case "identify": case "identify":
if (e.status === "temp") return "临时文件不能整理"; if (e.status === "temp") return "未完成的文件不能整理";
if (e.type === "file" && e.fileKind !== "video") return "只有视频或目录能整理"; if (e.type === "file" && e.fileKind !== "video") return "只有视频或目录能整理";
return null; return null;
case "scrape": case "scrape":
@@ -449,7 +449,10 @@ export function entrySubline(e: FileEntry): { text: string; tone: "link" | "hint
if (e.type === "dir" && e.dirSummary) { if (e.type === "dir" && e.dirSummary) {
const s = e.dirSummary; const s = e.dirSummary;
if (!s.videoCount && !s.registeredCount) return null; if (!s.videoCount && !s.registeredCount) return null;
return { text: `${s.videoCount}${s.partial ? "+" : ""} 视频 · ${s.registeredCount} 已登记`, tone: "meta" }; return {
text: `${s.videoCount}${s.partial ? "+" : ""} 个视频${s.registeredCount ? ` · ${s.registeredCount} 个已入库` : s.videoCount ? " · 未入库" : ""}`,
tone: "meta",
};
} }
if (e.parsedHint) return { text: e.parsedHint, tone: "hint" }; if (e.parsedHint) return { text: e.parsedHint, tone: "hint" };
return null; return null;
+4 -4
View File
@@ -101,11 +101,11 @@ export function RuleGroupTable({
}, },
{ key: "refs", header: "引用", cell: (g) => <RefsCell g={g} refs={refs} />, hideBelow: "lg" }, { key: "refs", header: "引用", cell: (g) => <RefsCell g={g} refs={refs} />, hideBelow: "lg" },
{ {
key: "rev", key: "updated",
header: "修订", header: "最后修改",
cell: (g) => ( cell: (g) => (
<span className="text-meta text-muted-foreground tabular-nums" title={`更新于 ${relTime(g.updatedAt)}`}> <span className="text-meta whitespace-nowrap text-muted-foreground" title={`r${g.revision}`}>
r{g.revision} {relTime(g.updatedAt)}
</span> </span>
), ),
hideBelow: "md", hideBelow: "md",
+14 -9
View File
@@ -339,21 +339,26 @@ export function AtomsTab() {
onRowClick={(a) => setDialog({ open: true, atom: a })} onRowClick={(a) => setDialog({ open: true, atom: a })}
empty={{ icon: FlaskConical, title: "还没有自定义条件", description: "内置关键字覆盖不到时再新建。" }} empty={{ icon: FlaskConical, title: "还没有自定义条件", description: "内置关键字覆盖不到时再新建。" }}
/> />
<Panel title="内置关键字" description="对齐 MoviePilot;判定依据按解析字段优先"> <Panel title="内置关键字">
{keywords.isPending ? ( {keywords.isPending ? (
<LoadingState rows={3} /> <LoadingState rows={3} />
) : keywords.isError ? ( ) : keywords.isError ? (
<ErrorState plain error={keywords.error} onRetry={() => keywords.refetch()} /> <ErrorState plain error={keywords.error} onRetry={() => keywords.refetch()} />
) : ( ) : (
<ul className="grid gap-x-6 gap-y-2 sm:grid-cols-2"> <ul className="grid gap-x-6 gap-y-2 sm:grid-cols-2">
{builtins.map((k) => ( {builtins
<li key={k.id} className="flex min-w-0 items-baseline gap-2 text-caption"> .filter((k) => k.supported)
<span className="w-16 shrink-0 font-mono font-medium text-foreground">{k.id}</span> .map((k) => (
<span className="min-w-0 text-muted-foreground"> <li key={k.id} className="flex min-w-0 items-baseline gap-2 text-caption">
{k.supported ? k.description || k.name : "不支持,规则串里出现会报错"} <span className="w-16 shrink-0 font-mono font-medium text-foreground">{k.id}</span>
</span> <span className="min-w-0 text-muted-foreground">{k.description || k.name}</span>
</li>
))}
{builtins.some((k) => !k.supported) ? (
<li className="text-meta text-muted-foreground sm:col-span-2">
另有 {builtins.filter((k) => !k.supported).length} 个关键字暂不支持,写进规则串会报错
</li> </li>
))} ) : null}
</ul> </ul>
)} )}
</Panel> </Panel>
@@ -385,7 +390,7 @@ export function DefaultsTab({ groups }: { groups: RuleGroup[] | undefined }) {
<div className="space-y-4"> <div className="space-y-4">
<div className="flex flex-wrap items-center justify-between gap-2"> <div className="flex flex-wrap items-center justify-between gap-2">
<p className="text-caption text-muted-foreground"> <p className="text-caption text-muted-foreground">
订阅和收录版本没指定规则组时用这里的链。链上的组按顺序串联,任一组拒绝即拒绝,优先级取最后一个带层的组。 订阅和收录版本没指定规则组时用这里的链。按顺序检查,任一组不通过就不下载。
</p> </p>
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
{dirty ? <StatusBadge tone="warning">未保存</StatusBadge> : null} {dirty ? <StatusBadge tone="warning">未保存</StatusBadge> : null}
@@ -1,5 +1,5 @@
import { type SearchAction, type SearchWork, tmdbImageUrl } from "@umt/contracts"; import { type SearchAction, type SearchWork, tmdbImageUrl } from "@umt/contracts";
import { ArrowRight, CornerDownLeft, Film, Globe, LoaderCircle, type LucideIcon, Search } from "lucide-react"; import { CornerDownLeft, Film, Globe, LoaderCircle, type LucideIcon, Search } from "lucide-react";
import { type ReactNode, useEffect, useId, useMemo, useRef, useState } from "react"; import { type ReactNode, useEffect, useId, useMemo, useRef, useState } from "react";
import { Link, useNavigate } from "react-router"; import { Link, useNavigate } from "react-router";
import { useSearch } from "~/api/search.ts"; import { useSearch } from "~/api/search.ts";
@@ -111,7 +111,6 @@ function PaletteBody({ initial }: { initial: string }) {
查看「<span className="font-medium">{term}</span>」的全部结果 查看「<span className="font-medium">{term}</span>」的全部结果
</span> </span>
), ),
meta: "作品卡上可以选站点搜资源",
hint: "打开", hint: "打开",
run: () => go(searchPagePath(term)), run: () => go(searchPagePath(term)),
}); });
@@ -254,10 +253,6 @@ function PaletteBody({ initial }: { initial: string }) {
<div className="hidden items-center gap-4 border-t border-border/70 px-4 py-2 text-meta text-muted-foreground sm:flex"> <div className="hidden items-center gap-4 border-t border-border/70 px-4 py-2 text-meta text-muted-foreground sm:flex">
<span>↑↓ 选择</span> <span>↑↓ 选择</span>
<span>↵ 打开</span> <span>↵ 打开</span>
<span className="ml-auto inline-flex items-center gap-1">
<ArrowRight className="h-3 w-3" />
搜资源在作品详情页
</span>
</div> </div>
</div> </div>
); );
@@ -196,7 +196,7 @@ export function PasskeyBlock({ disabled }: { disabled: boolean }) {
<SettingsBlock <SettingsBlock
section="account" section="account"
anchor="passkeys" anchor="passkeys"
title="Passkey" title="通行密钥(Passkey)"
description="用指纹、面容或安全钥匙直接登录,不用输密码和验证码。可以登记多把。" description="用指纹、面容或安全钥匙直接登录,不用输密码和验证码。可以登记多把。"
> >
{body} {body}
@@ -239,7 +239,7 @@ function PasskeyForm({ site, label, has }: { site: SiteListItem; label: string;
} }
}} }}
> >
<h2 className="text-lead font-semibold text-foreground">Passkey</h2> <h2 className="text-lead font-semibold text-foreground">站点 Passkey(RSS 与下载链接用)</h2>
<p className="mb-3 text-caption text-muted-foreground"> <p className="mb-3 text-caption text-muted-foreground">
用于 RSS 和下载链接,不参与登录。{has ? "已保存;再次保存会替换。" : "还没有保存。"} 用于 RSS 和下载链接,不参与登录。{has ? "已保存;再次保存会替换。" : "还没有保存。"}
</p> </p>
+6 -25
View File
@@ -27,7 +27,6 @@ import { cn } from "~/lib/utils.ts";
import type { SiteDialog, useSiteChecks } from "./site-dialogs.tsx"; import type { SiteDialog, useSiteChecks } from "./site-dialogs.tsx";
import { import {
ACCOUNT_OVERALL, ACCOUNT_OVERALL,
AUTH_KIND_LABEL,
bytes, bytes,
dataAccount, dataAccount,
healthLine, healthLine,
@@ -36,7 +35,6 @@ import {
loginFailureText, loginFailureText,
overallStatus, overallStatus,
primaryAccount, primaryAccount,
rateLimitText,
ratioText, ratioText,
} from "./site-fields.ts"; } from "./site-fields.ts";
@@ -197,21 +195,8 @@ function CheckButtons({ site, checks, compact }: Omit<Props, "onDialog"> & { com
function AccountBadges({ site }: { site: SiteListItem }) { function AccountBadges({ site }: { site: SiteListItem }) {
const st = ACCOUNT_OVERALL[overallStatus(site)]; const st = ACCOUNT_OVERALL[overallStatus(site)];
const acc = primaryAccount(site.accounts); // 正常不标;登录方式不做徽章(DEAI-2)
const hasPasskey = site.accounts?.some((a) => a.hasPasskey || a.authKind === "passkey"); return st.tone === "success" ? null : <StatusBadge tone={st.tone}>账号{st.label}</StatusBadge>;
return (
<>
<StatusBadge tone={st.tone}>账号{st.label}</StatusBadge>
{acc && acc.authKind !== "passkey" ? (
<span className="rounded-full border border-border px-2 py-0.5 text-meta text-muted-foreground">
{AUTH_KIND_LABEL[acc.authKind]}
</span>
) : null}
{hasPasskey ? (
<span className="rounded-full border border-border px-2 py-0.5 text-meta text-muted-foreground">Passkey</span>
) : null}
</>
);
} }
function Stat({ label, children, className }: { label: string; children: ReactNode; className?: string }) { function Stat({ label, children, className }: { label: string; children: ReactNode; className?: string }) {
@@ -307,14 +292,14 @@ export function SiteCard({ site, checks, onDialog }: Props) {
<dd className="text-foreground">{relTime(acc?.lastLoginAt)}</dd> <dd className="text-foreground">{relTime(acc?.lastLoginAt)}</dd>
</div> </div>
<div className="min-w-0"> <div className="min-w-0">
<dt className="text-meta text-muted-foreground">健康检测</dt> <dt className="text-meta text-muted-foreground">状态</dt>
<dd className="truncate" title={hmsg ?? undefined}> <dd className="truncate" title={hmsg ?? undefined}>
<StatusDot tone={health.tone} /> <StatusDot tone={health.tone} />
{health.text} {health.text}
</dd> </dd>
</div> </div>
<div className="min-w-0"> <div className="min-w-0">
<dt className="text-meta text-muted-foreground">抓取</dt> <dt className="text-meta text-muted-foreground">资源更新</dt>
<dd className={cn("text-foreground", stale && "text-warning")}> <dd className={cn("text-foreground", stale && "text-warning")}>
{!site.snapshotEnabled {!site.snapshotEnabled
? "未开启" ? "未开启"
@@ -323,10 +308,6 @@ export function SiteCard({ site, checks, onDialog }: Props) {
: "还没抓取过"} : "还没抓取过"}
</dd> </dd>
</div> </div>
<div className="min-w-0">
<dt className="text-meta text-muted-foreground">限流</dt>
<dd className="truncate text-foreground">{rateLimitText(site.rateLimit)}</dd>
</div>
</dl> </dl>
<footer className="mt-4 flex flex-wrap items-center justify-end gap-2 border-t border-border/60 pt-3"> <footer className="mt-4 flex flex-wrap items-center justify-end gap-2 border-t border-border/60 pt-3">
@@ -441,7 +422,7 @@ export function SiteTable({
}, },
{ {
key: "health", key: "health",
header: "健康检测", header: "状态",
hideBelow: "md", hideBelow: "md",
cell: (s) => { cell: (s) => {
const h = healthLine(s.lastHealth, s.lastHealthAt); const h = healthLine(s.lastHealth, s.lastHealthAt);
@@ -455,7 +436,7 @@ export function SiteTable({
}, },
{ {
key: "snapshot", key: "snapshot",
header: "抓取", header: "资源更新",
hideBelow: "lg", hideBelow: "lg",
cell: (s) => ( cell: (s) => (
<span className={s.snapshotEnabled && snapshotStale(s) ? "text-warning" : "text-muted-foreground"}> <span className={s.snapshotEnabled && snapshotStale(s) ? "text-warning" : "text-muted-foreground"}>
+1 -1
View File
@@ -121,7 +121,7 @@ const HEALTH_STATUS_TEXT: Record<string, string> = {
export function healthLine(h: SiteLastHealth | null, at: string | null): { text: string; tone: StatusTone } { export function healthLine(h: SiteLastHealth | null, at: string | null): { text: string; tone: StatusTone } {
if (!h) return { text: "未检测", tone: "neutral" }; if (!h) return { text: "未检测", tone: "neutral" };
const parts = [HEALTH_STATUS_TEXT[h.status] ?? h.status]; const parts = [HEALTH_STATUS_TEXT[h.status] ?? h.status];
if (h.latencyMs !== null) parts.push(`${h.latencyMs} ms`); // 延迟毫秒数不上屏(DEAI-2),需要时看站点详情
parts.push(relTime(at)); parts.push(relTime(at));
const tone: StatusTone = h.ok ? "success" : h.status.startsWith("auth_") ? "destructive" : "warning"; const tone: StatusTone = h.ok ? "success" : h.status.startsWith("auth_") ? "destructive" : "warning";
return { text: parts.join(" · "), tone }; return { text: parts.join(" · "), tone };
@@ -48,6 +48,16 @@ export function HistoryChart({
return [...m.values()].sort((a, b) => String(a.at).localeCompare(String(b.at))); return [...m.values()].sort((a, b) => String(a.at).localeCompare(String(b.at)));
}, [series, metric]); }, [series, metric]);
// 同名序列(容器重建后 pid 相同)加序号区分,图例不再重复拼接
const labels = new Map<string, string>();
const seen = new Map<string, number>();
for (const s of series) {
const base = seriesLabel(s);
const n = (seen.get(base) ?? 0) + 1;
seen.set(base, n);
labels.set(s.instanceId, n > 1 ? `${base}(${n})` : base);
}
if (rows.length === 0) return <EmptyState plain title="这段时间没有采样" className="py-8" />; if (rows.length === 0) return <EmptyState plain title="这段时间没有采样" className="py-8" />;
return ( return (
@@ -80,13 +90,19 @@ export function HistoryChart({
}} }}
cursor={{ stroke: "var(--color-muted-foreground)", strokeDasharray: "3 3" }} cursor={{ stroke: "var(--color-muted-foreground)", strokeDasharray: "3 3" }}
/> />
{series.length > 1 ? <Legend iconType="plainline" wrapperStyle={{ fontSize: 12 }} /> : null} {series.length > 1 ? (
<Legend
iconType="plainline"
wrapperStyle={{ fontSize: 12, paddingTop: 4 }}
formatter={(v) => <span className="mr-3 text-muted-foreground">{String(v)}</span>}
/>
) : null}
{series.map((s, i) => ( {series.map((s, i) => (
<Line <Line
key={s.instanceId} key={s.instanceId}
type="monotone" type="monotone"
dataKey={s.instanceId} dataKey={s.instanceId}
name={seriesLabel(s)} name={labels.get(s.instanceId) ?? seriesLabel(s)}
stroke="var(--color-foreground)" stroke="var(--color-foreground)"
strokeOpacity={OPACITY[i % OPACITY.length]} strokeOpacity={OPACITY[i % OPACITY.length]}
strokeDasharray={DASH[i % DASH.length]} strokeDasharray={DASH[i % DASH.length]}
@@ -12,6 +12,7 @@ import { useStorageCleanup, useSystemStorage } from "~/api/system.ts";
import { DataTable } from "~/components/console/data-table.tsx"; import { DataTable } from "~/components/console/data-table.tsx";
import { ErrorState, LoadingState } from "~/components/console/empty-state.tsx"; import { ErrorState, LoadingState } from "~/components/console/empty-state.tsx";
import { StatusBadge, type StatusTone } from "~/components/console/status-badge.tsx"; import { StatusBadge, type StatusTone } from "~/components/console/status-badge.tsx";
import { TechInfo } from "~/components/console/tech-info.tsx";
import { Button } from "~/components/ui/button.tsx"; import { Button } from "~/components/ui/button.tsx";
import { errorMessage } from "~/lib/api.ts"; import { errorMessage } from "~/lib/api.ts";
import { formatRelative } from "~/lib/labels.ts"; import { formatRelative } from "~/lib/labels.ts";
@@ -257,52 +258,56 @@ export function StorageSection({ health }: { health: SystemHealth }) {
</ul> </ul>
<div className="grid gap-6 xl:grid-cols-2"> <div className="grid gap-6 xl:grid-cols-2">
<Panel title={`体积最大的表(前 ${TOP_TABLES})`} note="含索引与 TOAST"> <TechInfo title={`数据库里最大的 ${TOP_TABLES} 张表`} columns={1}>
<DataTable<TableRow> <Panel title={`体积最大的表(前 ${TOP_TABLES})`} note="含索引与 TOAST">
rows={s.db.tables.slice(0, TOP_TABLES)} <DataTable<TableRow>
rowKey={(t) => `${t.schema}.${t.name}`} rows={s.db.tables.slice(0, TOP_TABLES)}
empty={{ title: "取不到表体积" }} rowKey={(t) => `${t.schema}.${t.name}`}
columns={[ empty={{ title: "取不到表体积" }}
{ columns={[
key: "name", {
header: "表", key: "name",
cell: (t) => ( header: "表",
<span className="font-mono text-caption break-all"> cell: (t) => (
{t.schema === "public" ? t.name : `${t.schema}.${t.name}`} <span className="font-mono text-caption break-all">
</span> {t.schema === "public" ? t.name : `${t.schema}.${t.name}`}
), </span>
}, ),
{ },
key: "total", {
header: "合计", key: "total",
align: "right", header: "合计",
cell: (t) => <span className="whitespace-nowrap tabular-nums">{formatBytes(t.totalBytes, 1)}</span>, align: "right",
}, cell: (t) => (
{ <span className="whitespace-nowrap tabular-nums">{formatBytes(t.totalBytes, 1)}</span>
key: "idx", ),
header: "索引", },
align: "right", {
hideBelow: "md", key: "idx",
cell: (t) => ( header: "索引",
<span className="whitespace-nowrap tabular-nums text-muted-foreground"> align: "right",
{formatBytes(t.indexBytes, 1)} hideBelow: "md",
</span> cell: (t) => (
), <span className="whitespace-nowrap tabular-nums text-muted-foreground">
}, {formatBytes(t.indexBytes, 1)}
{ </span>
key: "rows", ),
header: "估算行数", },
align: "right", {
hideBelow: "sm", key: "rows",
cell: (t) => ( header: "估算行数",
<span className="tabular-nums text-muted-foreground"> align: "right",
{t.rowsEstimate === null ? "—" : t.rowsEstimate.toLocaleString("zh-CN")} hideBelow: "sm",
</span> cell: (t) => (
), <span className="tabular-nums text-muted-foreground">
}, {t.rowsEstimate === null ? "—" : t.rowsEstimate.toLocaleString("zh-CN")}
]} </span>
/> ),
</Panel> },
]}
/>
</Panel>
</TechInfo>
<div className="space-y-6"> <div className="space-y-6">
<Panel title="缓存" note="条数含尚未清理的过期条目"> <Panel title="缓存" note="条数含尚未清理的过期条目">
<DataTable<KvRow> <DataTable<KvRow>
@@ -127,7 +127,7 @@ export function CoverageMatrix({
key={c.unitKey} key={c.unitKey}
scope="col" scope="col"
title={ title={
[c.airDate ? `播出 ${c.airDate}` : null, c.temporary ? "临时单元" : null] [c.airDate ? `播出 ${c.airDate}` : null, c.temporary ? "编号待确认" : null]
.filter(Boolean) .filter(Boolean)
.join(" · ") || undefined .join(" · ") || undefined
} }
@@ -275,7 +275,7 @@ export function CellSheet({
items={[ items={[
{ label: "单元", value: sel.col.unitKey, mono: true }, { label: "单元", value: sel.col.unitKey, mono: true },
...(sel.col.airDate ? [{ label: "播出日期", value: sel.col.airDate }] : []), ...(sel.col.airDate ? [{ label: "播出日期", value: sel.col.airDate }] : []),
...(sel.col.temporary ? [{ label: "临时单元", value: "还没有正式的内容单元" }] : []), ...(sel.col.temporary ? [{ label: "编号待确认", value: "这一集的编号还没确认" }] : []),
{ {
label: "质量", label: "质量",
value: value:
+30 -8
View File
@@ -1,4 +1,4 @@
import { AuditAction, type AuditEvent } from "@umt/contracts"; import { AuditAction, type AuditEvent, CAPABILITY_CATALOG, type KnownCapabilityId } from "@umt/contracts";
import { X } from "lucide-react"; import { X } from "lucide-react";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { useSearchParams } from "react-router"; import { useSearchParams } from "react-router";
@@ -40,7 +40,8 @@ const ACTION_LABEL: Record<string, string> = {
"schedule.skip": "跳过定时任务", "schedule.skip": "跳过定时任务",
"acquisition_plan.manual_submit": "手动提交下载计划", "acquisition_plan.manual_submit": "手动提交下载计划",
"engine.run_retry": "重跑任务", "engine.run_retry": "重跑任务",
"capability.invoke": "智能体调用能力", "capability.invoke": "智能体操作",
"capability.denied": "智能体操作被拒绝",
"site.created": "登记站点", "site.created": "登记站点",
"site.updated": "修改站点", "site.updated": "修改站点",
"feed_source.created": "新建 RSS", "feed_source.created": "新建 RSS",
@@ -64,6 +65,29 @@ const NOUN: Record<string, string> = {
schedule: "定时任务", schedule: "定时任务",
automation_grant: "持续授权", automation_grant: "持续授权",
}; };
const TARGET_LABEL: Record<string, string> = {
...NOUN,
admin_user: "管理员",
api_key: "API Key",
settings: "设置",
secret: "凭证",
site: "站点",
site_account: "站点账号",
feed_source: "RSS",
engine_run: "任务",
acquisition_plan: "下载计划",
download_task: "下载任务",
media_entity: "作品",
source_release: "资源",
organization_record: "整理记录",
file: "文件",
capability: "能力",
};
/** 对象列:能力显示中文名,其余显示对象类型;ID 只在详情里 */
function targetText(type: string, id: string | null): string {
if (type === "capability" && id) return CAPABILITY_CATALOG[id as KnownCapabilityId]?.title ?? id;
return TARGET_LABEL[type] ?? type;
}
function actionLabel(a: string): string { function actionLabel(a: string): string {
if (ACTION_LABEL[a]) return ACTION_LABEL[a]; if (ACTION_LABEL[a]) return ACTION_LABEL[a];
const [noun, verb] = a.split("."); const [noun, verb] = a.split(".");
@@ -132,7 +156,7 @@ export default function AuditPage() {
return ( return (
<> <>
<PageHeader title="审计" description="登录、设置、密钥与实例变更,新的在前。不记录凭证内容。" /> <PageHeader title="审计" />
<FilterBar <FilterBar
search={{ value: target, onChange: setTarget, placeholder: "对象类型,如 downloader_instance" }} search={{ value: target, onChange: setTarget, placeholder: "对象类型,如 downloader_instance" }}
onReset={ onReset={
@@ -188,7 +212,6 @@ export default function AuditPage() {
cell: (r) => ( cell: (r) => (
<div className="min-w-0"> <div className="min-w-0">
<p className="font-medium">{actionLabel(r.action)}</p> <p className="font-medium">{actionLabel(r.action)}</p>
<p className="font-mono text-meta text-muted-foreground">{r.action}</p>
</div> </div>
), ),
}, },
@@ -199,10 +222,9 @@ export default function AuditPage() {
hideBelow: "md", hideBelow: "md",
cell: (r) => cell: (r) =>
r.targetType ? ( r.targetType ? (
<div className="min-w-0 max-w-[18rem]"> <p className="min-w-0 max-w-[18rem] truncate" title={`${r.targetType} · ${r.targetId ?? ""}`}>
<p className="truncate">{r.targetType}</p> {targetText(r.targetType, r.targetId)}
<p className="truncate font-mono text-meta text-muted-foreground">{r.targetId}</p> </p>
</div>
) : ( ) : (
"—" "—"
), ),
@@ -78,7 +78,7 @@ export default function DownloadPlansPage() {
return ( return (
<> <>
<PageHeader title="下载面板" description="候选被选中后生成计划,同时预留收录版本、空间与预算。" /> <PageHeader title="下载面板" />
<DownloadsTabs /> <DownloadsTabs />
<FilterBar onReset={f.active ? f.reset : undefined}> <FilterBar onReset={f.active ? f.reset : undefined}>
<FilterSelect <FilterSelect
@@ -91,7 +91,6 @@ export default function DownloadsPage() {
<> <>
<PageHeader <PageHeader
title="下载面板" title="下载面板"
description="阈值暂停不能手动绕过;无进展只记录,不自动换源。"
actions={ actions={
<Button variant="outline" size="sm" onClick={() => void qc.invalidateQueries({ queryKey: ["downloads"] })}> <Button variant="outline" size="sm" onClick={() => void qc.invalidateQueries({ queryKey: ["downloads"] })}>
<RefreshCw className={downloads.isFetching ? "animate-spin" : undefined} /> <RefreshCw className={downloads.isFetching ? "animate-spin" : undefined} />
+1 -1
View File
@@ -695,7 +695,7 @@ export default function FilesPage() {
key: "scrape", key: "scrape",
label: "刷新元数据", label: "刷新元数据",
icon: RefreshCw, icon: RefreshCw,
disabled: selected.every((e) => e.asset) ? null : "只对已登记项", disabled: selected.every((e) => e.asset) ? null : "只对已入库的文件",
onSelect: () => act("scrape", selected), onSelect: () => act("scrape", selected),
}); });
items.push({ key: "copyPath", label: "复制路径", icon: ClipboardCopy, onSelect: () => void copyPaths(selected) }); items.push({ key: "copyPath", label: "复制路径", icon: ClipboardCopy, onSelect: () => void copyPaths(selected) });
+1 -1
View File
@@ -98,7 +98,7 @@ function entityOf(d: Decision): string | null {
const IMPACT_KEY: Record<string, string> = { const IMPACT_KEY: Record<string, string> = {
slots: "收录版本", slots: "收录版本",
units: "内容单元", units: "季与集",
files: "文件", files: "文件",
releases: "资源", releases: "资源",
tasks: "任务", tasks: "任务",
+72 -46
View File
@@ -43,6 +43,7 @@ import { type DataColumn, DataTable } from "~/components/console/data-table.tsx"
import { EmptyState, ErrorState, LoadingState } from "~/components/console/empty-state.tsx"; import { EmptyState, ErrorState, LoadingState } from "~/components/console/empty-state.tsx";
import { consolePath } from "~/components/console/nav.ts"; import { consolePath } from "~/components/console/nav.ts";
import { StatusBadge } from "~/components/console/status-badge.tsx"; import { StatusBadge } from "~/components/console/status-badge.tsx";
import { TechInfo } from "~/components/console/tech-info.tsx";
import { evidenceLabel, FieldLockDialog, IdentityDialog, MergeDialog } from "~/components/library/entity-dialogs.tsx"; import { evidenceLabel, FieldLockDialog, IdentityDialog, MergeDialog } from "~/components/library/entity-dialogs.tsx";
import { import {
CONTENT_TYPE, CONTENT_TYPE,
@@ -79,6 +80,7 @@ import { CELL_LABEL, type CellKind, cellKind } from "~/components/subscriptions/
import { SubscriptionFormDialog } from "~/components/subscriptions/subscription-form.tsx"; import { SubscriptionFormDialog } from "~/components/subscriptions/subscription-form.tsx";
import { Button } from "~/components/ui/button.tsx"; import { Button } from "~/components/ui/button.tsx";
import { errorMessage } from "~/lib/api.ts"; import { errorMessage } from "~/lib/api.ts";
import { useUiPrefs } from "~/lib/ui-prefs.ts";
import { formatBytes, formatDateTime } from "~/lib/utils.ts"; import { formatBytes, formatDateTime } from "~/lib/utils.ts";
// 作品详情(REQ §13.1 / §13.4.3):实际路径、外部身份映射及状态、元数据来源、各 Slot、候选拒绝理由、 // 作品详情(REQ §13.1 / §13.4.3):实际路径、外部身份映射及状态、元数据来源、各 Slot、候选拒绝理由、
@@ -120,7 +122,7 @@ function PathsPanel({ detail }: { detail: LibraryDetail }) {
const rootOf = (id: string | null) => roots.data?.items.find((r) => r.id === id); const rootOf = (id: string | null) => roots.data?.items.find((r) => r.id === id);
const bindings = detail.pathBindings.filter((b) => b.status !== "superseded"); const bindings = detail.pathBindings.filter((b) => b.status !== "superseded");
return ( return (
<Panel title="实际路径与媒体库目录" description="路径绑定建立后不随译名变化"> <Panel title="文件位置">
{bindings.length === 0 && detail.assets.length === 0 ? ( {bindings.length === 0 && detail.assets.length === 0 ? (
<EmptyState <EmptyState
plain plain
@@ -158,19 +160,16 @@ function PathsPanel({ detail }: { detail: LibraryDetail }) {
<div className="flex flex-wrap items-center gap-2"> <div className="flex flex-wrap items-center gap-2">
<span className="text-sm font-medium text-foreground">{deliveryLine(a.asset) || "未知规格"}</span> <span className="text-sm font-medium text-foreground">{deliveryLine(a.asset) || "未知规格"}</span>
{a.asset.status !== "active" ? <StatusBadge tone="warning">{a.asset.status}</StatusBadge> : null} {a.asset.status !== "active" ? <StatusBadge tone="warning">{a.asset.status}</StatusBadge> : null}
{a.asset.verifiedAt ? ( {a.asset.verifiedAt ? null : <StatusBadge>未核验</StatusBadge>}
<StatusBadge tone="success">已核验 {relTime(a.asset.verifiedAt)}</StatusBadge>
) : (
<StatusBadge>未核验</StatusBadge>
)}
</div> </div>
<ul className="mt-2 space-y-1.5"> <ul className="mt-2 space-y-1.5">
{a.locations.map((l) => ( {a.locations.map((l) => (
<li key={l.id} className="min-w-0"> <li key={l.id} className="min-w-0">
<div className="flex flex-wrap items-center gap-1.5"> <div className="flex flex-wrap items-center gap-1.5">
<Chip>{LOCATION_KIND[l.locationKind] ?? l.locationKind}</Chip> {l.locationKind !== "library" ? (
{l.isPrimary ? <Chip>主位置</Chip> : null} <Chip>{LOCATION_KIND[l.locationKind] ?? l.locationKind}</Chip>
<Tone v={LOCATION_STATUS[l.status]} /> ) : null}
{l.status !== "available" ? <Tone v={LOCATION_STATUS[l.status]} /> : null}
{l.libraryRootId ? ( {l.libraryRootId ? (
<span className="text-meta text-muted-foreground"> <span className="text-meta text-muted-foreground">
{rootOf(l.libraryRootId)?.name ?? "媒体库目录"} {rootOf(l.libraryRootId)?.name ?? "媒体库目录"}
@@ -192,6 +191,8 @@ function PathsPanel({ detail }: { detail: LibraryDetail }) {
); );
} }
const PROVIDER_LABEL: Record<string, string> = { tmdb: "TMDB", tvdb: "TVDB", imdb: "IMDb", douban: "豆瓣" };
// ── 外部身份映射 ── // ── 外部身份映射 ──
function IdentityPanel({ detail }: { detail: LibraryDetail }) { function IdentityPanel({ detail }: { detail: LibraryDetail }) {
const [open, setOpen] = useState(false); const [open, setOpen] = useState(false);
@@ -199,8 +200,7 @@ function IdentityPanel({ detail }: { detail: LibraryDetail }) {
const candidates = detail.identities.filter((i) => i.status === "proposed" || i.status === "conflicted"); const candidates = detail.identities.filter((i) => i.status === "proposed" || i.status === "conflicted");
return ( return (
<Panel <Panel
title="外部身份" title="匹配的 TMDB 条目"
description="以本地 ID 为准,外部身份可修改"
actions={ actions={
<Button variant="outline" size="sm" onClick={() => setOpen(true)}> <Button variant="outline" size="sm" onClick={() => setOpen(true)}>
<PencilLine /> <PencilLine />
@@ -240,10 +240,13 @@ function IdentityRow({ i }: { i: ExternalIdentity }) {
return ( return (
<li className="rounded-lg border border-border/70 px-3 py-2"> <li className="rounded-lg border border-border/70 px-3 py-2">
<div className="flex flex-wrap items-center gap-2"> <div className="flex flex-wrap items-center gap-2">
<span className="font-mono text-caption break-all text-foreground"> <span
{i.provider}:{i.entityType}:{i.externalId} className="text-caption break-all text-foreground"
title={`${i.provider}:${i.entityType}:${i.externalId}`}
>
{PROVIDER_LABEL[i.provider] ?? i.provider} {i.externalId}
</span> </span>
<Tone v={IDENTITY_STATUS[i.status]} /> {i.status !== "accepted" ? <Tone v={IDENTITY_STATUS[i.status]} /> : null}
{i.locked ? ( {i.locked ? (
<StatusBadge> <StatusBadge>
<Lock className="h-3 w-3" /> <Lock className="h-3 w-3" />
@@ -251,9 +254,12 @@ function IdentityRow({ i }: { i: ExternalIdentity }) {
</StatusBadge> </StatusBadge>
) : null} ) : null}
</div> </div>
<p className="mt-1 text-meta text-muted-foreground"> <p
证据 {evidenceLabel(i.evidenceLevel)} · {VERIFY_STATUS[i.verifyStatus]?.label ?? i.verifyStatus} className="mt-1 text-meta text-muted-foreground"
{i.verifiedAt ? `(${relTime(i.verifiedAt)})` : ""} · r{i.revision} title={`证据 ${evidenceLabel(i.evidenceLevel)} · ${VERIFY_STATUS[i.verifyStatus]?.label ?? i.verifyStatus} · r${i.revision}`}
>
{i.locked || i.evidenceLevel === "manual" ? "你确认的" : "自动匹配"}
{i.verifiedAt ? ` · ${relTime(i.verifiedAt)}` : ""}
</p> </p>
{reason ? <p className="mt-0.5 text-meta break-words text-muted-foreground">{reason}</p> : null} {reason ? <p className="mt-0.5 text-meta break-words text-muted-foreground">{reason}</p> : null}
</li> </li>
@@ -360,29 +366,44 @@ function MetadataPanel({ detail, entity }: { detail: LibraryDetail; entity: Medi
.filter((x) => x.final || !ENRICH_ONLY_FIELDS.has(x.field)); .filter((x) => x.final || !ENRICH_ONLY_FIELDS.has(x.field));
const candidatesOf = (f: string) => (entity?.metadataFields ?? []).filter((m) => m.field === f); const candidatesOf = (f: string) => (entity?.metadataFields ?? []).filter((m) => m.field === f);
const current = editing ? finals.find((x) => x.field === editing)?.final?.value : undefined; const current = editing ? finals.find((x) => x.field === editing)?.final?.value : undefined;
const prefs = useUiPrefs();
const [showSources, setShowSources] = useState(prefs.techInfoExpanded);
const [allAliases, setAllAliases] = useState(false);
// 别名:默认只列中英文与手动加的,其余折成 +N
const aliases = entity?.aliases ?? [];
const keyAliases = aliases.filter(
(a) => a.locked || !a.language || /^(zh|en|cn)/i.test(a.language) || /[\p{Script=Han}]/u.test(a.alias),
);
const shownAliases = allAliases ? aliases : keyAliases.slice(0, 12);
const moreAliases = aliases.length - shownAliases.length;
return ( return (
<Panel <Panel
title="字段来源与锁" title="元数据"
description={`锁定的字段刷新时不变 · 最近刷新 ${formatDateTime(detail.entity.lastMetadataRefreshAt)}`} description={`更新于 ${formatDateTime(detail.entity.lastMetadataRefreshAt)}`}
actions={ actions={
<Button <>
variant="outline" <Button variant="ghost" size="sm" aria-pressed={showSources} onClick={() => setShowSources((v) => !v)}>
size="sm" {showSources ? "隐藏来源" : "显示来源"}
disabled={refresh.isPending} </Button>
onClick={() => <Button
refresh.mutate( variant="outline"
{ full: true }, size="sm"
{ disabled={refresh.isPending}
onSuccess: () => toast.success("已提交刷新,含全部季的每集信息"), onClick={() =>
onError: (err) => toast.error(errorMessage(err, "刷新失败")), refresh.mutate(
}, { full: true },
) {
} onSuccess: () => toast.success("已提交刷新,含全部季的每集信息"),
> onError: (err) => toast.error(errorMessage(err, "刷新失败")),
<RefreshCw className={refresh.isPending ? "animate-spin" : undefined} /> },
刷新元数据 )
</Button> }
>
<RefreshCw className={refresh.isPending ? "animate-spin" : undefined} />
刷新元数据
</Button>
</>
} }
> >
<ul className="divide-y divide-border/60"> <ul className="divide-y divide-border/60">
@@ -395,14 +416,14 @@ function MetadataPanel({ detail, entity }: { detail: LibraryDetail; entity: Medi
<p className="line-clamp-4 text-sm break-words text-foreground"> <p className="line-clamp-4 text-sm break-words text-foreground">
{final ? fieldText(field, final.value) : <span className="text-muted-foreground">未提供</span>} {final ? fieldText(field, final.value) : <span className="text-muted-foreground">未提供</span>}
</p> </p>
{final ? ( {final && showSources ? (
<p className="text-meta text-muted-foreground"> <p className="text-meta text-muted-foreground">
来源 {METADATA_SOURCE[final.source] ?? final.source} 来源 {METADATA_SOURCE[final.source] ?? final.source}
{final.language ? ` · ${final.language}` : ""} · {relTime(final.at)} {final.language ? ` · ${final.language}` : ""} · {relTime(final.at)}
</p> </p>
) : null} ) : null}
{final ? <EvidenceLine field={cands.find((c) => c.source === final.source)} /> : null} {final && showSources ? <EvidenceLine field={cands.find((c) => c.source === final.source)} /> : null}
{cands.length ? ( {cands.length && showSources ? (
<p className="mt-0.5 text-meta break-words text-muted-foreground"> <p className="mt-0.5 text-meta break-words text-muted-foreground">
候选: 候选:
{cands {cands
@@ -456,15 +477,20 @@ function MetadataPanel({ detail, entity }: { detail: LibraryDetail; entity: Medi
</ul> </ul>
{entity?.aliases.length ? ( {entity?.aliases.length ? (
<div className="mt-3 border-t border-border/60 pt-3"> <div className="mt-3 border-t border-border/60 pt-3">
<p className="mb-1.5 text-meta text-muted-foreground">别名(用于模糊召回)</p> <p className="mb-1.5 text-meta text-muted-foreground">别名</p>
<ChipList <ChipList
items={entity.aliases.map((a) => ( items={shownAliases.map((a) => (
<span key={a.id}> <span key={a.id}>
{a.alias} {a.alias}
{a.locked ? <Lock className="ml-1 inline h-3 w-3" /> : null} {a.locked ? <Lock className="ml-1 inline h-3 w-3" /> : null}
</span> </span>
))} ))}
/> />
{moreAliases > 0 || allAliases ? (
<Button variant="ghost" size="xs" className="mt-1" onClick={() => setAllAliases((v) => !v)}>
{allAliases ? "收起" : `还有 ${moreAliases} 个`}
</Button>
) : null}
</div> </div>
) : null} ) : null}
<FieldLockDialog entityId={id} field={editing} current={current} onOpenChange={(o) => !o && setEditing(null)} /> <FieldLockDialog entityId={id} field={editing} current={current} onOpenChange={(o) => !o && setEditing(null)} />
@@ -542,7 +568,7 @@ function UnitsPanel({ entity, detail }: { entity: ReturnType<typeof useEntityDet
cell: (u) => ( cell: (u) => (
<div className="flex flex-wrap gap-1"> <div className="flex flex-wrap gap-1">
{u.status === "provisional" ? ( {u.status === "provisional" ? (
<StatusBadge tone="warning">临时单元</StatusBadge> <StatusBadge tone="warning">编号待确认</StatusBadge>
) : u.status === "retired" ? ( ) : u.status === "retired" ? (
<StatusBadge>已退役</StatusBadge> <StatusBadge>已退役</StatusBadge>
) : ( ) : (
@@ -577,7 +603,7 @@ function UnitsPanel({ entity, detail }: { entity: ReturnType<typeof useEntityDet
a.segment.localeCompare(b.segment), a.segment.localeCompare(b.segment),
); );
return ( return (
<Panel title="内容单元" description="临时单元按解析结果创建,确认或改编号后锁定" bodyClassName="p-0 sm:p-0"> <Panel title="季与集" bodyClassName="p-0 sm:p-0">
<DataTable <DataTable
plain plain
columns={columns} columns={columns}
@@ -587,8 +613,8 @@ function UnitsPanel({ entity, detail }: { entity: ReturnType<typeof useEntityDet
error={entity.error} error={entity.error}
onRetry={() => entity.refetch()} onRetry={() => entity.refetch()}
empty={{ empty={{
title: detail.entity.kind === "movie" ? "电影没有季和集" : "还没有内容单元", title: detail.entity.kind === "movie" ? "电影没有季和集" : "还没有季和集",
description: detail.entity.kind === "movie" ? "电影按内容版本核对完整性。" : "识别到新集后会建临时单元。", description: detail.entity.kind === "movie" ? undefined : "识别到新的一集后会出现在这里。",
}} }}
/> />
</Panel> </Panel>
@@ -1048,8 +1074,8 @@ export default function LibraryDetailPage() {
</Button> </Button>
) : null} ) : null}
<EntityNamingButton entityId={e.id} kind={e.kind} /> <EntityNamingButton entityId={e.id} kind={e.kind} />
<span className="font-mono text-meta break-all text-muted-foreground sm:ml-auto">{e.id}</span>
</div> </div>
<TechInfo className="-mt-3 mb-5" items={[{ label: "作品 ID", value: e.id, wide: true }]} />
<div className="space-y-5"> <div className="space-y-5">
{credits.cast.length || credits.crew.length ? ( {credits.cast.length || credits.crew.length ? (
+2 -3
View File
@@ -16,7 +16,7 @@ import { CoverPlaceholder, relTime, Tone } from "~/components/library/parts.tsx"
import { Button } from "~/components/ui/button.tsx"; import { Button } from "~/components/ui/button.tsx";
import { Tabs, TabsList, TabsTrigger } from "~/components/ui/tabs.tsx"; import { Tabs, TabsList, TabsTrigger } from "~/components/ui/tabs.tsx";
export const meta = () => [{ title: "媒体概览 · UHD 媒体自动化控制台" }]; export const meta = () => [{ title: "媒体库 · UHD 媒体自动化控制台" }];
const FILTERS: { value: NonNullable<LibraryListQuery["filter"]>; label: string }[] = [ const FILTERS: { value: NonNullable<LibraryListQuery["filter"]>; label: string }[] = [
{ value: "gap", label: "有缺口" }, { value: "gap", label: "有缺口" },
@@ -61,8 +61,7 @@ export default function LibraryPage() {
return ( return (
<> <>
<PageHeader <PageHeader
title="媒体概览" title="媒体库"
description="本地账本:作品、收录版本、资产与外部身份。自动匹配不覆盖人工锁定的外部身份。"
actions={ actions={
view === "unidentified" ? ( view === "unidentified" ? (
<Button asChild variant="outline" size="sm"> <Button asChild variant="outline" size="sm">
+4 -5
View File
@@ -72,12 +72,11 @@ export default function RulesPage() {
<> <>
<PageHeader <PageHeader
title="规则" title="规则"
description="规则组决定哪些资源能下载、同一作品优先挑哪个。收录策略决定哪些新作品自动收录。"
actions={ actions={
tab === "policies" ? ( tab === "policies" ? (
<Button onClick={() => setCreatingPolicy(true)}> <Button onClick={() => setCreatingPolicy(true)}>
<FilePlus2 /> <FilePlus2 />
新建策略草案 新建
</Button> </Button>
) : ( ) : (
<Button onClick={create}> <Button onClick={create}>
@@ -104,9 +103,9 @@ export default function RulesPage() {
<TabsList aria-label="规则分节"> <TabsList aria-label="规则分节">
<TabsTrigger value="groups">规则组</TabsTrigger> <TabsTrigger value="groups">规则组</TabsTrigger>
<TabsTrigger value="atoms">自定义条件</TabsTrigger> <TabsTrigger value="atoms">自定义条件</TabsTrigger>
<TabsTrigger value="defaults">默认值</TabsTrigger> <TabsTrigger value="defaults">默认规则</TabsTrigger>
<TabsTrigger value="policies">收录策略</TabsTrigger> <TabsTrigger value="policies">自动收新作品</TabsTrigger>
<TabsTrigger value="suppressions">抑制记录</TabsTrigger> <TabsTrigger value="suppressions">已忽略</TabsTrigger>
</TabsList> </TabsList>
<TabsContent value="groups"> <TabsContent value="groups">
+1 -1
View File
@@ -44,7 +44,7 @@ export default function SearchPage() {
return ( return (
<> <>
<PageHeader title="搜索" description="先看作品和库内状态,需要时再到站点搜资源。" /> <PageHeader title="搜索" />
<form onSubmit={submit} className="mb-6 flex gap-2"> <form onSubmit={submit} className="mb-6 flex gap-2">
<div className="relative min-w-0 flex-1 sm:max-w-xl"> <div className="relative min-w-0 flex-1 sm:max-w-xl">
<Search className="pointer-events-none absolute top-1/2 left-3 h-4 w-4 -translate-y-1/2 text-muted-foreground" /> <Search className="pointer-events-none absolute top-1/2 left-3 h-4 w-4 -translate-y-1/2 text-muted-foreground" />
-1
View File
@@ -100,7 +100,6 @@ export default function SitesPage() {
<> <>
<PageHeader <PageHeader
title="站点" title="站点"
description="凭证、账号数据和健康状态;点站点名看资源、抓取与 RSS"
actions={ actions={
<> <>
<Button variant="outline" size="sm" onClick={() => void sites.refetch()} disabled={sites.isFetching}> <Button variant="outline" size="sm" onClick={() => void sites.refetch()} disabled={sites.isFetching}>
-1
View File
@@ -84,7 +84,6 @@ export default function SourcesPage() {
<> <>
<PageHeader <PageHeader
title="RSS" title="RSS"
description="单个站点的抓取、RSS 和账号在站点页管理。"
actions={ actions={
<Button size="sm" onClick={() => setCreating(true)}> <Button size="sm" onClick={() => setCreating(true)}>
<Plus /> <Plus />
+13 -11
View File
@@ -21,6 +21,7 @@ import { ErrorState, LoadingState } from "~/components/console/empty-state.tsx";
import { KvList } from "~/components/console/kv-list.tsx"; import { KvList } from "~/components/console/kv-list.tsx";
import { PageHeader } from "~/components/console/page-header.tsx"; import { PageHeader } from "~/components/console/page-header.tsx";
import { StatusBadge, type StatusTone } from "~/components/console/status-badge.tsx"; import { StatusBadge, type StatusTone } from "~/components/console/status-badge.tsx";
import { TechInfo } from "~/components/console/tech-info.tsx";
import { HistoryChart } from "~/components/status/history-chart.tsx"; import { HistoryChart } from "~/components/status/history-chart.tsx";
import { StorageSection } from "~/components/status/storage-section.tsx"; import { StorageSection } from "~/components/status/storage-section.tsx";
import { Button } from "~/components/ui/button.tsx"; import { Button } from "~/components/ui/button.tsx";
@@ -465,7 +466,6 @@ export default function StatusPage() {
<> <>
<PageHeader <PageHeader
title="运行状态" title="运行状态"
description="进程心跳、数据库、磁盘、挂载根与存储。15 秒刷新一次。"
actions={ actions={
<Button <Button
variant="outline" variant="outline"
@@ -485,16 +485,6 @@ export default function StatusPage() {
) : d ? ( ) : d ? (
<div className="space-y-4"> <div className="space-y-4">
<Banner d={d} /> <Banner d={d} />
<section className="min-w-0">
<h2 className="mb-2 flex items-center gap-2 text-body font-semibold text-foreground">
<Cpu className="h-4 w-4 text-muted-foreground" />
进程
<span className="text-meta font-normal text-muted-foreground">SSE 连接合计 {d.sse.connections}</span>
</h2>
<Processes d={d} />
<RetiredProcesses rows={d.retiredProcesses} />
</section>
<History />
<div className="grid gap-4 md:grid-cols-2 xl:grid-cols-3"> <div className="grid gap-4 md:grid-cols-2 xl:grid-cols-3">
<Card title="数据库" icon={Database} level={d.db.level}> <Card title="数据库" icon={Database} level={d.db.level}>
{d.db.error ? <p className="mb-2 text-caption text-destructive">{d.db.error}</p> : null} {d.db.error ? <p className="mb-2 text-caption text-destructive">{d.db.error}</p> : null}
@@ -578,6 +568,18 @@ export default function StatusPage() {
<Mounts d={d} /> <Mounts d={d} />
</div> </div>
<StorageSection health={d} /> <StorageSection health={d} />
<TechInfo title="进程与趋势" columns={1}>
<section className="min-w-0">
<h2 className="mb-2 flex items-center gap-2 text-body font-semibold text-foreground">
<Cpu className="h-4 w-4 text-muted-foreground" />
进程
<span className="text-meta font-normal text-muted-foreground">SSE 连接合计 {d.sse.connections}</span>
</h2>
<Processes d={d} />
<RetiredProcesses rows={d.retiredProcesses} />
</section>
<History />
</TechInfo>
</div> </div>
) : null} ) : null}
</> </>
+1 -1
View File
@@ -986,7 +986,7 @@ export const SETTINGS_SECTIONS: readonly SettingsSectionDef[] = [
anchors: [ anchors: [
{ id: "password", label: "密码" }, { id: "password", label: "密码" },
{ id: "totp", label: "二次验证" }, { id: "totp", label: "二次验证" },
{ id: "passkeys", label: "Passkey" }, { id: "passkeys", label: "通行密钥" },
{ id: "session", label: "会话" }, { id: "session", label: "会话" },
{ id: "shortcuts", label: "快捷键" }, { id: "shortcuts", label: "快捷键" },
], ],