diff --git a/internal/rpc/rpc_client.go b/internal/rpc/rpc_client.go
index f7cfec41..bb5cfa40 100644
--- a/internal/rpc/rpc_client.go
+++ b/internal/rpc/rpc_client.go
@@ -212,6 +212,10 @@ func (this *RPCClient) DNSDomainRPC() pb.DNSDomainServiceClient {
return pb.NewDNSDomainServiceClient(this.pickConn())
}
+func (this *RPCClient) DNSRPC() pb.DNSServiceClient {
+ return pb.NewDNSServiceClient(this.pickConn())
+}
+
// 构造Admin上下文
func (this *RPCClient) Context(adminId int64) context.Context {
ctx := context.Background()
diff --git a/internal/web/actions/default/dns/clusters/cluster.go b/internal/web/actions/default/dns/clusters/cluster.go
index 14c710ef..00ec14d6 100644
--- a/internal/web/actions/default/dns/clusters/cluster.go
+++ b/internal/web/actions/default/dns/clusters/cluster.go
@@ -68,10 +68,11 @@ func (this *ClusterAction) RunGet(params struct {
nodeMaps := []maps.Map{}
for _, node := range nodesResp.Nodes {
nodeMaps = append(nodeMaps, maps.Map{
- "id": node.Id,
- "name": node.Name,
- "ipAddr": node.IpAddr,
- "route": node.Route,
+ "id": node.Id,
+ "name": node.Name,
+ "ipAddr": node.IpAddr,
+ "route": node.Route,
+ "clusterId": node.ClusterId,
})
}
this.Data["nodes"] = nodeMaps
@@ -92,5 +93,13 @@ func (this *ClusterAction) RunGet(params struct {
}
this.Data["servers"] = serverMaps
+ // 检查解析记录是否有变化
+ checkChangesResp, err := this.RPC().NodeClusterRPC().CheckNodeClusterDNSChanges(this.AdminContext(), &pb.CheckNodeClusterDNSChangesRequest{NodeClusterId: params.ClusterId})
+ if err != nil {
+ this.ErrorPage(err)
+ return
+ }
+ this.Data["dnsHasChanges"] = checkChangesResp.IsChanged
+
this.Show()
}
diff --git a/internal/web/actions/default/dns/clusters/sync.go b/internal/web/actions/default/dns/clusters/sync.go
new file mode 100644
index 00000000..be890f20
--- /dev/null
+++ b/internal/web/actions/default/dns/clusters/sync.go
@@ -0,0 +1,46 @@
+package clusters
+
+import (
+ "github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
+ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
+ "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
+)
+
+type SyncAction struct {
+ actionutils.ParentAction
+}
+
+func (this *SyncAction) RunPost(params struct {
+ ClusterId int64
+}) {
+ // 记录日志
+ this.CreateLog(oplogs.LevelInfo, "同步集群 %d 的DNS设置", params.ClusterId)
+
+ dnsInfoResp, err := this.RPC().NodeClusterRPC().FindEnabledNodeClusterDNS(this.AdminContext(), &pb.FindEnabledNodeClusterDNSRequest{NodeClusterId: params.ClusterId})
+ if err != nil {
+ this.ErrorPage(err)
+ return
+ }
+ domain := dnsInfoResp.Domain
+ if domain == nil || domain.Id <= 0 {
+ this.Fail("此集群尚未设置域名")
+ }
+
+ syncResp, err := this.RPC().DNSDomainRPC().SyncDNSDomainData(this.AdminContext(), &pb.SyncDNSDomainDataRequest{
+ DnsDomainId: domain.Id,
+ NodeClusterId: params.ClusterId,
+ })
+ if err != nil {
+ this.ErrorPage(err)
+ return
+ }
+ if syncResp.ShouldFix {
+ this.Fail("请先修改当前页面中红色标记的问题")
+ }
+
+ if !syncResp.IsOk {
+ this.Fail(syncResp.Error)
+ }
+
+ this.Success()
+}
diff --git a/internal/web/actions/default/dns/init.go b/internal/web/actions/default/dns/init.go
index 7f2f87df..23f6410f 100644
--- a/internal/web/actions/default/dns/init.go
+++ b/internal/web/actions/default/dns/init.go
@@ -23,6 +23,7 @@ func init() {
// 集群
Prefix("/dns/clusters").
Get("/cluster", new(clusters.ClusterAction)).
+ Post("/sync", new(clusters.SyncAction)).
// 服务商
Prefix("/dns/providers").
@@ -47,9 +48,8 @@ func init() {
// 问题修复
Prefix("/dns/issues").
Data("teaSubMenu", "issue").
- Get("", new(issues.IndexAction)).
+ GetPost("", new(issues.IndexAction)).
GetPost("/updateNodePopup", new(issues.UpdateNodePopupAction)).
- GetPost("/updateServerPopup", new(issues.UpdateServerPopupAction)).
EndData().
EndAll()
diff --git a/internal/web/actions/default/dns/issues/index.go b/internal/web/actions/default/dns/issues/index.go
index 78359cdb..230aad40 100644
--- a/internal/web/actions/default/dns/issues/index.go
+++ b/internal/web/actions/default/dns/issues/index.go
@@ -1,6 +1,10 @@
package issues
-import "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
+import (
+ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
+ "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
+ "github.com/iwind/TeaGo/maps"
+)
type IndexAction struct {
actionutils.ParentAction
@@ -11,5 +15,27 @@ func (this *IndexAction) Init() {
}
func (this *IndexAction) RunGet(params struct{}) {
+ this.Data["issues"] = []interface{}{}
this.Show()
}
+
+func (this *IndexAction) RunPost(params struct{}) {
+ issuesResp, err := this.RPC().DNSRPC().FindAllDNSIssues(this.AdminContext(), &pb.FindAllDNSIssuesRequest{})
+ if err != nil {
+ this.ErrorPage(err)
+ return
+ }
+ issueMaps := []maps.Map{}
+ for _, issue := range issuesResp.Issues {
+ issueMaps = append(issueMaps, maps.Map{
+ "target": issue.Target,
+ "targetId": issue.TargetId,
+ "type": issue.Type,
+ "description": issue.Description,
+ "params": issue.Params,
+ })
+ }
+ this.Data["issues"] = issueMaps
+
+ this.Success()
+}
diff --git a/internal/web/actions/default/dns/issues/updateNodePopup.go b/internal/web/actions/default/dns/issues/updateNodePopup.go
index fe0bce6e..d936cbcd 100644
--- a/internal/web/actions/default/dns/issues/updateNodePopup.go
+++ b/internal/web/actions/default/dns/issues/updateNodePopup.go
@@ -35,6 +35,7 @@ func (this *UpdateNodePopupAction) RunGet(params struct {
this.Data["ipAddr"] = dnsInfo.IpAddr
this.Data["route"] = dnsInfo.Route
this.Data["domainId"] = dnsInfo.DnsDomainId
+ this.Data["domainName"] = dnsInfo.DnsDomainName
// 读取所有线路
routes := []string{}
diff --git a/internal/web/actions/default/dns/issues/updateServerPopup.go b/internal/web/actions/default/dns/issues/updateServerPopup.go
deleted file mode 100644
index cf0f9856..00000000
--- a/internal/web/actions/default/dns/issues/updateServerPopup.go
+++ /dev/null
@@ -1,15 +0,0 @@
-package issues
-
-import "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
-
-type UpdateServerPopupAction struct {
- actionutils.ParentAction
-}
-
-func (this *UpdateServerPopupAction) Init() {
- this.Nav("", "", "")
-}
-
-func (this *UpdateServerPopupAction) RunGet(params struct{}) {
- this.Show()
-}
diff --git a/internal/web/actions/default/dns/providers/provider.go b/internal/web/actions/default/dns/providers/provider.go
index bbd0d26c..9d318fb2 100644
--- a/internal/web/actions/default/dns/providers/provider.go
+++ b/internal/web/actions/default/dns/providers/provider.go
@@ -60,15 +60,15 @@ func (this *ProviderAction) RunGet(params struct {
dataUpdatedTime = timeutil.FormatTime("Y-m-d H:i:s", domain.DataUpdatedAt)
}
domainMaps = append(domainMaps, maps.Map{
- "id": domain.Id,
- "name": domain.Name,
- "isOn": domain.IsOn,
- "dataUpdatedTime": dataUpdatedTime,
- "countRoutes": len(domain.Routes),
- "countServerRecords": domain.ServerRecords,
- "allServersResolved": domain.AllServersResolved,
- "countClusterRecords": domain.ClusterRecords,
- "allClustersResolved": domain.AllClustersResolved,
+ "id": domain.Id,
+ "name": domain.Name,
+ "isOn": domain.IsOn,
+ "dataUpdatedTime": dataUpdatedTime,
+ "countRoutes": len(domain.Routes),
+ "countServerRecords": domain.CountServerRecords,
+ "serversChanged": domain.ServersChanged,
+ "countNodeRecords": domain.CountNodeRecords,
+ "nodesChanged": domain.NodesChanged,
})
}
this.Data["domains"] = domainMaps
diff --git a/web/public/js/components/common/links.js b/web/public/js/components/common/links.js
index 0e38465d..0824ae9e 100644
--- a/web/public/js/components/common/links.js
+++ b/web/public/js/components/common/links.js
@@ -35,6 +35,17 @@ Vue.component("link-popup", {
template: `
下面的DNS解析记录也可以手工在DNS服务商提供的管理平台添加。
@@ -48,10 +58,10 @@暂时没有发现问题。
+| 问题对象 | +问题描述 | +操作 | +
|---|---|---|
|
+
+ 集群 "{{issue.target}}"
+
+ 集群 "{{issue.params.clusterName}}" 节点 "{{issue.target}}"
+ |
+ + {{issue.description}} + | +
+
+
+
+
+ |
+
| 主域名 | +{{domainName}}
+ 由当前节点所属集群设置。 + |
+ |||||||||
| IP地址 * | diff --git a/web/views/@default/dns/providers/provider.html b/web/views/@default/dns/providers/provider.html index 6d8ef7d9..b07aba3c 100644 --- a/web/views/@default/dns/providers/provider.html +++ b/web/views/@default/dns/providers/provider.html @@ -40,7 +40,7 @@ | |||||||||
| 域名 | 线路 | -集群域名 | +节点域名 | 服务域名 | 数据更新时间 | 状态 | @@ -54,11 +54,11 @@ 0个- {{domain.countClusterRecords}}个 + {{domain.countNodeRecords}}个 0个 | - {{domain.countServerRecords}}个 + {{domain.countServerRecords}}个 0个 | @@ -66,7 +66,7 @@ 尚未更新 |
-
+
需要同步
正在同步...
diff --git a/web/views/@default/dns/providers/provider.js b/web/views/@default/dns/providers/provider.js
index 17f5a71c..8204637d 100644
--- a/web/views/@default/dns/providers/provider.js
+++ b/web/views/@default/dns/providers/provider.js
@@ -43,29 +43,33 @@ Tea.context(function () {
}
this.syncDomain = function (index, domain) {
- domain.isSyncing = true
- Vue.set(this.domains, index, domain)
+ let that = this
+ teaweb.confirm("确定要同步此域名下的所有解析记录吗?", function () {
+ domain.isSyncing = true
+ Vue.set(that.domains, index, domain)
- this.$post("/dns/domains/sync")
- .params({
- domainId: domain.id
- })
- .success(function () {
- teaweb.success("同步成功", function () {
- teaweb.reload()
+ this.$post("/dns/domains/sync")
+ .params({
+ domainId: domain.id
})
- })
- .fail(function (resp) {
- teaweb.warn(resp.message, function () {
- if (resp.data.shouldFix) {
- window.location = "/dns/issues"
- }
+ .success(function () {
+ teaweb.success("同步成功", function () {
+ teaweb.reload()
+ })
})
- })
- .done(function () {
- domain.isSyncing = false
- Vue.set(this.domains, index, domain)
- })
+ .fail(function (resp) {
+ teaweb.warn(resp.message, function () {
+ if (resp.data.shouldFix) {
+ window.location = "/dns/issues"
+ }
+ })
+ })
+ .done(function () {
+ domain.isSyncing = false
+ that.dnsHasChanges = false
+ Vue.set(that.domains, index, domain)
+ })
+ })
}
this.showRoutes = function (domainId) {
|
|---|