mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-13 20:00:25 +08:00
如果用户设置的可缓存最大尺寸超出缓存策略设置,则提示用户
This commit is contained in:
@@ -19,10 +19,16 @@ Vue.component("http-cache-config-box", {
|
||||
cacheConfig.cacheRefs = []
|
||||
}
|
||||
|
||||
var maxBytes = null
|
||||
if (this.vCachePolicy != null && this.vCachePolicy.maxBytes != null) {
|
||||
maxBytes = this.vCachePolicy.maxBytes
|
||||
}
|
||||
|
||||
return {
|
||||
cacheConfig: cacheConfig,
|
||||
moreOptionsVisible: false,
|
||||
enablePolicyRefs: !cacheConfig.disablePolicyRefs
|
||||
enablePolicyRefs: !cacheConfig.disablePolicyRefs,
|
||||
maxBytes: maxBytes
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@@ -62,7 +68,7 @@ Vue.component("http-cache-config-box", {
|
||||
<td class="title">全局缓存策略</td>
|
||||
<td>
|
||||
<div v-if="vCachePolicy != null">{{vCachePolicy.name}} <link-icon :href="'/servers/components/cache/policy?cachePolicyId=' + vCachePolicy.id"></link-icon>
|
||||
<p class="comment">使用当前服务所在集群的设置。</p>
|
||||
<p class="comment">使用当前网站所在集群的设置。</p>
|
||||
</div>
|
||||
<span v-else class="red">当前集群没有设置缓存策略,当前配置无法生效。</span>
|
||||
</td>
|
||||
@@ -142,7 +148,7 @@ Vue.component("http-cache-config-box", {
|
||||
|
||||
<div v-show="isOn()" style="margin-top: 1em">
|
||||
<h4>缓存条件 <a href="" style="font-size: 0.8em" @click.prevent="$refs.cacheRefsConfigBoxRef.addRef(false)">[添加]</a> </h4>
|
||||
<http-cache-refs-config-box ref="cacheRefsConfigBoxRef" :v-cache-config="cacheConfig" :v-cache-refs="cacheConfig.cacheRefs" :v-web-id="vWebId"></http-cache-refs-config-box>
|
||||
<http-cache-refs-config-box ref="cacheRefsConfigBoxRef" :v-cache-config="cacheConfig" :v-cache-refs="cacheConfig.cacheRefs" :v-web-id="vWebId" :v-max-bytes="maxBytes"></http-cache-refs-config-box>
|
||||
</div>
|
||||
<div class="margin"></div>
|
||||
</div>`
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
Vue.component("http-cache-refs-config-box", {
|
||||
props: ["v-cache-refs", "v-cache-config", "v-cache-policy-id", "v-web-id"],
|
||||
props: ["v-cache-refs", "v-cache-config", "v-cache-policy-id", "v-web-id", "v-max-bytes"],
|
||||
mounted: function () {
|
||||
let that = this
|
||||
sortTable(function (ids) {
|
||||
@@ -21,10 +21,17 @@ Vue.component("http-cache-refs-config-box", {
|
||||
refs = []
|
||||
}
|
||||
|
||||
let maxBytes = this.vMaxBytes
|
||||
|
||||
let id = 0
|
||||
refs.forEach(function (ref) {
|
||||
id++
|
||||
ref.id = id
|
||||
|
||||
// check max size
|
||||
if (ref.maxSize != null && maxBytes != null && maxBytes.count > 0 && teaweb.compareSizeCapacity(ref.maxSize, maxBytes) > 0) {
|
||||
ref.overMaxSize = maxBytes
|
||||
}
|
||||
})
|
||||
return {
|
||||
refs: refs,
|
||||
@@ -180,11 +187,15 @@ Vue.component("http-cache-refs-config-box", {
|
||||
|
||||
<!-- 特殊参数 -->
|
||||
<grey-label v-if="cacheRef.key != null && cacheRef.key.indexOf('\${args}') < 0">忽略URI参数</grey-label>
|
||||
|
||||
<grey-label v-if="cacheRef.minSize != null && cacheRef.minSize.count > 0">
|
||||
{{cacheRef.minSize.count}}{{cacheRef.minSize.unit}}
|
||||
<span v-if="cacheRef.maxSize != null && cacheRef.maxSize.count > 0">- {{cacheRef.maxSize.count}}{{cacheRef.maxSize.unit}}</span>
|
||||
<span v-if="cacheRef.maxSize != null && cacheRef.maxSize.count > 0">- {{cacheRef.maxSize.count}}{{cacheRef.maxSize.unit.toUpperCase()}}</span>
|
||||
</grey-label>
|
||||
<grey-label v-else-if="cacheRef.maxSize != null && cacheRef.maxSize.count > 0">0 - {{cacheRef.maxSize.count}}{{cacheRef.maxSize.unit}}</grey-label>
|
||||
<grey-label v-else-if="cacheRef.maxSize != null && cacheRef.maxSize.count > 0">0 - {{cacheRef.maxSize.count}}{{cacheRef.maxSize.unit.toUpperCase()}}</grey-label>
|
||||
|
||||
<grey-label v-if="cacheRef.overMaxSize != null"><span class="red">系统限制{{cacheRef.overMaxSize.count}}{{cacheRef.overMaxSize.unit.toUpperCase()}}</span> </grey-label>
|
||||
|
||||
<grey-label v-if="cacheRef.methods != null && cacheRef.methods.length > 0">{{cacheRef.methods.join(", ")}}</grey-label>
|
||||
<grey-label v-if="cacheRef.expiresTime != null && cacheRef.expiresTime.isPrior && cacheRef.expiresTime.isOn">Expires</grey-label>
|
||||
<grey-label v-if="cacheRef.status != null && cacheRef.status.length > 0 && (cacheRef.status.length > 1 || cacheRef.status[0] != 200)">状态码:{{cacheRef.status.map(function(v) {return v.toString()}).join(", ")}}</grey-label>
|
||||
|
||||
@@ -35,7 +35,7 @@ Vue.component("http-firewall-config-box", {
|
||||
<td class="title">全局WAF策略</td>
|
||||
<td>
|
||||
<div v-if="vFirewallPolicy != null">{{vFirewallPolicy.name}} <span v-if="vFirewallPolicy.modeInfo != null"> <span :class="{green: vFirewallPolicy.modeInfo.code == 'defend', blue: vFirewallPolicy.modeInfo.code == 'observe', grey: vFirewallPolicy.modeInfo.code == 'bypass'}">[{{vFirewallPolicy.modeInfo.name}}]</span> </span> <link-icon :href="'/servers/components/waf/policy?firewallPolicyId=' + vFirewallPolicy.id"></link-icon>
|
||||
<p class="comment">当前服务所在集群的设置。</p>
|
||||
<p class="comment">当前网站所在集群的设置。</p>
|
||||
</div>
|
||||
<span v-else class="red">当前集群没有设置WAF策略,当前配置无法生效。</span>
|
||||
</td>
|
||||
|
||||
Reference in New Issue
Block a user