优化代码

This commit is contained in:
刘祥超
2022-07-27 16:55:19 +08:00
parent 08ce2b7799
commit e6a30b99d3
2 changed files with 16 additions and 4 deletions

View File

@@ -26,7 +26,7 @@ func (this *AddPortPopupAction) RunGet(params struct {
}) { }) {
this.Data["from"] = params.From this.Data["from"] = params.From
protocols := serverconfigs.AllServerProtocolsForType(params.ServerType) protocols := serverconfigs.FindAllServerProtocolsForType(params.ServerType)
if len(params.Protocol) > 0 { if len(params.Protocol) > 0 {
result := []maps.Map{} result := []maps.Map{}
for _, p := range protocols { for _, p := range protocols {

View File

@@ -1,5 +1,5 @@
Vue.component("network-addresses-box", { Vue.component("network-addresses-box", {
props: ["v-server-type", "v-addresses", "v-protocol", "v-name", "v-from", "v-support-range"], props: ["v-server-type", "v-addresses", "v-protocol", "v-name", "v-from", "v-support-range", "v-url"],
data: function () { data: function () {
let addresses = this.vAddresses let addresses = this.vAddresses
if (addresses == null) { if (addresses == null) {
@@ -41,7 +41,13 @@ Vue.component("network-addresses-box", {
addAddr: function () { addAddr: function () {
let that = this let that = this
window.UPDATING_ADDR = null window.UPDATING_ADDR = null
teaweb.popup("/servers/addPortPopup?serverType=" + this.vServerType + "&protocol=" + this.protocol + "&from=" + this.from + "&supportRange=" + (this.supportRange() ? 1 : 0), {
let url = this.vUrl
if (url == null) {
url = "/servers/addPortPopup"
}
teaweb.popup(url + "?serverType=" + this.vServerType + "&protocol=" + this.protocol + "&from=" + this.from + "&supportRange=" + (this.supportRange() ? 1 : 0), {
height: "18em", height: "18em",
callback: function (resp) { callback: function (resp) {
var addr = resp.data.address var addr = resp.data.address
@@ -72,7 +78,13 @@ Vue.component("network-addresses-box", {
updateAddr: function (index, addr) { updateAddr: function (index, addr) {
let that = this let that = this
window.UPDATING_ADDR = addr window.UPDATING_ADDR = addr
teaweb.popup("/servers/addPortPopup?serverType=" + this.vServerType + "&protocol=" + this.protocol + "&from=" + this.from + "&supportRange=" + (this.supportRange() ? 1 : 0), {
let url = this.vUrl
if (url == null) {
url = "/servers/addPortPopup"
}
teaweb.popup(url + "?serverType=" + this.vServerType + "&protocol=" + this.protocol + "&from=" + this.from + "&supportRange=" + (this.supportRange() ? 1 : 0), {
height: "18em", height: "18em",
callback: function (resp) { callback: function (resp) {
var addr = resp.data.address var addr = resp.data.address