diff --git a/web/public/js/components.js b/web/public/js/components.js index d5bc4f40..d632e8c1 100644 --- a/web/public/js/components.js +++ b/web/public/js/components.js @@ -1838,7 +1838,7 @@ Vue.component("traffic-map-box",{props:["v-stats","v-is-attack"],mounted:functio
所有规则匹配顺序为从上到下,可以拖动左侧的排序。
-`}),Vue.component("http-cache-ref-box",{props:["v-cache-ref","v-is-reverse"],mounted:function(){this.$refs.variablesDescriber.update(this.ref.key),null!=this.ref.simpleCond?(this.condType=this.ref.simpleCond.type,this.changeCondType(this.ref.simpleCond.type,!0),this.condCategory="simple"):null!=this.ref.conds&&null!=this.ref.conds.groups&&(this.condCategory="complex"),this.changeCondCategory(this.condCategory)},data:function(){let e=this.vCacheRef;null==(e=null==e?{isOn:!0,cachePolicyId:0,key:"${scheme}://${host}${requestPath}${isArgs}${args}",life:{count:2,unit:"hour"},status:[200],maxSize:{count:32,unit:"mb"},minSize:{count:0,unit:"kb"},skipCacheControlValues:["private","no-cache","no-store"],skipSetCookie:!0,enableRequestCachePragma:!1,conds:null,simpleCond:null,allowChunkedEncoding:!0,allowPartialContent:!0,forcePartialContent:!1,enableIfNoneMatch:!1,enableIfModifiedSince:!1,enableReadingOriginAsync:!1,isReverse:this.vIsReverse,methods:[],expiresTime:{isPrior:!1,isOn:!1,overwrite:!0,autoCalculate:!0,duration:{count:-1,unit:"hour"}}}:e).key&&(e.key=""),null==e.methods&&(e.methods=[]),null==e.life&&(e.life={count:2,unit:"hour"}),null==e.maxSize&&(e.maxSize={count:32,unit:"mb"}),null==e.minSize&&(e.minSize={count:0,unit:"kb"});var t=window.REQUEST_COND_COMPONENTS.$find(function(e,t){return"url-extension"==t.type});return{ref:e,keyIgnoreArgs:"string"==typeof e.key&&e.key.indexOf("${args}")<0,moreOptionsVisible:!1,condCategory:"simple",condType:"url-extension",condComponent:t,condIsCaseInsensitive:null==e.simpleCond||e.simpleCond.isCaseInsensitive,components:window.REQUEST_COND_COMPONENTS}},watch:{keyIgnoreArgs:function(e){"string"==typeof this.ref.key&&(e?this.ref.key=this.ref.key.replace("${isArgs}${args}",""):(this.ref.key.indexOf("${isArgs}")<0&&(this.ref.key=this.ref.key+"${isArgs}"),this.ref.key.indexOf("${args}")<0&&(this.ref.key=this.ref.key+"${args}")))}},methods:{changeOptionsVisible:function(e){this.moreOptionsVisible=e},changeLife:function(e){this.ref.life=e},changeMaxSize:function(e){this.ref.maxSize=e},changeMinSize:function(e){this.ref.minSize=e},changeConds:function(e){this.ref.conds=e,this.ref.simpleCond=null},changeStatusList:function(e){let t=[];e.forEach(function(e){e=parseInt(e);isNaN(e)||e<100||999| 操作 | - +||
|---|---|---|
|
@@ -3575,7 +3580,7 @@ example2.com
`}),Vue.component("http-cache-policy-selector",{props:["v-cache-policy"],mounted:function(){let t=this;Tea.action("/servers/components/cache/count").post().success(function(e){t.count=e.data.count})},data:function(){return{count:0,cachePolicy:this.vCachePolicy}},methods:{remove:function(){this.cachePolicy=null},select:function(){let t=this;teaweb.popup("/servers/components/cache/selectPopup",{width:"42em",height:"26em",callback:function(e){t.cachePolicy=e.data.cachePolicy}})},create:function(){let t=this;teaweb.popup("/servers/components/cache/createPopup",{height:"26em",callback:function(e){t.cachePolicy=e.data.cachePolicy}})}},template:`
[选择已有策略] [创建新策略]
diff --git a/web/public/js/components.src.js b/web/public/js/components.src.js
index 3d35c956..388ce2ad 100755
--- a/web/public/js/components.src.js
+++ b/web/public/js/components.src.js
@@ -5045,7 +5045,7 @@ Vue.component("http-cache-ref-box", {
key: "${scheme}://${host}${requestPath}${isArgs}${args}",
life: {count: 2, unit: "hour"},
status: [200],
- maxSize: {count: 32, unit: "mb"},
+ maxSize: {count: 128, unit: "mb"},
minSize: {count: 0, unit: "kb"},
skipCacheControlValues: ["private", "no-cache", "no-store"],
skipSetCookie: true,
@@ -6171,12 +6171,18 @@ Vue.component("http-cache-config-box", {
cacheConfig: cacheConfig,
moreOptionsVisible: false,
enablePolicyRefs: !cacheConfig.disablePolicyRefs,
- maxBytes: maxBytes
+ maxBytes: maxBytes,
+
+ searchBoxVisible: false,
+ searchKeyword: ""
}
},
watch: {
enablePolicyRefs: function (v) {
this.cacheConfig.disablePolicyRefs = !v
+ },
+ searchKeyword: function (v) {
+ this.$refs.cacheRefsConfigBoxRef.search(v)
}
},
methods: {
@@ -6201,6 +6207,18 @@ Vue.component("http-cache-config-box", {
},
changeStale: function (stale) {
this.cacheConfig.stale = stale
+ },
+
+ showSearchBox: function () {
+ this.searchBoxVisible = !this.searchBoxVisible
+ if (this.searchBoxVisible) {
+ let that = this
+ setTimeout(function () {
+ that.$refs.searchBox.focus()
+ })
+ } else {
+ this.searchKeyword = ""
+ }
}
},
template: `
@@ -6290,7 +6308,12 @@ Vue.component("http-cache-config-box", {
@@ -6814,11 +6837,13 @@ Vue.component("http-cache-refs-config-box", {
let id = 0
refs.forEach(function (ref) {
+ // preset variables
id++
ref.id = id
+ ref.visible = true
// check max size
- if (ref.maxSize != null && maxBytes != null && teaweb.compareSizeCapacity(ref.maxSize, maxBytes) > 0) {
+ if (ref.maxSize != null && maxBytes != null && maxBytes.count > 0 && teaweb.compareSizeCapacity(ref.maxSize, maxBytes) > 0) {
ref.overMaxSize = maxBytes
}
})
@@ -6951,6 +6976,41 @@ Vue.component("http-cache-refs-config-box", {
})
.post()
}
+ },
+ search: function (keyword) {
+ if (typeof keyword != "string") {
+ keyword = ""
+ }
+
+ this.refs.forEach(function (ref) {
+ if (keyword.length == 0) {
+ ref.visible = true
+ return
+ }
+ ref.visible = false
+
+ // simple cond
+ if (ref.simpleCond != null && typeof ref.simpleCond.value == "string" && teaweb.match(ref.simpleCond.value, keyword)) {
+ ref.visible = true
+ return
+ }
+
+ // composed conds
+ if (ref.conds == null || ref.conds.groups == null || ref.conds.groups.length == 0) {
+ return
+ }
+
+ ref.conds.groups.forEach(function (group) {
+ if (group.conds != null) {
+ group.conds.forEach(function (cond) {
+ if (typeof cond.value == "string" && teaweb.match(cond.value, keyword)) {
+ ref.visible = true
+ }
+ })
+ }
+ })
+ })
+ this.$forceUpdate()
}
},
template: `
@@ -6967,7 +7027,7 @@ Vue.component("http-cache-refs-config-box", {
操作 |
| |
| @@ -10037,7 +10097,7 @@ Vue.component("http-cache-policy-selector", { template: ` |