换成单集群模式
This commit is contained in:
@@ -66,6 +66,28 @@ func (this *IndexAction) RunGet(params struct{}) {
|
||||
// 当前默认的智能DNS设置
|
||||
this.Data["nsIsVisible"] = plus.AllowComponent(plus.ComponentCodeNS)
|
||||
|
||||
// HTTPDNS 集群列表(用于默认集群多选)
|
||||
httpdnsClusterResp, err := this.RPC().HTTPDNSClusterRPC().FindAllHTTPDNSClusters(this.AdminContext(), &pb.FindAllHTTPDNSClustersRequest{})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
httpdnsClusters := make([]maps.Map, 0, len(httpdnsClusterResp.GetClusters()))
|
||||
for _, cluster := range httpdnsClusterResp.GetClusters() {
|
||||
httpdnsClusters = append(httpdnsClusters, maps.Map{
|
||||
"id": cluster.GetId(),
|
||||
"name": cluster.GetName(),
|
||||
})
|
||||
}
|
||||
this.Data["httpdnsClusters"] = httpdnsClusters
|
||||
|
||||
// 当前选中的默认集群(取数组第一个元素)
|
||||
var httpdnsDefaultClusterId int64
|
||||
if len(config.HTTPDNSDefaultClusterIds) > 0 {
|
||||
httpdnsDefaultClusterId = config.HTTPDNSDefaultClusterIds[0]
|
||||
}
|
||||
this.Data["httpdnsDefaultClusterId"] = httpdnsDefaultClusterId
|
||||
|
||||
this.Show()
|
||||
}
|
||||
|
||||
@@ -102,7 +124,8 @@ func (this *IndexAction) RunPost(params struct {
|
||||
|
||||
NsIsOn bool
|
||||
|
||||
HttpdnsIsOn bool
|
||||
HttpdnsIsOn bool
|
||||
HttpdnsDefaultClusterId int64
|
||||
|
||||
Must *actions.Must
|
||||
CSRF *actionutils.CSRF
|
||||
@@ -154,6 +177,11 @@ func (this *IndexAction) RunPost(params struct {
|
||||
|
||||
config.NSIsOn = params.NsIsOn
|
||||
config.HTTPDNSIsOn = params.HttpdnsIsOn
|
||||
if params.HttpdnsDefaultClusterId > 0 {
|
||||
config.HTTPDNSDefaultClusterIds = []int64{params.HttpdnsDefaultClusterId}
|
||||
} else {
|
||||
config.HTTPDNSDefaultClusterIds = []int64{}
|
||||
}
|
||||
|
||||
configJSON, err := json.Marshal(config)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user