feat(admin): A6 通知页前端 — 统一通知/事件中心(管理面板#16)
- Notifications.tsx(254行): 类型筛选(全部/system/channel/backthink/audit,服务端重拉) + before游标加载更多(id去重/到底判定) + 空态/错误(后端文案) + 30s静默刷新; 卡片行(非AdminTable,避其rowKey升序与倒序feed冲突); Miuix
- api.ts adminListNotifications + types.ts AdminNotification(Query) + sections.tsx 侧栏项{id:notifications,group:运行时,icon:light} + AdminApp renderSection + router.ts VALID_SECTIONS
- 契约: GET /admin/notifications?type=&before=&limit= → {data:[{id,type,title,body,source,createdAt}]}; 未读/清空需后端read端点(诚实Notice,不做前端假实现)
- 前端 build 绿(157 modules); 后端端点由并发代理[194]落地
- icon 用现有 light(Icon.tsx 无 bell; 如需铃铛另加 path)
This commit is contained in:
1 parent
1a85de555d
commit
34c8cc4dca
6 files changed
+302
-1
No files matched your search
@@ -5,6 +5,8 @@ import type {
|
||||
AdminIoTDevice,
|
||||
AdminLlmConfig,
|
||||
AdminLlmProvider,
|
||||
AdminNotification,
|
||||
AdminNotificationQuery,
|
||||
AdminObservabilityMetrics,
|
||||
AdminPluginRecord,
|
||||
AdminRagHit,
|
||||
@@ -738,6 +740,21 @@ export function adminBackthink(limit?: number): Promise<BackthinkItem[]> {
|
||||
return request<BackthinkItem[]>(`/admin/backthink${limitQuery(limit)}`);
|
||||
}
|
||||
|
||||
/** GET /api/v1/admin/notifications?type=&before=&limit= — the unified notification
|
||||
* feed (design/10 §3 #16: audit + channel + backthink + system aggregated).
|
||||
* `type` omitted = all types, `before` = createdAt(ms) cursor for older pages,
|
||||
* `limit` defaults to 50 (backend caps at 200). Returned newest first. */
|
||||
export function adminListNotifications(
|
||||
params: AdminNotificationQuery = {}
|
||||
): Promise<AdminNotification[]> {
|
||||
const qs = new URLSearchParams();
|
||||
if (params.type) qs.set("type", params.type);
|
||||
if (params.before !== undefined) qs.set("before", String(params.before));
|
||||
if (params.limit !== undefined) qs.set("limit", String(params.limit));
|
||||
const q = qs.toString();
|
||||
return request<AdminNotification[]>(`/admin/notifications${q ? `?${q}` : ""}`);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* System management admin writes (owner-only, audited). Reference:
|
||||
* internal/services/gateway/admin_system.go + Docs/api-client.md §系统设置契约.
|
||||
|
||||
Reference in new issue
Block a user