修复缓存条件状态码无法修改的问题

This commit is contained in:
GoEdgeLab
2021-08-29 09:22:02 +08:00
parent ba0153fa43
commit e95cbdb707
2 changed files with 16 additions and 1 deletions

View File

@@ -38,6 +38,10 @@ func (this *CreatePopupAction) RunPost(params struct {
this.Fail("请输入缓存Key") this.Fail("请输入缓存Key")
} }
if cacheRef.Conds == nil || len(cacheRef.Conds.Groups) == 0 {
this.Fail("请填写匹配条件分组")
}
err = cacheRef.Init() err = cacheRef.Init()
if err != nil { if err != nil {
this.ErrorPage(err) this.ErrorPage(err)

View File

@@ -42,6 +42,17 @@ Vue.component("http-cache-ref-box", {
}, },
changeConds: function (v) { changeConds: function (v) {
this.ref.conds = v this.ref.conds = v
},
changeStatusList: function (list) {
let result = []
list.forEach(function (status) {
let statusNumber = parseInt(status)
if (isNaN(statusNumber) || statusNumber < 100 || statusNumber > 999) {
return
}
result.push(statusNumber)
})
this.ref.status = result
} }
}, },
template: `<tbody> template: `<tbody>
@@ -85,7 +96,7 @@ Vue.component("http-cache-ref-box", {
<tr v-show="moreOptionsVisible && !vIsReverse"> <tr v-show="moreOptionsVisible && !vIsReverse">
<td>状态码列表</td> <td>状态码列表</td>
<td> <td>
<values-box name="statusList" size="3" maxlength="3" :values="ref.status"></values-box> <values-box name="statusList" size="3" maxlength="3" :values="ref.status" @change="changeStatusList"></values-box>
<p class="comment">允许缓存的HTTP状态码列表。</p> <p class="comment">允许缓存的HTTP状态码列表。</p>
</td> </td>
</tr> </tr>