diff --git a/internal/web/actions/default/servers/server/settings/cache/createPopup.go b/internal/web/actions/default/servers/server/settings/cache/createPopup.go
index 1e340971..6281d880 100644
--- a/internal/web/actions/default/servers/server/settings/cache/createPopup.go
+++ b/internal/web/actions/default/servers/server/settings/cache/createPopup.go
@@ -28,8 +28,9 @@ func (this *CreatePopupAction) RunGet(params struct {
func (this *CreatePopupAction) RunPost(params struct {
CacheRefJSON []byte
- CondType string
- CondJSON []byte
+ CondType string
+ CondJSON []byte
+ CondIsCaseInsensitive bool
Must *actions.Must
}) {
@@ -48,6 +49,7 @@ func (this *CreatePopupAction) RunPost(params struct {
return
}
cond.Type = params.CondType
+ cond.IsCaseInsensitive = params.CondIsCaseInsensitive
cacheRef.SimpleCond = cond
// 将组合条件置为空
diff --git a/web/public/js/components/server/http-cache-ref-box.js b/web/public/js/components/server/http-cache-ref-box.js
index 228214f2..1a833464 100644
--- a/web/public/js/components/server/http-cache-ref-box.js
+++ b/web/public/js/components/server/http-cache-ref-box.js
@@ -4,11 +4,13 @@ Vue.component("http-cache-ref-box", {
mounted: function () {
this.$refs.variablesDescriber.update(this.ref.key)
if (this.ref.simpleCond != null) {
- this.changeCondType(this.ref.simpleCond.type)
+ this.condType = this.ref.simpleCond.type
+ this.changeCondType(this.ref.simpleCond.type, true)
this.condCategory = "simple"
} else if (this.ref.conds != null && this.ref.conds.groups != null) {
this.condCategory = "complex"
}
+ this.changeCondCategory(this.condCategory)
},
data: function () {
let ref = this.vCacheRef
@@ -66,9 +68,12 @@ Vue.component("http-cache-ref-box", {
return {
ref: ref,
moreOptionsVisible: false,
+
condCategory: "simple", // 条件分类:simple|complex
condType: condType,
condComponent: condComponent,
+ condIsCaseInsensitive: (ref.simpleCond != null) ? ref.simpleCond.isCaseInsensitive : true,
+
components: window.REQUEST_COND_COMPONENTS
}
},
@@ -115,8 +120,27 @@ Vue.component("http-cache-ref-box", {
// 切换条件类型
changeCondCategory: function (condCategory) {
this.condCategory = condCategory
+
+ // resize window
+ let dialog = window.parent.document.querySelector("*[role='dialog']")
+ switch (condCategory) {
+ case "simple":
+ dialog.style.width = "40em"
+ break
+ case "complex":
+ let width = window.parent.innerWidth
+ if (width > 1024) {
+ width = 1024
+ }
+
+ dialog.style.width = width + "px"
+ break
+ }
},
- changeCondType: function (condType) {
+ changeCondType: function (condType, isInit) {
+ if (!isInit && this.ref.simpleCond != null) {
+ this.ref.simpleCond.value = null
+ }
let def = this.components.$find(function (k, component) {
return component.type == condType
})
@@ -129,11 +153,11 @@ Vue.component("http-cache-ref-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 cfaeaec4..11a49a38 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
@@ -35,17 +35,12 @@ Vue.component("http-cache-refs-config-box", {
addRef: function (isReverse) {
window.UPDATING_CACHE_REF = null
- let width = window.innerWidth
- if (width > 1024) {
- width = 1024
- }
let height = window.innerHeight
if (height > 500) {
height = 500
}
let that = this
teaweb.popup("/servers/server/settings/cache/createPopup?isReverse=" + (isReverse ? 1 : 0), {
- width: width + "px",
height: height + "px",
callback: function (resp) {
let newRef = resp.data.cacheRef
@@ -82,17 +77,12 @@ Vue.component("http-cache-refs-config-box", {
updateRef: function (index, cacheRef) {
window.UPDATING_CACHE_REF = cacheRef
- let width = window.innerWidth
- if (width > 1024) {
- width = 1024
- }
let height = window.innerHeight
if (height > 500) {
height = 500
}
let that = this
teaweb.popup("/servers/server/settings/cache/createPopup", {
- width: width + "px",
height: height + "px",
callback: function (resp) {
resp.data.cacheRef.id = that.refs[index].id
@@ -220,7 +210,7 @@ Vue.component("http-cache-refs-config-box", {
- +添加不缓存设置
+ +添加不缓存条件
`
diff --git a/web/public/js/components/server/http-cond-definitions.js b/web/public/js/components/server/http-cond-definitions.js
index a97b6b87..c84cfbd0 100644
--- a/web/public/js/components/server/http-cond-definitions.js
+++ b/web/public/js/components/server/http-cond-definitions.js
@@ -70,7 +70,7 @@ Vue.component("http-cond-url-extension", {
template: `
- `
})
-// URL扩展名条件
+// 排除URL扩展名条件
Vue.component("http-cond-url-not-extension", {
props: ["v-cond"],
data: function () {
@@ -161,7 +161,7 @@ Vue.component("http-cond-url-not-extension", {
template: `
- `
})
// 根据URL前缀
Vue.component("http-cond-url-prefix", {
props: ["v-cond"],
+ mounted: function () {
+ this.$refs.valueInput.focus()
+ },
data: function () {
let cond = {
isRequest: true,
@@ -205,13 +208,16 @@ Vue.component("http-cond-url-prefix", {
},
template: `
-
+
`
})
Vue.component("http-cond-url-not-prefix", {
props: ["v-cond"],
+ mounted: function () {
+ this.$refs.valueInput.focus()
+ },
data: function () {
let cond = {
isRequest: true,
@@ -235,7 +241,7 @@ Vue.component("http-cond-url-not-prefix", {
},
template: `
-
+
`
})
@@ -273,6 +279,9 @@ Vue.component("http-cond-url-eq-index", {
// URL精准匹配
Vue.component("http-cond-url-eq", {
props: ["v-cond"],
+ mounted: function () {
+ this.$refs.valueInput.focus()
+ },
data: function () {
let cond = {
isRequest: true,
@@ -295,13 +304,16 @@ Vue.component("http-cond-url-eq", {
},
template: `
-
+
`
})
Vue.component("http-cond-url-not-eq", {
props: ["v-cond"],
+ mounted: function () {
+ this.$refs.valueInput.focus()
+ },
data: function () {
let cond = {
isRequest: true,
@@ -325,7 +337,7 @@ Vue.component("http-cond-url-not-eq", {
},
template: `
-
+
`
})
@@ -333,6 +345,9 @@ Vue.component("http-cond-url-not-eq", {
// URL正则匹配
Vue.component("http-cond-url-regexp", {
props: ["v-cond"],
+ mounted: function () {
+ this.$refs.valueInput.focus()
+ },
data: function () {
let cond = {
isRequest: true,
@@ -355,7 +370,7 @@ Vue.component("http-cond-url-regexp", {
},
template: `
-
+
`
})
@@ -363,6 +378,9 @@ Vue.component("http-cond-url-regexp", {
// 排除URL正则匹配
Vue.component("http-cond-url-not-regexp", {
props: ["v-cond"],
+ mounted: function () {
+ this.$refs.valueInput.focus()
+ },
data: function () {
let cond = {
isRequest: true,
@@ -385,7 +403,7 @@ Vue.component("http-cond-url-not-regexp", {
},
template: `
-
+
`
})
@@ -394,6 +412,9 @@ Vue.component("http-cond-url-not-regexp", {
// User-Agent正则匹配
Vue.component("http-cond-user-agent-regexp", {
props: ["v-cond"],
+ mounted: function () {
+ this.$refs.valueInput.focus()
+ },
data: function () {
let cond = {
isRequest: true,
@@ -416,7 +437,7 @@ Vue.component("http-cond-user-agent-regexp", {
},
template: `
-
+
`
})
@@ -424,6 +445,9 @@ Vue.component("http-cond-user-agent-regexp", {
// User-Agent正则不匹配
Vue.component("http-cond-user-agent-not-regexp", {
props: ["v-cond"],
+ mounted: function () {
+ this.$refs.valueInput.focus()
+ },
data: function () {
let cond = {
isRequest: true,
@@ -446,7 +470,7 @@ Vue.component("http-cond-user-agent-not-regexp", {
},
template: `
-
+
`
})
@@ -520,12 +544,12 @@ Vue.component("http-cond-mime-type", {
-
+
`
diff --git a/web/public/js/components/server/http-request-conds-box.js b/web/public/js/components/server/http-request-conds-box.js
index 6d841a3a..abbd60d8 100644
--- a/web/public/js/components/server/http-request-conds-box.js
+++ b/web/public/js/components/server/http-request-conds-box.js
@@ -105,7 +105,7 @@ Vue.component("http-request-conds-box", {
-
+
`
diff --git a/web/public/js/conds/official.json b/web/public/js/conds/official.json
index 406243f9..9fcaf104 100644
--- a/web/public/js/conds/official.json
+++ b/web/public/js/conds/official.json
@@ -27,7 +27,7 @@
},
{
"type": "url-eq",
- "name": "URL精准匹配",
+ "name": "URL完整路径",
"description": "检查URL中的文件路径是否一致",
"component": "http-cond-url-eq",
"paramsTitle": "URL完整路径",
@@ -79,7 +79,7 @@
},
{
"type": "url-not-eq",
- "name": "排除:URL精准匹配",
+ "name": "排除:URL完整路径",
"description": "检查URL中的文件路径是否一致",
"component": "http-cond-url-not-eq",
"paramsTitle": "URL完整路径",
diff --git a/web/views/@default/servers/server/settings/cache/createPopup.html b/web/views/@default/servers/server/settings/cache/createPopup.html
index 0216d1ab..db1ddcd9 100644
--- a/web/views/@default/servers/server/settings/cache/createPopup.html
+++ b/web/views/@default/servers/server/settings/cache/createPopup.html
@@ -1,9 +1,9 @@
{$layout "layout_popup"}
-添加缓存设置
-修改缓存设置
-添加不缓存设置
-添加不缓存设置
+添加缓存条件
+修改缓存条件
+添加不缓存条件
+修改不缓存条件
|