发布管理:状态卡 + 一个主按钮,准备动作与检查项分层次收纳,去掉重复入口。 系统设置:F02 停滞阈值接入活动配置;F03 分区保存边界;F05/F06 生产绑定分层与凭据说明; F07 备份未接主机/未知证据如实显示;F09 分区独立加载与保存后重探;F10 文案精简;F11 重置密码对话框。
This commit is contained in:
+203
-175
@@ -958,39 +958,15 @@ function ProtectionCard({
|
||||
<dt>恢复条件</dt>
|
||||
<dd>{gate.reasons.length === 0 ? '已满足' : `缺 ${gate.reasons.length} 项`}</dd>
|
||||
</dl>
|
||||
<RestoreVerificationSection
|
||||
scope={scope}
|
||||
isAdmin={sync.canSign}
|
||||
onAccepted={verification.onAccepted}
|
||||
onComplete={verification.onComplete}
|
||||
/>
|
||||
{gate.reasons.length > 0 ? (
|
||||
<ul className="rel-gate" aria-label="恢复与启动条件">
|
||||
{gate.reasons.map((reason) => (
|
||||
<li key={reason}>{reason}</li>
|
||||
))}
|
||||
</ul>
|
||||
) : null}
|
||||
<div className="rel-drawer-actions">
|
||||
{sync.canSign && authorization.state !== 'active' && targetSealed ? (
|
||||
<button type="button" className="rel-secondary" onClick={sync.onGrant} disabled={sync.pendingGrant}>
|
||||
{sync.pendingGrant ? '签发中…' : '签发同步授权(30 分钟)'}
|
||||
</button>
|
||||
) : null}
|
||||
{baseline.canStart && baselineNeeded ? (
|
||||
<button type="button" className="rel-secondary" onClick={baseline.onStart} disabled={baseline.pending}>
|
||||
{baseline.pending ? '投递中…' : '建立目标权威基线(维护隔离)'}
|
||||
</button>
|
||||
) : null}
|
||||
</div>
|
||||
<p className="rel-hint">
|
||||
{gate.reasons.length > 0
|
||||
? `启动与恢复条件还有 ${gate.reasons.length} 项未满足,见上方“发布前检查”。`
|
||||
: '启动与恢复条件已满足。'}
|
||||
</p>
|
||||
{authorization.state !== 'active' && !sync.canSign ? (
|
||||
<p className="rel-hint">同步授权只能由管理员按目标+快照签发;工程师看不到签发入口。</p>
|
||||
) : null}
|
||||
<p className="rel-hint">同步启动后,这里显示本次生产恢复点及备份进度,可直接查看对应快照。</p>
|
||||
<button type="button" className="rel-secondary" onClick={onOpen}>
|
||||
查看已有版本与快照 ›
|
||||
</button>
|
||||
<p className="rel-warn">恢复版本会恢复一整套生产知识状态,不回退测试知识库。</p>
|
||||
<p className="rel-warn">恢复会回退整套生产知识状态,不回退测试知识库。</p>
|
||||
</aside>
|
||||
)
|
||||
}
|
||||
@@ -1040,7 +1016,6 @@ function ReadyBody({
|
||||
return (
|
||||
<>
|
||||
<div className="rel-grid">
|
||||
<ChangeTable diff={diff} />
|
||||
<ProtectionCard
|
||||
production={production}
|
||||
productionNote={productionNote}
|
||||
@@ -1077,18 +1052,7 @@ function ReadyBody({
|
||||
: '还没有测试库封存。封存会短暂停住测试写入者,导出完整版本后恢复。'}
|
||||
</p>
|
||||
</div>
|
||||
{canCapture ? (
|
||||
<button
|
||||
type="button"
|
||||
className="rel-secondary"
|
||||
onClick={onCapture}
|
||||
disabled={pendingCapture || Boolean(view.activeJob)}
|
||||
>
|
||||
{pendingCapture ? '投递中…' : '封存测试版本'}
|
||||
</button>
|
||||
) : (
|
||||
<span className="rel-hint">{captureHint(view, canWrite)}</span>
|
||||
)}
|
||||
<span className="rel-hint">{canCapture ? '封存入口在页面顶部“下一步”。' : captureHint(view, canWrite)}</span>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
@@ -1918,17 +1882,69 @@ export function ReleaseTargetsView(props: ViewProps) {
|
||||
const gate = view.overview?.gate ?? { sync_allowed: false, reasons: ['整库状态接口不可用'] }
|
||||
const authorization = view.overview?.authorization ?? { state: 'none' as const, reason: '整库状态接口不可用' }
|
||||
|
||||
const sealed = Boolean(view.snapshot)
|
||||
const authorizationActive = authorization.state === 'active'
|
||||
// 主按钮永远是"同步"或"查看当前任务";准备动作(封存/基线/恢复验证/授权)
|
||||
// 作为次要按钮按状态出现,页面因此只有一个前进方向。
|
||||
const primaryAction = runningJob
|
||||
? {
|
||||
label: '查看当前任务',
|
||||
hint: `${jobKindText(runningJob.kind)}正在执行,不要重复启动。`,
|
||||
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,
|
||||
}
|
||||
const prepAction = !sealed
|
||||
? canCapture
|
||||
? {
|
||||
label: pendingCapture ? '封存中…' : '封存测试版本',
|
||||
hint: '只读导出测试库,生成一份可发布的整库版本。',
|
||||
disabled: pendingCapture,
|
||||
run: onCapture,
|
||||
}
|
||||
: { label: '尚无封存', hint: captureHint(view, canWrite), disabled: true, run: () => {} }
|
||||
: productionClass === 'nonempty' && baseline.canStart
|
||||
? {
|
||||
label: baseline.pending ? '投递中…' : '建立目标权威基线(维护隔离)',
|
||||
hint: '生产目标非空但还没有权威版本,先登记一份基线。',
|
||||
disabled: baseline.pending,
|
||||
run: baseline.onStart,
|
||||
}
|
||||
: !authorizationActive && sync.canSign
|
||||
? {
|
||||
label: sync.pendingGrant ? '签发中…' : '签发同步授权(30 分钟)',
|
||||
hint: '授权后才允许写生产;一次授权只对当前目标+快照有效。',
|
||||
disabled: sync.pendingGrant,
|
||||
run: sync.onGrant,
|
||||
}
|
||||
: null
|
||||
|
||||
const productionText =
|
||||
productionClass === 'known' && production?.version
|
||||
? production.version.version_label || `生效 ${production.version.snapshot_id.slice(0, 12)}`
|
||||
: productionClass === 'empty'
|
||||
? '目标已读且为空'
|
||||
: productionClass === 'unreachable'
|
||||
? '读取失败'
|
||||
: productionClass === 'nonempty'
|
||||
? '目标非空,尚无权威版本'
|
||||
: '未读取'
|
||||
|
||||
return (
|
||||
<section className="release-targets" aria-label="发布管理">
|
||||
<header className="rel-head page-header">
|
||||
<div>
|
||||
<h1 className="page-title">发布管理</h1>
|
||||
<p className="page-subtitle">测试维护与验证,生产按知识库版本同步。</p>
|
||||
<p className="page-subtitle">测试封存 → 生产同步:每一步只保留一个入口。</p>
|
||||
</div>
|
||||
<div className="rel-head-actions page-header-actions">
|
||||
<button type="button" className="rel-secondary" onClick={() => onDrawer(true)}>
|
||||
▣ 版本与快照
|
||||
</button>
|
||||
<button type="button" className="rel-secondary" onClick={onRefresh} disabled={loading}>
|
||||
{loading ? '刷新中…' : '刷新'}
|
||||
</button>
|
||||
@@ -1969,128 +1985,87 @@ export function ReleaseTargetsView(props: ViewProps) {
|
||||
) : null}
|
||||
{notice ? <p className="rel-notice">{notice}</p> : null}
|
||||
|
||||
<div className="rel-panel rel-jobhead">
|
||||
<div className="rel-between">
|
||||
<h2>
|
||||
{scopeName(scope)} ·{' '}
|
||||
{active
|
||||
? `${jobKindText(view.job?.kind)}进行中`
|
||||
: view.snapshot
|
||||
? '已封存,同步按条件放行'
|
||||
: '尚无测试封存'}
|
||||
</h2>
|
||||
<div className="rel-head-actions">
|
||||
<button type="button" className="rel-secondary" onClick={() => onDrawer(true)}>
|
||||
版本与快照
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className="rel-primary"
|
||||
onClick={() => {
|
||||
if (runningJob) {
|
||||
document.getElementById('rel-progress')?.scrollIntoView?.({ behavior: 'smooth', block: 'start' })
|
||||
return
|
||||
}
|
||||
sync.onStart()
|
||||
}}
|
||||
disabled={Boolean(runningJob) ? false : !sync.canStart || sync.pending}
|
||||
title={
|
||||
runningJob
|
||||
? `${jobKindText(runningJob.kind)}正在执行;请查看当前任务,不要重复启动`
|
||||
: sync.canStart
|
||||
? '按已签发的同步授权启动:先固定测试版本,再备份目标并写入'
|
||||
: `暂不能启动同步:${gate.reasons.join(';')}`
|
||||
}
|
||||
>
|
||||
{runningJob ? '查看当前任务' : sync.pending ? '投递中…' : '▶ 启动同步'}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<p className="rel-target-identity" aria-label="实际目标实例">
|
||||
目标实例 {view.overview?.target_instance || view.overview?.executor?.instance || '未读取'} · 项目{' '}
|
||||
{view.overview?.target_project || view.overview?.executor?.project || '未读取'} · 知识库{' '}
|
||||
{view.overview?.target_knowledge_base_id || target?.knowledge_base_id || '未读取'}({scopeName(scope)})
|
||||
<div className="rel-panel rel-status">
|
||||
<p className="rel-scope-state">
|
||||
{scopeName(scope)} ·{' '}
|
||||
{active ? `${jobKindText(view.job?.kind)}进行中` : sealed ? '已封存,同步按条件放行' : '尚无测试封存'}
|
||||
{sealed ? '(需要新版本时点上方“封存测试版本”)' : ''}
|
||||
</p>
|
||||
<p className="rel-versionline">
|
||||
目标当前{' '}
|
||||
{productionClass === 'known' && production?.version ? (
|
||||
<b>
|
||||
{production.version.version_label || `生效 ${production.version.snapshot_id.slice(0, 12)}`}
|
||||
{' · '}
|
||||
快照 {production.version.snapshot_id.slice(0, 12)}
|
||||
</b>
|
||||
) : productionClass === 'empty' ? (
|
||||
<b>目标已读且为空(首次发布)</b>
|
||||
) : productionClass === 'unreachable' ? (
|
||||
<b className="rel-unknown">读取失败:{production?.reason || '无法读取目标整库状态'}</b>
|
||||
) : productionClass === 'nonempty' ? (
|
||||
<b className="rel-unknown">目标非空,尚无权威版本</b>
|
||||
) : (
|
||||
<b className="rel-unknown">{productionNote}</b>
|
||||
)}
|
||||
{productionStale ? <em className="rel-scope">({STALE_NOTE})</em> : null} → 拟发布{' '}
|
||||
<b>{target ? `封存 ${target.snapshot_id.slice(0, 12)} · ${stamp(target.created_at)}` : '还没有测试封存'}</b> ·{' '}
|
||||
{publishStateText(view.job)}
|
||||
</p>
|
||||
<dl className="rel-metrics">
|
||||
<dl className="rel-status-grid">
|
||||
<div>
|
||||
<dt>新增文档</dt>
|
||||
<dd className={diff.state === 'computed' ? '' : 'rel-unknown'}>
|
||||
{diff.state === 'computed' ? diff.added.length : '未接入'}
|
||||
<dt>测试封存</dt>
|
||||
<dd className={sealed ? '' : 'rel-unknown'}>
|
||||
{sealed ? `快照 ${view.snapshot!.snapshot_id.slice(0, 12)}` : '尚无'}
|
||||
</dd>
|
||||
<small>{sealed ? stamp(view.snapshot!.created_at) : '先封存测试版本'}</small>
|
||||
</div>
|
||||
<div>
|
||||
<dt>更新文档</dt>
|
||||
<dd className={diff.state === 'computed' ? '' : 'rel-unknown'}>
|
||||
{diff.state === 'computed' ? diff.updated.length : '未接入'}
|
||||
</dd>
|
||||
<dt>生产当前</dt>
|
||||
<dd className={productionClass === 'known' ? '' : 'rel-unknown'}>{productionText}</dd>
|
||||
<small>{publishStateText(view.job)}</small>
|
||||
</div>
|
||||
<div>
|
||||
<dt>删除文档</dt>
|
||||
<dd className={diff.state === 'computed' ? '' : 'rel-unknown'}>
|
||||
{diff.state === 'computed' ? diff.removed.length : '未接入'}
|
||||
</dd>
|
||||
<dt>发布授权</dt>
|
||||
<dd className={authorizationActive ? '' : 'rel-unknown'}>{authorizationActive ? '已签发' : '未签发'}</dd>
|
||||
<small>
|
||||
{authorizationActive
|
||||
? `有效至 ${stamp(authorization.expires_at ?? '')}`
|
||||
: sync.canSign
|
||||
? '可在下方签发'
|
||||
: '需管理员签发'}
|
||||
</small>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Wiki 发布方式</dt>
|
||||
<dd>{target ? '完整快照' : '未接入'}</dd>
|
||||
<dt>最近预备份</dt>
|
||||
<dd className={prebackup.state === 'known' ? '' : 'rel-unknown'}>
|
||||
{prebackup.state === 'known' ? '已登记' : '无'}
|
||||
</dd>
|
||||
<small>
|
||||
{prebackup.state === 'known' && prebackup.version
|
||||
? stamp(prebackup.version.created_at)
|
||||
: '同步时自动生成'}
|
||||
</small>
|
||||
</div>
|
||||
</dl>
|
||||
{target?.source_identity ? (
|
||||
<details className="rel-source-identity">
|
||||
<summary>来源身份与完整摘要</summary>
|
||||
<p>
|
||||
来源实例:{target.source_identity.project} / {target.source_identity.app}
|
||||
</p>
|
||||
<p>
|
||||
来源租户 / 知识库:{target.source_identity.tenant_id} / {target.source_identity.knowledge_base_id}
|
||||
</p>
|
||||
<p>来源身份:{target.source_id}</p>
|
||||
<p>快照摘要:{target.snapshot_id}</p>
|
||||
</details>
|
||||
<div className="rel-status-actions">
|
||||
<p className="rel-next">
|
||||
<span>下一步</span>
|
||||
{prepAction && prepAction.disabled === false && !runningJob ? prepAction.hint : primaryAction.hint}
|
||||
</p>
|
||||
{prepAction && !runningJob ? (
|
||||
<button
|
||||
type="button"
|
||||
className="rel-secondary"
|
||||
onClick={prepAction.run}
|
||||
disabled={prepAction.disabled}
|
||||
title={prepAction.hint}
|
||||
>
|
||||
{prepAction.label}
|
||||
</button>
|
||||
) : null}
|
||||
<button
|
||||
type="button"
|
||||
className="rel-primary"
|
||||
onClick={primaryAction.run}
|
||||
disabled={primaryAction.disabled}
|
||||
title={primaryAction.hint}
|
||||
>
|
||||
{primaryAction.label}
|
||||
</button>
|
||||
<button type="button" className="rel-secondary" onClick={() => onDrawer(true)}>
|
||||
版本与快照
|
||||
</button>
|
||||
</div>
|
||||
{gate.reasons.length > 0 ? (
|
||||
<p className="rel-hint">还差 {gate.reasons.length} 项条件,展开“发布前检查”查看原因。</p>
|
||||
) : null}
|
||||
<ul className="rel-checklist">
|
||||
<li className={target ? 'ok' : 'unknown'}>
|
||||
{target
|
||||
? `✓ 文档解析与索引完整(${target.totals.chunks ?? 0} 分块 / ${target.totals.index_documents ?? 0} 索引)`
|
||||
: '○ 文档解析与索引:未接入'}
|
||||
{target ? (
|
||||
<em className="rel-scope">
|
||||
依据 {stamp(target.created_at)} 封存的测试库全库快照,不代表实时测试库已就绪
|
||||
</em>
|
||||
) : null}
|
||||
</li>
|
||||
<li className={target ? 'ok' : 'unknown'}>
|
||||
{target ? `✓ Wiki 快照完整(${target.totals.wiki_pages ?? 0} 页)` : '○ Wiki 快照:未接入'}
|
||||
{target ? <em className="rel-scope">同一份封存快照,不是实时 Wiki 队列状态</em> : null}
|
||||
</li>
|
||||
<li className={target ? 'ok' : 'unknown'}>
|
||||
{target ? `✓ 清单与摘要登记:${target.parts.length} 项部件摘要已记录` : '○ 数据完整性:尚无封存可核验'}
|
||||
{target ? (
|
||||
<em className="rel-scope">封存时逐项哈希登记;列表只校验清单自身,字节级复核在同步/恢复执行前进行</em>
|
||||
) : null}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<details className="rel-check" id="rel-check" open={gate.reasons.length > 0}>
|
||||
<summary>
|
||||
发布前检查
|
||||
{gate.reasons.length > 0 ? `(${gate.reasons.length} 项未满足)` : '(已满足)'}
|
||||
</summary>
|
||||
{gate.reasons.length > 0 ? (
|
||||
<ul className="rel-gate" aria-label="启动同步的缺项">
|
||||
{gate.reasons.map((reason) => (
|
||||
@@ -2098,26 +2073,47 @@ export function ReleaseTargetsView(props: ViewProps) {
|
||||
))}
|
||||
</ul>
|
||||
) : null}
|
||||
<p className="rel-footnote">启动后先固定测试版本,再备份生产。备份失败或恢复条件不满足,不进入生产写入。</p>
|
||||
</div>
|
||||
|
||||
<MaintenanceCard
|
||||
maintenance={maintenance}
|
||||
ownerJob={maintenanceOwnerJob}
|
||||
scope={scope}
|
||||
canWrite={canWrite}
|
||||
onRecover={onRecover}
|
||||
/>
|
||||
<ul className="rel-checklist">
|
||||
<li className={target ? 'ok' : 'unknown'}>
|
||||
{target
|
||||
? `✓ 文档解析与索引完整(${target.totals.chunks ?? 0} 分块 / ${target.totals.index_documents ?? 0} 索引)`
|
||||
: '○ 文档解析与索引:未接入(尚无封存)'}
|
||||
{target ? (
|
||||
<em className="rel-scope">
|
||||
依据 {stamp(target.created_at)} 封存的测试库全库快照,不代表实时测试库已就绪
|
||||
</em>
|
||||
) : null}
|
||||
</li>
|
||||
<li className={target ? 'ok' : 'unknown'}>
|
||||
{target ? `✓ Wiki 快照完整(${target.totals.wiki_pages ?? 0} 页)` : '○ Wiki 快照:未接入(尚无封存)'}
|
||||
{target ? <em className="rel-scope">同一份封存快照,不是实时 Wiki 队列状态</em> : null}
|
||||
</li>
|
||||
<li className={target ? 'ok' : 'unknown'}>
|
||||
{target ? `✓ 清单与摘要登记:${target.parts.length} 项部件摘要` : '○ 数据完整性:未接入(尚无封存可核验)'}
|
||||
{target ? (
|
||||
<em className="rel-scope">封存时逐项哈希登记;列表只校验清单自身,字节级复核在同步/恢复执行前进行</em>
|
||||
) : null}
|
||||
</li>
|
||||
</ul>
|
||||
<RestoreVerificationSection
|
||||
scope={scope}
|
||||
isAdmin={sync.canSign}
|
||||
onAccepted={verification.onAccepted}
|
||||
onComplete={verification.onComplete}
|
||||
/>
|
||||
</details>
|
||||
|
||||
{active ? (
|
||||
<ProgressBody
|
||||
view={view}
|
||||
now={now}
|
||||
onOpen={() => onDrawer(true)}
|
||||
canReconcileCapture={canReconcileCapture}
|
||||
pendingReconcileCapture={pendingReconcileCapture}
|
||||
onReconcileCapture={onReconcileCapture}
|
||||
/>
|
||||
<div id="rel-progress">
|
||||
<ProgressBody
|
||||
view={view}
|
||||
now={now}
|
||||
onOpen={() => onDrawer(true)}
|
||||
canReconcileCapture={canReconcileCapture}
|
||||
pendingReconcileCapture={pendingReconcileCapture}
|
||||
onReconcileCapture={onReconcileCapture}
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
<ReadyBody
|
||||
view={view}
|
||||
@@ -2139,6 +2135,38 @@ export function ReleaseTargetsView(props: ViewProps) {
|
||||
/>
|
||||
)}
|
||||
|
||||
<details className="rel-advanced">
|
||||
<summary>高级与历史(目标维护、差异明细、来源身份)</summary>
|
||||
<MaintenanceCard
|
||||
maintenance={maintenance}
|
||||
ownerJob={maintenanceOwnerJob}
|
||||
scope={scope}
|
||||
canWrite={canWrite}
|
||||
onRecover={onRecover}
|
||||
/>
|
||||
<ChangeTable diff={diff} />
|
||||
<p className="rel-target-identity" aria-label="实际目标实例">
|
||||
目标实例 {view.overview?.target_instance || view.overview?.executor?.instance || '未读取'} · 项目{' '}
|
||||
{view.overview?.target_project || view.overview?.executor?.project || '未读取'} · 知识库{' '}
|
||||
{view.overview?.target_knowledge_base_id || target?.knowledge_base_id || '未读取'}({scopeName(scope)})
|
||||
{productionStale ? <em className="rel-scope">({STALE_NOTE})</em> : null}
|
||||
</p>
|
||||
{target?.source_identity ? (
|
||||
<details className="rel-source-identity">
|
||||
<summary>来源身份与完整摘要</summary>
|
||||
<p>
|
||||
来源实例:{target.source_identity.project} / {target.source_identity.app}
|
||||
</p>
|
||||
<p>
|
||||
来源租户 / 知识库:{target.source_identity.tenant_id} / {target.source_identity.knowledge_base_id}
|
||||
</p>
|
||||
<p>来源身份:{target.source_id}</p>
|
||||
<p>快照摘要:{target.snapshot_id}</p>
|
||||
</details>
|
||||
) : null}
|
||||
<p className="rel-footnote">同步会先固定测试版本,再备份生产;备份失败或恢复条件不满足时不进入生产写入。</p>
|
||||
</details>
|
||||
|
||||
<Drawer
|
||||
view={view}
|
||||
page={page}
|
||||
|
||||
Reference in New Issue
Block a user