mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-11 18:30:25 +08:00
缓存条件类型支持“全站”
This commit is contained in:
@@ -141,8 +141,8 @@ Vue.component("http-cache-config-box", {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-show="isOn()" style="margin-top: 1em">
|
<div v-show="isOn()" style="margin-top: 1em">
|
||||||
<h4>缓存条件</h4>
|
<h4>缓存条件 <a href="" style="font-size: 0.8em" @click.prevent="$refs.cacheRefsConfigBoxRef.addRef(false)">[添加]</a> </h4>
|
||||||
<http-cache-refs-config-box :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"></http-cache-refs-config-box>
|
||||||
</div>
|
</div>
|
||||||
<div class="margin"></div>
|
<div class="margin"></div>
|
||||||
</div>`
|
</div>`
|
||||||
|
|||||||
@@ -177,9 +177,10 @@ Vue.component("http-cache-ref-box", {
|
|||||||
<td class="title color-border">条件类型 *</td>
|
<td class="title color-border">条件类型 *</td>
|
||||||
<td>
|
<td>
|
||||||
<select class="ui dropdown auto-width" name="condType" v-model="condType" @change="changeCondType(condType, false)">
|
<select class="ui dropdown auto-width" name="condType" v-model="condType" @change="changeCondType(condType, false)">
|
||||||
<option value="url-extension">URL扩展名</option>
|
<option value="url-extension">文件扩展名</option>
|
||||||
<option value="url-prefix">URL前缀</option>
|
<option value="url-prefix">URL前缀</option>
|
||||||
<option value="url-eq-index">首页</option>
|
<option value="url-eq-index">首页</option>
|
||||||
|
<option value="url-all">全站</option>
|
||||||
<option value="url-eq">URL完整路径</option>
|
<option value="url-eq">URL完整路径</option>
|
||||||
<option value="url-regexp">URL正则匹配</option>
|
<option value="url-regexp">URL正则匹配</option>
|
||||||
<option value="params">参数匹配</option>
|
<option value="params">参数匹配</option>
|
||||||
|
|||||||
@@ -214,7 +214,7 @@ Vue.component("http-cache-refs-config-box", {
|
|||||||
</table>
|
</table>
|
||||||
<p class="comment" v-if="refs.length > 1">所有条件匹配顺序为从上到下,可以拖动左侧的<i class="icon bars"></i>排序。服务设置的优先级比全局缓存策略设置的优先级要高。</p>
|
<p class="comment" v-if="refs.length > 1">所有条件匹配顺序为从上到下,可以拖动左侧的<i class="icon bars"></i>排序。服务设置的优先级比全局缓存策略设置的优先级要高。</p>
|
||||||
|
|
||||||
<button class="ui button tiny" @click.prevent="addRef(false)" type="button">+添加缓存条件</button> <a href="" @click.prevent="addRef(true)">+添加不缓存条件</a>
|
<button class="ui button tiny" @click.prevent="addRef(false)" type="button">+添加缓存条件</button> <a href="" @click.prevent="addRef(true)" style="font-size: 0.8em">+添加不缓存条件</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="margin"></div>
|
<div class="margin"></div>
|
||||||
</div>`
|
</div>`
|
||||||
|
|||||||
@@ -276,6 +276,36 @@ Vue.component("http-cond-url-eq-index", {
|
|||||||
</div>`
|
</div>`
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 全站
|
||||||
|
Vue.component("http-cond-url-all", {
|
||||||
|
props: ["v-cond"],
|
||||||
|
data: function () {
|
||||||
|
let cond = {
|
||||||
|
isRequest: true,
|
||||||
|
param: "${requestPath}",
|
||||||
|
operator: "prefix",
|
||||||
|
value: "/",
|
||||||
|
isCaseInsensitive: false
|
||||||
|
}
|
||||||
|
if (this.vCond != null && typeof this.vCond.value == "string") {
|
||||||
|
cond.value = this.vCond.value
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
cond: cond
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
changeCaseInsensitive: function (isCaseInsensitive) {
|
||||||
|
this.cond.isCaseInsensitive = isCaseInsensitive
|
||||||
|
}
|
||||||
|
},
|
||||||
|
template: `<div>
|
||||||
|
<input type="hidden" name="condJSON" :value="JSON.stringify(cond)"/>
|
||||||
|
<input type="text" v-model="cond.value" disabled="disabled" style="background: #eee"/>
|
||||||
|
<p class="comment">支持全站所有URL。</p>
|
||||||
|
</div>`
|
||||||
|
})
|
||||||
|
|
||||||
// URL精准匹配
|
// URL精准匹配
|
||||||
Vue.component("http-cond-url-eq", {
|
Vue.component("http-cond-url-eq", {
|
||||||
props: ["v-cond"],
|
props: ["v-cond"],
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"type": "url-extension",
|
"type": "url-extension",
|
||||||
"name": "URL扩展名",
|
"name": "文件扩展名",
|
||||||
"description": "根据URL中的文件路径扩展名进行过滤",
|
"description": "根据URL中的文件路径扩展名进行过滤",
|
||||||
"component": "http-cond-url-extension",
|
"component": "http-cond-url-extension",
|
||||||
"paramsTitle": "扩展名列表",
|
"paramsTitle": "扩展名列表",
|
||||||
@@ -16,6 +16,15 @@
|
|||||||
"isRequest": true,
|
"isRequest": true,
|
||||||
"caseInsensitive": false
|
"caseInsensitive": false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "url-all",
|
||||||
|
"name": "全站",
|
||||||
|
"description": "全站所有URL",
|
||||||
|
"component": "http-cond-url-all",
|
||||||
|
"paramsTitle": "URL完整路径",
|
||||||
|
"isRequest": true,
|
||||||
|
"caseInsensitive": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "url-prefix",
|
"type": "url-prefix",
|
||||||
"name": "URL前缀",
|
"name": "URL前缀",
|
||||||
|
|||||||
Reference in New Issue
Block a user