fix(admin): repair system maintenance controls

Implement server-side searchable user filtering for usage records, including backend search parameters and a shared frontend selector with loading, empty, and pinned-selected states.

Fix announcement deletion by cascading announcement read rows through a Postgres migration and defensive repository cleanup across supported backends.

Wire admin system purge and cleanup endpoints to real data deletion/maintenance flows, improve DataManagement messages, rebuild stats after stats purge, and add runtime OAuth token refresh maintenance when enabled.

Verified with rust-ci equivalent checks: cargo fmt, split clippy, split cargo tests, SQLite/Postgres/MySQL smoke tests, plus frontend npm ci, build, pages build, type-check, and targeted usage selector tests.
This commit is contained in:
Entropy.Xu
2026-05-07 21:26:40 +08:00
parent 2b439094c5
commit dd8c2ebec6
37 changed files with 2836 additions and 103 deletions

View File

@@ -106,11 +106,11 @@ const purgeItems: PurgeItem[] = [
},
{
key: 'stats',
title: '清空聚合数据',
description: '清空仪表盘统计聚合数据,保留原始使用记录',
buttonText: '清空聚合数据',
title: '清空统计聚合',
description: '删除统计聚合数据,保留原始使用记录;统计可从原始使用记录重新构建',
buttonText: '清空统计聚合',
icon: markRaw(PieChart),
confirmMessage: '确定要清空全部聚合统计数据吗?仪表盘数据将被清除,用户和 Key 的累计统计也会归零,操作不可逆。',
confirmMessage: '确定要清空全部统计聚合数据吗?原始使用记录会保留,仪表盘和累计统计可从原始记录重新构建。',
action: () => adminApi.purgeStats(),
},
]
@@ -122,9 +122,9 @@ async function handlePurge(item: PurgeItem) {
loadingKey.value = item.key
try {
const result = await item.action()
success(result.message)
success(result.message || '操作成功')
} catch (e) {
error(parseApiError(e))
error(parseApiError(e, '清空失败'))
} finally {
loadingKey.value = null
}