This commit is contained in:
robin
2026-03-13 14:25:13 +08:00
parent a25a474d6a
commit afbaaa869c
95 changed files with 4591 additions and 2578 deletions

View File

@@ -19,6 +19,7 @@ import (
"github.com/TeaOSLab/EdgeCommon/pkg/userconfigs"
"github.com/iwind/TeaGo/maps"
"github.com/iwind/TeaGo/types"
stringutil "github.com/iwind/TeaGo/utils/string"
timeutil "github.com/iwind/TeaGo/utils/time"
"regexp"
"time"
@@ -409,5 +410,55 @@ func (this *IndexAction) RunPost(params struct {
}
this.Data["countWeakAdmins"] = countWeakAdminsResp.Count
upgradeConfig, err := configloaders.LoadUpgradeConfig()
if err != nil {
this.ErrorPage(err)
return
}
this.Data["autoUpgrade"] = upgradeConfig.AutoUpgrade
httpdnsNodeUpgradeInfo, err := this.composeHTTPDNSNodeUpgradeInfo()
if err != nil {
this.ErrorPage(err)
return
}
this.Data["httpdnsNodeUpgradeInfo"] = httpdnsNodeUpgradeInfo
this.Success()
}
func (this *IndexAction) composeHTTPDNSNodeUpgradeInfo() (maps.Map, error) {
clustersResp, err := this.RPC().HTTPDNSClusterRPC().ListHTTPDNSClusters(this.AdminContext(), &pb.ListHTTPDNSClustersRequest{
Offset: 0,
Size: 10000,
})
if err != nil {
return nil, err
}
count := 0
version := ""
for _, cluster := range clustersResp.Clusters {
resp, err := this.RPC().HTTPDNSNodeRPC().FindAllUpgradeHTTPDNSNodesWithClusterId(this.AdminContext(), &pb.FindAllUpgradeHTTPDNSNodesWithClusterIdRequest{
ClusterId: cluster.Id,
})
if err != nil {
return nil, err
}
count += len(resp.Nodes)
for _, nodeUpgrade := range resp.Nodes {
if len(nodeUpgrade.NewVersion) == 0 {
continue
}
if len(version) == 0 || stringutil.VersionCompare(version, nodeUpgrade.NewVersion) < 0 {
version = nodeUpgrade.NewVersion
}
}
}
return maps.Map{
"count": count,
"version": version,
}, nil
}