去掉页头副标题与刷新状态按钮、工程师/管理员权限条、活动版本横幅、 与向导重复的模块说明,以及「去掉来源」按钮(保留停用来源与修订历史)。
This commit is contained in:
@@ -135,10 +135,6 @@ export function SourceWizard({
|
||||
<div className="source-wizard-bar">
|
||||
<div>
|
||||
<h3>数据源</h3>
|
||||
<p className="hint">
|
||||
一个入口添加:{kinds.map((item) => item.title).join(' / ')}。对内/对外不在这里配置,去「来源与目录」标注。
|
||||
单篇钉钉文档或表格把链接发给我,我用 dws 直接导入。
|
||||
</p>
|
||||
</div>
|
||||
<button type="button" className="source-wizard-open" onClick={() => setOpen(true)}>
|
||||
+ 添加数据源
|
||||
|
||||
@@ -185,24 +185,22 @@ describe('SystemSettingsView', () => {
|
||||
onRefresh={vi.fn()}
|
||||
/>
|
||||
)
|
||||
for (const text of [
|
||||
'系统设置',
|
||||
'数据源配置',
|
||||
'服务配置',
|
||||
'存储与备份',
|
||||
'刷新策略',
|
||||
'设置服务已启用',
|
||||
'当前活动版本',
|
||||
for (const text of ['系统设置', '数据源配置', '服务配置', '存储与备份', '刷新策略']) expect(html).toContain(text)
|
||||
// 主人 2026-10-26 要求去掉的噪声:页头副标题、刷新状态、权限条、活动版本横幅。
|
||||
for (const removed of [
|
||||
'查看内容源、服务与备份状态',
|
||||
'刷新状态',
|
||||
'文档工程师可调整',
|
||||
'管理员设置已锁定',
|
||||
'设置服务已启用',
|
||||
])
|
||||
expect(html).toContain(text)
|
||||
expect(html).not.toContain(removed)
|
||||
// 需求(2026-10-14 收敛):数据源配置只剩两个入口 —— dws 导入(按当前钉钉账号发现)
|
||||
// 与 PP 导入;AList/静态钉钉知识库等来源类型不再出现在这里(也没有折叠开关兜着)。
|
||||
for (const hidden of ['公司级技术支持知识库', '专用浏览器扫码会话', '显示 AList/钉钉知识库来源'])
|
||||
expect(html).not.toContain(hidden)
|
||||
expect(html).toContain('dws 导入')
|
||||
expect(html).toContain('PP 导入')
|
||||
// 统一入口后不再按类型分标题:PP 与钉钉共用同一张清单与同一个添加向导。
|
||||
expect(html).not.toContain('PP 导入')
|
||||
// 需求(2026-10-10):数据源配置不再做文件格式筛选(格式由目录级标注决定)。
|
||||
for (const removed of ['文件格式筛选', '未勾选的一律不取件', '保存保留格式', '恢复继承上级规则'])
|
||||
expect(html).not.toContain(removed)
|
||||
@@ -562,8 +560,8 @@ describe('SystemSettingsView 数据源配置的默认清单', () => {
|
||||
expect(html).not.toContain(hidden)
|
||||
// 统一入口:一个「+ 添加数据源」向导,不再有按类型分家的 dws 导入面板标题。
|
||||
expect(html).toContain('+ 添加数据源')
|
||||
expect(html).toContain('PP 导入')
|
||||
expect(html).toContain('去掉来源</button>')
|
||||
expect(html).not.toContain('PP 导入')
|
||||
expect(html).not.toContain('去掉来源')
|
||||
expect(html).toContain('端点与凭据')
|
||||
// PP 来源的卡片操作照旧:改刷新周期、启停、看修订历史。
|
||||
for (const kept of ['查看修订历史', '保存并启用调度', '停用来源', '自动刷新周期']) expect(html).toContain(kept)
|
||||
@@ -571,8 +569,9 @@ describe('SystemSettingsView 数据源配置的默认清单', () => {
|
||||
// 文档工程师看不到添加向导与「去掉来源」:两者都是管理员动作。
|
||||
const engineer = view('engineer')
|
||||
expect(engineer).not.toContain('+ 添加数据源')
|
||||
expect(engineer).not.toContain('去掉来源</button>')
|
||||
expect(engineer).toContain('PP 导入')
|
||||
expect(engineer).not.toContain('去掉来源')
|
||||
// PP 与钉钉共用同一张清单:工程师看得到卡,只是没有添加与归档。
|
||||
expect(engineer).toContain('PP资料下载中心')
|
||||
})
|
||||
})
|
||||
describe('ppSourceConnections(数据源配置的清单规则)', () => {
|
||||
|
||||
@@ -165,27 +165,8 @@ function SourceSettingsCard({
|
||||
const [showHistory, setShowHistory] = useState(false)
|
||||
const [history, setHistory] = useState<SourceSettingsRevision[] | null>(null)
|
||||
const [pendingDisable, setPendingDisable] = useState(false)
|
||||
// 「去掉来源」= 归档下架:先弹确认,再调后端(后端会再校验一次管理员权限)。
|
||||
const [pendingArchive, setPendingArchive] = useState(false)
|
||||
const scheduled = connection.source_type !== 'manual'
|
||||
|
||||
// 归档下架:来源从列表、目录、调度与扫描里消失,但数据不删;重新登记同一来源即复活。
|
||||
const archive = async () => {
|
||||
setBusy(true)
|
||||
setFailure(null)
|
||||
setMessage(null)
|
||||
try {
|
||||
await archiveSourceConnection(connection.id)
|
||||
setMessage(`「${connection.name}」已归档下架:列表、来源与目录、计划刷新里都不再出现,数据保留可恢复。`)
|
||||
setPendingArchive(false)
|
||||
onSourcesChanged()
|
||||
} catch (cause) {
|
||||
setFailure(cause instanceof Error ? cause.message : '去掉来源失败')
|
||||
} finally {
|
||||
setBusy(false)
|
||||
}
|
||||
}
|
||||
|
||||
const submit = async (nextEnabled: boolean) => {
|
||||
setBusy(true)
|
||||
setMessage(null)
|
||||
@@ -288,11 +269,6 @@ function SourceSettingsCard({
|
||||
<button className="link" onClick={() => void loadHistory()}>
|
||||
{showHistory ? '收起修订历史' : '查看修订历史'}
|
||||
</button>
|
||||
{isAdmin ? (
|
||||
<button className="link danger" disabled={busy} onClick={() => setPendingArchive(true)}>
|
||||
去掉来源
|
||||
</button>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
{message ? (
|
||||
@@ -346,26 +322,6 @@ function SourceSettingsCard({
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
{pendingArchive ? (
|
||||
<div className="modal-backdrop" role="dialog" aria-modal="true">
|
||||
<div className="modal-card">
|
||||
<h3>去掉「{connection.name}」?</h3>
|
||||
<p>
|
||||
去掉 =
|
||||
归档下架:该来源会从数据源配置、来源与目录、计划刷新与手动扫描里摘掉。目录快照、发布记录与审计数据全部保留,
|
||||
随时可恢复(用 dws 重新登记同一来源即原地复活)。此操作会先由后端再次校验管理员权限。
|
||||
</p>
|
||||
<div className="modal-actions">
|
||||
<button className="danger" disabled={busy} onClick={() => void archive()}>
|
||||
{busy ? '正在归档…' : '确认去掉'}
|
||||
</button>
|
||||
<button className="secondary" disabled={busy} onClick={() => setPendingArchive(false)}>
|
||||
取消
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
</article>
|
||||
)
|
||||
}
|
||||
@@ -384,7 +340,6 @@ export function SystemSettingsView({
|
||||
saveMessage,
|
||||
onSave,
|
||||
onSourcesChanged,
|
||||
onRefresh,
|
||||
initialSection = 'sources',
|
||||
}: Props) {
|
||||
const auth = useOptionalAuth()
|
||||
@@ -456,11 +411,7 @@ export function SystemSettingsView({
|
||||
<header className="hero compact">
|
||||
<div>
|
||||
<h1>系统设置</h1>
|
||||
<p className="subtitle">查看内容源、服务与备份状态;来源调度与刷新参数采用版本化保存。</p>
|
||||
</div>
|
||||
<button onClick={onRefresh} disabled={loading}>
|
||||
{loading ? '刷新中…' : '刷新状态'}
|
||||
</button>
|
||||
</header>
|
||||
{error ? (
|
||||
<div className="error-banner" role="alert">
|
||||
@@ -483,29 +434,8 @@ export function SystemSettingsView({
|
||||
))}
|
||||
</nav>
|
||||
<div className="settings-content">
|
||||
<div className="settings-role-strip">
|
||||
<span className="engineer-role">文档工程师可调整:来源调度周期、刷新间隔、停滞判断</span>
|
||||
<span className="admin-role">管理员设置已锁定:端点、凭据、映射、生产开关</span>
|
||||
</div>
|
||||
<div className="simulation-banner server-settings-banner">
|
||||
<strong>设置服务已启用</strong>
|
||||
<span>
|
||||
当前活动版本 · 启用人 {settings.updated_by} · 启用时间{' '}
|
||||
{settings.activated_at ? new Date(settings.activated_at).toLocaleString('zh-CN') : '待激活'}
|
||||
;新设置先验证,再原子切换。
|
||||
</span>
|
||||
</div>
|
||||
{section === 'sources' ? (
|
||||
<section className="settings-panel wide source-settings-panel" id="settings-sources">
|
||||
<div className="settings-section-heading">
|
||||
<div>
|
||||
<h2>数据源配置</h2>
|
||||
<p>
|
||||
一个入口添加:<strong>钉钉知识库 / 钉盘</strong> 用当前钉钉账号列出可加入的空间,
|
||||
单篇文档或表格把链接发给我用 dws 导入。对内/对外不在这里配置,去「来源与目录」标注。
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{identity?.role === 'admin' ? (
|
||||
<SourceWizard
|
||||
registeredNames={connections.map((item) => item.name)}
|
||||
@@ -514,15 +444,6 @@ export function SystemSettingsView({
|
||||
/>
|
||||
) : null}
|
||||
<div className="settings-source-group" id="settings-sources-pp">
|
||||
<div className="settings-section-heading sub">
|
||||
<div>
|
||||
<h3>PP 导入</h3>
|
||||
<p>
|
||||
公开只读的 PP 资料下载中心。这里的「去掉来源」是归档下架:从列表、来源与目录、计划刷新里摘掉,
|
||||
但目录快照与发布记录不删,随时可恢复。
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{ppConnections.length ? (
|
||||
<div className="settings-source-list">
|
||||
{ppConnections.map((connection) => (
|
||||
|
||||
Reference in New Issue
Block a user