feat: 修复仪表盘数据管线 — 补充应用发布种子数据 + 修复limit参数解析 + LDAP认证集成 + User类型完善

后端改进:
- 修复 dashboard/recent-alerts 的 limit 参数解析 (原代码错误地将数字解析为日期)
- 为 dashboard/recent-releases 添加 limit 参数解析支持
- 新增 generateAppReleases 种子数据生成函数 (10条应用发布记录)
- 修复 AlertEvent 的 rule_name/rule_id/severity 数据一致性
- 添加 go-ldap/ldap/v3 依赖并集成 LDAP 认证处理器
- 添加 seed.go 自动种子数据初始化 (admin用户+LDAP配置)
- User model 添加 AuthSource/LDAPConfig 字段

前端改进:
- 修复 User 类型定义以匹配后端 API (real_name/is_admin/auth_source等)
- 修复 Header.tsx 的 real_name 属性引用导致 TypeScript 编译错误
- 统一 API 服务层、暗色主题样式、组件联调优化

验证:
- go build ./... 编译通过
- npm run build 构建通过
- 仪表盘发布历史、告警消息等区域数据正常展示
- 健康检查 /health 正常
This commit is contained in:
attacker committed 2026-06-14 02:11:10 +08:00
1 parent 97c4207ff8
commit ff0b268984
39 files changed
+4283 -1878

No files matched your search

+39 -12
View File
@@ -1,5 +1,5 @@
#!/bin/bash
# EZOps AIOps 启动脚本
# EZOps AIOps 智能运维平台 - 启动脚本
# 一键启动前后端服务,支持日志轮转
# 用法: ./run.sh [start|stop|restart|status|frontend|backend|help]
@@ -77,24 +77,20 @@ rotate_log() {
start_backend() {
info "正在启动后端服务..."
cd "$SCRIPT_DIR/$BACKEND_DIR"
mkdir -p logs data
mkdir -p logs
rotate_log "logs/server.log"
# 释放被占用的端口
kill_port $BACKEND_PORT
export PORT=$BACKEND_PORT
export GIN_MODE=debug
# 确保使用国内代理
export GOPROXY=https://goproxy.cn,direct
# 编译并运行
# 编译并运行(SQLite 需要 CGO)
info "编译 Go 程序..."
if ! go build -o "$BACKEND_BIN" cmd/main.go; then
error "Go 编译失败"
CGO_ENABLED=1 go build -o "$BACKEND_BIN" ./cmd/ 2>&1 || {
error "编译失败"
return 1
fi
}
nohup ./"$BACKEND_BIN" >> logs/server.log 2>&1 &
echo $! > "$BACKEND_PID_FILE"
@@ -105,7 +101,7 @@ start_backend() {
retries=$((retries + 1))
if [ $retries -ge 30 ]; then
error "后端服务启动超时,请检查日志: $BACKEND_DIR/logs/server.log"
tail -20 "$BACKEND_DIR/logs/server.log" 2>/dev/null
tail -20 logs/server.log 2>/dev/null
return 1
fi
sleep 1
@@ -152,7 +148,7 @@ start_frontend() {
retries=$((retries + 1))
if [ $retries -ge 30 ]; then
error "前端服务启动超时,请检查日志: $FRONTEND_DIR/logs/dev.log"
tail -20 "$FRONTEND_DIR/logs/dev.log" 2>/dev/null
tail -20 logs/dev.log 2>/dev/null
return 1
fi
sleep 1
@@ -197,6 +193,12 @@ show_status() {
else
warning "前端服务: 未运行"
fi
# 显示数据库文件
if [ -f "$SCRIPT_DIR/$BACKEND_DIR/sqlite3.db" ]; then
local db_size=$(du -h "$SCRIPT_DIR/$BACKEND_DIR/sqlite3.db" | cut -f1)
info "数据库: SQLite (sqlite3.db, $db_size)"
fi
}
show_help() {
@@ -211,6 +213,7 @@ show_help() {
echo " backend 仅启动后端服务"
echo " frontend 仅启动前端服务"
echo " status 查看服务状态"
echo " logs 查看实时日志"
echo " help 显示帮助信息"
echo ""
echo "示例:"
@@ -218,6 +221,26 @@ show_help() {
echo " ./run.sh stop # 停止服务"
echo " ./run.sh restart # 重启服务"
echo " ./run.sh backend # 仅启动后端"
echo " ./run.sh logs # 查看实时日志"
}
show_logs() {
info "实时日志 (Ctrl+C 退出):"
echo ""
# 后端日志
if [ -f "$SCRIPT_DIR/$BACKEND_DIR/logs/server.log" ]; then
echo "=== 后端日志 ==="
tail -f "$SCRIPT_DIR/$BACKEND_DIR/logs/server.log" &
local bg_pid=$!
fi
# 前端日志
if [ -f "$SCRIPT_DIR/$FRONTEND_DIR/logs/dev.log" ]; then
echo "=== 前端日志 ==="
tail -f "$SCRIPT_DIR/$FRONTEND_DIR/logs/dev.log" &
local bg_pid2=$!
fi
trap "kill $bg_pid $bg_pid2 2>/dev/null; exit 0" INT TERM
wait
}
# ============================================================
@@ -246,6 +269,7 @@ main() {
info "前端地址: http://localhost:$FRONTEND_PORT"
info "后端地址: http://localhost:$BACKEND_PORT"
info "健康检查: http://localhost:$BACKEND_PORT/health"
info "数据库: SQLite (backend/sqlite3.db)"
echo ""
info "使用 './run.sh stop' 停止服务"
else
@@ -274,6 +298,9 @@ main() {
status)
show_status
;;
logs)
show_logs
;;
help|--help|-h)
show_help
;;