diff --git a/internal/web/actions/default/dns/clusters/cluster.go b/internal/web/actions/default/dns/clusters/cluster.go
index 91928863..37e52258 100644
--- a/internal/web/actions/default/dns/clusters/cluster.go
+++ b/internal/web/actions/default/dns/clusters/cluster.go
@@ -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
diff --git a/internal/web/actions/default/dns/domains/clustersPopup.go b/internal/web/actions/default/dns/domains/clustersPopup.go
new file mode 100644
index 00000000..7edfebf6
--- /dev/null
+++ b/internal/web/actions/default/dns/domains/clustersPopup.go
@@ -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()
+}
diff --git a/internal/web/actions/default/dns/domains/nodesPopup.go b/internal/web/actions/default/dns/domains/nodesPopup.go
new file mode 100644
index 00000000..33147258
--- /dev/null
+++ b/internal/web/actions/default/dns/domains/nodesPopup.go
@@ -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()
+}
diff --git a/internal/web/actions/default/dns/domains/serversPopup.go b/internal/web/actions/default/dns/domains/serversPopup.go
new file mode 100644
index 00000000..889ab0db
--- /dev/null
+++ b/internal/web/actions/default/dns/domains/serversPopup.go
@@ -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()
+}
diff --git a/internal/web/actions/default/dns/init.go b/internal/web/actions/default/dns/init.go
index 364c5b2d..00e1ad2b 100644
--- a/internal/web/actions/default/dns/init.go
+++ b/internal/web/actions/default/dns/init.go
@@ -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().
// 问题修复
diff --git a/internal/web/actions/default/dns/providers/provider.go b/internal/web/actions/default/dns/providers/provider.go
index 9d318fb2..16caf824 100644
--- a/internal/web/actions/default/dns/providers/provider.go
+++ b/internal/web/actions/default/dns/providers/provider.go
@@ -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
diff --git a/internal/web/actions/default/servers/create.go b/internal/web/actions/default/servers/create.go
index 1dda5ea9..c87b2251 100644
--- a/internal/web/actions/default/servers/create.go
+++ b/internal/web/actions/default/servers/create.go
@@ -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 {
diff --git a/web/public/js/components/common/checkbox.js b/web/public/js/components/common/checkbox.js
index eb169e91..6bafcf01 100644
--- a/web/public/js/components/common/checkbox.js
+++ b/web/public/js/components/common/checkbox.js
@@ -26,6 +26,6 @@ Vue.component("checkbox", {
},
template: `
-
+
`
})
\ No newline at end of file
diff --git a/web/public/js/components/common/links.js b/web/public/js/components/common/links.js
index 69e9b2ff..09b1e690 100644
--- a/web/public/js/components/common/links.js
+++ b/web/public/js/components/common/links.js
@@ -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: ` `
diff --git a/web/views/@default/dns/clusters/cluster.html b/web/views/@default/dns/clusters/cluster.html
index 15cf3780..8d2fff14 100644
--- a/web/views/@default/dns/clusters/cluster.html
+++ b/web/views/@default/dns/clusters/cluster.html
@@ -54,6 +54,7 @@
记录类型
记录值
线路
+ 状态
操作
@@ -72,6 +73,10 @@
{{node.route.name}}
没有设置
+
+ 已解析
+ 未解析
+
修改
@@ -87,6 +92,7 @@
子域名
记录类型
记录值
+ 状态
@@ -97,5 +103,9 @@
{{dnsInfo.dnsName}} .{{dnsInfo.domainName}}.
没有设置
+
+ 已解析
+ 未解析
+
\ No newline at end of file
diff --git a/web/views/@default/dns/domains/clustersPopup.html b/web/views/@default/dns/domains/clustersPopup.html
new file mode 100644
index 00000000..01a9d7f7
--- /dev/null
+++ b/web/views/@default/dns/domains/clustersPopup.html
@@ -0,0 +1,20 @@
+{$layout "layout_popup"}
+
+使用域名"{{domain}}"的集群
+
+
+
+ 集群
+ 域名
+ 解析状态
+
+
+
+ {{cluster.name}}
+ {{cluster.dnsName}}.{{domain}}
+
+ 已解析
+ 未解析
+
+
+
\ No newline at end of file
diff --git a/web/views/@default/dns/domains/nodesPopup.html b/web/views/@default/dns/domains/nodesPopup.html
new file mode 100644
index 00000000..688731b8
--- /dev/null
+++ b/web/views/@default/dns/domains/nodesPopup.html
@@ -0,0 +1,41 @@
+{$layout "layout_popup"}
+
+使用域名"{{domain}}"的节点
+
+
+
+
+
+ 集群
+ 节点
+ 子域名
+ 线路
+ IP
+ 解析状态
+
+
+
+ {{node.cluster.name}}
+ {{node.name}}
+ {{node.cluster.dnsName}}
+ {{node.route.name}}
+ {{node.ipAddr}}
+
+ 已解析
+ 未解析
+
+
+
\ No newline at end of file
diff --git a/web/views/@default/dns/domains/nodesPopup.js b/web/views/@default/dns/domains/nodesPopup.js
new file mode 100644
index 00000000..8a95baee
--- /dev/null
+++ b/web/views/@default/dns/domains/nodesPopup.js
@@ -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
+ })
+ }
+})
\ No newline at end of file
diff --git a/web/views/@default/dns/domains/serversPopup.html b/web/views/@default/dns/domains/serversPopup.html
new file mode 100644
index 00000000..cbb6b498
--- /dev/null
+++ b/web/views/@default/dns/domains/serversPopup.html
@@ -0,0 +1,39 @@
+{$layout "layout_popup"}
+
+使用域名"{{domain}}"的节点
+
+
+
+
+
+ 集群
+ 服务
+ 子域名
+ CNAME
+ 解析状态
+
+
+
+ {{server.cluster.name}}
+ {{server.name}}
+ {{server.cluster.dnsName}}
+ {{server.dnsName}}
+
+ 已解析
+ 未解析
+
+
+
\ No newline at end of file
diff --git a/web/views/@default/dns/domains/serversPopup.js b/web/views/@default/dns/domains/serversPopup.js
new file mode 100644
index 00000000..39230f84
--- /dev/null
+++ b/web/views/@default/dns/domains/serversPopup.js
@@ -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
+ })
+ }
+})
\ No newline at end of file
diff --git a/web/views/@default/dns/providers/provider.html b/web/views/@default/dns/providers/provider.html
index b0f6595a..16e4f4f9 100644
--- a/web/views/@default/dns/providers/provider.html
+++ b/web/views/@default/dns/providers/provider.html
@@ -52,9 +52,10 @@
域名
- 线路
- 节点域名
- 服务域名
+ 线路
+ 集群
+ 节点域名
+ 服务域名
数据更新时间
状态
操作
@@ -63,15 +64,19 @@
{{domain.name}}
- {{domain.countRoutes}}个
+ {{domain.countRoutes}}个
+ 0个
+
+
+ {{domain.countClusters}}
+ 0个
+
+
+ {{domain.countNodeRecords}}/{{domain.countAllNodes}}个
0个
- {{domain.countNodeRecords}}个
- 0个
-
-
- {{domain.countServerRecords}}个
+ {{domain.countServerRecords}}/{{domain.countAllServers}}个
0个
diff --git a/web/views/@default/dns/providers/provider.js b/web/views/@default/dns/providers/provider.js
index 38318445..844b0a89 100644
--- a/web/views/@default/dns/providers/provider.js
+++ b/web/views/@default/dns/providers/provider.js
@@ -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)
+ }
})
\ No newline at end of file