From d03bdfe2036b2383ad0dd7bd749a74b129482b4e Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Mon, 28 Jun 2021 21:09:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BA=A4=E4=BA=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/actions/default/servers/addPortPopup.go | 3 +++ .../js/components/common/network-addresses-box.js | 12 +++++++++--- web/views/@default/api/node/createPopup.html | 2 +- web/views/@default/api/node/update.html | 2 +- web/views/@default/servers/addPortPopup.html | 4 ++-- web/views/@default/servers/addPortPopup.js | 14 ++++++++++---- 6 files changed, 26 insertions(+), 11 deletions(-) diff --git a/internal/web/actions/default/servers/addPortPopup.go b/internal/web/actions/default/servers/addPortPopup.go index 1f082f4a..b22bbd2d 100644 --- a/internal/web/actions/default/servers/addPortPopup.go +++ b/internal/web/actions/default/servers/addPortPopup.go @@ -20,7 +20,10 @@ func (this *AddPortPopupAction) Init() { func (this *AddPortPopupAction) RunGet(params struct { ServerType string Protocol string + From string }) { + this.Data["from"] = params.From + protocols := serverconfigs.AllServerProtocolsForType(params.ServerType) if len(params.Protocol) > 0 { result := []maps.Map{} diff --git a/web/public/js/components/common/network-addresses-box.js b/web/public/js/components/common/network-addresses-box.js index f1c7c1aa..b3cf6a89 100644 --- a/web/public/js/components/common/network-addresses-box.js +++ b/web/public/js/components/common/network-addresses-box.js @@ -1,5 +1,5 @@ Vue.component("network-addresses-box", { - props: ["v-server-type", "v-addresses", "v-protocol", "v-name"], + props: ["v-server-type", "v-addresses", "v-protocol", "v-name", "v-from"], data: function () { let addresses = this.vAddresses if (addresses == null) { @@ -15,10 +15,16 @@ Vue.component("network-addresses-box", { name = "addresses" } + let from = this.vFrom + if (from == null) { + from = "" + } + return { addresses: addresses, protocol: protocol, - name: name + name: name, + from: from } }, watch: { @@ -35,7 +41,7 @@ Vue.component("network-addresses-box", { addAddr: function () { let that = this window.UPDATING_ADDR = null - teaweb.popup("/servers/addPortPopup?serverType=" + this.vServerType + "&protocol=" + this.protocol, { + teaweb.popup("/servers/addPortPopup?serverType=" + this.vServerType + "&protocol=" + this.protocol + "&from=" + this.from, { height: "16em", callback: function (resp) { var addr = resp.data.address diff --git a/web/views/@default/api/node/createPopup.html b/web/views/@default/api/node/createPopup.html index 37849cca..0acd42b3 100644 --- a/web/views/@default/api/node/createPopup.html +++ b/web/views/@default/api/node/createPopup.html @@ -12,7 +12,7 @@ GRPC监听端口 * - +

通过GRPC访问API节点进程监听的网络端口。

diff --git a/web/views/@default/api/node/update.html b/web/views/@default/api/node/update.html index e9d48417..af66a5f6 100644 --- a/web/views/@default/api/node/update.html +++ b/web/views/@default/api/node/update.html @@ -17,7 +17,7 @@ GRPC监听端口 * - +

通过GRPC访问API节点进程监听的网络端口。

diff --git a/web/views/@default/servers/addPortPopup.html b/web/views/@default/servers/addPortPopup.html index b7e7c9c8..94cc51bc 100644 --- a/web/views/@default/servers/addPortPopup.html +++ b/web/views/@default/servers/addPortPopup.html @@ -17,8 +17,8 @@

可以是一个数字端口(通常不超过65535),也可以是"地址:端口"的方式。 - HTTP常用端口为80 - HTTPS常用端口为443 + HTTP常用端口为80 + HTTPS常用端口为443

diff --git a/web/views/@default/servers/addPortPopup.js b/web/views/@default/servers/addPortPopup.js index 99e1412d..4fe5cd2f 100644 --- a/web/views/@default/servers/addPortPopup.js +++ b/web/views/@default/servers/addPortPopup.js @@ -7,10 +7,13 @@ Tea.context(function () { this.protocol = this.protocols[0].code // 初始化 - if (this.protocol == "http") { - this.address = "80" - } else if (this.protocol == "https") { - this.address = "443" + // from 用来标记是否为特殊的节点 + if (this.from.length == 0) { + if (this.protocol == "http") { + this.address = "80" + } else if (this.protocol == "https") { + this.address = "443" + } } if (window.parent.UPDATING_ADDR != null) { @@ -25,6 +28,9 @@ Tea.context(function () { } this.changeProtocol = function () { + if (this.from.length > 0) { + return + } switch (this.protocol) { case "http": this.address = "80"