配色回到全站钴蓝与中性灰 token;折叠区原先引用不存在的 CSS 变量导致无边框,已修正。生产生效版本即当前测试封存时,主按钮为不可点的「已同步」,次按钮为「重新封存测试版本」,不再催授权缺项。删去重复的测试库封存卡,生产保护卡满宽,状态四格横排。移除页面上的「文档级发布(旧流程)」与「关联旧封存来源证据」入口,后端接口保留。验证:tsc -b 通过,vitest 全量 635 通过(新增已同步用例),本机 8088 数据截图核对桌面与 390px。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+63
-54
@@ -1,4 +1,3 @@
|
||||
import { LegacySourceAssociation } from './LegacySourceAssociation'
|
||||
import { useCallback, useEffect, useRef, useState } from 'react'
|
||||
import {
|
||||
createLibraryRestoreAuthorization,
|
||||
@@ -981,10 +980,6 @@ interface ReadyProps {
|
||||
prebackup: LibraryOverview['prebackup']
|
||||
gate: LibraryOverview['gate']
|
||||
authorization: LibraryOverview['authorization']
|
||||
canCapture: boolean
|
||||
canWrite: boolean
|
||||
pendingCapture: boolean
|
||||
onCapture: () => void
|
||||
onOpen: () => void
|
||||
sync: ReleaseSyncActions
|
||||
baseline: ReleaseBaselineActions
|
||||
@@ -1006,16 +1001,12 @@ function ReadyBody({
|
||||
sync,
|
||||
baseline,
|
||||
verification,
|
||||
canCapture,
|
||||
canWrite,
|
||||
pendingCapture,
|
||||
onCapture,
|
||||
onOpen,
|
||||
}: ReadyProps) {
|
||||
const snapshot = view.snapshot
|
||||
return (
|
||||
<>
|
||||
<div className="rel-grid">
|
||||
<div>
|
||||
<ProtectionCard
|
||||
production={production}
|
||||
productionNote={productionNote}
|
||||
@@ -1043,17 +1034,6 @@ function ReadyBody({
|
||||
</header>
|
||||
<StageBar view={view} />
|
||||
</div>
|
||||
<div className="rel-panel rel-seal">
|
||||
<div>
|
||||
<h2>测试库封存</h2>
|
||||
<p>
|
||||
{snapshot
|
||||
? `最近一次封存 ${stamp(snapshot.created_at)},快照 ${snapshot.snapshot_id.slice(0, 12)}。封存只读测试库,不影响生产。`
|
||||
: '还没有测试库封存。封存会短暂停住测试写入者,导出完整版本后恢复。'}
|
||||
</p>
|
||||
</div>
|
||||
<span className="rel-hint">{canCapture ? '封存入口在页面顶部“下一步”。' : captureHint(view, canWrite)}</span>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -1884,7 +1864,22 @@ export function ReleaseTargetsView(props: ViewProps) {
|
||||
|
||||
const sealed = Boolean(view.snapshot)
|
||||
const authorizationActive = authorization.state === 'active'
|
||||
// 主按钮永远是"同步"或"查看当前任务";准备动作(封存/基线/恢复验证/授权)
|
||||
// 生产生效版本就是这份测试封存时,再同步只会把同一份内容重写一遍(还要停机维护),
|
||||
// 所以主按钮改成不可点的"已同步",前进方向换成封存新版本。闸口放行与否不影响这个判断。
|
||||
const inSync =
|
||||
!runningJob &&
|
||||
productionClass === 'known' &&
|
||||
Boolean(target?.snapshot_id) &&
|
||||
production?.version?.snapshot_id === target?.snapshot_id
|
||||
const captureAction = {
|
||||
label: pendingCapture ? '封存中…' : sealed ? '重新封存测试版本' : '封存测试版本',
|
||||
hint: sealed
|
||||
? '生产已是当前测试封存,无需同步;测试库有新内容时先封存新版本。'
|
||||
: '还没有测试库封存。封存只读导出测试库(短暂停住测试写入者),不影响生产。',
|
||||
disabled: pendingCapture,
|
||||
run: onCapture,
|
||||
}
|
||||
// 主按钮永远是"同步"、"已同步"或"查看当前任务";准备动作(封存/基线/授权)
|
||||
// 作为次要按钮按状态出现,页面因此只有一个前进方向。
|
||||
const primaryAction = runningJob
|
||||
? {
|
||||
@@ -1893,24 +1888,32 @@ export function ReleaseTargetsView(props: ViewProps) {
|
||||
disabled: false,
|
||||
run: () => document.getElementById('rel-progress')?.scrollIntoView?.({ behavior: 'smooth', block: 'start' }),
|
||||
}
|
||||
: {
|
||||
label: sync.pending ? '投递中…' : '▶ 启动同步',
|
||||
hint: sync.canStart
|
||||
? '先固定测试版本,再备份目标并写入;失败会停在维护窗口。'
|
||||
: `暂不能启动:${gate.reasons.join(';') || '条件未满足'}`,
|
||||
disabled: !sync.canStart || sync.pending,
|
||||
run: sync.onStart,
|
||||
}
|
||||
: inSync
|
||||
? {
|
||||
label: '✓ 已同步',
|
||||
hint: canCapture
|
||||
? captureAction.hint
|
||||
: `生产已是当前测试封存,无需同步。${captureHint(view, canWrite)}`,
|
||||
disabled: true,
|
||||
run: () => {},
|
||||
}
|
||||
: {
|
||||
label: sync.pending ? '投递中…' : '▶ 启动同步',
|
||||
hint: sync.canStart
|
||||
? '先固定测试版本,再备份目标并写入;失败会停在维护窗口。'
|
||||
: `暂不能启动:${gate.reasons.join(';') || '条件未满足'}`,
|
||||
disabled: !sync.canStart || sync.pending,
|
||||
run: sync.onStart,
|
||||
}
|
||||
const prepAction = !sealed
|
||||
? canCapture
|
||||
? {
|
||||
label: pendingCapture ? '封存中…' : '封存测试版本',
|
||||
hint: '只读导出测试库,生成一份可发布的整库版本。',
|
||||
disabled: pendingCapture,
|
||||
run: onCapture,
|
||||
}
|
||||
? captureAction
|
||||
: { label: '尚无封存', hint: captureHint(view, canWrite), disabled: true, run: () => {} }
|
||||
: productionClass === 'nonempty' && baseline.canStart
|
||||
: inSync
|
||||
? canCapture
|
||||
? captureAction
|
||||
: null
|
||||
: productionClass === 'nonempty' && baseline.canStart
|
||||
? {
|
||||
label: baseline.pending ? '投递中…' : '建立目标权威基线(维护隔离)',
|
||||
hint: '生产目标非空但还没有权威版本,先登记一份基线。',
|
||||
@@ -1988,8 +1991,13 @@ export function ReleaseTargetsView(props: ViewProps) {
|
||||
<div className="rel-panel rel-status">
|
||||
<p className="rel-scope-state">
|
||||
{scopeName(scope)} ·{' '}
|
||||
{active ? `${jobKindText(view.job?.kind)}进行中` : sealed ? '已封存,同步按条件放行' : '尚无测试封存'}
|
||||
{sealed ? '(需要新版本时点上方“封存测试版本”)' : ''}
|
||||
{active
|
||||
? `${jobKindText(view.job?.kind)}进行中`
|
||||
: inSync
|
||||
? '生产已是当前测试封存'
|
||||
: sealed
|
||||
? '已封存,同步按条件放行'
|
||||
: '尚无测试封存'}
|
||||
</p>
|
||||
<dl className="rel-status-grid">
|
||||
<div>
|
||||
@@ -1998,6 +2006,15 @@ export function ReleaseTargetsView(props: ViewProps) {
|
||||
{sealed ? `快照 ${view.snapshot!.snapshot_id.slice(0, 12)}` : '尚无'}
|
||||
</dd>
|
||||
<small>{sealed ? stamp(view.snapshot!.created_at) : '先封存测试版本'}</small>
|
||||
{/* 封存入口跟着"测试封存"这一格走:主操作区已经放了封存按钮时不再重复;
|
||||
不能封存时把接口给的真实原因写在这里,而不是只藏在按钮 title 里。 */}
|
||||
{runningJob || prepAction === captureAction ? null : canCapture ? (
|
||||
<button type="button" className="rel-link rel-cell-action" onClick={onCapture} disabled={pendingCapture}>
|
||||
{captureAction.label}
|
||||
</button>
|
||||
) : (
|
||||
<small className="rel-unknown">{captureHint(view, canWrite)}</small>
|
||||
)}
|
||||
</div>
|
||||
<div>
|
||||
<dt>生产当前</dt>
|
||||
@@ -2010,7 +2027,9 @@ export function ReleaseTargetsView(props: ViewProps) {
|
||||
<small>
|
||||
{authorizationActive
|
||||
? `有效至 ${stamp(authorization.expires_at ?? '')}`
|
||||
: sync.canSign
|
||||
: inSync
|
||||
? '已同步,无需签发'
|
||||
: sync.canSign
|
||||
? '可在下方签发'
|
||||
: '需管理员签发'}
|
||||
</small>
|
||||
@@ -2045,7 +2064,7 @@ export function ReleaseTargetsView(props: ViewProps) {
|
||||
) : null}
|
||||
<button
|
||||
type="button"
|
||||
className="rel-primary"
|
||||
className={inSync ? 'rel-primary rel-synced' : 'rel-primary'}
|
||||
onClick={primaryAction.run}
|
||||
disabled={primaryAction.disabled}
|
||||
title={primaryAction.hint}
|
||||
@@ -2056,12 +2075,13 @@ export function ReleaseTargetsView(props: ViewProps) {
|
||||
版本与快照
|
||||
</button>
|
||||
</div>
|
||||
{gate.reasons.length > 0 ? (
|
||||
{/* 已同步时闸口缺项(多半只是授权过期)跟下一步无关:不催、不自动展开,缺项仍在折叠区里可查。 */}
|
||||
{gate.reasons.length > 0 && !inSync ? (
|
||||
<p className="rel-hint">还差 {gate.reasons.length} 项条件,展开“发布前检查”查看原因。</p>
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
<details className="rel-check" id="rel-check" open={gate.reasons.length > 0}>
|
||||
<details className="rel-check" id="rel-check" open={gate.reasons.length > 0 && !inSync}>
|
||||
<summary>
|
||||
发布前检查
|
||||
{gate.reasons.length > 0 ? `(${gate.reasons.length} 项未满足)` : '(已满足)'}
|
||||
@@ -2127,10 +2147,6 @@ export function ReleaseTargetsView(props: ViewProps) {
|
||||
sync={sync}
|
||||
baseline={baseline}
|
||||
verification={verification}
|
||||
canCapture={canCapture}
|
||||
canWrite={canWrite}
|
||||
pendingCapture={pendingCapture}
|
||||
onCapture={onCapture}
|
||||
onOpen={() => onDrawer(true)}
|
||||
/>
|
||||
)}
|
||||
@@ -2560,13 +2576,6 @@ export function ReleaseTargets() {
|
||||
onCapture={() => void startCapture()}
|
||||
onRecover={(windowJobID) => void recover(windowJobID)}
|
||||
/>
|
||||
<LegacySourceAssociation
|
||||
key={scope}
|
||||
scope={scope}
|
||||
snapshots={page?.snapshots ?? []}
|
||||
admin={role === 'admin'}
|
||||
onBound={() => load()}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user