diff --git a/internal/web/actions/default/dns/clusters/cluster.go b/internal/web/actions/default/dns/clusters/cluster.go index 0fbc6100..c9344a6e 100644 --- a/internal/web/actions/default/dns/clusters/cluster.go +++ b/internal/web/actions/default/dns/clusters/cluster.go @@ -43,7 +43,7 @@ func (this *ClusterAction) RunGet(params struct { } var defaultRoute = dnsResp.DefaultRoute domainName := "" - dnsMap := maps.Map{ + var dnsMap = maps.Map{ "dnsName": dnsResp.Name, "domainId": 0, "domainName": "", @@ -76,14 +76,14 @@ func (this *ClusterAction) RunGet(params struct { this.ErrorPage(err) return } - nodeMaps := []maps.Map{} + var nodeMaps = []maps.Map{} for _, node := range nodesResp.Nodes { if len(node.Routes) > 0 { for _, route := range node.Routes { // 检查是否已解析 - isResolved := false + var isResolved = false if cluster.DnsDomainId > 0 && len(cluster.DnsName) > 0 && len(node.IpAddr) > 0 { - recordType := "A" + var recordType = "A" if utils.IsIPv6(node.IpAddr) { recordType = "AAAA" } @@ -102,9 +102,10 @@ func (this *ClusterAction) RunGet(params struct { } nodeMaps = append(nodeMaps, maps.Map{ - "id": node.Id, - "name": node.Name, - "ipAddr": node.IpAddr, + "id": node.Id, + "name": node.Name, + "ipAddr": node.IpAddr, + "ipAddrId": node.NodeIPAddressId, "route": maps.Map{ "name": route.Name, "code": route.Code, @@ -117,7 +118,7 @@ func (this *ClusterAction) RunGet(params struct { // 默认线路 var isResolved = false if len(defaultRoute) > 0 { - recordType := "A" + var recordType = "A" if utils.IsIPv6(node.IpAddr) { recordType = "AAAA" } @@ -135,9 +136,10 @@ func (this *ClusterAction) RunGet(params struct { isResolved = checkResp.IsOk } nodeMaps = append(nodeMaps, maps.Map{ - "id": node.Id, - "name": node.Name, - "ipAddr": node.IpAddr, + "id": node.Id, + "name": node.Name, + "ipAddr": node.IpAddr, + "ipAddrId": node.NodeIPAddressId, "route": maps.Map{ "name": "", "code": "", @@ -155,7 +157,7 @@ func (this *ClusterAction) RunGet(params struct { this.ErrorPage(err) return } - serverMaps := []maps.Map{} + var serverMaps = []maps.Map{} for _, server := range serversResp.Servers { // 检查是否已解析 isResolved := false @@ -198,7 +200,7 @@ func (this *ClusterAction) RunGet(params struct { this.ErrorPage(err) return } - issueMaps := []maps.Map{} + var issueMaps = []maps.Map{} for _, issue := range issuesResp.Issues { issueMaps = append(issueMaps, maps.Map{ "target": issue.Target, @@ -218,7 +220,7 @@ func (this *ClusterAction) RunGet(params struct { this.ErrorPage(err) return } - taskMaps := []maps.Map{} + var taskMaps = []maps.Map{} for _, task := range resp.DnsTasks { var clusterMap maps.Map = nil var nodeMap maps.Map = nil diff --git a/internal/web/actions/default/dns/issues/updateNodePopup.go b/internal/web/actions/default/dns/issues/updateNodePopup.go index b43ea8e1..d86d841d 100644 --- a/internal/web/actions/default/dns/issues/updateNodePopup.go +++ b/internal/web/actions/default/dns/issues/updateNodePopup.go @@ -22,12 +22,14 @@ func (this *UpdateNodePopupAction) Init() { func (this *UpdateNodePopupAction) RunGet(params struct { ClusterId int64 NodeId int64 + IpAddrId int64 }) { this.Data["nodeId"] = params.NodeId dnsInfoResp, err := this.RPC().NodeRPC().FindEnabledNodeDNS(this.AdminContext(), &pb.FindEnabledNodeDNSRequest{ NodeId: params.NodeId, NodeClusterId: params.ClusterId, + NodeIPAddrId: params.IpAddrId, }) if err != nil { this.ErrorPage(err) @@ -39,12 +41,13 @@ func (this *UpdateNodePopupAction) RunGet(params struct { return } this.Data["ipAddr"] = dnsInfo.IpAddr + this.Data["ipAddrId"] = dnsInfo.NodeIPAddressId this.Data["routes"] = domainutils.ConvertRoutesToMaps(dnsInfo) this.Data["domainId"] = dnsInfo.DnsDomainId this.Data["domainName"] = dnsInfo.DnsDomainName // 读取所有线路 - allRouteMaps := []maps.Map{} + var allRouteMaps = []maps.Map{} if dnsInfo.DnsDomainId > 0 { routesResp, err := this.RPC().DNSDomainRPC().FindAllDNSDomainRoutes(this.AdminContext(), &pb.FindAllDNSDomainRoutesRequest{DnsDomainId: dnsInfo.DnsDomainId}) if err != nil { @@ -75,6 +78,7 @@ func (this *UpdateNodePopupAction) RunGet(params struct { func (this *UpdateNodePopupAction) RunPost(params struct { NodeId int64 IpAddr string + IpAddrId int64 DomainId int64 DnsRoutesJSON []byte @@ -84,7 +88,7 @@ func (this *UpdateNodePopupAction) RunPost(params struct { // 操作日志 defer this.CreateLog(oplogs.LevelInfo, "修改节点 %d 的DNS设置", params.NodeId) - routes := []string{} + var routes = []string{} if len(params.DnsRoutesJSON) > 0 { err := json.Unmarshal(params.DnsRoutesJSON, &routes) if err != nil { @@ -103,10 +107,11 @@ func (this *UpdateNodePopupAction) RunPost(params struct { // 执行修改 _, err := this.RPC().NodeRPC().UpdateNodeDNS(this.AdminContext(), &pb.UpdateNodeDNSRequest{ - NodeId: params.NodeId, - IpAddr: params.IpAddr, - DnsDomainId: params.DomainId, - Routes: routes, + NodeId: params.NodeId, + IpAddr: params.IpAddr, + NodeIPAddressId: params.IpAddrId, + DnsDomainId: params.DomainId, + Routes: routes, }) if err != nil { this.ErrorPage(err) diff --git a/web/views/@default/dns/clusters/cluster.html b/web/views/@default/dns/clusters/cluster.html index 040479ce..6d18ed50 100644 --- a/web/views/@default/dns/clusters/cluster.html +++ b/web/views/@default/dns/clusters/cluster.html @@ -157,18 +157,18 @@