feat: 新增日志中心、功能优化与代码重构

- 新增 log_datasource.go / log_proxy.go / user_api_token.go 后端控制器
- 新增 log_datasource.go model
- 新增 monitor/log-center.ts API 模块
- 新增 LogCenter 前端组件及页面
- 重构 deployment 相关组件 (HPDA/UpdateImageModal/bundle-yaml 等)
- 新增 ResetPasswordDialog / code-snippet-block / copy-button 等 UI 组件
- 重构多个 k8s 相关组件 (TopologyView/ResourceVisualEditor/PodFileBrowser 等)
- 更新多个 API 和工具函数 (auth.ts/monitor/index.ts/request.ts 等)
- 更新静态资源 (index.html + 新 JS/CSS bundle)
- 删除废弃静态资源文件
This commit is contained in:
Logan committed 2026-06-26 23:18:05 +08:00
1 parent 5ca0e6d83a
commit 8d46e8f352
197 files changed
+5014 -815

No files matched your search

+1
View File
@@ -21,6 +21,7 @@ type KubernetesCluster struct {
PodCount int `gorm:"default:0" json:"pod_count"`
ServiceCount int `gorm:"default:0" json:"service_count"`
DeploymentCount int `gorm:"default:0" json:"deployment_count"`
IngressCount int `gorm:"default:0" json:"ingress_count"` // 路由/Ingress 数量 // Logan.Li
CPUUsage float64 `json:"cpu_usage"`
MemoryUsage float64 `json:"memory_usage"`
Description string `gorm:"size:500" json:"description"`
+65
View File
@@ -0,0 +1,65 @@
package model
import (
"time"
)
// LogDataSource 日志数据源连接配置(Loki / Elasticsearch)
// 平台不存储海量日志,仅存连接信息与告警策略 // Logan.Li
type LogDataSource struct {
ID uint `gorm:"primaryKey;autoIncrement;comment:主键ID" json:"id"`
Name string `gorm:"type:varchar(128);not null;uniqueIndex;comment:数据源名称" json:"name"`
Type string `gorm:"type:varchar(32);not null;index;comment:类型 loki/elasticsearch" json:"type"`
URL string `gorm:"type:varchar(512);not null;comment:服务地址" json:"url"`
BasicAuth bool `gorm:"default:false;comment:基础认证" json:"basic_auth"`
BasicAuthUser string `gorm:"type:varchar(128);comment:认证用户名" json:"basic_auth_user,omitempty"`
BasicAuthPass string `gorm:"type:varchar(256);comment:认证密码" json:"basic_auth_pass,omitempty"`
SkipTLSVerify bool `gorm:"default:false;comment:跳过TLS验证" json:"skip_tls_verify"`
DefaultIndex string `gorm:"type:varchar(128);comment:ES默认索引" json:"default_index,omitempty"`
IsDefault bool `gorm:"default:false;index;comment:是否默认" json:"is_default"`
Status int `gorm:"default:1;comment:状态 1启用 0禁用" json:"status"`
CreatedAt time.Time `gorm:"not null;comment:创建时间" json:"created_at"`
UpdatedAt time.Time `gorm:"not null;comment:更新时间" json:"updated_at"`
DeletedAt *time.Time `gorm:"index;comment:删除时间" json:"deleted_at,omitempty"`
}
func (LogDataSource) TableName() string {
return "monitor_log_datasources"
}
// CreateLogDSReq 创建日志数据源 // Logan.Li
type CreateLogDSReq struct {
Name string `json:"name" binding:"required"`
Type string `json:"type" binding:"required"`
URL string `json:"url" binding:"required"`
BasicAuth bool `json:"basic_auth"`
BasicAuthUser string `json:"basic_auth_user"`
BasicAuthPass string `json:"basic_auth_pass"`
SkipTLSVerify bool `json:"skip_tls_verify"`
DefaultIndex string `json:"default_index"`
IsDefault bool `json:"is_default"`
}
// UpdateLogDSReq 更新日志数据源 // Logan.Li
type UpdateLogDSReq struct {
Name *string `json:"name"`
Type *string `json:"type"`
URL *string `json:"url"`
BasicAuth *bool `json:"basic_auth"`
BasicAuthUser *string `json:"basic_auth_user"`
BasicAuthPass *string `json:"basic_auth_pass"`
SkipTLSVerify *bool `json:"skip_tls_verify"`
DefaultIndex *string `json:"default_index"`
IsDefault *bool `json:"is_default"`
Status *int `json:"status"`
}
// TestLogDSReq 测试连接 // Logan.Li
type TestLogDSReq struct {
Type string `json:"type" binding:"required"`
URL string `json:"url" binding:"required"`
BasicAuth bool `json:"basic_auth"`
BasicAuthUser string `json:"basic_auth_user"`
BasicAuthPass string `json:"basic_auth_pass"`
SkipTLSVerify bool `json:"skip_tls_verify"`
}
+9
View File
@@ -18,6 +18,15 @@ type User struct {
IsAdmin bool `gorm:"default:false" json:"is_admin"`
AuthSource string `gorm:"size:20;default:'local'" json:"auth_source"` // local / ldap
LastLogin *time.Time `json:"last_login"`
// CI/CD Webhook 长期访问密钥(每用户仅一条,明文仅生成时返回一次)// Logan.Li
ApiAccessKeyHash string `gorm:"size:255" json:"-"`
ApiAccessKeyPrefix string `gorm:"size:32;index" json:"api_access_key_prefix,omitempty"`
ApiAccessKeyID string `gorm:"size:32" json:"api_access_key_id,omitempty"`
ApiAccessKeyDescription string `gorm:"size:255" json:"api_access_key_description,omitempty"`
ApiAccessKeyDurationMonths int `gorm:"default:12" json:"api_access_key_duration_months,omitempty"`
ApiAccessKeyAt *time.Time `json:"api_access_key_at,omitempty"`
ApiAccessKeyExpiresAt *time.Time `json:"api_access_key_expires_at,omitempty"`
ApiAccessKeyLastUsedAt *time.Time `json:"api_access_key_last_used_at,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`