From a55d7f454e74f3a123b62180adad90a7ab16868b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=9A=E7=AB=A0=E6=B5=A9?= Date: Mon, 26 Oct 2026 19:16:44 +0800 Subject: [PATCH] =?UTF-8?q?style(settings):=20=E7=B2=BE=E7=AE=80=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=BA=90=E5=88=97=E8=A1=A8=E5=B9=B6=E6=94=B6=E8=B5=B7?= =?UTF-8?q?=E4=BD=8E=E9=A2=91=E7=AE=A1=E7=90=86=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/SystemSettings.test.tsx | 18 +++-- web/src/SystemSettings.tsx | 126 ++++++++++++++++---------------- web/src/systemSettings.css | 53 ++++++++++++-- 3 files changed, 119 insertions(+), 78 deletions(-) diff --git a/web/src/SystemSettings.test.tsx b/web/src/SystemSettings.test.tsx index 3f8fad2..4df0ada 100644 --- a/web/src/SystemSettings.test.tsx +++ b/web/src/SystemSettings.test.tsx @@ -198,9 +198,8 @@ describe('SystemSettingsView', () => { // 需求(2026-10-14 收敛):数据源配置只剩两个入口 —— dws 导入(按当前钉钉账号发现) // 与 PP 导入;AList/静态钉钉知识库等来源类型不再出现在这里(也没有折叠开关兜着)。 expect(html).toContain('公司级技术支持知识库') - expect(html).toContain('dws 共享授权') - for (const hidden of ['专用浏览器扫码会话', '显示 AList/钉钉知识库来源']) - expect(html).not.toContain(hidden) + expect(html).not.toContain('dws 共享授权') + for (const hidden of ['专用浏览器扫码会话', '显示 AList/钉钉知识库来源']) expect(html).not.toContain(hidden) // 统一入口后不再按类型分标题:PP 与钉钉共用同一张清单与同一个添加向导。 expect(html).not.toContain('PP 导入') // 需求(2026-10-10):数据源配置不再做文件格式筛选(格式由目录级标注决定)。 @@ -291,9 +290,10 @@ describe('SystemSettingsView', () => { expect(servicesHtml).toContain('端点探测:暂无真实探测结果') // V1: left-nav section controls, per-source schedule editing, danger modal & history affordances. expect(html).toContain('settings-nav') - for (const kept of ['查看修订历史', '保存并启用调度', '停用来源', '下次自动刷新']) expect(html).toContain(kept) + for (const kept of ['更多', '下次自动刷新']) expect(html).toContain(kept) + for (const hidden of ['查看修订历史', '保存并启用调度', '停用来源']) expect(html).not.toContain(hidden) expect(html).not.toContain('本页只列 PP 来源') - expect(html).toContain('本地手工导入来源不支持定时刷新') + expect(html).not.toContain('本地手工导入来源不支持定时刷新') // dead buttons removed expect(html).not.toContain('添加内容源') expect(html).not.toContain('管理员编辑') @@ -561,9 +561,11 @@ describe('SystemSettingsView 数据源配置的默认清单', () => { expect(html).toContain('+ 添加数据源') expect(html).not.toContain('PP 导入') expect(html).not.toContain('去掉来源') - expect(html).toContain('端点与凭据') - // PP 来源的卡片操作照旧:改刷新周期、启停、看修订历史。 - for (const kept of ['查看修订历史', '保存并启用调度', '停用来源', '自动刷新周期']) expect(html).toContain(kept) + for (const removed of ['端点与凭据', '认证方式', '查看修订历史', '保存并启用调度', '停用来源', '自动刷新周期']) + expect(html).not.toContain(removed) + expect(html).toContain('更多') + expect(html).toContain('aria-expanded="false"') + expect(html).toContain('已启用') for (const removed of ['+ 新增钉钉知识库', '文件格式筛选']) expect(html).not.toContain(removed) // 文档工程师看不到添加向导与「去掉来源」:两者都是管理员动作。 const engineer = view('engineer') diff --git a/web/src/SystemSettings.tsx b/web/src/SystemSettings.tsx index bf03fa3..1830d0e 100644 --- a/web/src/SystemSettings.tsx +++ b/web/src/SystemSettings.tsx @@ -76,12 +76,6 @@ const sourceTypeLabels: Record = { export const ppSourceConnections = (connections: SourceConnectionListItem[]) => connections.filter((item) => item.source_type === 'pp') -const sourceAuthLabels: Record = { - dingtalk: 'dws 共享授权', - pp: '公开只读访问', - alist: '直连 API Token', - manual: '离线导入,无在线认证', -} const secondsLabel = (value: number) => value < 60 ? `${value}秒` : value < 3600 ? `${value / 60}分钟` : `${value / 3600}小时` export const visibleSaveMessage = (message: string | null, dirty: boolean) => (dirty ? null : message) @@ -165,6 +159,7 @@ function SourceSettingsCard({ const [showHistory, setShowHistory] = useState(false) const [history, setHistory] = useState(null) const [pendingDisable, setPendingDisable] = useState(false) + const [showOptions, setShowOptions] = useState(false) const scheduled = connection.source_type !== 'manual' const submit = async (nextEnabled: boolean) => { @@ -195,6 +190,10 @@ function SourceSettingsCard({ } const loadHistory = async () => { + if (showHistory) { + setShowHistory(false) + return + } setShowHistory(true) if (history) return try { @@ -210,67 +209,66 @@ function SourceSettingsCard({
{connection.name} - - {sourceTypeLabels[connection.source_type] ?? connection.source_type} - {connection.enabled ? '' : ' · 已停用'} + {sourceTypeLabels[connection.source_type] ?? connection.source_type} +
+
+ + {connection.enabled ? '已启用' : '已停用'} + {connection.enabled ? formatHorizon(connection.next_refresh_at) : '自动刷新已暂停'}
-
-
-
认证方式
-
{sourceAuthLabels[connection.source_type] ?? '按连接配置'}
-
-
-
端点与凭据
-
已保存,不可回读(草稿留空即沿用现值)
-
-
-
当前调度
-
{connection.enabled ? formatHorizon(connection.next_refresh_at) : '停用中(不入队)'}
-
-
-
- {scheduled ? ( - - ) : ( - 本地手工导入来源不支持定时刷新,只能手动触发扫描。 - )} - {connection.enabled ? ( -
- - + {showOptions ? ( +
+ {scheduled ? ( + + ) : ( + 本地手工导入来源不支持定时刷新,只能手动触发扫描。 + )} + {connection.enabled ? ( +
+ + +
+ ) : ( +
+ +
+ )} + {connection.source_type === 'dingtalk' && isAdmin ? : null} +
+
- ) : ( -
- -
- )} - {connection.source_type === 'dingtalk' && isAdmin ? : null} -
-
-
+ ) : null} {message ? (

{message} @@ -281,7 +279,7 @@ function SourceSettingsCard({ {failure}

) : null} - {showHistory && history ? ( + {showOptions && showHistory && history ? (
    {history.map((item) => (
  • @@ -303,7 +301,7 @@ function SourceSettingsCard({ ))}
) : null} - {showHistory && !history ? 正在加载修订历史… : null} + {showOptions && showHistory && !history ? 正在加载修订历史… : null} {pendingDisable ? (
diff --git a/web/src/systemSettings.css b/web/src/systemSettings.css index 478e78a..221d345 100644 --- a/web/src/systemSettings.css +++ b/web/src/systemSettings.css @@ -235,13 +235,13 @@ } .settings-source-row { display: grid; - grid-template-columns: minmax(170px, 0.8fr) minmax(420px, 2fr) minmax(130px, 0.55fr) auto; + grid-template-columns: minmax(180px, 1fr) minmax(180px, 0.8fr) auto; align-items: center; gap: 14px; border: 1px solid var(--border-base); border-radius: 10px; - padding: 12px; - background: var(--bg-page); + padding: 18px 20px; + background: var(--bg-panel); } .settings-source-name { display: grid; @@ -249,11 +249,11 @@ } .settings-source-name strong { color: var(--ink-base); - font-size: 12px; + font-size: 14px; } .settings-source-name span { color: var(--ink-mute); - font-size: 9px; + font-size: 12px; } .settings-source-row dl { display: grid; @@ -291,6 +291,39 @@ padding: 7px 9px; box-shadow: none; } +.settings-source-status { + display: grid; + gap: 6px; + font-size: 12px; +} +.settings-source-status small { + color: var(--ink-mute); + font-size: 11px; +} +.source-enabled { + color: #18704b; +} +.source-disabled { + color: var(--ink-mute); +} +.settings-source-row .source-schedule-form { + grid-column: 1 / -1; + border-top: 1px solid var(--border-base); + padding-top: 16px; +} +.settings-source-row > .success-message, +.settings-source-row > .error-message, +.settings-source-row > .revision-list { + grid-column: 1 / -1; +} +.settings-source-row .source-more { + font-size: 12px; + min-width: 64px; +} +.settings-source-row .source-more:focus-visible { + outline: 2px solid #2978bd; + outline-offset: 3px; +} .dependency-grid { margin-top: 12px; } @@ -308,7 +341,15 @@ } @media (max-width: 1100px) { .settings-source-row { - grid-template-columns: 1fr 1fr; + grid-template-columns: minmax(0, 1fr) auto; + } + .settings-source-status { + grid-column: 1; + grid-row: 2; + } + .settings-source-row .source-more { + grid-column: 2; + grid-row: 1; } .settings-source-row dl { grid-column: 1/-1;