mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-06 06:40:27 +08:00
实现请求连接数等限制/容量组件增加EB支持
This commit is contained in:
@@ -2723,6 +2723,105 @@ Vue.component("http-cache-ref-box", {
|
||||
</tbody>`
|
||||
})
|
||||
|
||||
// 请求限制
|
||||
Vue.component("http-request-limit-config-box", {
|
||||
props: ["v-request-limit-config"],
|
||||
data: function () {
|
||||
let config = this.vRequestLimitConfig
|
||||
if (config == null) {
|
||||
config = {
|
||||
isPrior: false,
|
||||
isOn: false,
|
||||
maxConns: 0,
|
||||
maxConnsPerIP: 0,
|
||||
maxBodySize: {
|
||||
count: -1,
|
||||
unit: "kb"
|
||||
},
|
||||
outBandwidthPerConn: {
|
||||
count: -1,
|
||||
unit: "kb"
|
||||
}
|
||||
}
|
||||
}
|
||||
return {
|
||||
config: config,
|
||||
maxConns: config.maxConns,
|
||||
maxConnsPerIP: config.maxConnsPerIP
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
maxConns: function (v) {
|
||||
let conns = parseInt(v, 10)
|
||||
if (isNaN(conns)) {
|
||||
this.config.maxConns = 0
|
||||
return
|
||||
}
|
||||
if (conns < 0) {
|
||||
this.config.maxConns = 0
|
||||
} else {
|
||||
this.config.maxConns = conns
|
||||
}
|
||||
},
|
||||
maxConnsPerIP: function (v) {
|
||||
let conns = parseInt(v, 10)
|
||||
if (isNaN(conns)) {
|
||||
this.config.maxConnsPerIP = 0
|
||||
return
|
||||
}
|
||||
if (conns < 0) {
|
||||
this.config.maxConnsPerIP = 0
|
||||
} else {
|
||||
this.config.maxConnsPerIP = conns
|
||||
}
|
||||
}
|
||||
},
|
||||
template: `<div>
|
||||
<input type="hidden" name="requestLimitJSON" :value="JSON.stringify(config)"/>
|
||||
<table class="ui table selectable definition">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="title">是否启用</td>
|
||||
<td>
|
||||
<checkbox v-model="config.isOn"></checkbox>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody v-show="config.isOn">
|
||||
<tr>
|
||||
<td>最大并发连接数</td>
|
||||
<td>
|
||||
<input type="text" maxlength="6" v-model="maxConns"/>
|
||||
<p class="comment">为0表示不限制。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>单IP最大并发连接数</td>
|
||||
<td>
|
||||
<input type="text" maxlength="6" v-model="maxConnsPerIP"/>
|
||||
<p class="comment">为0表示不限制。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>单连接带宽限制</td>
|
||||
<td>
|
||||
<size-capacity-box :v-value="config.outBandwidthPerConn" :v-supported-units="['byte', 'kb', 'mb']"></size-capacity-box>
|
||||
<p class="comment">客户端单个请求每秒可以读取的下行流量。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>单请求最大尺寸</td>
|
||||
<td>
|
||||
<size-capacity-box :v-value="config.maxBodySize" :v-supported-units="['byte', 'kb', 'mb', 'gb']"></size-capacity-box>
|
||||
<p class="comment">单个请求能发送的最大内容尺寸。</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="margin"></div>
|
||||
</div>`
|
||||
})
|
||||
|
||||
// 浏览条件列表
|
||||
Vue.component("http-request-conds-view", {
|
||||
props: ["v-conds"],
|
||||
@@ -5976,7 +6075,7 @@ Vue.component("http-pages-and-shutdown-box", {
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="comment">开启临时关闭页面时,所有请求的响应都会显示此页面。可用于临时升级网站使用。</p>
|
||||
<p class="comment">开启临时关闭页面时,所有请求都会直接显示此页面。可用于临时升级网站或者禁止用户访问某个网页。</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -6428,6 +6527,7 @@ Vue.component("http-expires-time-config-box", {
|
||||
<td>强制缓存时间</td>
|
||||
<td>
|
||||
<time-duration-box :v-value="expiresTime.duration" @change="notifyChange"></time-duration-box>
|
||||
<p class="comment">从客户端访问的时间开始要缓存的时长。</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@@ -11108,7 +11208,7 @@ Vue.component("source-code-box", {
|
||||
})
|
||||
|
||||
Vue.component("size-capacity-box", {
|
||||
props: ["v-name", "v-value", "v-count", "v-unit", "size", "maxlength"],
|
||||
props: ["v-name", "v-value", "v-count", "v-unit", "size", "maxlength", "v-supported-units"],
|
||||
data: function () {
|
||||
let v = this.vValue
|
||||
if (v == null) {
|
||||
@@ -11131,11 +11231,17 @@ Vue.component("size-capacity-box", {
|
||||
vMaxlength = 10
|
||||
}
|
||||
|
||||
let supportedUnits = this.vSupportedUnits
|
||||
if (supportedUnits == null) {
|
||||
supportedUnits = []
|
||||
}
|
||||
|
||||
return {
|
||||
capacity: v,
|
||||
countString: (v.count >= 0) ? v.count.toString() : "",
|
||||
vSize: vSize,
|
||||
vMaxlength: vMaxlength
|
||||
vMaxlength: vMaxlength,
|
||||
supportedUnits: supportedUnits
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@@ -11165,12 +11271,13 @@ Vue.component("size-capacity-box", {
|
||||
</div>
|
||||
<div class="ui field">
|
||||
<select class="ui dropdown" v-model="capacity.unit" @change="change">
|
||||
<option value="byte">字节</option>
|
||||
<option value="kb">KB</option>
|
||||
<option value="mb">MB</option>
|
||||
<option value="gb">GB</option>
|
||||
<option value="tb">TB</option>
|
||||
<option value="pb">PB</option>
|
||||
<option value="byte" v-if="supportedUnits.length == 0 || supportedUnits.$contains('byte')">字节</option>
|
||||
<option value="kb" v-if="supportedUnits.length == 0 || supportedUnits.$contains('kb')">KB</option>
|
||||
<option value="mb" v-if="supportedUnits.length == 0 || supportedUnits.$contains('mb')">MB</option>
|
||||
<option value="gb" v-if="supportedUnits.length == 0 || supportedUnits.$contains('gb')">GB</option>
|
||||
<option value="tb" v-if="supportedUnits.length == 0 || supportedUnits.$contains('tb')">TB</option>
|
||||
<option value="pb" v-if="supportedUnits.length == 0 || supportedUnits.$contains('pb')">PB</option>
|
||||
<option value="eb" v-if="supportedUnits.length == 0 || supportedUnits.$contains('eb')">EB</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>`
|
||||
|
||||
Reference in New Issue
Block a user