mirror of
				https://github.com/TeaOSLab/EdgeAdmin.git
				synced 2025-11-04 13:10:26 +08:00 
			
		
		
		
	[域名解析]优化解析状态显示
This commit is contained in:
		@@ -39,6 +39,7 @@ func (this *ClusterAction) RunGet(params struct {
 | 
			
		||||
		this.ErrorPage(err)
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	domainName := ""
 | 
			
		||||
	dnsMap := maps.Map{
 | 
			
		||||
		"dnsName":          dnsResp.Name,
 | 
			
		||||
		"domainId":         0,
 | 
			
		||||
@@ -48,6 +49,7 @@ func (this *ClusterAction) RunGet(params struct {
 | 
			
		||||
		"providerTypeName": "",
 | 
			
		||||
	}
 | 
			
		||||
	if dnsResp.Domain != nil {
 | 
			
		||||
		domainName = dnsResp.Domain.Name
 | 
			
		||||
		dnsMap["domainId"] = dnsResp.Domain.Id
 | 
			
		||||
		dnsMap["domainName"] = dnsResp.Domain.Name
 | 
			
		||||
	}
 | 
			
		||||
@@ -69,6 +71,23 @@ func (this *ClusterAction) RunGet(params struct {
 | 
			
		||||
	for _, node := range nodesResp.Nodes {
 | 
			
		||||
		if len(node.Routes) > 0 {
 | 
			
		||||
			for _, route := range node.Routes {
 | 
			
		||||
				// 检查是否已解析
 | 
			
		||||
				isResolved := false
 | 
			
		||||
				if cluster.DnsDomainId > 0 && len(cluster.DnsName) > 0 && len(node.IpAddr) > 0 {
 | 
			
		||||
					checkResp, err := this.RPC().DNSDomainRPC().ExistDNSDomainRecord(this.AdminContext(), &pb.ExistDNSDomainRecordRequest{
 | 
			
		||||
						DnsDomainId: cluster.DnsDomainId,
 | 
			
		||||
						Name:        cluster.DnsName,
 | 
			
		||||
						Type:        "A",
 | 
			
		||||
						Route:       route.Code,
 | 
			
		||||
						Value:       node.IpAddr,
 | 
			
		||||
					})
 | 
			
		||||
					if err != nil {
 | 
			
		||||
						this.ErrorPage(err)
 | 
			
		||||
						return
 | 
			
		||||
					}
 | 
			
		||||
					isResolved = checkResp.IsOk
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				nodeMaps = append(nodeMaps, maps.Map{
 | 
			
		||||
					"id":     node.Id,
 | 
			
		||||
					"name":   node.Name,
 | 
			
		||||
@@ -77,7 +96,8 @@ func (this *ClusterAction) RunGet(params struct {
 | 
			
		||||
						"name": route.Name,
 | 
			
		||||
						"code": route.Code,
 | 
			
		||||
					},
 | 
			
		||||
					"clusterId": node.NodeClusterId,
 | 
			
		||||
					"clusterId":  node.NodeClusterId,
 | 
			
		||||
					"isResolved": isResolved,
 | 
			
		||||
				})
 | 
			
		||||
			}
 | 
			
		||||
		} else {
 | 
			
		||||
@@ -89,7 +109,8 @@ func (this *ClusterAction) RunGet(params struct {
 | 
			
		||||
					"name": "",
 | 
			
		||||
					"code": "",
 | 
			
		||||
				},
 | 
			
		||||
				"clusterId": node.NodeClusterId,
 | 
			
		||||
				"clusterId":  node.NodeClusterId,
 | 
			
		||||
				"isResolved": false,
 | 
			
		||||
			})
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
@@ -103,10 +124,27 @@ func (this *ClusterAction) RunGet(params struct {
 | 
			
		||||
	}
 | 
			
		||||
	serverMaps := []maps.Map{}
 | 
			
		||||
	for _, server := range serversResp.Servers {
 | 
			
		||||
		// 检查是否已解析
 | 
			
		||||
		isResolved := false
 | 
			
		||||
		if cluster.DnsDomainId > 0 && len(cluster.DnsName) > 0 && len(server.DnsName) > 0 && len(domainName) > 0 {
 | 
			
		||||
			checkResp, err := this.RPC().DNSDomainRPC().ExistDNSDomainRecord(this.AdminContext(), &pb.ExistDNSDomainRecordRequest{
 | 
			
		||||
				DnsDomainId: cluster.DnsDomainId,
 | 
			
		||||
				Name:        server.DnsName,
 | 
			
		||||
				Type:        "CNAME",
 | 
			
		||||
				Value:       cluster.DnsName + "." + domainName,
 | 
			
		||||
			})
 | 
			
		||||
			if err != nil {
 | 
			
		||||
				this.ErrorPage(err)
 | 
			
		||||
				return
 | 
			
		||||
			}
 | 
			
		||||
			isResolved = checkResp.IsOk
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		serverMaps = append(serverMaps, maps.Map{
 | 
			
		||||
			"id":      server.Id,
 | 
			
		||||
			"name":    server.Name,
 | 
			
		||||
			"dnsName": server.DnsName,
 | 
			
		||||
			"id":         server.Id,
 | 
			
		||||
			"name":       server.Name,
 | 
			
		||||
			"dnsName":    server.DnsName,
 | 
			
		||||
			"isResolved": isResolved,
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
	this.Data["servers"] = serverMaps
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										68
									
								
								internal/web/actions/default/dns/domains/clustersPopup.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										68
									
								
								internal/web/actions/default/dns/domains/clustersPopup.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,68 @@
 | 
			
		||||
package domains
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
 | 
			
		||||
	"github.com/iwind/TeaGo/maps"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type ClustersPopupAction struct {
 | 
			
		||||
	actionutils.ParentAction
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *ClustersPopupAction) Init() {
 | 
			
		||||
	this.Nav("", "", "")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *ClustersPopupAction) RunGet(params struct {
 | 
			
		||||
	DomainId int64
 | 
			
		||||
}) {
 | 
			
		||||
	// 域名信息
 | 
			
		||||
	domainResp, err := this.RPC().DNSDomainRPC().FindEnabledBasicDNSDomain(this.AdminContext(), &pb.FindEnabledBasicDNSDomainRequest{
 | 
			
		||||
		DnsDomainId: params.DomainId,
 | 
			
		||||
	})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		this.ErrorPage(err)
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	domain := domainResp.DnsDomain
 | 
			
		||||
	if domain == nil {
 | 
			
		||||
		this.NotFound("dnsDomain", params.DomainId)
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	this.Data["domain"] = domain.Name
 | 
			
		||||
 | 
			
		||||
	// 集群
 | 
			
		||||
	clustersResp, err := this.RPC().NodeClusterRPC().FindAllEnabledNodeClustersWithDNSDomainId(this.AdminContext(), &pb.FindAllEnabledNodeClustersWithDNSDomainIdRequest{DnsDomainId: params.DomainId})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		this.ErrorPage(err)
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	clusterMaps := []maps.Map{}
 | 
			
		||||
	for _, cluster := range clustersResp.NodeClusters {
 | 
			
		||||
		isOk := false
 | 
			
		||||
		if len(cluster.Name) > 0 {
 | 
			
		||||
			checkResp, err := this.RPC().DNSDomainRPC().ExistDNSDomainRecord(this.AdminContext(), &pb.ExistDNSDomainRecordRequest{
 | 
			
		||||
				DnsDomainId: params.DomainId,
 | 
			
		||||
				Name:        cluster.DnsName,
 | 
			
		||||
				Type:        "A",
 | 
			
		||||
			})
 | 
			
		||||
			if err != nil {
 | 
			
		||||
				this.ErrorPage(err)
 | 
			
		||||
				return
 | 
			
		||||
			}
 | 
			
		||||
			isOk = checkResp.IsOk
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		clusterMaps = append(clusterMaps, maps.Map{
 | 
			
		||||
			"id":      cluster.Id,
 | 
			
		||||
			"name":    cluster.Name,
 | 
			
		||||
			"dnsName": cluster.DnsName,
 | 
			
		||||
			"isOk":    isOk,
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
	this.Data["clusters"] = clusterMaps
 | 
			
		||||
 | 
			
		||||
	this.Show()
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										113
									
								
								internal/web/actions/default/dns/domains/nodesPopup.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										113
									
								
								internal/web/actions/default/dns/domains/nodesPopup.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,113 @@
 | 
			
		||||
package domains
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
 | 
			
		||||
	"github.com/iwind/TeaGo/maps"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type NodesPopupAction struct {
 | 
			
		||||
	actionutils.ParentAction
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *NodesPopupAction) Init() {
 | 
			
		||||
	this.Nav("", "", "")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *NodesPopupAction) RunGet(params struct {
 | 
			
		||||
	DomainId int64
 | 
			
		||||
}) {
 | 
			
		||||
	// 域名信息
 | 
			
		||||
	domainResp, err := this.RPC().DNSDomainRPC().FindEnabledBasicDNSDomain(this.AdminContext(), &pb.FindEnabledBasicDNSDomainRequest{
 | 
			
		||||
		DnsDomainId: params.DomainId,
 | 
			
		||||
	})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		this.ErrorPage(err)
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	domain := domainResp.DnsDomain
 | 
			
		||||
	if domain == nil {
 | 
			
		||||
		this.NotFound("dnsDomain", params.DomainId)
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	this.Data["domain"] = domain.Name
 | 
			
		||||
 | 
			
		||||
	// 集群
 | 
			
		||||
	clusterMaps := []maps.Map{}
 | 
			
		||||
	clustersResp, err := this.RPC().NodeClusterRPC().FindAllEnabledNodeClustersWithDNSDomainId(this.AdminContext(), &pb.FindAllEnabledNodeClustersWithDNSDomainIdRequest{DnsDomainId: params.DomainId})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		this.ErrorPage(err)
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	for _, cluster := range clustersResp.NodeClusters {
 | 
			
		||||
		// 节点DNS解析记录
 | 
			
		||||
		nodesResp, err := this.RPC().NodeRPC().FindAllEnabledNodesDNSWithClusterId(this.AdminContext(), &pb.FindAllEnabledNodesDNSWithClusterIdRequest{NodeClusterId: cluster.Id})
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			this.ErrorPage(err)
 | 
			
		||||
			return
 | 
			
		||||
		}
 | 
			
		||||
		nodeMaps := []maps.Map{}
 | 
			
		||||
		for _, node := range nodesResp.Nodes {
 | 
			
		||||
			if len(node.Routes) > 0 {
 | 
			
		||||
				for _, route := range node.Routes {
 | 
			
		||||
					// 检查是否有域名解析记录
 | 
			
		||||
					isOk := false
 | 
			
		||||
					if len(route.Name) > 0 && len(node.IpAddr) > 0 && len(cluster.DnsName) > 0 {
 | 
			
		||||
						checkResp, err := this.RPC().DNSDomainRPC().ExistDNSDomainRecord(this.AdminContext(), &pb.ExistDNSDomainRecordRequest{
 | 
			
		||||
							DnsDomainId: params.DomainId,
 | 
			
		||||
							Name:        cluster.DnsName,
 | 
			
		||||
							Type:        "A",
 | 
			
		||||
							Route:       route.Code,
 | 
			
		||||
							Value:       node.IpAddr,
 | 
			
		||||
						})
 | 
			
		||||
						if err != nil {
 | 
			
		||||
							this.ErrorPage(err)
 | 
			
		||||
							return
 | 
			
		||||
						}
 | 
			
		||||
						isOk = checkResp.IsOk
 | 
			
		||||
					}
 | 
			
		||||
 | 
			
		||||
					nodeMaps = append(nodeMaps, maps.Map{
 | 
			
		||||
						"id":     node.Id,
 | 
			
		||||
						"name":   node.Name,
 | 
			
		||||
						"ipAddr": node.IpAddr,
 | 
			
		||||
						"route": maps.Map{
 | 
			
		||||
							"name": route.Name,
 | 
			
		||||
							"code": route.Code,
 | 
			
		||||
						},
 | 
			
		||||
						"clusterId": node.NodeClusterId,
 | 
			
		||||
						"isOk":      isOk,
 | 
			
		||||
					})
 | 
			
		||||
				}
 | 
			
		||||
			} else {
 | 
			
		||||
				nodeMaps = append(nodeMaps, maps.Map{
 | 
			
		||||
					"id":     node.Id,
 | 
			
		||||
					"name":   node.Name,
 | 
			
		||||
					"ipAddr": node.IpAddr,
 | 
			
		||||
					"route": maps.Map{
 | 
			
		||||
						"name": "",
 | 
			
		||||
						"code": "",
 | 
			
		||||
					},
 | 
			
		||||
					"clusterId": node.NodeClusterId,
 | 
			
		||||
					"isOk":      false,
 | 
			
		||||
				})
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if len(nodeMaps) == 0 {
 | 
			
		||||
			continue
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		clusterMaps = append(clusterMaps, maps.Map{
 | 
			
		||||
			"id":      cluster.Id,
 | 
			
		||||
			"name":    cluster.Name,
 | 
			
		||||
			"dnsName": cluster.DnsName,
 | 
			
		||||
			"nodes":   nodeMaps,
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
	this.Data["clusters"] = clusterMaps
 | 
			
		||||
 | 
			
		||||
	this.Show()
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										83
									
								
								internal/web/actions/default/dns/domains/serversPopup.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										83
									
								
								internal/web/actions/default/dns/domains/serversPopup.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,83 @@
 | 
			
		||||
package domains
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
 | 
			
		||||
	"github.com/iwind/TeaGo/maps"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type ServersPopupAction struct {
 | 
			
		||||
	actionutils.ParentAction
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *ServersPopupAction) Init() {
 | 
			
		||||
	this.Nav("", "", "")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *ServersPopupAction) RunGet(params struct {
 | 
			
		||||
	DomainId int64
 | 
			
		||||
}) {
 | 
			
		||||
	// 域名信息
 | 
			
		||||
	domainResp, err := this.RPC().DNSDomainRPC().FindEnabledBasicDNSDomain(this.AdminContext(), &pb.FindEnabledBasicDNSDomainRequest{
 | 
			
		||||
		DnsDomainId: params.DomainId,
 | 
			
		||||
	})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		this.ErrorPage(err)
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	domain := domainResp.DnsDomain
 | 
			
		||||
	if domain == nil {
 | 
			
		||||
		this.NotFound("dnsDomain", params.DomainId)
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	this.Data["domain"] = domain.Name
 | 
			
		||||
 | 
			
		||||
	// 服务信息
 | 
			
		||||
	clusterMaps := []maps.Map{}
 | 
			
		||||
	clustersResp, err := this.RPC().NodeClusterRPC().FindAllEnabledNodeClustersWithDNSDomainId(this.AdminContext(), &pb.FindAllEnabledNodeClustersWithDNSDomainIdRequest{DnsDomainId: params.DomainId})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		this.ErrorPage(err)
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	for _, cluster := range clustersResp.NodeClusters {
 | 
			
		||||
		serversResp, err := this.RPC().ServerRPC().FindAllEnabledServersDNSWithClusterId(this.AdminContext(), &pb.FindAllEnabledServersDNSWithClusterIdRequest{NodeClusterId: cluster.Id})
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			this.ErrorPage(err)
 | 
			
		||||
			return
 | 
			
		||||
		}
 | 
			
		||||
		serverMaps := []maps.Map{}
 | 
			
		||||
		for _, server := range serversResp.Servers {
 | 
			
		||||
			isOk := false
 | 
			
		||||
			if len(cluster.DnsName) > 0 && len(server.DnsName) > 0 {
 | 
			
		||||
				checkResp, err := this.RPC().DNSDomainRPC().ExistDNSDomainRecord(this.AdminContext(), &pb.ExistDNSDomainRecordRequest{
 | 
			
		||||
					DnsDomainId: params.DomainId,
 | 
			
		||||
					Name:        server.DnsName,
 | 
			
		||||
					Type:        "CNAME",
 | 
			
		||||
					Value:       cluster.DnsName + "." + domain.Name,
 | 
			
		||||
				})
 | 
			
		||||
				if err != nil {
 | 
			
		||||
					this.ErrorPage(err)
 | 
			
		||||
					return
 | 
			
		||||
				}
 | 
			
		||||
				isOk = checkResp.IsOk
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			serverMaps = append(serverMaps, maps.Map{
 | 
			
		||||
				"id":      server.Id,
 | 
			
		||||
				"name":    server.Name,
 | 
			
		||||
				"dnsName": server.DnsName,
 | 
			
		||||
				"isOk":    isOk,
 | 
			
		||||
			})
 | 
			
		||||
		}
 | 
			
		||||
		clusterMaps = append(clusterMaps, maps.Map{
 | 
			
		||||
			"id":      cluster.Id,
 | 
			
		||||
			"name":    cluster.Name,
 | 
			
		||||
			"dnsName": cluster.DnsName,
 | 
			
		||||
			"servers": serverMaps,
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
	this.Data["clusters"] = clusterMaps
 | 
			
		||||
 | 
			
		||||
	this.Show()
 | 
			
		||||
}
 | 
			
		||||
@@ -45,6 +45,9 @@ func init() {
 | 
			
		||||
			Post("/sync", new(domains.SyncAction)).
 | 
			
		||||
			Get("/routesPopup", new(domains.RoutesPopupAction)).
 | 
			
		||||
			GetPost("/selectPopup", new(domains.SelectPopupAction)).
 | 
			
		||||
			Get("/clustersPopup", new(domains.ClustersPopupAction)).
 | 
			
		||||
			Get("/nodesPopup", new(domains.NodesPopupAction)).
 | 
			
		||||
			Get("/serversPopup", new(domains.ServersPopupAction)).
 | 
			
		||||
			EndData().
 | 
			
		||||
 | 
			
		||||
			// 问题修复
 | 
			
		||||
 
 | 
			
		||||
@@ -69,6 +69,9 @@ func (this *ProviderAction) RunGet(params struct {
 | 
			
		||||
			"serversChanged":     domain.ServersChanged,
 | 
			
		||||
			"countNodeRecords":   domain.CountNodeRecords,
 | 
			
		||||
			"nodesChanged":       domain.NodesChanged,
 | 
			
		||||
			"countClusters":      domain.CountNodeClusters,
 | 
			
		||||
			"countAllNodes":      domain.CountAllNodes,
 | 
			
		||||
			"countAllServers":    domain.CountAllServers,
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
	this.Data["domains"] = domainMaps
 | 
			
		||||
 
 | 
			
		||||
@@ -21,6 +21,16 @@ func (this *CreateAction) Init() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *CreateAction) RunGet(params struct{}) {
 | 
			
		||||
	// 审核中的数量
 | 
			
		||||
	countAuditingResp, err := this.RPC().ServerRPC().CountAllEnabledServersMatch(this.AdminContext(), &pb.CountAllEnabledServersMatchRequest{
 | 
			
		||||
		AuditingFlag: 1,
 | 
			
		||||
	})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		this.ErrorPage(err)
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	this.Data["countAuditing"] = countAuditingResp.Count
 | 
			
		||||
 | 
			
		||||
	// 所有集群
 | 
			
		||||
	resp, err := this.RPC().NodeClusterRPC().FindAllEnabledNodeClusters(this.AdminContext(), &pb.FindAllEnabledNodeClustersRequest{})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
 
 | 
			
		||||
@@ -26,6 +26,6 @@ Vue.component("checkbox", {
 | 
			
		||||
	},
 | 
			
		||||
	template: `<div class="ui checkbox">
 | 
			
		||||
	<input type="checkbox" :name="name" :value="elementValue" :id="elementId" @change="change" v-model="newValue"/>
 | 
			
		||||
	<label :for="elementId"><slot></slot></label>
 | 
			
		||||
	<label :for="elementId" style="font-size: 0.85em!important;"><slot></slot></label>
 | 
			
		||||
</div>`
 | 
			
		||||
})
 | 
			
		||||
@@ -44,9 +44,11 @@ Vue.component("popup-icon", {
 | 
			
		||||
	props: ["title", "href", "height"],
 | 
			
		||||
	methods: {
 | 
			
		||||
		clickPrevent: function () {
 | 
			
		||||
			teaweb.popup(this.href, {
 | 
			
		||||
				height: this.height
 | 
			
		||||
			})
 | 
			
		||||
			if (this.href != null && this.href.length > 0) {
 | 
			
		||||
				teaweb.popup(this.href, {
 | 
			
		||||
					height: this.height
 | 
			
		||||
				})
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	},
 | 
			
		||||
	template: `<span><slot></slot> <a href="" :title="title" @click.prevent="clickPrevent"><i class="icon clone outline small"></i></a></span>`
 | 
			
		||||
 
 | 
			
		||||
@@ -54,6 +54,7 @@
 | 
			
		||||
			<th>记录类型</th>
 | 
			
		||||
			<th>记录值</th>
 | 
			
		||||
			<th>线路</th>
 | 
			
		||||
            <th>状态</th>
 | 
			
		||||
			<th class="two op">操作</th>
 | 
			
		||||
		</tr>
 | 
			
		||||
	</thead>
 | 
			
		||||
@@ -72,6 +73,10 @@
 | 
			
		||||
			<span v-if="node.route.code.length > 0">{{node.route.name}}</span>
 | 
			
		||||
			<link-red v-else title="点击设置" @click.prevent="updateNode(node.id)">没有设置</link-red>
 | 
			
		||||
		</td>
 | 
			
		||||
        <td>
 | 
			
		||||
            <span class="green" v-if="node.isResolved">已解析</span>
 | 
			
		||||
            <span v-else class="red">未解析</span>
 | 
			
		||||
        </td>
 | 
			
		||||
		<td>
 | 
			
		||||
			<link-popup @click.prevent="updateNode(node.id)">修改</link-popup>
 | 
			
		||||
		</td>
 | 
			
		||||
@@ -87,6 +92,7 @@
 | 
			
		||||
			<th>子域名</th>
 | 
			
		||||
			<th>记录类型</th>
 | 
			
		||||
			<th>记录值</th>
 | 
			
		||||
            <th>状态</th>
 | 
			
		||||
		</tr>
 | 
			
		||||
	</thead>
 | 
			
		||||
	<tr v-for="server in servers">
 | 
			
		||||
@@ -97,5 +103,9 @@
 | 
			
		||||
			<span v-if="dnsInfo.domainName.length > 0"><var>{{dnsInfo.dnsName}}</var>.{{dnsInfo.domainName}}.</span>
 | 
			
		||||
			<link-red title="点击设置"  v-else @click.prevent="updateCluster(cluster.id)">没有设置</link-red>
 | 
			
		||||
		</td>
 | 
			
		||||
        <td>
 | 
			
		||||
            <span class="green" v-if="server.isResolved">已解析</span>
 | 
			
		||||
            <span v-else class="red">未解析</span>
 | 
			
		||||
        </td>
 | 
			
		||||
	</tr>
 | 
			
		||||
</table>
 | 
			
		||||
							
								
								
									
										20
									
								
								web/views/@default/dns/domains/clustersPopup.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								web/views/@default/dns/domains/clustersPopup.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,20 @@
 | 
			
		||||
{$layout "layout_popup"}
 | 
			
		||||
 | 
			
		||||
<h3>使用域名"{{domain}}"的集群</h3>
 | 
			
		||||
<table class="ui table selectable">
 | 
			
		||||
    <thead>
 | 
			
		||||
        <tr>
 | 
			
		||||
            <th>集群</th>
 | 
			
		||||
            <th>域名</th>
 | 
			
		||||
            <th class="width10">解析状态</th>
 | 
			
		||||
        </tr>
 | 
			
		||||
    </thead>
 | 
			
		||||
    <tr v-for="cluster in clusters">
 | 
			
		||||
        <td>{{cluster.name}}<a :href="'/clusters/cluster?clusterId=' + cluster.id" target="_blank"><link-icon></link-icon></a> </td>
 | 
			
		||||
        <td>{{cluster.dnsName}}.{{domain}}</td>
 | 
			
		||||
        <td>
 | 
			
		||||
            <span class="green" v-if="cluster.isOk">已解析</span>
 | 
			
		||||
            <span class="red" v-else>未解析</span>
 | 
			
		||||
        </td>
 | 
			
		||||
    </tr>
 | 
			
		||||
</table>
 | 
			
		||||
							
								
								
									
										41
									
								
								web/views/@default/dns/domains/nodesPopup.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								web/views/@default/dns/domains/nodesPopup.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,41 @@
 | 
			
		||||
{$layout "layout_popup"}
 | 
			
		||||
 | 
			
		||||
<h3>使用域名"{{domain}}"的节点</h3>
 | 
			
		||||
<form class="ui form">
 | 
			
		||||
    <div class="ui fields inline">
 | 
			
		||||
        <div class="ui field">
 | 
			
		||||
            <input type="text" placeholder="关键词" v-model="keyword"/>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="ui field">
 | 
			
		||||
            <select class="ui dropdown auto-width" v-model="status">
 | 
			
		||||
                <option value="">[全部状态]</option>
 | 
			
		||||
                <option value="ok">已解析</option>
 | 
			
		||||
                <option value="notOk">未解析</option>
 | 
			
		||||
            </select>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
</form>
 | 
			
		||||
<div class="ui divider"></div>
 | 
			
		||||
<table class="ui table selectable">
 | 
			
		||||
    <thead>
 | 
			
		||||
        <tr>
 | 
			
		||||
            <th>集群</th>
 | 
			
		||||
            <th>节点</th>
 | 
			
		||||
            <th>子域名</th>
 | 
			
		||||
            <th>线路</th>
 | 
			
		||||
            <th>IP</th>
 | 
			
		||||
            <th class="width10">解析状态</th>
 | 
			
		||||
        </tr>
 | 
			
		||||
    </thead>
 | 
			
		||||
    <tr v-for="node in nodes">
 | 
			
		||||
        <td>{{node.cluster.name}}<a :href="'/clusters/cluster?clusterId=' + node.cluster.id" target="_blank"><link-icon></link-icon></a> </td>
 | 
			
		||||
        <td>{{node.name}}<a :href="'/clusters/cluster/node?clusterId=' + node.cluster.id + '&nodeId=' + node.id" target="_blank"><link-icon></link-icon></a></td>
 | 
			
		||||
        <td>{{node.cluster.dnsName}}</td>
 | 
			
		||||
        <td>{{node.route.name}}</td>
 | 
			
		||||
        <td>{{node.ipAddr}}</td>
 | 
			
		||||
        <td>
 | 
			
		||||
            <span class="green" v-if="node.isOk">已解析</span>
 | 
			
		||||
            <span class="red" v-else>未解析</span>
 | 
			
		||||
        </td>
 | 
			
		||||
    </tr>
 | 
			
		||||
</table>
 | 
			
		||||
							
								
								
									
										45
									
								
								web/views/@default/dns/domains/nodesPopup.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								web/views/@default/dns/domains/nodesPopup.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,45 @@
 | 
			
		||||
Tea.context(function () {
 | 
			
		||||
	this.keyword = ""
 | 
			
		||||
	this.status = ""
 | 
			
		||||
 | 
			
		||||
	let allNodes = []
 | 
			
		||||
	this.clusters.forEach(function (cluster) {
 | 
			
		||||
		let nodes = cluster.nodes
 | 
			
		||||
		nodes.forEach(function (node) {
 | 
			
		||||
			node.cluster = cluster
 | 
			
		||||
			allNodes.push(node)
 | 
			
		||||
		})
 | 
			
		||||
	})
 | 
			
		||||
 | 
			
		||||
	this.nodes = allNodes
 | 
			
		||||
 | 
			
		||||
	this.$delay(function () {
 | 
			
		||||
		this.$watch("keyword", function () {
 | 
			
		||||
			this.reloadNodes()
 | 
			
		||||
		})
 | 
			
		||||
		this.$watch("status", function () {
 | 
			
		||||
			this.reloadNodes()
 | 
			
		||||
		})
 | 
			
		||||
	})
 | 
			
		||||
 | 
			
		||||
	this.reloadNodes = function () {
 | 
			
		||||
		let that = this
 | 
			
		||||
		this.nodes = allNodes.$copy().$findAll(function (k, v) {
 | 
			
		||||
			if (that.keyword.length > 0
 | 
			
		||||
				&& !teaweb.match(v.cluster.name, that.keyword)
 | 
			
		||||
				&& !teaweb.match(v.cluster.dnsName, that.keyword)
 | 
			
		||||
				&& !teaweb.match(v.name, that.keyword)
 | 
			
		||||
				&& !teaweb.match(v.ipAddr, that.keyword)
 | 
			
		||||
				&& !teaweb.match(v.route.name, that.keyword)) {
 | 
			
		||||
				return false
 | 
			
		||||
			}
 | 
			
		||||
			if (that.status == "ok" && !v.isOk) {
 | 
			
		||||
				return false
 | 
			
		||||
			}
 | 
			
		||||
			if (that.status == "notOk" && v.isOk) {
 | 
			
		||||
				return false
 | 
			
		||||
			}
 | 
			
		||||
			return true
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
})
 | 
			
		||||
							
								
								
									
										39
									
								
								web/views/@default/dns/domains/serversPopup.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								web/views/@default/dns/domains/serversPopup.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,39 @@
 | 
			
		||||
{$layout "layout_popup"}
 | 
			
		||||
 | 
			
		||||
<h3>使用域名"{{domain}}"的节点</h3>
 | 
			
		||||
<form class="ui form">
 | 
			
		||||
    <div class="ui fields inline">
 | 
			
		||||
        <div class="ui field">
 | 
			
		||||
            <input type="text" placeholder="关键词" v-model="keyword"/>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="ui field">
 | 
			
		||||
            <select class="ui dropdown auto-width" v-model="status">
 | 
			
		||||
                <option value="">[全部状态]</option>
 | 
			
		||||
                <option value="ok">已解析</option>
 | 
			
		||||
                <option value="notOk">未解析</option>
 | 
			
		||||
            </select>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
</form>
 | 
			
		||||
<div class="ui divider"></div>
 | 
			
		||||
<table class="ui table selectable">
 | 
			
		||||
    <thead>
 | 
			
		||||
        <tr>
 | 
			
		||||
            <th>集群</th>
 | 
			
		||||
            <th>服务</th>
 | 
			
		||||
            <th>子域名</th>
 | 
			
		||||
            <th>CNAME</th>
 | 
			
		||||
            <th class="width10">解析状态</th>
 | 
			
		||||
        </tr>
 | 
			
		||||
    </thead>
 | 
			
		||||
    <tr v-for="server in servers">
 | 
			
		||||
        <td>{{server.cluster.name}}<a :href="'/clusters/cluster?clusterId=' + server.cluster.id" target="_blank"><link-icon></link-icon></a> </td>
 | 
			
		||||
        <td>{{server.name}}<a :href="'/servers/server?clusterId=' + server.cluster.id + '&serverId=' + server.id" target="_blank"><link-icon></link-icon></a></td>
 | 
			
		||||
        <td>{{server.cluster.dnsName}}</td>
 | 
			
		||||
        <td>{{server.dnsName}}</td>
 | 
			
		||||
        <td>
 | 
			
		||||
            <span class="green" v-if="server.isOk">已解析</span>
 | 
			
		||||
            <span class="red" v-else>未解析</span>
 | 
			
		||||
        </td>
 | 
			
		||||
    </tr>
 | 
			
		||||
</table>
 | 
			
		||||
							
								
								
									
										44
									
								
								web/views/@default/dns/domains/serversPopup.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								web/views/@default/dns/domains/serversPopup.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,44 @@
 | 
			
		||||
Tea.context(function () {
 | 
			
		||||
	this.keyword = ""
 | 
			
		||||
	this.status = ""
 | 
			
		||||
 | 
			
		||||
	let allServers = []
 | 
			
		||||
	this.clusters.forEach(function (cluster) {
 | 
			
		||||
		let servers = cluster.servers
 | 
			
		||||
		servers.forEach(function (server) {
 | 
			
		||||
			server.cluster = cluster
 | 
			
		||||
			allServers.push(server)
 | 
			
		||||
		})
 | 
			
		||||
	})
 | 
			
		||||
 | 
			
		||||
	this.servers = allServers
 | 
			
		||||
 | 
			
		||||
	this.$delay(function () {
 | 
			
		||||
		this.$watch("keyword", function () {
 | 
			
		||||
			this.reloadServers()
 | 
			
		||||
		})
 | 
			
		||||
		this.$watch("status", function () {
 | 
			
		||||
			this.reloadServers()
 | 
			
		||||
		})
 | 
			
		||||
	})
 | 
			
		||||
 | 
			
		||||
	this.reloadServers = function () {
 | 
			
		||||
		let that = this
 | 
			
		||||
		this.servers = allServers.$copy().$findAll(function (k, v) {
 | 
			
		||||
			if (that.keyword.length > 0
 | 
			
		||||
				&& !teaweb.match(v.cluster.name, that.keyword)
 | 
			
		||||
				&& !teaweb.match(v.cluster.dnsName, that.keyword)
 | 
			
		||||
				&& !teaweb.match(v.name, that.keyword)
 | 
			
		||||
				&& !teaweb.match(v.dnsName, that.keyword)) {
 | 
			
		||||
				return false
 | 
			
		||||
			}
 | 
			
		||||
			if (that.status == "ok" && !v.isOk) {
 | 
			
		||||
				return false
 | 
			
		||||
			}
 | 
			
		||||
			if (that.status == "notOk" && v.isOk) {
 | 
			
		||||
				return false
 | 
			
		||||
			}
 | 
			
		||||
			return true
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
})
 | 
			
		||||
@@ -52,9 +52,10 @@
 | 
			
		||||
	<thead>
 | 
			
		||||
		<tr>
 | 
			
		||||
			<th>域名</th>
 | 
			
		||||
			<th class="width10 center">线路</th>
 | 
			
		||||
			<th class="width10 center">节点域名</th>
 | 
			
		||||
			<th class="width10 center">服务域名</th>
 | 
			
		||||
			<th class="center" style="width: 7em">线路</th>
 | 
			
		||||
            <th class="center" style="width: 6em">集群</th>
 | 
			
		||||
			<th class="center" style="width: 7em">节点域名</th>
 | 
			
		||||
			<th class="center" style="width: 7em">服务域名</th>
 | 
			
		||||
			<th>数据更新时间</th>
 | 
			
		||||
			<th class="center width10">状态</th>
 | 
			
		||||
			<th class="three op">操作</th>
 | 
			
		||||
@@ -63,15 +64,19 @@
 | 
			
		||||
	<tr v-for="(domain, index) in domains">
 | 
			
		||||
		<td>{{domain.name}}</td>
 | 
			
		||||
		<td class="center">
 | 
			
		||||
			<a href="" v-if="domain.countRoutes > 0" @click.prevent="showRoutes(domain.id)">{{domain.countRoutes}}个</a>
 | 
			
		||||
			<a href="" v-if="domain.countRoutes > 0" @click.prevent="showRoutes(domain.id)">{{domain.countRoutes}}个<popup-icon></popup-icon></a>
 | 
			
		||||
			<span v-else class="disabled">0个</span>
 | 
			
		||||
		</td>
 | 
			
		||||
        <td class="center">
 | 
			
		||||
            <a href="" v-if="domain.countClusters > 0" @click.prevent="viewClusters(domain.id)">{{domain.countClusters}}<popup-icon></popup-icon></a>
 | 
			
		||||
            <span v-else class="disabled">0个</span>
 | 
			
		||||
        </td>
 | 
			
		||||
		<td class="center">
 | 
			
		||||
			<a href="" v-if="domain.countAllNodes > 0" @click.prevent="viewNodes(domain.id)">{{domain.countNodeRecords}}/{{domain.countAllNodes}}个<popup-icon></popup-icon></a>
 | 
			
		||||
			<span v-else class="disabled">0个</span>
 | 
			
		||||
		</td>
 | 
			
		||||
		<td class="center">
 | 
			
		||||
			<span v-if="domain.countNodeRecords > 0">{{domain.countNodeRecords}}个</span>
 | 
			
		||||
			<span v-else class="disabled">0个</span>
 | 
			
		||||
		</td>
 | 
			
		||||
		<td class="center">
 | 
			
		||||
			<span v-if="domain.countServerRecords > 0">{{domain.countServerRecords}}个</span>
 | 
			
		||||
			<a href="" v-if="domain.countAllServers > 0" @click.prevent="viewServers(domain.id)">{{domain.countServerRecords}}/{{domain.countAllServers}}个<popup-icon></popup-icon></a>
 | 
			
		||||
			<span v-else class="disabled">0个</span>
 | 
			
		||||
		</td>
 | 
			
		||||
		<td>
 | 
			
		||||
 
 | 
			
		||||
@@ -73,4 +73,19 @@ Tea.context(function () {
 | 
			
		||||
	this.showRoutes = function (domainId) {
 | 
			
		||||
		teaweb.popup("/dns/domains/routesPopup?domainId=" + domainId)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	this.viewClusters = function (domainId) {
 | 
			
		||||
		teaweb.popup("/dns/domains/clustersPopup?domainId=" + domainId)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	this.viewNodes = function (domainId) {
 | 
			
		||||
		teaweb.popup("/dns/domains/nodesPopup?domainId=" + domainId, {
 | 
			
		||||
			width: "50em",
 | 
			
		||||
			height: "30em"
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	this.viewServers = function (domainId) {
 | 
			
		||||
		teaweb.popup("/dns/domains/serversPopup?domainId=" + domainId)
 | 
			
		||||
	}
 | 
			
		||||
})
 | 
			
		||||
		Reference in New Issue
	
	Block a user