diff --git a/web/public/js/components/server/http-cache-config-box.js b/web/public/js/components/server/http-cache-config-box.js
index 8bf2b35a..dd03c011 100644
--- a/web/public/js/components/server/http-cache-config-box.js
+++ b/web/public/js/components/server/http-cache-config-box.js
@@ -28,12 +28,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: {
@@ -58,6 +64,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: `
@@ -147,7 +165,12 @@ Vue.component("http-cache-config-box", {
diff --git a/web/public/js/components/server/http-cache-refs-config-box.js b/web/public/js/components/server/http-cache-refs-config-box.js
index 469f5e4f..3c75368c 100644
--- a/web/public/js/components/server/http-cache-refs-config-box.js
+++ b/web/public/js/components/server/http-cache-refs-config-box.js
@@ -25,8 +25,10 @@ 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 && maxBytes.count > 0 && teaweb.compareSizeCapacity(ref.maxSize, maxBytes) > 0) {
@@ -162,6 +164,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: `
@@ -178,7 +215,7 @@ Vue.component("http-cache-refs-config-box", {
操作 |
-
+
| |
diff --git a/web/views/@default/servers/components/cache/update.html b/web/views/@default/servers/components/cache/update.html
index 2cb6d500..37895529 100644
--- a/web/views/@default/servers/components/cache/update.html
+++ b/web/views/@default/servers/components/cache/update.html
@@ -126,7 +126,7 @@
默认缓存条件
-
+
\ No newline at end of file
|