diff --git a/CHANGELOG.md b/CHANGELOG.md index 917cde0..d1f758e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## 开发快照 snapshot/v0.1.113 - 2026-10-28 + +### Changed + +- 发布管理按已确认稿重做:顶部只保留「对内知识库 / 对外知识库」两个页签,切换后只渲染选中库的一个作业区,不再并排两张巨型数据卡。 +- 同步前布局回到原稿:生产当前 → 拟发布版本行、新增/更新/删除文档与 Wiki 完整快照、准备清单(文档解析与索引、Wiki、数据完整性)、右上「版本与快照 / 启动同步」、下方左「本次变更」右「生产保护与恢复」、底部五段作业阶段。 +- 同步中布局:顶部作业阶段/版本/已用时,中间四类数据卡(数据库、原文件、索引、Wiki),底部「同步明细」与异常说明;没有真实总量与完成量的项目只显示状态,不编造百分比。 +- 「版本与快照」改为右侧抽屉:按选中库列出全部已封存记录,区分测试封存与生产生效/备份,展开看到文档/索引/资源/Wiki 分项数量、字节与逐项摘要;恢复入口在有真实恢复演练前保持禁用并说明。 +- 存储口径从发布主页移到「系统设置 → 存储管理」只读区(跨版本去重内容、blob 表观/分配、未引用、清单),保留策略/依赖保护/清理预览标未接线,自动清理保持关闭。 +- 生产段(当前版本、变更差异、预备份、同步、生产验证)没有真实数据的一律显示「未接入 / 尚无记录」;「启动同步」保持禁用并写明原因,不把发起封存冒充启动同步。 + +### Removed + +- 主页面上的研发口径文案(A04/A06、schema、SHA、内部表名等)移入必要的分项详情。 + ## 开发快照 snapshot/v0.1.112 - 2026-10-28 ### Changed diff --git a/docs/library-capture.md b/docs/library-capture.md index f3e0979..6a0dfa3 100644 --- a/docs/library-capture.md +++ b/docs/library-capture.md @@ -41,7 +41,7 @@ ./scripts/library-capture.sh recover ``` -产物默认写到 `~/.local/share/knowledge-governance/library`(0700),日志写到 `~/.local/share/knowledge-governance/freeze`(0700)。api 容器只以只读方式挂载前者,「整库版本」页据此展示。 +产物默认写到 `~/.local/share/knowledge-governance/library`(0700),日志写到 `~/.local/share/knowledge-governance/freeze`(0700)。api 容器只以只读方式挂载前者;发布管理的「版本与快照」抽屉与系统设置 → 存储管理据此展示。 同一个作业号重跑是**幂等重放**:直接返回已封存的同一份候选(`replay=true`、`source_read=false`、`writers_stopped=false`),不读来源、不停写入者;同一作业号换了 scope 或绑定库则明确拒绝。 diff --git a/web/src/LibraryStorageSection.tsx b/web/src/LibraryStorageSection.tsx new file mode 100644 index 0000000..bff3910 --- /dev/null +++ b/web/src/LibraryStorageSection.tsx @@ -0,0 +1,79 @@ +import { useEffect, useState } from 'react' +import { fetchLibrarySnapshots, formatBytes, type LibrarySnapshotList } from './librarySnapshots' +import './libraryStorage.css' + +// 系统设置 → 存储管理:只读展示整库归档的真实口径。 +// 保留策略、依赖保护、清理预览都没有实现,自动清理保持关闭——页面不能暗示可以删。 +export function LibraryStorageSection() { + const [page, setPage] = useState(null) + const [error, setError] = useState(null) + const [loading, setLoading] = useState(true) + + useEffect(() => { + const controller = new AbortController() + fetchLibrarySnapshots(controller.signal) + .then((value) => { + setPage(value) + setError(null) + }) + .catch((loadError) => { + if ((loadError as Error).name === 'AbortError') return + setError(loadError instanceof Error ? loadError.message : '读取归档用量失败') + }) + .finally(() => setLoading(false)) + return () => controller.abort() + }, []) + + return ( +
+
+

版本快照与归档占用

+

只读口径:被版本引用的去重内容、blob 文件表观/实际分配字节、未被引用对象、清单文件。

+
+ {loading ?

读取中…

: null} + {error ? ( +
+ 读取失败 +

{error}

+
+ ) : null} + {page && !page.available ?

{page.reason || '归档未接线'}

: null} + {page?.available ? ( +
+
+
版本数
+
{page.versions}
+
+
+
被版本引用的去重内容
+
{formatBytes(page.content_bytes)}
+
+
+
blob 文件(表观)
+
{formatBytes(page.blob_file_bytes)}
+
+
+
blob 实际分配
+
{formatBytes(page.blob_allocated_bytes)}
+
+
+
未被任何版本引用
+
+ {page.unreferenced_blobs} 个 / {formatBytes(page.unreferenced_bytes)} +
+
+
+
清单文件
+
{formatBytes(page.manifest_file_bytes)}
+
+
+ ) : null} +
    +
  • 保留策略:未接线(不提供保留几版/多少天的设置)
  • +
  • 依赖保护与清理预览:未接线
  • +
  • 自动清理:保持关闭,页面不提供删除动作
  • +
  • 以上数字都不是“可回收空间”,不能用来估算清理收益
  • +
+
+ ) +} \ No newline at end of file diff --git a/web/src/ReleaseTargets.test.tsx b/web/src/ReleaseTargets.test.tsx index 1aba14e..3c5b552 100644 --- a/web/src/ReleaseTargets.test.tsx +++ b/web/src/ReleaseTargets.test.tsx @@ -3,7 +3,7 @@ import { describe, expect, it, vi } from 'vitest' import { ReleaseTargetsView } from './ReleaseTargets' import type { LibraryCaptureJob, LibrarySnapshot, LibrarySnapshotList } from './librarySnapshots' -const snapshot: LibrarySnapshot = { +const internalSnapshot: LibrarySnapshot = { snapshot_id: 'f992d64ea45bf737a0721a465b5aef2b150ef7757157eb84f3aaf8b6972d98f9', scope: 'internal', knowledge_base_id: '0c84a098-d3ed-4b82-a165-e6de9691d6a8', @@ -17,11 +17,11 @@ const snapshot: LibrarySnapshot = { retriever_engine: 'elasticsearch_v8', embedding_model: 'text-embedding-v4', embedding_dimension: 1024, - index_mapping_sha256: '137cde2965f3b56521f5fb722b4e0617f46d0e509e571b217fe01e090d5e4d01', + index_mapping_sha256: 'a'.repeat(64), }, parts: [ - { kind: 'database', name: 'knowledges', sha256: 'a'.repeat(64), count: 4, bytes: 10654 }, - { kind: 'index', name: 'chunks', sha256: 'b'.repeat(64), count: 122, bytes: 1624880 }, + { kind: 'database', name: 'knowledges', sha256: 'b'.repeat(64), count: 4, bytes: 10654 }, + { kind: 'index', name: 'chunks', sha256: 'c'.repeat(64), count: 122, bytes: 1624880 }, ], logical_bytes: 55309044, unique_bytes: 55309040, @@ -29,7 +29,15 @@ const snapshot: LibrarySnapshot = { totals: { documents: 4, chunks: 38, index_documents: 122, resources: 21, wiki_pages: 31 }, } -const job: LibraryCaptureJob = { +const externalSnapshot: LibrarySnapshot = { + ...internalSnapshot, + snapshot_id: '01343b0b310b3977c2fdda05f5b8a6272148c4f7bfa124a6c5944123cf0c51c3', + scope: 'external', + created_at: '2026-10-28T03:35:53.000000000Z', + totals: { documents: 0, chunks: 0, index_documents: 0, resources: 0, wiki_pages: 1 }, +} + +const runningJob: LibraryCaptureJob = { job_id: 'library-capture-internal-1', capture_job: 'lib-internal-20261028T033457', scope: 'internal', @@ -38,14 +46,14 @@ const job: LibraryCaptureJob = { last_error: '', requested_by: 'yaozhanghao', created_at: '2026-10-28T03:34:50Z', - updated_at: '2026-10-28T03:34:51Z', + updated_at: '2026-10-28T03:34:55Z', } const page: LibrarySnapshotList = { available: true, reason: '', archive_root: '/var/lib/knowledge-governance/library', - snapshots: [snapshot], + snapshots: [internalSnapshot, externalSnapshot], versions: 2, content_bytes: 55309693, blob_file_bytes: 55309693, @@ -59,75 +67,100 @@ const page: LibrarySnapshotList = { capture_reason: '', } -const baseProps = { +type ViewProps = Parameters[0] + +const base: ViewProps = { page, - jobs: [] as LibraryCaptureJob[], + jobs: [], loading: false, error: null, notice: null, - expanded: null, - pendingScope: null, + scope: 'internal', + onScope: vi.fn(), + drawerOpen: false, + onDrawer: vi.fn(), + expandedSnapshot: null, + onExpandSnapshot: vi.fn(), + pendingCapture: false, canCapture: true, - onRefresh: () => undefined, + canWrite: true, + now: new Date('2026-10-28T03:35:00Z').getTime(), + onRefresh: vi.fn(), onCapture: vi.fn(), - onToggleExpanded: () => undefined, } -const render = (overrides: Partial = {}) => - renderToStaticMarkup() +const render = (overrides: Partial = {}) => renderToStaticMarkup() -describe('ReleaseTargetsView', () => { - it('shows exactly the two library targets with real counts and integrity wording', () => { +describe('ReleaseTargetsView(确认稿布局)', () => { + it('顶部只有两个知识库页签,且一次只显示选中库的作业区', () => { const html = render() - expect(html).toContain('对内') - expect(html).toContain('对外') - expect(html).not.toContain('第三目标') - expect(html).toContain('122') - expect(html).toContain('31') - expect(html).toMatch(/完整性:读取时已重算 2 项摘要/) - expect(html).toContain('text-embedding-v4') + expect(html).toContain('对内知识库') + expect(html).toContain('对外知识库') + expect(html).toContain('role="tab"') + // 只显示一个主作业卡:选中库标题出现一次,另一个库不渲染作业卡 + expect(html.match(/· 已封存,生产同步未接入/g)?.length).toBe(1) + expect(html).not.toContain('对外知识库 · 尚无') }) - it('keeps the unbuilt chain stages disabled instead of faking progress', () => { + it('未接入项显示“未接入”,不用 0 / 无变化冒充', () => { const html = render() - expect(html).toMatch(/生产预备份[\s\S]*未接线/) - expect(html).toMatch(/同步到生产[\s\S]*未授权/) - expect(html).toMatch(/校验 \/ 恢复[\s\S]*未接线/) - expect(html).not.toMatch(/\d+%/) - // Disabled actions carry a reason in the title attribute. - expect(html).toContain('title="生产独立预备份与恢复演练未接线"') - expect(html).toContain('title="生产写入需要独立授权闸口,当前未开放"') + expect(html).toContain('生产当前') + expect(html).toContain('未接入') + expect(html).toContain('尚无记录 · 变更清单来自生产与测试版本对比') }) - it('offers the capture action only when the agent is wired and the role allows it', () => { - expect(render()).toContain('发起对内封存') - const readonly = render({ canCapture: false }) - expect(readonly).toContain('发起封存需要知识工程师及以上权限') + it('“启动同步”保持禁用并说明原因,不把封存当成同步', () => { + const html = render() + expect(html).toMatch(/]*class="rel-primary"[^>]*disabled/) + expect(html).toContain('生产同步未接线') + expect(html).toContain('封存测试版本') + }) + + it('版本与快照抽屉按 scope 列出全部历史并区分测试封存/不可直接恢复', () => { + const html = render({ drawerOpen: true, expandedSnapshot: internalSnapshot.snapshot_id }) + expect(html).toContain('版本与快照') + expect(html).toContain('封存 f992d64ea45b') + expect(html).toContain('测试封存') + expect(html).toContain('不可直接恢复') + expect(html).toContain('恢复至该版本') + expect(html).toMatch(/恢复至该版本[^<]*<\/button>/) + expect(html).toContain('分项数量 / 字节 / 摘要(2 项)') + expect(html).toContain('不支持只选择 Wiki 或某张数据表恢复') + }) + + it('抽屉只展示当前选中库的历史', () => { + const html = render({ drawerOpen: true, scope: 'external' }) + expect(html).toContain('封存 01343b0b310b') + expect(html).not.toContain('封存 f992d64ea45b') + }) + + it('同步中布局显示四类数据卡与明细,且不编造百分比', () => { + const html = render({ jobs: [runningJob] }) + expect(html).toContain('正在封存测试版本') + expect(html).toContain('数据库 · 文档与分块') + expect(html).toContain('原文件 · 图片 · 附件') + expect(html).toContain('检索索引 · 向量') + expect(html).toContain('Wiki · 完整快照') + expect(html).toContain('同步明细') + // 唯一允许出现的百分比是免责声明里的「100% ≠ 作业完成」,没有任何进度主张 + expect(html.match(/[1-9]\d*%/g) ?? []).toEqual(['100%']) + expect(html).toContain('文件传输 100% ≠ 作业完成') + expect(html).toContain('不编造百分比') + }) + + it('无权限时不给封存入口,未接线时说明通道状态', () => { + expect(render({ canCapture: false, canWrite: false })).toContain('封存需要知识工程师及以上权限') const unwired = render({ - page: { ...page, capture_available: false, capture_reason: '未接线:主机侧封存 agent 没有挂载' }, + canCapture: false, + canWrite: true, + page: { ...page, capture_available: false, capture_reason: '主机侧封存 agent 未接线' }, }) - expect(unwired).toContain('未接线:主机侧封存 agent 没有挂载') - expect(unwired).not.toContain('发起对内封存') + expect(unwired).toContain('封存通道未接线') }) - it('reports the live job instead of a guessed stage', () => { - const html = render({ jobs: [job] }) - expect(html).toContain('执行中') - expect(html).toContain('lib-internal-20261028T033457') - expect(html).toContain('yaozhanghao') - // A running job disables the capture button for that scope. - expect(html).toMatch(/disabled[^>]*>发起对内封存/) - }) - - it('states that storage numbers are content accounting, not reclaimable space', () => { - const html = render() - expect(html).toContain('被版本引用的去重内容') - expect(html).toContain('不是可回收空间') - expect(html).toMatch(/保留策略、依赖保护、清理预览都没有接线/) - }) - - it('shows an empty target as an invitation, with the blocking reason', () => { - const html = render({ page: { ...page, snapshots: [], available: false, reason: '未接线:归档根未配置' } }) - expect(html).toContain('未接线:归档根未配置') + it('无封存时给出“尚无封存”而不是空表', () => { + const html = render({ page: { ...page, snapshots: [] } }) + expect(html).toContain('尚无测试封存') + expect(html).toContain('还没有测试库封存') }) }) \ No newline at end of file diff --git a/web/src/ReleaseTargets.tsx b/web/src/ReleaseTargets.tsx index 90d981d..de451da 100644 --- a/web/src/ReleaseTargets.tsx +++ b/web/src/ReleaseTargets.tsx @@ -1,4 +1,4 @@ -import { useCallback, useEffect, useMemo, useState } from 'react' +import { useCallback, useEffect, useState } from 'react' import { enqueueLibraryCapture, fetchLibraryCaptures, @@ -12,11 +12,12 @@ import { import { useOptionalAuth } from './auth' import './releaseTargets.css' -// 发布管理的主视图:只服务『对内 / 对外』两个整库目标。 +// 发布管理:按已确认稿实现——顶部两个知识库页签,下面是**一个**作业区。 // -// 这条链有四段:封存 → 生产预备份 → 同步 → 校验/恢复。目前只有第一段接通, -// 其余三段一律禁用并写明"未接线/未授权"——不用假进度、不推算阶段、不显示假成功。 -// 文档级旧流程折叠保留在页面底部,它成功也不代表整库发布成功。 +// 真实能力只有「测试库封存」这一段;生产当前版本、变更差异、生产预备份、 +// 同步与生产验证都还没有接线。页面照原稿结构全部画出来,但未接线的位置一律 +// 写「未接入 / 尚无记录」,不用 0、无变化或已同步冒充。队列状态、封存、传输、 +// 生产验证是四个不同阶段,不能互相顶替。 const stamp = (value: string) => value && Number.isFinite(new Date(value).getTime()) @@ -30,6 +31,16 @@ const stamp = (value: string) => }) : '—' +const elapsed = (from: string, to: number) => { + const start = new Date(from).getTime() + if (!Number.isFinite(start) || to <= start) return '—' + const total = Math.floor((to - start) / 1000) + const minutes = Math.floor(total / 60) + const seconds = total % 60 + return `${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')}` +} + +const ACTIVE_STATES = ['pending', 'running', 'retry'] const jobStateLabel: Record = { pending: '排队中', running: '执行中', @@ -38,328 +49,659 @@ const jobStateLabel: Record = { failed: '失败', } -const ACTIVE_STATES = ['pending', 'running', 'retry'] -const metric = (snapshot: LibrarySnapshot, key: string) => snapshot.totals[key] ?? 0 +type Scope = 'internal' | 'external' -interface StageProps { - id: string - label: string - state: 'ready' | 'not-wired' | 'not-authorized' - detail: string +interface ScopeView { + scope: Scope + snapshot?: LibrarySnapshot + history: LibrarySnapshot[] + activeJob?: LibraryCaptureJob + lastJob?: LibraryCaptureJob } -function Stage({ label, state, detail }: StageProps) { - const chip = - state === 'ready' ? '已接通' : state === 'not-authorized' ? '未授权' : '未接线' - return ( -
  • - {label} - {chip} - {detail} -
  • - ) -} - -interface ReleaseTargetsViewProps { +interface ViewProps { page: LibrarySnapshotList | null jobs: LibraryCaptureJob[] loading: boolean error: string | null notice: string | null - expanded: string | null - pendingScope: string | null + scope: Scope + onScope: (scope: Scope) => void + drawerOpen: boolean + onDrawer: (open: boolean) => void + expandedSnapshot: string | null + onExpandSnapshot: (id: string | null) => void + pendingCapture: boolean canCapture: boolean + canWrite: boolean + now: number onRefresh: () => void - onCapture: (scope: string) => void - onToggleExpanded: (snapshotID: string) => void + onCapture: () => void } -export function ReleaseTargetsView(props: ReleaseTargetsViewProps) { - const { page, jobs, loading, error, notice, expanded, pendingScope, canCapture, onRefresh, onCapture, onToggleExpanded } = props - const latestByScope = useMemo(() => { - const map: Record = {} - for (const snapshot of page?.snapshots ?? []) { - if (!map[snapshot.scope]) map[snapshot.scope] = snapshot - } - return map - }, [page]) +function scopeView(page: LibrarySnapshotList | null, jobs: LibraryCaptureJob[], scope: Scope): ScopeView { + const history = (page?.snapshots ?? []).filter((item) => item.scope === scope) + const scoped = jobs.filter((job) => job.scope === scope) + return { + scope, + snapshot: history[0], + history, + activeJob: scoped.find((job) => ACTIVE_STATES.includes(job.state)), + lastJob: scoped[0], + } +} +const scopeName = (scope: Scope) => (scope === 'internal' ? '对内知识库' : '对外知识库') + +function statusOf(view: ScopeView) { + if (view.activeJob) return { text: '封存中', tone: 'blue' as const } + if (view.snapshot) return { text: '已有封存', tone: 'green' as const } + return { text: '尚无封存', tone: 'gray' as const } +} + +const jstate = (state?: string) => + state === 'failed' ? '封存失败,可在版本与快照里查看原因' : state ? '封存已完成,生产段未接入' : '尚无作业' + +// 五个阶段对应原稿:固定测试版本 → 备份生产 → 同步数据与 Wiki → 生产验证 → 新版本生效。 +// 只有第一段有真实实现;其余按"未接入"显示,不画成进行中或已完成。 +function StageBar({ view }: { view: ScopeView }) { + const sealed = Boolean(view.snapshot) + const capturing = Boolean(view.activeJob) + const stages = [ + { + label: '固定测试版本', + state: capturing ? 'live' : sealed ? 'done' : 'idle', + hint: capturing ? '封存执行中' : sealed ? `最近封存 ${stamp(view.snapshot!.created_at)}` : '尚未封存', + }, + { label: '备份生产', state: 'idle', hint: '未接入' }, + { label: '同步数据与 Wiki', state: 'idle', hint: '未接入' }, + { label: '生产验证', state: 'idle', hint: '未接入' }, + { label: '新版本生效', state: 'idle', hint: '未接入' }, + ] return ( -
    -
    + <> +
      + {stages.map((stage, index) => ( +
    1. + {stage.state === 'done' ? '✓' : stage.state === 'live' ? '●' : '○'} + {stage.label} + {stage.hint} + {index < stages.length - 1 ? → : null} +
    2. + ))} +
    +

    + {capturing + ? '封存是停写入者后的原子导出,没有分项进度上报;导出完成后才会出现新版本。' + : '运行时展开各类数据的数量、字节进度及 Wiki 快照进度;不把提交成功当作版本生效。'} +

    + + ) +} + +function ChangeTable() { + return ( +
    +
    -

    发布管理

    +

    本次变更

    +

    整库版本同步,不单独勾选文件

    +
    + 未接入 +
    + + + + + + + + + + + + +
    动作文档
    + 尚无记录 · 变更清单来自生产与测试版本对比,这项数据还没有接入 +
    +
    + ) +} + +function ProtectionCard({ onOpen }: { onOpen: () => void }) { + return ( + + ) +} + +interface ReadyProps { + view: ScopeView + canCapture: boolean + canWrite: boolean + pendingCapture: boolean + onCapture: () => void + onOpen: () => void +} + +function ReadyBody({ view, canCapture, canWrite, pendingCapture, onCapture, onOpen }: ReadyProps) { + const snapshot = view.snapshot + return ( + <> +
    + + +
    +
    +
    +

    启动后的作业进度

    + 此时尚未运行 +
    + +
    +
    +
    +

    测试库封存

    - 两个目标:对内与对外。每个目标是一份完整封存的整库版本,不是若干单篇文档。 - 这条链只有第一段接通,其余动作按真实状态禁用。 + {snapshot + ? `最近一次封存 ${stamp(snapshot.created_at)},快照 ${snapshot.snapshot_id.slice(0, 12)}。封存只读测试库,不影响生产。` + : '还没有测试库封存。封存会短暂停住测试写入者,导出完整版本后恢复。'}

    - + {canCapture ? ( + + ) : ( + {canWrite ? '封存通道未接线' : '封存需要知识工程师及以上权限'} + )} +
    + + ) +} + +function ProgressBody({ view, now, onOpen }: { view: ScopeView; now: number; onOpen: () => void }) { + const job = view.activeJob ?? view.lastJob + const running = Boolean(view.activeJob) + const cards = [ + { title: '数据库 · 文档与分块', note: '封存导出为原子操作,尚无分项上报' }, + { title: '原文件 · 图片 · 附件', note: '封存导出为原子操作,尚无分项上报' }, + { title: '检索索引 · 向量', note: '复用测试端产物;生产不重新解析(未接入)' }, + { title: 'Wiki · 完整快照', note: 'Wiki 随整库快照导出;生产写入未接入' }, + ] + return ( + <> +
    +
    +

    + 正在封存测试版本 + + 当前 {view.snapshot ? view.snapshot.snapshot_id.slice(0, 12) : '未接入'} → 目标{' '} + 本次封存产物 + +

    + + {job ? `${jobStateLabel[job.state] ?? job.state} · 已用时 ${elapsed(job.created_at, now)}` : '无作业'} + +
    +

    + 作业 {job?.capture_job ?? '未接入'} · 操作人 {job?.requested_by || '—'} · 最近进展{' '} + {job ? stamp(job.updated_at) : '—'} +

    + +
    + 当前:{running ? '导出数据库、索引、对象与 Wiki 快照' : jstate(job?.state)} + +
    +
    + +
    +
    +

    各类数据同步情况

    + 没有真实总量与完成量的项目只显示状态,不编造百分比 +
    +
    + {cards.map((card) => ( +
    +
    +

    {card.title}

    + 未接入 +
    +

    + — / 未接入 +

    + +

    {card.note}

    +
    + ))} +
    +
    + +
    +
    +

    同步明细

    +
    + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    任务 / 对象数据类型进度状态说明
    测试库封存 {job ? job.capture_job : ''}数据库 / 资源 / 索引 / Wiki{job ? jobStateLabel[job.state] : '—'}{running ? '执行中' : job?.state === 'failed' ? '失败' : job ? '已完成' : '未接入'} + {job?.last_error ? job.last_error : running ? '导出完成前无分项数据' : '封存结束后恢复测试写入者'} +
    生产恢复备份数据库 / 资源 / 索引 / Wiki未接入未接入生产预备份还没有接线
    本次变更文档文档 / 分块 / 资源关联未接入未接入差异清单还没有接入
    生产 Wiki 快照Wiki 页面 / 关联数据未接入未接入生产不重新生成 Wiki;写入未接线
    +
    + + 最近事件: + {job?.last_error + ? `封存作业报错(${job.last_error.slice(0, 60)})` + : running + ? '封存作业执行中;无错误。' + : job + ? '封存作业已结束;无错误。' + : '尚无作业记录。'} + + 文件传输 100% ≠ 作业完成;生产验证通过前不显示“完成”。 +
    +
    + + ) +} + +interface DrawerProps { + view: ScopeView + page: LibrarySnapshotList | null + now: number + open: boolean + expanded: string | null + onExpand: (id: string | null) => void + onClose: () => void + canCapture: boolean + pendingCapture: boolean + onCapture: () => void +} + +function Drawer({ view, page, now, open, expanded, onExpand, onClose, canCapture, pendingCapture, onCapture }: DrawerProps) { + if (!open) return null + const listing = view.history + const selected = listing.find((item) => item.snapshot_id === expanded) + return ( +
    + +
    + ) +} + +export function ReleaseTargetsView(props: ViewProps) { + const { + page, jobs, loading, error, notice, scope, onScope, drawerOpen, onDrawer, expandedSnapshot, onExpandSnapshot, + pendingCapture, canCapture, canWrite, now, onRefresh, onCapture, + } = props + const internal = scopeView(page, jobs, 'internal') + const external = scopeView(page, jobs, 'external') + const view = scope === 'internal' ? internal : external + const active = Boolean(view.activeJob) + + return ( +
    +
    +
    +

    发布管理

    +

    测试维护与验证,生产按知识库版本同步。

    +
    +
    + + +
    -
      - - - - -
    +
    + {[internal, external].map((item) => { + const status = statusOf(item) + const isSelected = item.scope === scope + return ( + + ) + })} +
    {error ? ( -
    +
    读取失败

    {error}

    ) : null} {page && !page.available ? ( -
    +
    归档未接线

    {page.reason || '整库归档根未配置'}

    ) : null} - {notice ?

    {notice}

    : null} + {notice ?

    {notice}

    : null} -
    - {(['internal', 'external'] as const).map((scope) => { - const snapshot = latestByScope[scope] - const activeJob = jobs.find((job) => job.scope === scope && ACTIVE_STATES.includes(job.state)) - const lastJob = jobs.find((job) => job.scope === scope) - const expandedHere = snapshot && expanded === snapshot.snapshot_id - const blockedReason = !page - ? '正在读取归档' - : !page.available - ? page.reason || '归档根未配置' - : !page.capture_available - ? page.capture_reason || '主机侧封存 agent 未接线' - : null - return ( -
    -
    -

    {scopeLabel(scope)}

    - - {snapshot ? '已封存' : '尚无封存'} - -
    - - {snapshot ? ( - <> -

    - 封存于 {stamp(snapshot.created_at)} · 快照 {snapshot.snapshot_id.slice(0, 16)} -

    -
    -
    -
    文档
    -
    {metric(snapshot, 'documents')}
    -
    -
    -
    分块
    -
    {metric(snapshot, 'chunks')}
    -
    -
    -
    索引
    -
    {metric(snapshot, 'index_documents')}
    -
    -
    -
    资源
    -
    {metric(snapshot, 'resources')}
    -
    -
    -
    Wiki 页
    -
    {metric(snapshot, 'wiki_pages')}
    -
    -
    -
    内容字节
    -
    {formatBytes(snapshot.logical_bytes)}
    -
    -
    -

    - 完整性:读取时已重算 {snapshot.parts.length} 项摘要并逐项匹配(A04 口径)。 - 模型 {snapshot.compatibility.embedding_model || '未知'} /{' '} - {snapshot.compatibility.embedding_dimension || '?'} 维 · schema{' '} - {snapshot.compatibility.schema_version || '?'} · 策略 {snapshot.validation_policy || '—'} -

    - - {expandedHere ? ( -
    - - - - - - - - - - - - {snapshot.parts.map((part) => ( - - - - - - - - ))} - -
    类别分项数量字节摘要(SHA256)
    {part.kind}{part.name}{part.count}{part.bytes.toLocaleString('zh-CN')} - {part.sha256.slice(0, 12)} -
    -

    - 校验结果:{snapshot.parts.length} 项全部可读且摘要一致;未发现异常。 - 这证明的是数据完整性,不是效果测试(A06 已取消)。 -

    -
    - ) : null} - - ) : ( -

    - {blockedReason || '还没有封存产物。先发起一次封存,产出一份完整版本。'} -

    - )} - -
    - {activeJob ? ( - <> - - {jobStateLabel[activeJob.state] ?? activeJob.state} - - {activeJob.capture_job} - {activeJob.requested_by || '—'} - - ) : lastJob ? ( - <> - - {jobStateLabel[lastJob.state] ?? lastJob.state} - - 上次作业 {lastJob.capture_job} - {lastJob.last_error ? ( - - {lastJob.last_error.slice(0, 80)} - - ) : null} - - ) : ( - 当前没有封存作业 - )} -
    - -
    - {page?.capture_available ? ( - canCapture ? ( - - ) : ( - 发起封存需要知识工程师及以上权限 - ) - ) : ( - {page?.capture_reason || '封存未接线'} - )} - - - -
    -

    - 禁用项不是流程建议,而是能力状态:预备份、同步、校验恢复都没有接线,点击不会发生任何事。 -

    -
    - ) - })} +
    +
    +

    + {scopeName(scope)} · {active ? '封存进行中' : view.snapshot ? '已封存,生产同步未接入' : '尚无测试封存'} +

    +
    + + +
    +
    +

    + 生产当前 未接入 → 拟发布{' '} + {view.snapshot ? `封存 ${view.snapshot.snapshot_id.slice(0, 12)}` : '未接入'} · 尚未启动,不修改生产 +

    +
    +
    +
    新增文档
    +
    未接入
    +
    +
    +
    更新文档
    +
    未接入
    +
    +
    +
    删除文档
    +
    未接入
    +
    +
    +
    Wiki 发布方式
    +
    {view.snapshot ? '完整快照' : '未接入'}
    +
    +
    +
      +
    • + {view.snapshot + ? `✓ 文档解析与索引完整(${view.snapshot.totals.chunks ?? 0} 分块 / ${view.snapshot.totals.index_documents ?? 0} 索引)` + : '○ 文档解析与索引:未接入'} +
    • +
    • + {view.snapshot ? `✓ Wiki 快照完整(${view.snapshot.totals.wiki_pages ?? 0} 页)` : '○ Wiki 快照:未接入'} +
    • +
    • + {view.snapshot ? `✓ 数据完整性:${view.snapshot.parts.length} 项摘要逐项一致` : '○ 数据完整性:尚无封存可核验'} +
    • +
    +

    + 启动后先固定测试版本,再备份生产。备份失败或恢复条件不满足,不进入生产写入。启动同步这一步当前未接线。 +

    - {jobs.length > 0 ? ( -
    -

    封存作业

    - - - - - - - - - - - - - {jobs.map((job) => ( - - - - - - - - - ))} - -
    投递时间目标状态作业号发起人最后错误
    {stamp(job.created_at)}{scopeLabel(job.scope)}{jobStateLabel[job.state] ?? job.state} - {job.capture_job} - {job.requested_by || '—'}{job.last_error || '—'}
    -
    - ) : null} + {active ? ( + onDrawer(true)} /> + ) : ( + onDrawer(true)} + /> + )} -
    -

    归档存储

    - {page?.available ? ( - <> -
    -
    -
    被版本引用的去重内容
    -
    {formatBytes(page.content_bytes)}
    -
    -
    -
    blob 表观字节
    -
    {formatBytes(page.blob_file_bytes)}
    -
    -
    -
    实际分配字节
    -
    {formatBytes(page.blob_allocated_bytes)}
    -
    -
    -
    未被任何版本引用
    -
    - {page.unreferenced_blobs} 个 / {formatBytes(page.unreferenced_bytes)} -
    -
    -
    -
    清单文件
    -
    {formatBytes(page.manifest_file_bytes)}
    -
    -
    -
    版本数
    -
    {page.versions}
    -
    -
    -

    - 去重内容按跨版本重新计算;这些都不是可回收空间。 - 保留策略、依赖保护、清理预览都没有接线,自动清理保持关闭,页面不会删除任何东西。 -

    - - ) : ( -

    {page?.reason || '归档未接线,存储口径不可读。'}

    - )} -
    + onDrawer(false)} + canCapture={canCapture} + pendingCapture={pendingCapture} + onCapture={onCapture} + />
    ) } @@ -370,9 +712,12 @@ export function ReleaseTargets() { const [jobs, setJobs] = useState([]) const [loading, setLoading] = useState(true) const [error, setError] = useState(null) - const [expanded, setExpanded] = useState(null) - const [pendingScope, setPendingScope] = useState(null) const [notice, setNotice] = useState(null) + const [scope, setScope] = useState('internal') + const [drawerOpen, setDrawerOpen] = useState(false) + const [expandedSnapshot, setExpandedSnapshot] = useState(null) + const [pendingCapture, setPendingCapture] = useState(false) + const [now, setNow] = useState(() => Date.now()) const load = useCallback(async (signal?: AbortSignal) => { setLoading(true) @@ -383,10 +728,11 @@ export function ReleaseTargets() { ]) setPage(snapshots) setJobs(captures) + setNow(Date.now()) setError(null) } catch (loadError) { if ((loadError as Error).name === 'AbortError') return - setError(loadError instanceof Error ? loadError.message : '加载整库发布状态失败') + setError(loadError instanceof Error ? loadError.message : '加载发布状态失败') } finally { setLoading(false) } @@ -402,29 +748,31 @@ export function ReleaseTargets() { useEffect(() => { if (!busy) return const timer = window.setInterval(() => { + setNow(Date.now()) void load().catch(() => undefined) }, 3000) return () => window.clearInterval(timer) }, [busy, load]) const role = auth?.identity?.role - const canCapture = (role === 'engineer' || role === 'admin') && page?.capture_available === true + const canWrite = role === 'engineer' || role === 'admin' + const canCapture = canWrite && page?.capture_available === true - const startCapture = async (scope: string) => { - setPendingScope(scope) + const startCapture = async () => { + setPendingCapture(true) setNotice(null) try { const accepted = await enqueueLibraryCapture(scope) setNotice( accepted.reused - ? `该作业已存在:${scopeLabel(scope)} · ${accepted.capture_job}(状态 ${jobStateLabel[accepted.state] ?? accepted.state})` - : `已投递封存作业:${scopeLabel(scope)} · ${accepted.capture_job}` + ? `该封存作业已存在:${scopeLabel(scope)} · ${accepted.capture_job}(${jobStateLabel[accepted.state] ?? accepted.state})` + : `已投递封存:${scopeLabel(scope)} · ${accepted.capture_job}` ) await load() } catch (captureError) { setNotice(captureError instanceof Error ? captureError.message : '发起封存失败') } finally { - setPendingScope(null) + setPendingCapture(false) } } @@ -435,12 +783,21 @@ export function ReleaseTargets() { loading={loading} error={error} notice={notice} - expanded={expanded} - pendingScope={pendingScope} + scope={scope} + onScope={(next) => { + setScope(next) + setExpandedSnapshot(null) + }} + drawerOpen={drawerOpen} + onDrawer={setDrawerOpen} + expandedSnapshot={expandedSnapshot} + onExpandSnapshot={setExpandedSnapshot} + pendingCapture={pendingCapture} canCapture={canCapture} + canWrite={canWrite} + now={now} onRefresh={() => void load()} - onCapture={(scope) => void startCapture(scope)} - onToggleExpanded={(snapshotID) => setExpanded(expanded === snapshotID ? null : snapshotID)} + onCapture={() => void startCapture()} /> ) -} +} \ No newline at end of file diff --git a/web/src/SystemSettings.tsx b/web/src/SystemSettings.tsx index 1853e39..713cc6e 100644 --- a/web/src/SystemSettings.tsx +++ b/web/src/SystemSettings.tsx @@ -1,6 +1,7 @@ import { useCallback, useEffect, useState } from 'react' import { BackupScheduleSection } from './BackupScheduleSection' +import { LibraryStorageSection } from './LibraryStorageSection' import { QAModelSettings } from './QAModelSettings' import { MembersSection } from './MembersSection' import { DingtalkAccountStatus, SourceManagementDetails, SourceSettingsCard } from './SourceManagement' @@ -394,7 +395,12 @@ export function SystemSettingsView({ ) : null} {section === 'bindings' ? : null} {section === 'production-bindings' ? : null} - {section === 'storage' ? : null} + {section === 'storage' ? ( + <> + + + + ) : null} {section === 'members' && identity?.role === 'admin' ? : null} {section === 'refresh' ? (
    diff --git a/web/src/libraryStorage.css b/web/src/libraryStorage.css new file mode 100644 index 0000000..c426ca9 --- /dev/null +++ b/web/src/libraryStorage.css @@ -0,0 +1,66 @@ +.library-storage { + border: 1px solid var(--border-base, #e2e8f0); + border-radius: 10px; + padding: 16px 18px; + margin-bottom: 18px; + background: #fff; +} +.library-storage header h3 { + margin: 0 0 4px; + font-size: 16px; +} +.library-storage header p { + margin: 0 0 12px; + font-size: 12px; + color: var(--ink-mute, #64748b); + line-height: 1.6; +} +.library-storage-grid { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); + gap: 10px; + margin: 0 0 12px; +} +.library-storage-grid div { + border: 1px solid #e6edf2; + border-radius: 8px; + padding: 9px 11px; +} +.library-storage-grid dt { + font-size: 11px; + color: var(--ink-mute, #64748b); +} +.library-storage-grid dd { + margin: 3px 0 0; + font-size: 16px; + font-variant-numeric: tabular-nums; +} +.library-storage-limits { + margin: 0; + padding-left: 18px; + font-size: 12px; + color: #986b24; + line-height: 1.8; +} +.library-storage-hint { + margin: 0; + font-size: 12px; + color: var(--ink-mute, #64748b); +} +.library-storage-blocked { + border: 1px solid #f3c2b8; + background: #fff6f3; + border-radius: 8px; + padding: 10px 12px; + margin-bottom: 10px; +} +.library-storage-blocked strong { + display: block; + font-size: 12px; + color: #a03a1e; +} +.library-storage-blocked p { + margin: 2px 0 0; + font-size: 12px; + color: #7c2d12; +} diff --git a/web/src/releaseTargets.css b/web/src/releaseTargets.css index 4ce6932..5239952 100644 --- a/web/src/releaseTargets.css +++ b/web/src/releaseTargets.css @@ -1,360 +1,600 @@ -/* 发布管理:两个整库目标 + 四段链路。沿用页面既有的明亮面板风格。 */ +/* 发布管理:按已确认稿的布局与色系(浅底、青绿主色、白色圆角面板)。 */ .release-targets { + --rel-ink: #26394a; + --rel-muted: #7b8d9a; + --rel-line: #dce6ed; + --rel-teal: #269e88; + --rel-teal-dark: #228b75; + --rel-teal-soft: #eaf8f3; display: flex; flex-direction: column; - gap: 18px; + gap: 16px; + padding: 24px 28px 40px; + color: var(--rel-ink); min-width: 0; - padding: 24px; - color: var(--ink-base); } -.release-targets-head, -.release-chain, -.release-target, -.release-jobs, -.release-storage, -.release-blocked { - background: var(--bg-panel, #fff); - border: 1px solid var(--border-base, #e2e8f0); - border-radius: 10px; +.release-targets h1 { + margin: 0 0 4px; + font-size: 28px; } -.release-targets-head { +.release-targets h2 { + margin: 0; + font-size: 18px; +} +.release-targets h3 { + margin: 0; + font-size: 14px; +} +.rel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; - padding: 20px; flex-wrap: wrap; } -.release-targets h1 { - margin: 0 0 6px; - font-size: 22px; -} -.release-targets-head p { +.rel-head p { margin: 0; - max-width: 70ch; + color: var(--rel-muted); font-size: 13px; - line-height: 1.65; - color: var(--ink-mute, #64748b); } -.release-targets-head button { - padding: 7px 14px; - border-radius: 8px; - border: 1px solid var(--border-base, #e2e8f0); - background: var(--bg-panel, #fff); - cursor: pointer; -} -.release-targets-head button:disabled { - cursor: progress; - opacity: 0.6; -} - -/* 链路:四段各自带真实能力状态,不用百分比或进度条伪装。 */ -.release-chain { - display: grid; - grid-template-columns: repeat(4, minmax(0, 1fr)); - gap: 1px; - padding: 0; - margin: 0; - list-style: none; - overflow: hidden; - background: var(--border-base, #e2e8f0); -} -.release-stage { - background: var(--bg-panel, #fff); - padding: 14px 16px; +.rel-head-actions { display: flex; - flex-direction: column; - gap: 6px; - min-width: 0; -} -.release-stage-name { - font-size: 14px; - font-weight: 600; -} -.release-stage-chip { - align-self: flex-start; - font-size: 11px; - padding: 2px 8px; - border-radius: 999px; - border: 1px solid transparent; -} -.release-stage.ready .release-stage-chip { - background: #ecfdf5; - border-color: #a7f3d0; - color: #047857; -} -.release-stage.not-wired .release-stage-chip { - background: #f8fafc; - border-color: #e2e8f0; - color: #64748b; -} -.release-stage.not-authorized .release-stage-chip { - background: #fff7ed; - border-color: #fed7aa; - color: #b45309; -} -.release-stage-detail { - font-size: 12px; - line-height: 1.5; - color: var(--ink-mute, #64748b); -} - -.release-target-grid { - display: grid; - grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); - gap: 16px; -} -.release-target { - padding: 20px; - display: flex; - flex-direction: column; - gap: 12px; - min-width: 0; -} -.release-target-head { - display: flex; - align-items: baseline; - justify-content: space-between; - gap: 12px; -} -.release-target-head h2 { - margin: 0; - font-size: 20px; -} -.release-state { - font-size: 12px; - padding: 2px 10px; - border-radius: 999px; - border: 1px solid #e2e8f0; - background: #f8fafc; - color: #64748b; -} -.release-state.ready { - background: #ecfdf5; - border-color: #a7f3d0; - color: #047857; -} -.release-target-meta { - margin: 0; - font-size: 12px; - color: var(--ink-mute, #64748b); - overflow-wrap: anywhere; -} -.release-metrics { - display: grid; - grid-template-columns: repeat(3, minmax(0, 1fr)); - gap: 8px; - margin: 0; -} -.release-metrics div { - border: 1px solid var(--border-base, #e2e8f0); - border-radius: 8px; - padding: 8px 10px; -} -.release-metrics dt { - font-size: 11px; - color: var(--ink-mute, #64748b); -} -.release-metrics dd { - margin: 2px 0 0; - font-size: 17px; - font-variant-numeric: tabular-nums; -} -.release-integrity, -.release-target-empty, -.release-target-foot, -.release-storage-note, -.release-parts-note { - margin: 0; - font-size: 12px; - line-height: 1.6; - color: var(--ink-mute, #64748b); -} -.release-parts-toggle { - align-self: flex-start; - padding: 5px 10px; - border-radius: 7px; - border: 1px solid var(--border-base, #e2e8f0); - background: #f8fafc; - cursor: pointer; - font-size: 12px; -} -.release-parts table, -.release-jobs table { - width: 100%; - border-collapse: collapse; - font-size: 12px; -} -.release-parts th, -.release-jobs th { - text-align: left; - padding: 6px 8px; - background: #f8fafc; - color: var(--ink-mute, #64748b); - font-weight: 600; - border-bottom: 1px solid var(--border-base, #eef2f7); -} -.release-parts td, -.release-jobs td { - padding: 6px 8px; - border-bottom: 1px solid var(--border-base, #eef2f7); - font-variant-numeric: tabular-nums; -} -.release-parts-note { - margin-top: 8px; -} - -.release-target-job { - display: flex; - align-items: center; - gap: 8px; - flex-wrap: wrap; - font-size: 12px; - color: var(--ink-mute, #64748b); - min-height: 22px; -} -.release-job-state { - font-size: 11px; - padding: 2px 8px; - border-radius: 999px; - border: 1px solid #e2e8f0; - background: #f8fafc; -} -.release-job-state.running, -.release-job-state.pending, -.release-job-state.retry { - background: #eff6ff; - border-color: #bfdbfe; - color: #1d4ed8; -} -.release-job-state.completed { - background: #ecfdf5; - border-color: #a7f3d0; - color: #047857; -} -.release-job-state.failed { - background: #fef2f2; - border-color: #fecaca; - color: #b91c1c; -} -.release-job-error { - color: #b91c1c; - overflow-wrap: anywhere; -} -.release-job-idle { - color: var(--ink-mute, #64748b); -} - -.release-actions { - display: flex; - flex-wrap: wrap; gap: 8px; align-items: center; + flex-wrap: wrap; } -.release-actions button { - padding: 7px 12px; - border-radius: 8px; - border: 1px solid var(--border-base, #e2e8f0); +.release-targets button { + font: inherit; + cursor: pointer; background: #fff; - cursor: pointer; - font-size: 13px; + border: 1px solid #d6e2e8; + border-radius: 7px; + padding: 7px 14px; + color: #41596b; } -.release-actions button.primary { - border-color: #2563eb; - background: #eff6ff; - color: #1d4ed8; +.release-targets button:hover:not(:disabled) { + background: #edf8f5; } -.release-actions button:disabled { +.release-targets button:disabled { cursor: not-allowed; opacity: 0.55; - background: #f8fafc; } -.release-action-hint { +.rel-primary { + background: var(--rel-teal) !important; + border-color: var(--rel-teal) !important; + color: #fff !important; + font-weight: 600; +} +.rel-secondary { + background: #fff; +} +.rel-tabs { + display: flex; + gap: 12px; + flex-wrap: wrap; +} +.rel-tab { + width: 310px; + display: flex; + align-items: center; + justify-content: space-between; + gap: 12px; + padding: 13px 18px !important; + text-align: left; + border-radius: 9px !important; +} +.rel-tab strong { + font-size: 16px; +} +.rel-tab.selected { + background: var(--rel-teal-soft) !important; + border: 2px solid var(--rel-teal) !important; +} +.rel-pill { + border-radius: 5px; font-size: 12px; - color: var(--ink-mute, #64748b); + padding: 2px 9px; + white-space: nowrap; + border: 1px solid transparent; } - -.release-blocked { - border-color: #f3c2b8; - background: #fff6f3; - padding: 14px 18px; +.rel-pill.green { + color: #228368; + background: #e6f5ef; + border-color: #bfe6d8; } -.release-blocked strong { - display: block; - margin-bottom: 4px; - color: #a03a1e; +.rel-pill.blue { + color: #387eb8; + background: #eaf3fc; + border-color: #c6ddf1; +} +.rel-pill.gray { + color: #7c8d99; + background: #eff3f6; + border-color: #dde5ea; +} +.rel-pill.red { + color: #b4381f; + background: #fdecea; + border-color: #f3c6bc; +} +.rel-panel { + background: #fff; + border: 1px solid var(--rel-line); + border-radius: 12px; + padding: 20px 22px; + min-width: 0; +} +.rel-between { + display: flex; + align-items: flex-start; + justify-content: space-between; + gap: 14px; + flex-wrap: wrap; +} +.rel-panel-head { + display: flex; + align-items: flex-start; + justify-content: space-between; + gap: 12px; + margin-bottom: 12px; +} +.rel-panel-head p { + margin: 3px 0 0; + font-size: 12px; + color: var(--rel-muted); +} +.rel-jobhead h2 { + font-size: 19px; +} +.rel-versionline { + margin: 12px 0 0; + color: #496579; + font-size: 14px; +} +.rel-versionline b { + color: var(--rel-teal-dark); +} +.rel-unknown { + color: #9aa9b4 !important; + font-weight: 500; +} +.rel-metrics { + display: grid; + grid-template-columns: repeat(4, minmax(0, 1fr)); + gap: 10px; + margin: 16px 0 0; +} +.rel-metrics div { + border: 1px solid #e6edf2; + border-radius: 9px; + padding: 10px 12px; +} +.rel-metrics dt { + font-size: 12px; + color: var(--rel-muted); +} +.rel-metrics dd { + margin: 4px 0 0; + font-size: 20px; + font-weight: 700; +} +.rel-checklist { + list-style: none; + display: flex; + gap: 22px; + flex-wrap: wrap; + margin: 14px 0 0; + padding: 11px 14px; + border-radius: 9px; + background: #f2faf6; + font-size: 13px; + color: #228368; +} +.rel-checklist .unknown { + color: #8a9aa6; +} +.rel-footnote { + margin: 12px 0 0; + font-size: 12px; + color: var(--rel-muted); + line-height: 1.6; +} +.rel-grid { + display: grid; + grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); + gap: 16px; +} +.rel-grid-4 { + grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); +} +.rel-changes table, +.rel-details table, +.rel-drawer-table, +.rel-parts table { + width: 100%; + border-collapse: collapse; font-size: 13px; } -.release-blocked p { +.rel-changes th, +.rel-details th, +.rel-drawer-table th, +.rel-parts th { + text-align: left; + background: #f8fafb; + color: #8a9aa6; + font-size: 12px; + font-weight: 500; + padding: 9px 12px; +} +.rel-changes td, +.rel-details td, +.rel-drawer-table td, +.rel-parts td { + padding: 10px 12px; + border-top: 1px solid #eef2f5; + vertical-align: top; +} +.rel-table-empty { + color: var(--rel-muted); + font-size: 12px; + text-align: center; + padding: 22px 12px !important; +} +.rel-protection dl { + display: grid; + grid-template-columns: auto 1fr; + gap: 8px 14px; + margin: 0 0 12px; + font-size: 13px; +} +.rel-protection dt { + color: var(--rel-muted); +} +.rel-protection dd { + margin: 0; + color: var(--rel-ink); +} +.rel-hint { + margin: 0 0 10px; + font-size: 12px; + color: var(--rel-muted); + line-height: 1.6; +} +.rel-warn { + margin: 12px 0 0; + font-size: 12px; + color: #986b24; + background: #fff8e8; + border: 1px solid #ead7b0; + border-radius: 7px; + padding: 8px 10px; + line-height: 1.6; +} +.rel-notice { + margin: 0; + font-size: 12px; + color: #986b24; + background: #fff8e8; + border: 1px solid #ead7b0; + border-radius: 8px; + padding: 9px 12px; + line-height: 1.6; +} +.rel-blocked { + border: 1px solid #f3c2b8; + background: #fff6f3; + border-radius: 10px; + padding: 12px 16px; +} +.rel-blocked strong { + display: block; + color: #a03a1e; + font-size: 13px; + margin-bottom: 3px; +} +.rel-blocked p { margin: 0; font-size: 12px; color: #7c2d12; } -.release-notice { - margin: 0; - padding: 10px 14px; + +/* 阶段条 */ +.rel-steps { + display: flex; + align-items: stretch; + gap: 8px; + list-style: none; + margin: 16px 0 6px; + padding: 0; + flex-wrap: wrap; +} +.rel-step { + flex: 1 1 150px; + position: relative; + display: flex; + flex-direction: column; + gap: 2px; + padding: 11px 12px; border-radius: 8px; - background: #eff6ff; - border: 1px solid #bfdbfe; - color: #1d4ed8; + background: #f5f8fa; + border: 1px solid #e1e8ed; + color: #8a9aa6; font-size: 13px; } - -.release-jobs, -.release-storage { - padding: 18px 20px; +.rel-step strong { + font-size: 13px; + font-weight: 600; } -.release-jobs h2, -.release-storage h2 { - margin: 0 0 12px; - font-size: 16px; -} -.release-storage-grid { - display: grid; - grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); - gap: 10px; - margin: 0 0 10px; -} -.release-storage-grid div { - border: 1px solid var(--border-base, #e2e8f0); - border-radius: 8px; - padding: 10px 12px; -} -.release-storage-grid dt { +.rel-step small { font-size: 11px; - color: var(--ink-mute, #64748b); } -.release-storage-grid dd { - margin: 3px 0 0; - font-size: 16px; - font-variant-numeric: tabular-nums; +.rel-step.done { + color: #25886b; + background: #f0faf5; +} +.rel-step.live { + color: #167f70; + background: #e9f8f4; + border-color: #4eb49f; + font-weight: 700; +} +.rel-step-mark { + position: absolute; + top: 9px; + right: 12px; + font-size: 12px; +} +.rel-step-arrow { + display: none; +} +.rel-steps-note { + margin: 0; + font-size: 12px; + color: var(--rel-muted); + line-height: 1.6; } -/* 旧文档级流程:折叠保留,标题就写明它不是整库发布。 */ -.release-legacy { - margin: 0 24px 24px; - border: 1px dashed var(--border-base, #cbd5e1); +/* 仅剩的次级操作:封存测试版本 */ +.rel-seal { + display: flex; + align-items: center; + justify-content: space-between; + gap: 16px; + flex-wrap: wrap; + background: #fbfdfe; +} +.rel-seal p { + margin: 6px 0 0; + font-size: 12px; + color: var(--rel-muted); + line-height: 1.6; +} + +/* 同步中 */ +.rel-jobmeta { + margin: 8px 0 0; + font-size: 12px; + color: var(--rel-muted); +} +.rel-progress-foot { + margin-top: 12px; + border-top: 1px solid #eef2f5; + padding-top: 10px; + font-size: 12px; + color: var(--rel-muted); +} +.rel-link { + border: 0 !important; + background: transparent !important; + padding: 2px 4px !important; + color: #2b7fa6 !important; + font-size: 12px; +} +.rel-datacard { + border: 1px solid #dce6ed; border-radius: 10px; - background: #fcfcfd; + padding: 14px 16px; + background: #fff; } -.release-legacy > summary { - padding: 14px 18px; - cursor: pointer; +.rel-datacard header { + display: flex; + align-items: center; + justify-content: space-between; + gap: 8px; +} +.rel-datacount { + margin: 10px 0 6px; font-size: 13px; - color: var(--ink-mute, #64748b); + color: var(--rel-muted); } -.release-legacy[open] > summary { - border-bottom: 1px solid var(--border-base, #e2e8f0); +.rel-datacount strong { + font-size: 24px; + color: #9aa9b4; + margin-right: 4px; +} +.rel-progress { + height: 6px; + border-radius: 8px; + background: #edf1f4; + overflow: hidden; +} +.rel-progress span { + display: block; + height: 100%; + background: var(--rel-teal); +} +.rel-datadetail { + margin: 10px 0 0; + font-size: 12px; + color: var(--rel-muted); + line-height: 1.55; +} +.rel-filters { + display: flex; + gap: 6px; +} +.rel-filters button { + font-size: 12px; + padding: 4px 11px; +} +.rel-filters .chosen { + color: #168b73; + background: #ebf8f3; + border-color: #a6d7c8; +} +.rel-log { + display: flex; + justify-content: space-between; + gap: 12px; + flex-wrap: wrap; + background: #f9fbfc; + border-top: 1px solid #eef2f5; + padding: 10px 12px; + font-size: 12px; + color: #7b8e9c; } -@media (max-width: 860px) { - .release-targets { - padding: 12px; +/* 版本与快照抽屉 */ +.rel-drawer-backdrop { + position: fixed; + inset: 0; + background: rgba(20, 52, 74, 0.4); + display: flex; + justify-content: flex-end; + z-index: 40; +} +.rel-drawer { + width: min(1024px, 92vw); + height: 100%; + overflow-y: auto; + background: #fff; + border-left: 1px solid #dce6ed; + box-shadow: -12px 0 32px rgba(19, 44, 61, 0.18); + padding: 22px 26px 28px; + display: flex; + flex-direction: column; + gap: 14px; +} +.rel-drawer-head { + display: flex; + align-items: flex-start; + justify-content: space-between; + gap: 12px; +} +.rel-drawer-head p { + margin: 4px 0 0; + font-size: 12px; + color: var(--rel-muted); +} +.rel-close { + padding: 5px 10px !important; + font-size: 12px; +} +.rel-drawer-table td small { + display: block; + color: var(--rel-muted); + font-size: 11px; + margin-top: 2px; +} +.rel-drawer-table tr.selected td { + background: #f4fbf8; +} +.rel-snapshot { + border: 1px solid #cfe6dd; + border-radius: 10px; + padding: 16px 18px; + background: #fbfefd; +} +.rel-snapshot header { + display: flex; + align-items: center; + justify-content: space-between; + gap: 10px; + margin-bottom: 8px; +} +.rel-snapshot-grid { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); + gap: 10px; + margin: 12px 0; +} +.rel-snapshot-grid div { + border: 1px solid #e2eef7; + border-radius: 8px; + background: #fff; + padding: 9px 11px; +} +.rel-snapshot-grid dt { + font-size: 11px; + color: var(--rel-muted); +} +.rel-snapshot-grid dd { + margin: 4px 0 0; + font-size: 13px; +} +.rel-parts { + margin: 8px 0 12px; +} +.rel-parts summary { + cursor: pointer; + font-size: 12px; + color: #2b7fa6; +} +.rel-parts table { + margin-top: 8px; + border: 1px solid #e6edf2; + border-radius: 8px; + overflow: hidden; +} +.rel-drawer-actions { + display: flex; + gap: 8px; + flex-wrap: wrap; +} +.rel-danger { + border-color: #e7b4a8 !important; + color: #b4381f !important; +} +.rel-drawer-foot { + margin-top: auto; + border-top: 1px solid #eef2f5; + padding-top: 14px; + display: flex; + align-items: center; + justify-content: space-between; + gap: 14px; + flex-wrap: wrap; +} +.rel-drawer-foot p { + margin: 4px 0 0; + font-size: 12px; + color: var(--rel-muted); + line-height: 1.6; + max-width: 62ch; +} + +@media (max-width: 1100px) { + .rel-grid { + grid-template-columns: minmax(0, 1fr); } - .release-chain { + .rel-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } - .release-legacy { - margin: 0 12px 12px; +} +@media (max-width: 760px) { + .release-targets { + padding: 14px; + } + .rel-tab { + width: 100%; + } + .rel-drawer { + width: 100vw; + padding: 16px; + } + .rel-changes table, + .rel-details table { + display: block; + overflow-x: auto; } } \ No newline at end of file