import { Badge } from "@/components/ui/badge"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import type { AuditLog, PublicAccount, RoleDefinition } from "@/modules/core/types"; import { ROLE_LABELS } from "@/modules/core/types"; type SettingsOverviewProps = { accounts: PublicAccount[]; roles: RoleDefinition[]; auditLogs: AuditLog[]; }; export function SettingsOverview({ accounts, roles, auditLogs, }: SettingsOverviewProps): React.ReactElement { return (
RBAC + Audit

权限设置

内置角色、账号状态和关键操作审计。

系统账号

{accounts.length}

服务端持久化账号

角色数量

{roles.length}

内置权限组

审计日志

{auditLogs.length}

最近 100 条

内置角色 {roles.map((role) => (

{role.label}

{role.permissions.length} 权限

{role.description}

{role.permissions.map((permission) => ( {permission} ))}
))}
账号列表
{accounts.map((account) => ( ))}
账号 角色 状态 创建时间

{account.name}

{account.email}

{ROLE_LABELS[account.role]} {account.status === "active" ? "启用" : "停用"} {new Date(account.createdAt).toLocaleString("zh-CN")}
审计日志
{auditLogs.map((log) => ( ))} {auditLogs.length === 0 ? ( ) : null}
时间 操作者 动作 对象 结果 原因
{new Date(log.timestamp).toLocaleString("zh-CN")} {log.actorEmail ?? "系统"} {log.action} {log.targetType} {log.targetId ? ` / ${log.targetId.slice(0, 8)}` : ""} {log.result} {log.reason}
暂无审计日志
); }