From 0dad0b10e61ac87a085899ceba5b8e43c3aa6ecf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Wed, 25 Aug 2021 17:16:14 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=89=E6=8B=A9DNS=E7=BA=BF=E8=B7=AF?= =?UTF-8?q?=E6=97=B6=E5=A2=9E=E5=8A=A0=E6=90=9C=E7=B4=A2/=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E5=A6=82=E6=9E=9C=E6=B2=A1=E6=9C=89=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?DNS=E7=BA=BF=E8=B7=AF=E5=B0=B1=E4=BD=BF=E7=94=A8=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E7=BA=BF=E8=B7=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../actions/default/dns/clusters/cluster.go | 23 ++++++++++- .../cluster/node-clusters-labels.js | 7 +--- .../js/components/dns/dns-route-selector.js | 40 ++++++++++++++++--- .../@default/clusters/cluster/createNode.css | 2 +- .../@default/clusters/cluster/createNode.html | 4 +- .../@default/clusters/cluster/createNode.less | 2 +- web/views/@default/dns/clusters/cluster.js | 1 + web/views/@default/dns/issues/index.js | 2 + 8 files changed, 67 insertions(+), 14 deletions(-) diff --git a/internal/web/actions/default/dns/clusters/cluster.go b/internal/web/actions/default/dns/clusters/cluster.go index e7d2b43b..871ec491 100644 --- a/internal/web/actions/default/dns/clusters/cluster.go +++ b/internal/web/actions/default/dns/clusters/cluster.go @@ -40,6 +40,7 @@ func (this *ClusterAction) RunGet(params struct { this.ErrorPage(err) return } + var defaultRoute = dnsResp.DefaultRoute domainName := "" dnsMap := maps.Map{ "dnsName": dnsResp.Name, @@ -106,6 +107,26 @@ func (this *ClusterAction) RunGet(params struct { }) } } else { + // 默认线路 + var isResolved = false + if len(defaultRoute) > 0 { + recordType := "A" + if utils.IsIPv6(node.IpAddr) { + recordType = "AAAA" + } + checkResp, err := this.RPC().DNSDomainRPC().ExistDNSDomainRecord(this.AdminContext(), &pb.ExistDNSDomainRecordRequest{ + DnsDomainId: cluster.DnsDomainId, + Name: cluster.DnsName, + Type: recordType, + Route: defaultRoute, + Value: node.IpAddr, + }) + if err != nil { + this.ErrorPage(err) + return + } + isResolved = checkResp.IsOk + } nodeMaps = append(nodeMaps, maps.Map{ "id": node.Id, "name": node.Name, @@ -115,7 +136,7 @@ func (this *ClusterAction) RunGet(params struct { "code": "", }, "clusterId": node.NodeClusterId, - "isResolved": false, + "isResolved": isResolved, }) } } diff --git a/web/public/js/components/cluster/node-clusters-labels.js b/web/public/js/components/cluster/node-clusters-labels.js index 53c233ab..e4dd51d2 100644 --- a/web/public/js/components/cluster/node-clusters-labels.js +++ b/web/public/js/components/cluster/node-clusters-labels.js @@ -12,9 +12,6 @@ Vue.component("node-clusters-labels", { if (labelSize == null) { labelSize = "small" } - if (labelSize == "tiny") { - labelSize += " olive" - } return { cluster: cluster, secondaryClusters: secondaryClusters, @@ -22,7 +19,7 @@ Vue.component("node-clusters-labels", { } }, template: `
- {{cluster.name}} - {{c.name}} + {{cluster.name}} + {{c.name}}
` }) \ No newline at end of file diff --git a/web/public/js/components/dns/dns-route-selector.js b/web/public/js/components/dns/dns-route-selector.js index 7e85cd3f..d864b6fe 100644 --- a/web/public/js/components/dns/dns-route-selector.js +++ b/web/public/js/components/dns/dns-route-selector.js @@ -11,12 +11,21 @@ Vue.component("dns-route-selector", { return v.code + "@" + v.domainId }), isAdding: false, - routeCode: "" + routeCode: "", + keyword: "", + searchingRoutes: this.vAllRoutes.$copy() } }, methods: { add: function () { this.isAdding = true + this.keyword = "" + this.routeCode = "" + + let that = this + setTimeout(function () { + that.$refs.keywordRef.focus() + }, 200) }, cancel: function () { this.isAdding = false @@ -50,6 +59,23 @@ Vue.component("dns-route-selector", { }) } }, + watch: { + keyword: function (keyword) { + if (keyword.length == 0) { + this.searchingRoutes = this.vAllRoutes.$copy() + this.routeCode = "" + return + } + this.searchingRoutes = this.vAllRoutes.filter(function (route) { + return teaweb.match(route.name, keyword) + }) + if (this.searchingRoutes.length > 0) { + this.routeCode = this.searchingRoutes[0].code + "@" + this.searchingRoutes[0].domainId + } else { + this.routeCode = "" + } + } + }, template: `
@@ -62,16 +88,20 @@ Vue.component("dns-route-selector", {
- + +
+
+ +
+
- +
diff --git a/web/views/@default/clusters/cluster/createNode.css b/web/views/@default/clusters/cluster/createNode.css index 3fca0942..b49f9bab 100644 --- a/web/views/@default/clusters/cluster/createNode.css +++ b/web/views/@default/clusters/cluster/createNode.css @@ -5,7 +5,7 @@ top: 10em; } .row { - line-height: 4; + line-height: 2; } .step.active { font-weight: bold; diff --git a/web/views/@default/clusters/cluster/createNode.html b/web/views/@default/clusters/cluster/createNode.html index e158998f..7a1b6f22 100644 --- a/web/views/@default/clusters/cluster/createNode.html +++ b/web/views/@default/clusters/cluster/createNode.html @@ -140,11 +140,13 @@
-
在边缘节点安装目录下,复制configs/api.template.yamlconfigs/api.yaml,然后修改文件里面的内容为以下内容:
+
上传边缘节点程序到服务器并解压,然后在边缘节点安装目录下,复制configs/api.template.yamlconfigs/api.yaml,然后修改文件里面的内容为以下内容:
+
rpc: endpoints: [ {{apiEndpoints}} ] nodeId: "{{node.uniqueId}}" secret: "{{node.secret}}" +
然后再使用bin/edge-node start命令启动节点。
diff --git a/web/views/@default/clusters/cluster/createNode.less b/web/views/@default/clusters/cluster/createNode.less index 721683e5..fe7cf188 100644 --- a/web/views/@default/clusters/cluster/createNode.less +++ b/web/views/@default/clusters/cluster/createNode.less @@ -7,7 +7,7 @@ } .row { - line-height: 4; + line-height: 2; } .step.active { diff --git a/web/views/@default/dns/clusters/cluster.js b/web/views/@default/dns/clusters/cluster.js index c78a78f7..cd6f8412 100644 --- a/web/views/@default/dns/clusters/cluster.js +++ b/web/views/@default/dns/clusters/cluster.js @@ -12,6 +12,7 @@ Tea.context(function () { this.updateNode = function (clusterId, nodeId) { teaweb.popup("/dns/issues/updateNodePopup?clusterId=" + clusterId + "&nodeId=" + nodeId, { + width: "46em", height: "26em", callback: function () { teaweb.success("保存成功", function () { diff --git a/web/views/@default/dns/issues/index.js b/web/views/@default/dns/issues/index.js index 02a449f6..aa1c813a 100644 --- a/web/views/@default/dns/issues/index.js +++ b/web/views/@default/dns/issues/index.js @@ -20,6 +20,8 @@ Tea.context(function () { this.updateNode = function (clusterId, nodeId) { let that = this teaweb.popup("/dns/issues/updateNodePopup?clusterId=" + clusterId + "&nodeId=" + nodeId, { + width: "46em", + height: "26em", callback: function () { teaweb.success("保存成功", function () { that.reload()