mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-27 05:00:25 +08:00
界面优化
This commit is contained in:
@@ -57,6 +57,11 @@ func (this *IndexAction) RunPost(params struct {
|
||||
DomainMismatchActionPageStatusCode int
|
||||
DomainMismatchActionPageContentHTML string
|
||||
|
||||
// TCP端口设置
|
||||
TcpAllPortRangeMin int
|
||||
TcpAllPortRangeMax int
|
||||
TcpAllDenyPorts []int
|
||||
|
||||
DefaultDomain string
|
||||
}) {
|
||||
// 创建日志
|
||||
@@ -101,6 +106,22 @@ func (this *IndexAction) RunPost(params struct {
|
||||
}
|
||||
}
|
||||
|
||||
// TCP端口范围
|
||||
if params.TcpAllPortRangeMin < 1024 {
|
||||
params.TcpAllPortRangeMin = 1024
|
||||
}
|
||||
if params.TcpAllPortRangeMax > 65534 {
|
||||
params.TcpAllPortRangeMax = 65534
|
||||
} else if params.TcpAllPortRangeMax < 1024 {
|
||||
params.TcpAllPortRangeMax = 1024
|
||||
}
|
||||
if params.TcpAllPortRangeMin > params.TcpAllPortRangeMax {
|
||||
params.TcpAllPortRangeMin, params.TcpAllPortRangeMax = params.TcpAllPortRangeMax, params.TcpAllPortRangeMin
|
||||
}
|
||||
globalConfig.TCPAll.DenyPorts = params.TcpAllDenyPorts
|
||||
globalConfig.TCPAll.PortRangeMin = params.TcpAllPortRangeMin
|
||||
globalConfig.TCPAll.PortRangeMax = params.TcpAllPortRangeMax
|
||||
|
||||
// 修改配置
|
||||
globalConfigJSON, err := json.Marshal(globalConfig)
|
||||
if err != nil {
|
||||
|
||||
@@ -75,6 +75,19 @@ func (this *ServerHelper) createLeftMenu(action *actions.ActionObject) {
|
||||
return
|
||||
}
|
||||
|
||||
// 协议簇
|
||||
family := ""
|
||||
if serverConfig.IsHTTP() {
|
||||
family = "http"
|
||||
} else if serverConfig.IsTCP() {
|
||||
family = "tcp"
|
||||
} else if serverConfig.IsUnix() {
|
||||
family = "unix"
|
||||
} else if serverConfig.IsUDP() {
|
||||
family = "udp"
|
||||
}
|
||||
action.Data["serverFamily"] = family
|
||||
|
||||
// TABBAR
|
||||
selectedTabbar, _ := action.Data["mainTab"]
|
||||
tabbar := actionutils.NewTabbar()
|
||||
|
||||
@@ -73,7 +73,7 @@ Vue.component("values-box", {
|
||||
<button class="ui button small" type="button" @click.prevent="confirm()">确定</button>
|
||||
</div>
|
||||
<div class="ui field">
|
||||
<a href="" @click.prevent="cancel()">取消</a>
|
||||
<a href="" @click.prevent="cancel()" title="取消"><i class="icon remove small"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
Vue.component("reverse-proxy-box", {
|
||||
props: ["v-reverse-proxy-ref", "v-reverse-proxy-config", "v-is-location"],
|
||||
props: ["v-reverse-proxy-ref", "v-reverse-proxy-config", "v-is-location", "v-family"],
|
||||
data: function () {
|
||||
let reverseProxyRef = this.vReverseProxyRef
|
||||
if (reverseProxyRef == null) {
|
||||
@@ -23,7 +23,8 @@ Vue.component("reverse-proxy-box", {
|
||||
return {
|
||||
reverseProxyRef: reverseProxyRef,
|
||||
reverseProxyConfig: reverseProxyConfig,
|
||||
advancedVisible: false
|
||||
advancedVisible: false,
|
||||
family: this.vFamily
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@@ -58,7 +59,7 @@ Vue.component("reverse-proxy-box", {
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr v-show="family == null || family == 'http'">
|
||||
<td>回源主机名<em>(Host)</em></td>
|
||||
<td>
|
||||
<radio :v-value="0" v-model="reverseProxyConfig.requestHostType">跟随代理服务</radio>
|
||||
@@ -76,14 +77,14 @@ Vue.component("reverse-proxy-box", {
|
||||
</tbody>
|
||||
<more-options-tbody @change="changeAdvancedVisible" v-if="isOn()"></more-options-tbody>
|
||||
<tbody v-show="isOn() && advancedVisible">
|
||||
<tr>
|
||||
<tr v-show="family == null || family == 'http'">
|
||||
<td>请求URI<em>(RequestURI)</em></td>
|
||||
<td>
|
||||
<input type="text" placeholder="\${requestURI}" v-model="reverseProxyConfig.requestURI"/>
|
||||
<p class="comment">\${requestURI}为完整的请求URI,可以使用类似于"\${requestURI}?arg1=value1&arg2=value2"的形式添加你的参数。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr v-show="family == null || family == 'http'">
|
||||
<td>去除URL前缀<em>(StripPrefix)</em></td>
|
||||
<td>
|
||||
<input type="text" v-model="reverseProxyConfig.stripPrefix" placeholder="/PREFIX"/>
|
||||
|
||||
@@ -85,8 +85,8 @@ Vue.component("server-name-box", {
|
||||
</div>
|
||||
<div class="ui fields inline">
|
||||
<div class="ui field"><a href="" @click.prevent="addServerName()">[添加域名绑定]</a></div>
|
||||
<div class="ui field"><span class="grey">|</span> </div>
|
||||
<div class="ui field">
|
||||
<div class="ui field" v-if="serverNames.length > 0"><span class="grey">|</span> </div>
|
||||
<div class="ui field" v-if="serverNames.length > 0">
|
||||
<a href="" @click.prevent="showSearchBox()" v-if="!isSearching"><i class="icon search small"></i></a>
|
||||
<a href="" @click.prevent="showSearchBox()" v-if="isSearching"><i class="icon close small"></i></a>
|
||||
</div>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<div class="ui tabular menu tiny">
|
||||
<a href="" class="item" :class="{active: tab == 'domainMatch'}" @click.prevent="selectTab('domainMatch')">域名匹配配置</a>
|
||||
<a href="" class="item" :class="{active: tab == 'domainAuditing'}" @click.prevent="selectTab('domainAuditing')">域名审核配置</a>
|
||||
<a href="" class="item" :class="{active: tab == 'tcpPorts'}" @click.prevent="selectTab('tcpPorts')">TCP/TLS端口</a>
|
||||
</div>
|
||||
|
||||
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
|
||||
@@ -78,6 +79,36 @@
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- TCP 相关 -->
|
||||
<div v-show="tab == 'tcpPorts'">
|
||||
<table class="ui table definition selectable">
|
||||
<tr>
|
||||
<td class="title">允许的端口范围</td>
|
||||
<td>
|
||||
<div class="ui fields inline">
|
||||
<div class="ui field">
|
||||
<input type="text" name="tcpAllPortRangeMin" maxlength="5" size="6" v-model="tcpAllPortRangeMin"/>
|
||||
</div>
|
||||
<div class="ui field">
|
||||
-
|
||||
</div>
|
||||
<div class="ui field">
|
||||
<input type="text" name="tcpAllPortRangeMax" maxlength="5" size="6" v-model="tcpAllPortRangeMax"/>
|
||||
</div>
|
||||
</div>
|
||||
<p class="comment">用户创建TCP/TLS负载均衡服务时可以随机选择的端口范围,最小不能小于1024,最大不能大于65534。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>排除的端口</td>
|
||||
<td>
|
||||
<values-box placeholder="端口" size="6" name="tcpAllDenyPorts" :values="tcpAllDenyPorts"></values-box>
|
||||
<p class="comment">当为用户随机分配端口时要排除的端口。</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="margin"></div>
|
||||
<submit-btn>保存</submit-btn>
|
||||
</form>
|
||||
|
||||
@@ -1,12 +1,21 @@
|
||||
Tea.context(function () {
|
||||
this.tab = "domainMatch"
|
||||
|
||||
this.$delay(function () {
|
||||
if (window.location.hash != null && window.location.hash.length > 1) {
|
||||
this.selectTab(window.location.hash.substr(1))
|
||||
}
|
||||
})
|
||||
|
||||
this.selectTab = function (tab) {
|
||||
this.tab = tab
|
||||
window.location.hash = "#" + tab
|
||||
}
|
||||
|
||||
this.success = function () {
|
||||
teaweb.success("保存成功")
|
||||
teaweb.success("保存成功", function () {
|
||||
teaweb.reload()
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -37,4 +46,20 @@ Tea.context(function () {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* TCP端口
|
||||
*/
|
||||
this.tcpAllPortRangeMin = 10000
|
||||
this.tcpAllPortRangeMax = 40000
|
||||
if (this.globalConfig.tcpAll.portRangeMin > 0) {
|
||||
this.tcpAllPortRangeMin = this.globalConfig.tcpAll.portRangeMin
|
||||
}
|
||||
if (this.globalConfig.tcpAll.portRangeMax > 0) {
|
||||
this.tcpAllPortRangeMax = this.globalConfig.tcpAll.portRangeMax
|
||||
}
|
||||
|
||||
this.tcpAllDenyPorts = []
|
||||
if (this.globalConfig.tcpAll.denyPorts != null) {
|
||||
this.tcpAllDenyPorts = this.globalConfig.tcpAll.denyPorts
|
||||
}
|
||||
})
|
||||
@@ -8,7 +8,7 @@
|
||||
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
|
||||
<input type="hidden" name="serverId" :value="serverId"/>
|
||||
<input type="hidden" name="reverseProxyRefJSON" :value="JSON.stringify(reverseProxyRef)"/>
|
||||
<reverse-proxy-box :v-reverse-proxy-ref="reverseProxyRef" :v-reverse-proxy-config="reverseProxyConfig"></reverse-proxy-box>
|
||||
<reverse-proxy-box :v-reverse-proxy-ref="reverseProxyRef" :v-reverse-proxy-config="reverseProxyConfig" :v-family="serverFamily"></reverse-proxy-box>
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
</div>
|
||||
Reference in New Issue
Block a user