Backend • controller/uptime_kuma.go - Added Group field to Monitor struct to carry publicGroupList.name. - Extended status page parsing to capture group Name and inject it into each monitor. - Re-worked fetchGroupData loop: aggregate all sub-groups, drop unnecessary pre-allocation/breaks. Frontend • web/src/pages/Detail/index.js - renderMonitorList now buckets monitors by the new group field and renders a lightweight header per subgroup. - Fallback gracefully when group is empty to preserve previous single-list behaviour. Other • Expanded anonymous struct definition for statusData.PublicGroupList to include ID/Name, enabling JSON unmarshalling of group names. Result Custom CategoryName continues to work while each uptime group’s internal sub-groups are now clearly displayed in the UI, providing finer-grained visibility without impacting performance or existing validation logic.
39 lines
1.5 KiB
Go
39 lines
1.5 KiB
Go
package console_setting
|
|
|
|
import "one-api/setting/config"
|
|
|
|
type ConsoleSetting struct {
|
|
ApiInfo string `json:"api_info"` // 控制台 API 信息 (JSON 数组字符串)
|
|
UptimeKumaGroups string `json:"uptime_kuma_groups"` // Uptime Kuma 分组配置 (JSON 数组字符串)
|
|
Announcements string `json:"announcements"` // 系统公告 (JSON 数组字符串)
|
|
FAQ string `json:"faq"` // 常见问题 (JSON 数组字符串)
|
|
ApiInfoEnabled bool `json:"api_info_enabled"` // 是否启用 API 信息面板
|
|
UptimeKumaEnabled bool `json:"uptime_kuma_enabled"` // 是否启用 Uptime Kuma 面板
|
|
AnnouncementsEnabled bool `json:"announcements_enabled"` // 是否启用系统公告面板
|
|
FAQEnabled bool `json:"faq_enabled"` // 是否启用常见问答面板
|
|
}
|
|
|
|
// 默认配置
|
|
var defaultConsoleSetting = ConsoleSetting{
|
|
ApiInfo: "",
|
|
UptimeKumaGroups: "",
|
|
Announcements: "",
|
|
FAQ: "",
|
|
ApiInfoEnabled: true,
|
|
UptimeKumaEnabled: true,
|
|
AnnouncementsEnabled: true,
|
|
FAQEnabled: true,
|
|
}
|
|
|
|
// 全局实例
|
|
var consoleSetting = defaultConsoleSetting
|
|
|
|
func init() {
|
|
// 注册到全局配置管理器,键名为 console_setting
|
|
config.GlobalConfig.Register("console_setting", &consoleSetting)
|
|
}
|
|
|
|
// GetConsoleSetting 获取 ConsoleSetting 配置实例
|
|
func GetConsoleSetting() *ConsoleSetting {
|
|
return &consoleSetting
|
|
} |