mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-09 00:20:26 +08:00
Update components.js
This commit is contained in:
@@ -2574,8 +2574,8 @@ Vue.component("http-cache-refs-box", {
|
|||||||
<th class="width10">缓存时间</th>
|
<th class="width10">缓存时间</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr v-for="(cacheRef, index) in refs">
|
<tr v-for="(cacheRef, index) in refs">
|
||||||
<td :class="{'color-border': cacheRef.conds.connector == 'and'}" :style="{'border-left':cacheRef.isReverse ? '1px #db2828 solid' : ''}">
|
<td :class="{'color-border': cacheRef.conds.connector == 'and', disabled: !cacheRef.isOn}" :style="{'border-left':cacheRef.isReverse ? '1px #db2828 solid' : ''}">
|
||||||
<http-request-conds-view :v-conds="cacheRef.conds"></http-request-conds-view>
|
<http-request-conds-view :v-conds="cacheRef.conds" :class="{disabled: !cacheRef.isOn}"></http-request-conds-view>
|
||||||
<grey-label v-if="cacheRef.minSize != null && cacheRef.minSize.count > 0">
|
<grey-label v-if="cacheRef.minSize != null && cacheRef.minSize.count > 0">
|
||||||
{{cacheRef.minSize.count}}{{cacheRef.minSize.unit}}
|
{{cacheRef.minSize.count}}{{cacheRef.minSize.unit}}
|
||||||
<span v-if="cacheRef.maxSize != null && cacheRef.maxSize.count > 0">- {{cacheRef.maxSize.count}}{{cacheRef.maxSize.unit}}</span>
|
<span v-if="cacheRef.maxSize != null && cacheRef.maxSize.count > 0">- {{cacheRef.maxSize.count}}{{cacheRef.maxSize.unit}}</span>
|
||||||
@@ -2586,11 +2586,11 @@ Vue.component("http-cache-refs-box", {
|
|||||||
<grey-label v-if="cacheRef.status != null && cacheRef.status.length > 0 && (cacheRef.status.length > 1 || cacheRef.status[0] != 200)">状态码:{{cacheRef.status.map(function(v) {return v.toString()}).join(", ")}}</grey-label>
|
<grey-label v-if="cacheRef.status != null && cacheRef.status.length > 0 && (cacheRef.status.length > 1 || cacheRef.status[0] != 200)">状态码:{{cacheRef.status.map(function(v) {return v.toString()}).join(", ")}}</grey-label>
|
||||||
<grey-label v-if="cacheRef.allowPartialContent">区间缓存</grey-label>
|
<grey-label v-if="cacheRef.allowPartialContent">区间缓存</grey-label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td :class="{disabled: !cacheRef.isOn}">
|
||||||
<span v-if="cacheRef.conds.connector == 'and'">和</span>
|
<span v-if="cacheRef.conds.connector == 'and'">和</span>
|
||||||
<span v-if="cacheRef.conds.connector == 'or'">或</span>
|
<span v-if="cacheRef.conds.connector == 'or'">或</span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td :class="{disabled: !cacheRef.isOn}">
|
||||||
<span v-if="!cacheRef.isReverse">{{cacheRef.life.count}} {{timeUnitName(cacheRef.life.unit)}}</span>
|
<span v-if="!cacheRef.isReverse">{{cacheRef.life.count}} {{timeUnitName(cacheRef.life.unit)}}</span>
|
||||||
<span v-else class="red">不缓存</span>
|
<span v-else class="red">不缓存</span>
|
||||||
</td>
|
</td>
|
||||||
@@ -3783,7 +3783,7 @@ Vue.component("metric-board", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
Vue.component("http-cache-config-box", {
|
Vue.component("http-cache-config-box", {
|
||||||
props: ["v-cache-config", "v-is-location", "v-is-group", "v-cache-policy"],
|
props: ["v-cache-config", "v-is-location", "v-is-group", "v-cache-policy", "v-web-id"],
|
||||||
data: function () {
|
data: function () {
|
||||||
let cacheConfig = this.vCacheConfig
|
let cacheConfig = this.vCacheConfig
|
||||||
if (cacheConfig == null) {
|
if (cacheConfig == null) {
|
||||||
@@ -3922,7 +3922,7 @@ Vue.component("http-cache-config-box", {
|
|||||||
|
|
||||||
<div v-show="isOn()" style="margin-top: 1em">
|
<div v-show="isOn()" style="margin-top: 1em">
|
||||||
<h4>缓存条件</h4>
|
<h4>缓存条件</h4>
|
||||||
<http-cache-refs-config-box :v-cache-config="cacheConfig" :v-cache-refs="cacheConfig.cacheRefs" ></http-cache-refs-config-box>
|
<http-cache-refs-config-box :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>`
|
||||||
@@ -4226,7 +4226,7 @@ Vue.component("http-firewall-checkpoint-referer-block", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
Vue.component("http-cache-refs-config-box", {
|
Vue.component("http-cache-refs-config-box", {
|
||||||
props: ["v-cache-refs", "v-cache-config", "v-cache-policy-id"],
|
props: ["v-cache-refs", "v-cache-config", "v-cache-policy-id", "v-web-id"],
|
||||||
mounted: function () {
|
mounted: function () {
|
||||||
let that = this
|
let that = this
|
||||||
sortTable(function (ids) {
|
sortTable(function (ids) {
|
||||||
@@ -4328,6 +4328,14 @@ Vue.component("http-cache-refs-config-box", {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
disableRef: function (ref) {
|
||||||
|
ref.isOn = false
|
||||||
|
this.change()
|
||||||
|
},
|
||||||
|
enableRef: function (ref) {
|
||||||
|
ref.isOn = true
|
||||||
|
this.change()
|
||||||
|
},
|
||||||
removeRef: function (index) {
|
removeRef: function (index) {
|
||||||
let that = this
|
let that = this
|
||||||
teaweb.confirm("确定要删除此缓存设置吗?", function () {
|
teaweb.confirm("确定要删除此缓存设置吗?", function () {
|
||||||
@@ -4360,13 +4368,25 @@ Vue.component("http-cache-refs-config-box", {
|
|||||||
},
|
},
|
||||||
change: function () {
|
change: function () {
|
||||||
// 自动保存
|
// 自动保存
|
||||||
if (this.vCachePolicyId != null && this.vCachePolicyId > 0) {
|
if (this.vCachePolicyId != null && this.vCachePolicyId > 0) { // 缓存策略
|
||||||
Tea.action("/servers/components/cache/updateRefs")
|
Tea.action("/servers/components/cache/updateRefs")
|
||||||
.params({
|
.params({
|
||||||
cachePolicyId: this.vCachePolicyId,
|
cachePolicyId: this.vCachePolicyId,
|
||||||
refsJSON: JSON.stringify(this.refs)
|
refsJSON: JSON.stringify(this.refs)
|
||||||
})
|
})
|
||||||
.post()
|
.post()
|
||||||
|
} else if (this.vWebId != null && this.vWebId > 0) { // Server Web or Group Web
|
||||||
|
Tea.action("/servers/server/settings/cache/updateRefs")
|
||||||
|
.params({
|
||||||
|
webId: this.vWebId,
|
||||||
|
refsJSON: JSON.stringify(this.refs)
|
||||||
|
})
|
||||||
|
.success(function (resp) {
|
||||||
|
if (resp.data.isUpdated) {
|
||||||
|
teaweb.successToast("保存成功")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.post()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -4382,14 +4402,14 @@ Vue.component("http-cache-refs-config-box", {
|
|||||||
<th>缓存条件</th>
|
<th>缓存条件</th>
|
||||||
<th class="two wide">分组关系</th>
|
<th class="two wide">分组关系</th>
|
||||||
<th class="width10">缓存时间</th>
|
<th class="width10">缓存时间</th>
|
||||||
<th class="two op">操作</th>
|
<th class="three op">操作</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody v-for="(cacheRef, index) in refs" :key="cacheRef.id" :v-id="cacheRef.id">
|
<tbody v-for="(cacheRef, index) in refs" :key="cacheRef.id" :v-id="cacheRef.id">
|
||||||
<tr>
|
<tr>
|
||||||
<td style="text-align: center;"><i class="icon bars handle grey"></i> </td>
|
<td style="text-align: center;"><i class="icon bars handle grey"></i> </td>
|
||||||
<td :class="{'color-border': cacheRef.conds.connector == 'and'}" :style="{'border-left':cacheRef.isReverse ? '1px #db2828 solid' : ''}">
|
<td :class="{'color-border': cacheRef.conds.connector == 'and', disabled: !cacheRef.isOn}" :style="{'border-left':cacheRef.isReverse ? '1px #db2828 solid' : ''}">
|
||||||
<http-request-conds-view :v-conds="cacheRef.conds" ref="cacheRef"></http-request-conds-view>
|
<http-request-conds-view :v-conds="cacheRef.conds" ref="cacheRef" :class="{disabled: !cacheRef.isOn}"></http-request-conds-view>
|
||||||
<grey-label v-if="cacheRef.minSize != null && cacheRef.minSize.count > 0">
|
<grey-label v-if="cacheRef.minSize != null && cacheRef.minSize.count > 0">
|
||||||
{{cacheRef.minSize.count}}{{cacheRef.minSize.unit}}
|
{{cacheRef.minSize.count}}{{cacheRef.minSize.unit}}
|
||||||
<span v-if="cacheRef.maxSize != null && cacheRef.maxSize.count > 0">- {{cacheRef.maxSize.count}}{{cacheRef.maxSize.unit}}</span>
|
<span v-if="cacheRef.maxSize != null && cacheRef.maxSize.count > 0">- {{cacheRef.maxSize.count}}{{cacheRef.maxSize.unit}}</span>
|
||||||
@@ -4400,16 +4420,17 @@ Vue.component("http-cache-refs-config-box", {
|
|||||||
<grey-label v-if="cacheRef.status != null && cacheRef.status.length > 0 && (cacheRef.status.length > 1 || cacheRef.status[0] != 200)">状态码:{{cacheRef.status.map(function(v) {return v.toString()}).join(", ")}}</grey-label>
|
<grey-label v-if="cacheRef.status != null && cacheRef.status.length > 0 && (cacheRef.status.length > 1 || cacheRef.status[0] != 200)">状态码:{{cacheRef.status.map(function(v) {return v.toString()}).join(", ")}}</grey-label>
|
||||||
<grey-label v-if="cacheRef.allowPartialContent">区间缓存</grey-label>
|
<grey-label v-if="cacheRef.allowPartialContent">区间缓存</grey-label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td :class="{disabled: !cacheRef.isOn}">
|
||||||
<span v-if="cacheRef.conds.connector == 'and'">和</span>
|
<span v-if="cacheRef.conds.connector == 'and'">和</span>
|
||||||
<span v-if="cacheRef.conds.connector == 'or'">或</span>
|
<span v-if="cacheRef.conds.connector == 'or'">或</span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td :class="{disabled: !cacheRef.isOn}">
|
||||||
<span v-if="!cacheRef.isReverse">{{cacheRef.life.count}} {{timeUnitName(cacheRef.life.unit)}}</span>
|
<span v-if="!cacheRef.isReverse">{{cacheRef.life.count}} {{timeUnitName(cacheRef.life.unit)}}</span>
|
||||||
<span v-else class="red">不缓存</span>
|
<span v-else class="red">不缓存</span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="" @click.prevent="updateRef(index, cacheRef)">修改</a>
|
<a href="" @click.prevent="updateRef(index, cacheRef)">修改</a>
|
||||||
|
<a href="" v-if="cacheRef.isOn" @click.prevent="disableRef(cacheRef)">暂停</a><a href="" v-if="!cacheRef.isOn" @click.prevent="enableRef(cacheRef)"><span class="red">恢复</span></a>
|
||||||
<a href="" @click.prevent="removeRef(index)">删除</a>
|
<a href="" @click.prevent="removeRef(index)">删除</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
Reference in New Issue
Block a user