mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-09 16:50:26 +08:00
优化缓存条件;默认缓存有效期从2个小时改为1天
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
Vue.component("time-duration-box", {
|
Vue.component("time-duration-box", {
|
||||||
props: ["name", "v-name", "v-value", "v-count", "v-unit"],
|
props: ["v-name", "v-value", "v-count", "v-unit", "placeholder", "v-min-unit", "maxlength"],
|
||||||
mounted: function () {
|
mounted: function () {
|
||||||
this.change()
|
this.change()
|
||||||
},
|
},
|
||||||
@@ -15,17 +15,52 @@ Vue.component("time-duration-box", {
|
|||||||
v["count"] = -1
|
v["count"] = -1
|
||||||
}
|
}
|
||||||
|
|
||||||
let realName = ""
|
let minUnit = this.vMinUnit
|
||||||
if (typeof this.name == "string" && this.name.length > 0) {
|
let units = [
|
||||||
realName = this.name
|
{
|
||||||
} else if (typeof this.vName == "string" && this.vName.length > 0) {
|
code: "ms",
|
||||||
realName = this.vName
|
name: "毫秒"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
code: "second",
|
||||||
|
name: "秒"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
code: "minute",
|
||||||
|
name: "分钟"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
code: "hour",
|
||||||
|
name: "小时"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
code: "day",
|
||||||
|
name: "天"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
let minUnitIndex = -1
|
||||||
|
if (minUnit != null && typeof minUnit == "string" && minUnit.length > 0) {
|
||||||
|
for (let i = 0; i < units.length; i++) {
|
||||||
|
if (units[i].code == minUnit) {
|
||||||
|
minUnitIndex = i
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (minUnitIndex > -1) {
|
||||||
|
units = units.slice(minUnitIndex)
|
||||||
|
}
|
||||||
|
|
||||||
|
let maxLength = parseInt(this.maxlength)
|
||||||
|
if (typeof maxLength != "number") {
|
||||||
|
maxLength = 10
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
duration: v,
|
duration: v,
|
||||||
countString: (v.count >= 0) ? v.count.toString() : "",
|
countString: (v.count >= 0) ? v.count.toString() : "",
|
||||||
realName: realName
|
units: units,
|
||||||
|
realMaxLength: maxLength
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@@ -48,19 +83,37 @@ Vue.component("time-duration-box", {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
template: `<div class="ui fields inline" style="padding-bottom: 0; margin-bottom: 0">
|
template: `<div class="ui fields inline" style="padding-bottom: 0; margin-bottom: 0">
|
||||||
<input type="hidden" :name="realName" :value="JSON.stringify(duration)"/>
|
<input type="hidden" :name="vName" :value="JSON.stringify(duration)"/>
|
||||||
<div class="ui field">
|
<div class="ui field">
|
||||||
<input type="text" v-model="countString" maxlength="11" size="11" @keypress.enter.prevent="1"/>
|
<input type="text" v-model="countString" :maxlength="realMaxLength" :size="realMaxLength" :placeholder="placeholder" @keypress.enter.prevent="1"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="ui field">
|
<div class="ui field">
|
||||||
<select class="ui dropdown" v-model="duration.unit" @change="change">
|
<select class="ui dropdown" v-model="duration.unit" @change="change">
|
||||||
<option value="ms">毫秒</option>
|
<option v-for="unit in units" :value="unit.code">{{unit.name}}</option>
|
||||||
<option value="second">秒</option>
|
|
||||||
<option value="minute">分钟</option>
|
|
||||||
<option value="hour">小时</option>
|
|
||||||
<option value="day">天</option>
|
|
||||||
<option value="week">周</option>
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>`
|
</div>`
|
||||||
|
})
|
||||||
|
|
||||||
|
Vue.component("time-duration-text", {
|
||||||
|
props: ["v-value"],
|
||||||
|
methods: {
|
||||||
|
unitName: function (unit) {
|
||||||
|
switch (unit) {
|
||||||
|
case "ms":
|
||||||
|
return "毫秒"
|
||||||
|
case "second":
|
||||||
|
return "秒"
|
||||||
|
case "minute":
|
||||||
|
return "分钟"
|
||||||
|
case "hour":
|
||||||
|
return "小时"
|
||||||
|
case "day":
|
||||||
|
return "天"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
template: `<span>
|
||||||
|
{{vValue.count}} {{unitName(vValue.unit)}}
|
||||||
|
</span>`
|
||||||
})
|
})
|
||||||
@@ -19,7 +19,7 @@ Vue.component("http-cache-ref-box", {
|
|||||||
isOn: true,
|
isOn: true,
|
||||||
cachePolicyId: 0,
|
cachePolicyId: 0,
|
||||||
key: "${scheme}://${host}${requestPath}${isArgs}${args}",
|
key: "${scheme}://${host}${requestPath}${isArgs}${args}",
|
||||||
life: {count: 2, unit: "hour"},
|
life: {count: 1, unit: "day"},
|
||||||
status: [200],
|
status: [200],
|
||||||
maxSize: {count: 128, unit: "mb"},
|
maxSize: {count: 128, unit: "mb"},
|
||||||
minSize: {count: 0, unit: "kb"},
|
minSize: {count: 0, unit: "kb"},
|
||||||
@@ -220,7 +220,7 @@ Vue.component("http-cache-ref-box", {
|
|||||||
<tr v-show="!vIsReverse">
|
<tr v-show="!vIsReverse">
|
||||||
<td>缓存有效期 *</td>
|
<td>缓存有效期 *</td>
|
||||||
<td>
|
<td>
|
||||||
<time-duration-box :v-value="ref.life" @change="changeLife"></time-duration-box>
|
<time-duration-box :v-value="ref.life" @change="changeLife" :v-min-unit="'minute'" maxlength="4"></time-duration-box>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr v-show="!vIsReverse">
|
<tr v-show="!vIsReverse">
|
||||||
@@ -231,15 +231,15 @@ Vue.component("http-cache-ref-box", {
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr v-show="!vIsReverse">
|
<tr v-show="!vIsReverse">
|
||||||
|
<td colspan="2"><more-options-indicator @change="changeOptionsVisible"></more-options-indicator></td>
|
||||||
|
</tr>
|
||||||
|
<tr v-show="moreOptionsVisible && !vIsReverse">
|
||||||
<td>缓存Key *</td>
|
<td>缓存Key *</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" v-model="ref.key" @input="changeKey(ref.key)"/>
|
<input type="text" v-model="ref.key" @input="changeKey(ref.key)"/>
|
||||||
<p class="comment">用来区分不同缓存内容的唯一Key。<request-variables-describer ref="variablesDescriber"></request-variables-describer>。</p>
|
<p class="comment">用来区分不同缓存内容的唯一Key。<request-variables-describer ref="variablesDescriber"></request-variables-describer>。</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr v-show="!vIsReverse">
|
|
||||||
<td colspan="2"><more-options-indicator @change="changeOptionsVisible"></more-options-indicator></td>
|
|
||||||
</tr>
|
|
||||||
<tr v-show="moreOptionsVisible && !vIsReverse">
|
<tr v-show="moreOptionsVisible && !vIsReverse">
|
||||||
<td>请求方法限制</td>
|
<td>请求方法限制</td>
|
||||||
<td>
|
<td>
|
||||||
|
|||||||
Reference in New Issue
Block a user