业务名「对内知识库」在 WeKnora 里叫 wiki-demo,两边对不上号。 页面从测试知识库绑定读取库名并拼在业务名后,读不到就只显示业务名, 不影响发布状态判定。
This commit is contained in:
+37
-11
@@ -32,6 +32,7 @@ import { useOptionalAuth } from './auth'
|
|||||||
import './releaseTargets.css'
|
import './releaseTargets.css'
|
||||||
import { RestoreVerificationSection } from './RestoreVerificationSection'
|
import { RestoreVerificationSection } from './RestoreVerificationSection'
|
||||||
import { fetchSnapshotVerification } from './restoreVerification'
|
import { fetchSnapshotVerification } from './restoreVerification'
|
||||||
|
import { fetchRoutingBindings } from './routingBindings'
|
||||||
|
|
||||||
// 一个知识库对应一个发布工作区。主操作随封存、授权、执行状态推进;
|
// 一个知识库对应一个发布工作区。主操作随封存、授权、执行状态推进;
|
||||||
// 诊断按需展开,维护占用与失败恢复始终可见。
|
// 诊断按需展开,维护占用与失败恢复始终可见。
|
||||||
@@ -106,6 +107,8 @@ interface ViewProps {
|
|||||||
notice: string | null
|
notice: string | null
|
||||||
scope: Scope
|
scope: Scope
|
||||||
onScope: (scope: Scope) => void
|
onScope: (scope: Scope) => void
|
||||||
|
// 真实库名(来自测试知识库绑定):scope 是业务名,光看"对内知识库"对不上 WeKnora 里的库。
|
||||||
|
kbNames?: Record<Scope, string>
|
||||||
drawerOpen: boolean
|
drawerOpen: boolean
|
||||||
onDrawer: (open: boolean) => void
|
onDrawer: (open: boolean) => void
|
||||||
expandedSnapshot: string | null
|
expandedSnapshot: string | null
|
||||||
@@ -175,6 +178,11 @@ function scopeView(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const scopeName = (scope: Scope) => (scope === 'internal' ? '对内知识库' : '对外知识库')
|
const scopeName = (scope: Scope) => (scope === 'internal' ? '对内知识库' : '对外知识库')
|
||||||
|
// 绑定里拿不到库名时只显示业务名,不编一个名字出来。
|
||||||
|
const scopeTitle = (scope: Scope, kbName?: string) => {
|
||||||
|
const kb = kbName?.trim()
|
||||||
|
return kb ? `${scopeName(scope)} · ${kb}` : scopeName(scope)
|
||||||
|
}
|
||||||
|
|
||||||
// 生产目标必须按接口的四类状态原样呈现:把"已读且为空"和"读不到"都写成"未知",
|
// 生产目标必须按接口的四类状态原样呈现:把"已读且为空"和"读不到"都写成"未知",
|
||||||
// 会让人去点一个必然被拒绝的"建立基线"(后端对空目标返回 409 library_baseline_target_empty,
|
// 会让人去点一个必然被拒绝的"建立基线"(后端对空目标返回 409 library_baseline_target_empty,
|
||||||
@@ -1794,6 +1802,8 @@ function Drawer({
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const viewScopeLabel = (scope: Scope, kbNames?: Record<Scope, string>) => scopeTitle(scope, kbNames?.[scope])
|
||||||
|
|
||||||
export function ReleaseTargetsView(props: ViewProps) {
|
export function ReleaseTargetsView(props: ViewProps) {
|
||||||
const {
|
const {
|
||||||
page,
|
page,
|
||||||
@@ -1805,6 +1815,7 @@ export function ReleaseTargetsView(props: ViewProps) {
|
|||||||
notice,
|
notice,
|
||||||
scope,
|
scope,
|
||||||
onScope,
|
onScope,
|
||||||
|
kbNames,
|
||||||
drawerOpen,
|
drawerOpen,
|
||||||
onDrawer,
|
onDrawer,
|
||||||
expandedSnapshot,
|
expandedSnapshot,
|
||||||
@@ -1932,7 +1943,7 @@ export function ReleaseTargetsView(props: ViewProps) {
|
|||||||
className={isSelected ? 'rel-tab selected' : 'rel-tab'}
|
className={isSelected ? 'rel-tab selected' : 'rel-tab'}
|
||||||
onClick={() => onScope(item.scope)}
|
onClick={() => onScope(item.scope)}
|
||||||
>
|
>
|
||||||
<strong>{scopeName(item.scope)}</strong>
|
<strong>{viewScopeLabel(item.scope, kbNames)}</strong>
|
||||||
<span className={`rel-pill ${status.tone}`}>{status.text}</span>
|
<span className={`rel-pill ${status.tone}`}>{status.text}</span>
|
||||||
</button>
|
</button>
|
||||||
)
|
)
|
||||||
@@ -1956,7 +1967,7 @@ export function ReleaseTargetsView(props: ViewProps) {
|
|||||||
<div className="rel-panel rel-jobhead">
|
<div className="rel-panel rel-jobhead">
|
||||||
<div className="rel-between">
|
<div className="rel-between">
|
||||||
<h2>
|
<h2>
|
||||||
{scopeName(scope)} ·{' '}
|
{viewScopeLabel(scope, kbNames)} ·{' '}
|
||||||
{active
|
{active
|
||||||
? `${jobKindText(view.job?.kind)}进行中`
|
? `${jobKindText(view.job?.kind)}进行中`
|
||||||
: view.snapshot
|
: view.snapshot
|
||||||
@@ -2191,6 +2202,8 @@ export function ReleaseTargets() {
|
|||||||
const [drawerOpen, setDrawerOpen] = useState(false)
|
const [drawerOpen, setDrawerOpen] = useState(false)
|
||||||
const [expandedSnapshot, setExpandedSnapshot] = useState<string | null>(null)
|
const [expandedSnapshot, setExpandedSnapshot] = useState<string | null>(null)
|
||||||
const [pendingCapture, setPendingCapture] = useState(false)
|
const [pendingCapture, setPendingCapture] = useState(false)
|
||||||
|
// 真实库名只用于显示:读不到就退回业务名,不让它影响发布状态。
|
||||||
|
const [kbNames, setKbNames] = useState<Record<Scope, string>>({ internal: '', external: '' })
|
||||||
const [pendingReconcileCapture, setPendingReconcileCapture] = useState('')
|
const [pendingReconcileCapture, setPendingReconcileCapture] = useState('')
|
||||||
const [now, setNow] = useState(() => Date.now())
|
const [now, setNow] = useState(() => Date.now())
|
||||||
|
|
||||||
@@ -2198,15 +2211,24 @@ export function ReleaseTargets() {
|
|||||||
const seq = ++loadSeq.current
|
const seq = ++loadSeq.current
|
||||||
setLoading(true)
|
setLoading(true)
|
||||||
try {
|
try {
|
||||||
const [snapshots, captures, internalOverview, externalOverview, internalMaintenance, externalMaintenance] =
|
const [
|
||||||
await Promise.all([
|
snapshots,
|
||||||
fetchLibrarySnapshots(signal),
|
captures,
|
||||||
fetchLibraryCaptures(signal),
|
internalOverview,
|
||||||
fetchLibraryOverview('internal', signal),
|
externalOverview,
|
||||||
fetchLibraryOverview('external', signal),
|
internalMaintenance,
|
||||||
fetchLibraryMaintenance('internal', signal),
|
externalMaintenance,
|
||||||
fetchLibraryMaintenance('external', signal),
|
bindings,
|
||||||
])
|
] = await Promise.all([
|
||||||
|
fetchLibrarySnapshots(signal),
|
||||||
|
fetchLibraryCaptures(signal),
|
||||||
|
fetchLibraryOverview('internal', signal),
|
||||||
|
fetchLibraryOverview('external', signal),
|
||||||
|
fetchLibraryMaintenance('internal', signal),
|
||||||
|
fetchLibraryMaintenance('external', signal),
|
||||||
|
// 库名只是展示用:读不到(未登录/WeKnora 未连接)不能让整页报错。
|
||||||
|
fetchRoutingBindings(signal).catch(() => null),
|
||||||
|
])
|
||||||
// 只读既有作业详情接口,按维护记录的 owner_job_id 精确取;读不到就记下来,
|
// 只读既有作业详情接口,按维护记录的 owner_job_id 精确取;读不到就记下来,
|
||||||
// 不用 overview 的最新作业兜底(那是另一件事,会把失败窗口显示成已完成)。
|
// 不用 overview 的最新作业兜底(那是另一件事,会把失败窗口显示成已完成)。
|
||||||
const ownerIDs = {
|
const ownerIDs = {
|
||||||
@@ -2228,6 +2250,9 @@ export function ReleaseTargets() {
|
|||||||
setOverviews({ internal: internalOverview, external: externalOverview })
|
setOverviews({ internal: internalOverview, external: externalOverview })
|
||||||
setMaintenances({ internal: internalMaintenance, external: externalMaintenance })
|
setMaintenances({ internal: internalMaintenance, external: externalMaintenance })
|
||||||
setMaintenanceJobs({ internal: internalOwnerJob, external: externalOwnerJob })
|
setMaintenanceJobs({ internal: internalOwnerJob, external: externalOwnerJob })
|
||||||
|
if (bindings) {
|
||||||
|
setKbNames({ internal: bindings.internal_kb_name, external: bindings.external_kb_name })
|
||||||
|
}
|
||||||
setNow(Date.now())
|
setNow(Date.now())
|
||||||
setError(null)
|
setError(null)
|
||||||
} catch (loadError) {
|
} catch (loadError) {
|
||||||
@@ -2486,6 +2511,7 @@ export function ReleaseTargets() {
|
|||||||
// F10: 旧操作通知属于旧作业/旧对象,切范围后不得继续挂在页顶。
|
// F10: 旧操作通知属于旧作业/旧对象,切范围后不得继续挂在页顶。
|
||||||
setNotice(null)
|
setNotice(null)
|
||||||
}}
|
}}
|
||||||
|
kbNames={kbNames}
|
||||||
drawerOpen={drawerOpen}
|
drawerOpen={drawerOpen}
|
||||||
onDrawer={setDrawerOpen}
|
onDrawer={setDrawerOpen}
|
||||||
expandedSnapshot={expandedSnapshot}
|
expandedSnapshot={expandedSnapshot}
|
||||||
|
|||||||
Reference in New Issue
Block a user