F1 告警静默规则 [done]: - 后端 alert_silence.go: CRUD + Toggle (onetime/daily/weekly 三模式) - 告警引擎 isSilenced 集成 (alert_engine.go) - 前端 SilenceRuleTab + SilenceDialog - 路由 /alerts/silences 已注册 F2 审计日志导出 [done]: - 重写 ExportAuditLogs: 真正的 CSV 导出 (encoding/csv + UTF-8 BOM) - 支持 module/action/username/startTime/endTime 筛选 - 导出限制 10000 条防溢出,自动记录审计日志 - JSON 格式向后兼容 (format=json) - 前端 exportLogs 传递查询参数 同时包含累积的前期工作: - 目录重构 internal/ -> controller/model/router (v0.55-v0.57) - 后端分层架构 dto/repository/service/utils - 审计模块全功能 (终端审计/操作审计/登录日志) - asciicast v2 录制格式 - SFTP 文件浏览器 - StatStrip 紧凑统计条 - 在线会话自动刷新 - LiveMonitor WebSocket 诊断修复 验证: go build ✅ | npm run build ✅ | Docker 部署 ✅ | 10 回归端点 ✅ | CSV 导出 ✅ | 静默 CRUD ✅
96 lines
3.2 KiB
Go
96 lines
3.2 KiB
Go
package model
|
|
|
|
import (
|
|
"time"
|
|
|
|
)
|
|
|
|
// NavigationGroup 导航分组模型
|
|
type NavigationGroup struct {
|
|
ID uint `gorm:"primarykey" json:"id"`
|
|
Name string `gorm:"size:64;not null" json:"name"`
|
|
Code string `gorm:"size:64;uniqueIndex;not null" json:"code"`
|
|
Description string `gorm:"size:255" json:"description"`
|
|
Icon string `gorm:"size:64" json:"icon"`
|
|
Sort int `gorm:"default:0" json:"sort"`
|
|
Enabled bool `gorm:"default:true" json:"enabled"`
|
|
LinkCount int `gorm:"default:0" json:"link_count"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
// TableName 表名
|
|
func (NavigationGroup) TableName() string {
|
|
return "sys_navigation_groups"
|
|
}
|
|
|
|
// NavigationLink 导航链接模型
|
|
type NavigationLink struct {
|
|
ID uint `gorm:"primarykey" json:"id"`
|
|
GroupID uint `json:"group_id"`
|
|
Name string `gorm:"size:128;not null" json:"name"`
|
|
URL string `gorm:"size:500;not null" json:"url"`
|
|
Description string `gorm:"size:255" json:"description"`
|
|
Icon string `gorm:"size:64" json:"icon"`
|
|
Tags string `gorm:"type:text" json:"tags"` // JSON
|
|
IsFavorite bool `gorm:"default:false" json:"is_favorite"`
|
|
Sort int `gorm:"default:0" json:"sort"`
|
|
Enabled bool `gorm:"default:true" json:"enabled"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
|
|
// 关联
|
|
Group *NavigationGroup `json:"group,omitempty"`
|
|
}
|
|
|
|
// TableName 表名
|
|
func (NavigationLink) TableName() string {
|
|
return "navigation_links"
|
|
}
|
|
|
|
// CreateNavigationGroupRequest 创建导航分组请求
|
|
type CreateNavigationGroupRequest struct {
|
|
Name string `json:"name" binding:"required"`
|
|
Code string `json:"code" binding:"required"`
|
|
Description string `json:"description"`
|
|
Icon string `json:"icon"`
|
|
Sort int `json:"sort"`
|
|
}
|
|
|
|
// UpdateNavigationGroupRequest 更新导航分组请求
|
|
type UpdateNavigationGroupRequest struct {
|
|
Name string `json:"name"`
|
|
Description string `json:"description"`
|
|
Icon string `json:"icon"`
|
|
Sort int `json:"sort"`
|
|
Enabled *bool `json:"enabled"`
|
|
}
|
|
|
|
// CreateNavigationLinkRequest 创建导航链接请求
|
|
type CreateNavigationLinkRequest struct {
|
|
GroupID uint `json:"group_id" binding:"required"`
|
|
Name string `json:"name" binding:"required"`
|
|
URL string `json:"url" binding:"required,url"`
|
|
Description string `json:"description"`
|
|
Icon string `json:"icon"`
|
|
Tags []string `json:"tags"`
|
|
Sort int `json:"sort"`
|
|
}
|
|
|
|
// UpdateNavigationLinkRequest 更新导航链接请求
|
|
type UpdateNavigationLinkRequest struct {
|
|
GroupID uint `json:"group_id"`
|
|
Name string `json:"name"`
|
|
URL string `json:"url" binding:"omitempty,url"`
|
|
Description string `json:"description"`
|
|
Icon string `json:"icon"`
|
|
Tags []string `json:"tags"`
|
|
Sort int `json:"sort"`
|
|
Enabled *bool `json:"enabled"`
|
|
}
|
|
|
|
// ToggleFavoriteRequest 切换收藏请求
|
|
type ToggleFavoriteRequest struct {
|
|
IsFavorite bool `json:"is_favorite"`
|
|
}
|