feat: 审核规则模版+设置页面整合+去掉角色切换demo

后端:
- AuditRule 新增 value 字段, rule_type 扩展 DDL/DML
- MySQL/PG/Redis 预设规则种子接口 POST /audit-rules/seed/{db_type}
- 公告管理 CRUD (announcements)
- 消息推送 CRUD+测试 (notifications: 钉钉/飞书/邮件)
- LDAP 配置 CRUD+测试连接 (ldap-config)
- 164 tests passing (+31 新增)

前端:
- AuditRulesPage 重写: DB类型Tab+DDL/DML分组+参数编辑
- SettingsPage: 系统设置主页(审核规则/公告/推送/LDAP)
- NotificationPage: 钉钉/飞书/SMTP配置
- LdapConfigPage: LDAP设置+测试连接
- AnnouncementPage: 公告Markdown编辑
- 去掉左下角角色切换demo
- 侧边栏合并为: 系统设置(含审核规则+公告+推送+LDAP)
This commit is contained in:
logan committed 2026-05-22 22:26:10 +08:00
1 parent d5d19d6be4
commit bab55d3927
27 files changed
+2881 -591

No files matched your search

+15
View File
@@ -0,0 +1,15 @@
from sqlalchemy import Column, Integer, String, Text, Boolean, DateTime, func
from app.core.database import Base
class Announcement(Base):
__tablename__ = "announcements"
id = Column(Integer, primary_key=True, autoincrement=True)
title = Column(String(200), nullable=False)
content = Column(Text, nullable=False) # markdown
is_published = Column(Boolean, default=False)
published_at = Column(DateTime, nullable=True)
created_at = Column(DateTime, server_default=func.now())
updated_at = Column(DateTime, server_default=func.now(), onupdate=func.now())
+3 -2
View File
@@ -9,10 +9,11 @@ class AuditRule(Base):
id = Column(Integer, primary_key=True, autoincrement=True)
name = Column(String(100), nullable=False, unique=True)
description = Column(Text, nullable=True)
rule_type = Column(String(50), nullable=False) # syntax / performance / safety / naming
rule_type = Column(String(50), nullable=False) # syntax / performance / safety / naming / DDL / DML
severity = Column(String(20), default="warning") # error / warning / info
db_type = Column(String(20), default="mysql") # mysql / postgres / all
db_type = Column(String(20), default="mysql") # mysql / postgres / redis / all
pattern = Column(Text, nullable=True) # regex or keyword pattern
value = Column(String(255), nullable=True) # 规则参数值,如 DDLMaxKeyParts=8 → value="8"
is_enabled = Column(Boolean, default=True)
message = Column(String(500), nullable=False) # human-readable message
created_at = Column(DateTime, server_default=func.now())
+19
View File
@@ -0,0 +1,19 @@
from sqlalchemy import Column, Integer, String, Boolean, Text, DateTime, func
from app.core.database import Base
class LdapConfig(Base):
__tablename__ = "ldap_config"
id = Column(Integer, primary_key=True, autoincrement=True)
ldap_host = Column(String(200), nullable=False)
ldap_port = Column(Integer, default=389)
use_ldaps = Column(Boolean, default=False)
admin_dn = Column(String(500), nullable=False)
admin_password = Column(String(500), nullable=False) # encrypted
search_filter = Column(String(500), nullable=True)
base_dn = Column(String(500), nullable=False)
user_mapping = Column(Text, nullable=True) # JSON string
created_at = Column(DateTime, server_default=func.now())
updated_at = Column(DateTime, server_default=func.now(), onupdate=func.now())
+15
View File
@@ -0,0 +1,15 @@
from sqlalchemy import Column, Integer, String, Text, Boolean, DateTime, func
from app.core.database import Base
class NotificationChannel(Base):
__tablename__ = "notification_channels"
id = Column(Integer, primary_key=True, autoincrement=True)
name = Column(String(100), nullable=False)
channel_type = Column(String(30), nullable=False) # dingtalk / webhook_feishu / email
config = Column(Text, nullable=False) # JSON string
is_enabled = Column(Boolean, default=True)
created_at = Column(DateTime, server_default=func.now())
updated_at = Column(DateTime, server_default=func.now(), onupdate=func.now())