修正修改节点时由于DNS设置而引发的空白问题

This commit is contained in:
刘祥超
2020-12-03 10:16:16 +08:00
parent 9d8e1c5f87
commit 00a54a9c65

View File

@@ -66,17 +66,24 @@ func (this *UpdateAction) RunGet(params struct {
this.ErrorPage(err) this.ErrorPage(err)
return return
} }
nodeDNS := dnsInfoResp.Node
dnsRouteMaps := []maps.Map{} dnsRouteMaps := []maps.Map{}
for _, dnsInfo := range dnsInfoResp.Node.Routes { if nodeDNS != nil {
dnsRouteMaps = append(dnsRouteMaps, maps.Map{ for _, dnsInfo := range nodeDNS.Routes {
"name": dnsInfo.Name, dnsRouteMaps = append(dnsRouteMaps, maps.Map{
"code": dnsInfo.Code, "name": dnsInfo.Name,
}) "code": dnsInfo.Code,
})
}
} }
this.Data["dnsRoutes"] = dnsRouteMaps this.Data["dnsRoutes"] = dnsRouteMaps
this.Data["allDNSRoutes"] = []maps.Map{} this.Data["allDNSRoutes"] = []maps.Map{}
this.Data["dnsDomainId"] = dnsInfoResp.Node.DnsDomainId if nodeDNS != nil {
if dnsInfoResp.Node.DnsDomainId > 0 { this.Data["dnsDomainId"] = nodeDNS.DnsDomainId
} else {
this.Data["dnsDomainId"] = 0
}
if nodeDNS != nil && nodeDNS.DnsDomainId > 0 {
routesMaps := []maps.Map{} routesMaps := []maps.Map{}
routesResp, err := this.RPC().DNSDomainRPC().FindAllDNSDomainRoutes(this.AdminContext(), &pb.FindAllDNSDomainRoutesRequest{DnsDomainId: dnsInfoResp.Node.DnsDomainId}) routesResp, err := this.RPC().DNSDomainRPC().FindAllDNSDomainRoutes(this.AdminContext(), &pb.FindAllDNSDomainRoutesRequest{DnsDomainId: dnsInfoResp.Node.DnsDomainId})
if err != nil { if err != nil {