+ pending: boolean
+}): boolean {
+ if (input.pending) return true
+ if (input.captures.some((job) => ACTIVE_STATES.includes(job.state))) return true
+ return (['internal', 'external'] as Scope[]).some((scope) => {
+ const job = input.overviews[scope]?.job
+ return Boolean(job && ACTIVE_STATES.includes(job.state))
+ })
+}
+
// ---- 目标维护窗口:级别 / 进度 / 恢复错误 ----
//
// 维护窗口有两种级别:实例级(跨 scope 共用一把锁,真正挡住写入者)和库级。
@@ -403,7 +465,9 @@ export function wikiContributionLines(diff: LibraryOverview['diff'] | undefined)
function StageBar({ view }: { view: ScopeView }) {
const job = view.job
const sealJob = job?.kind === 'seal' ? job : undefined
- const syncJob = job?.kind === 'sync' ? job : undefined
+ // 同步、恢复、建立基线共用同一串阶段(预备份 → 数据四类 → 校验 → 登记版本)。
+ // 只按"sync"找阶段会让刚跑完的恢复/基线在页面上显示成"本次作业尚未开始"。
+ const writeJob = job && job.kind !== 'seal' ? job : undefined
let first: { state: StepState; hint: string }
if (sealJob) {
@@ -419,19 +483,24 @@ function StageBar({ view }: { view: ScopeView }) {
? '已排队,等待 worker'
: '本次封存未完成',
}
- } else if (syncJob) {
- first = { state: 'done', hint: '已绑定的测试版本' }
+ } else if (writeJob) {
+ first =
+ writeJob.kind === 'restore'
+ ? { state: 'done', hint: '恢复到选定快照(不经过测试封存)' }
+ : writeJob.kind === 'baseline'
+ ? { state: 'done', hint: '目标自身内容,非测试封存' }
+ : { state: 'done', hint: '已绑定的测试版本' }
} else {
first = { state: 'idle', hint: '本次作业尚未开始' }
}
- const prebackup = syncJob ? stageOf(syncJob, 'prebackup') : undefined
- const dataStages = syncJob
+ const prebackup = writeJob ? stageOf(writeJob, 'prebackup') : undefined
+ const dataStages = writeJob
? ['database', 'resources', 'index', 'wiki']
- .map((name) => stageOf(syncJob, name))
+ .map((name) => stageOf(writeJob, name))
.filter((row): row is LibraryStageRow => Boolean(row))
: []
- const verifyStage = syncJob ? stageOf(syncJob, 'verify') : undefined
+ const verifyStage = writeJob ? stageOf(writeJob, 'verify') : undefined
const stages: { label: string; state: StepState; hint: string }[] = [
{ label: '固定测试版本', ...first },
@@ -460,8 +529,15 @@ function StageBar({ view }: { view: ScopeView }) {
},
{
label: '新版本生效',
- state: syncJob && syncJob.state === 'succeeded' ? 'done' : 'idle',
- hint: syncJob && syncJob.state === 'succeeded' ? '生产已生效' : '未接入',
+ state: writeJob && writeJob.state === 'succeeded' ? 'done' : 'idle',
+ hint:
+ writeJob && writeJob.state === 'succeeded'
+ ? writeJob.kind === 'restore'
+ ? '生产已回到该快照'
+ : writeJob.kind === 'baseline'
+ ? '目标基线已登记(目标内容未改)'
+ : '生产已生效'
+ : '未接入',
},
]
return (
@@ -480,9 +556,7 @@ function StageBar({ view }: { view: ScopeView }) {
{job
- ? `作业 ${job.id} · ${job.kind === 'seal' ? '测试封存' : '生产同步'} · ${jobStateText(job)}${
- job.error ? ` · ${job.error}` : ''
- }`
+ ? `作业 ${job.id} · ${jobKindText(job.kind)} · ${jobStateText(job)}${job.error ? ` · ${job.error}` : ''}`
: view.snapshot
? `已有测试封存 ${stamp(view.snapshot.created_at)}(历史记录),但本次作业尚未开始;没有当前作业证据时不会把历史封存当作阶段完成。`
: '本次作业尚未开始。'}
@@ -603,14 +677,30 @@ function ProtectionCard({
@@ -1018,14 +1124,17 @@ function Drawer({
) : (
listing.map((snapshot) => {
const isSelected = expanded === snapshot.snapshot_id
+ // 类型只能来自版本登记:归档里的目标基线与预备份也在同一个根下。
+ const versionLabel = snapshotVersionLabel(view.overview?.versions, snapshot.snapshot_id)
+ const sealed = versionLabel.includes('测试封存')
return (
|
- 封存 {snapshot.snapshot_id.slice(0, 12)}
+ 快照 {snapshot.snapshot_id.slice(0, 12)}
{stamp(snapshot.created_at)}
|
- 测试封存
+ {versionLabel}
|
分项完整 · 未做生产恢复验证
@@ -1057,7 +1166,9 @@ function Drawer({
封存 {selected.snapshot_id.slice(0, 12)} · 恢复资料
- 读取时逐项校验通过
+
+ {snapshotVersionLabel(view.overview?.versions, selected.snapshot_id)}
+
完整快照 {selected.snapshot_id} · 封存于 {stamp(selected.created_at)} · 模型{' '}
@@ -1292,7 +1403,12 @@ export function ReleaseTargetsView(props: ViewProps) {
- {scopeName(scope)} · {active ? '封存进行中' : view.snapshot ? '已封存,同步按条件放行' : '尚无测试封存'}
+ {scopeName(scope)} ·{' '}
+ {active
+ ? `${jobKindText(view.job?.kind)}进行中`
+ : view.snapshot
+ ? '已封存,同步按条件放行'
+ : '尚无测试封存'}
|