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:
1 parent
5ca0e6d83a
commit
8d46e8f352
197 files changed
+5014
-815
No files matched your search
@@ -366,6 +366,7 @@ func (h *KubernetesHandler) listPodsWithNS(c *gin.Context, ns string) {
|
||||
Image string `json:"image"`
|
||||
CPUUsageM string `json:"cpu_usage_m,omitempty"`
|
||||
MemUsageMi string `json:"mem_usage_mi,omitempty"`
|
||||
Conditions []k8sclient.PodCondition `json:"conditions,omitempty"`
|
||||
}
|
||||
result := []PodSummary{}
|
||||
for _, p := range pods.Items {
|
||||
@@ -380,6 +381,7 @@ func (h *KubernetesHandler) listPodsWithNS(c *gin.Context, ns string) {
|
||||
IP: p.Status.PodIP,
|
||||
RestartCount: restarts,
|
||||
Image: image,
|
||||
Conditions: p.Status.Conditions,
|
||||
}
|
||||
if m, ok := podMetrics[p.Metadata.Namespace+"/"+p.Metadata.Name]; ok {
|
||||
ps.CPUUsageM = m.CPU
|
||||
@@ -523,17 +525,29 @@ func parseMemResource(val string) int64 {
|
||||
if val == "" {
|
||||
return 0
|
||||
}
|
||||
// 清理常见后缀,大小写不敏感,支持 GiB / G / GB / bytes 等 // Logan.Li
|
||||
val = strings.TrimSpace(val)
|
||||
val = strings.ToUpper(val)
|
||||
val = strings.TrimSuffix(val, "IB")
|
||||
val = strings.TrimSuffix(val, "B")
|
||||
var num float64
|
||||
var unit string
|
||||
fmt.Sscanf(val, "%f%s", &num, &unit)
|
||||
unit = strings.TrimSpace(unit)
|
||||
switch unit {
|
||||
case "Ki":
|
||||
case "KI":
|
||||
return int64(num / 1024)
|
||||
case "Mi":
|
||||
case "MI":
|
||||
return int64(num)
|
||||
case "Gi":
|
||||
case "GI":
|
||||
return int64(num * 1024)
|
||||
case "TI":
|
||||
return int64(num * 1024 * 1024)
|
||||
default:
|
||||
// 纯数字通常是 bytes
|
||||
if unit == "" && num > 0 {
|
||||
return int64(num / 1024 / 1024)
|
||||
}
|
||||
return int64(num / 1024 / 1024)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user