mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-07 15:20:25 +08:00
优化WAF规则相关界面
This commit is contained in:
@@ -32,6 +32,7 @@ func (this *CreateRulePopupAction) RunGet(params struct {
|
||||
"params": checkpoint.Params,
|
||||
"options": checkpoint.Options,
|
||||
"isComposed": checkpoint.IsComposed,
|
||||
"dataType": checkpoint.DataType,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ Vue.component("http-firewall-rules-box", {
|
||||
window.UPDATING_RULE = null
|
||||
let that = this
|
||||
teaweb.popup("/servers/components/waf/createRulePopup?type=" + this.vType, {
|
||||
height: "30em",
|
||||
callback: function (resp) {
|
||||
that.rules.push(resp.data.rule)
|
||||
}
|
||||
@@ -23,6 +24,7 @@ Vue.component("http-firewall-rules-box", {
|
||||
window.UPDATING_RULE = rule
|
||||
let that = this
|
||||
teaweb.popup("/servers/components/waf/createRulePopup?type=" + this.vType, {
|
||||
height: "30em",
|
||||
callback: function (resp) {
|
||||
Vue.set(that.rules, index, resp.data.rule)
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<span v-if="rule.operator == 'match' || rule.operator == 'not match'">正则表达式</span>
|
||||
<span v-if="(checkpoint == null || checkpoint.dataType != 'bool') && (rule.operator == 'match' || rule.operator == 'not match')">正则表达式</span>
|
||||
<span v-else>对比值</span>
|
||||
</td>
|
||||
<td>
|
||||
@@ -105,6 +105,15 @@
|
||||
<p class="comment">将二进制进行Base64Encode后放在这里,比如<code-label>Hello</code-label>对应<code-label>SGVsbG8=</code-label>。</p>
|
||||
</div>
|
||||
|
||||
<!-- bool数据 -->
|
||||
<div v-else-if="checkpoint != null && checkpoint.dataType == 'bool'">
|
||||
<select name="value" class="ui selectable auto-width" v-model="rule.value" @change="changeRuleValue">
|
||||
<option value="">[请选择]</option>
|
||||
<option value="1">是(1)</option>
|
||||
<option value="0">否(0)</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- 其余数据 -->
|
||||
<textarea rows="3" maxlength="4096" name="value" v-model="rule.value" @input="changeRuleValue" v-else></textarea>
|
||||
|
||||
@@ -132,7 +141,7 @@
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="rule.operator == 'match' || rule.operator == 'not match'">
|
||||
<tr v-if="(checkpoint == null || checkpoint.dataType != 'bool') && (rule.operator == 'match' || rule.operator == 'not match')">
|
||||
<td>正则表达式测试</td>
|
||||
<td>
|
||||
<a href="" v-if="!regexpTestIsOn" @click.prevent="changeRegexpTestIsOn">[输入测试字符串]</a>
|
||||
@@ -147,7 +156,7 @@
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="operator.case != 'none'">
|
||||
<tr v-if="(checkpoint == null || checkpoint.dataType != 'bool') && operator != null && operator.case != 'none'">
|
||||
<td>不区分大小写</td>
|
||||
<td>
|
||||
<div class="ui checkbox">
|
||||
|
||||
@@ -52,6 +52,19 @@ Tea.context(function () {
|
||||
this.checkpoint = this.checkpoints.$find(function (k, v) {
|
||||
return v.prefix == that.rule.checkpointPrefix
|
||||
})
|
||||
if (this.checkpoint == null) {
|
||||
return
|
||||
}
|
||||
switch (this.checkpoint.dataType) {
|
||||
case "bool":
|
||||
this.rule.operator = "eq"
|
||||
break
|
||||
case "number":
|
||||
this.rule.operator = "eq"
|
||||
break
|
||||
default:
|
||||
this.rule.operator = "match"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -63,6 +76,9 @@ Tea.context(function () {
|
||||
this.operator = this.operators.$find(function (k, v) {
|
||||
return v.code == that.rule.operator
|
||||
})
|
||||
if (this.operator == null) {
|
||||
return
|
||||
}
|
||||
if (!this.isUpdating) {
|
||||
this.rule.isCaseInsensitive = (this.operator.case == "yes")
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ Tea.context(function () {
|
||||
this.createSet = function (groupId) {
|
||||
teaweb.popup("/servers/components/waf/createSetPopup?firewallPolicyId=" + this.firewallPolicyId + "&groupId=" + groupId + "&type=" + this.type, {
|
||||
width: "50em",
|
||||
height: "30em",
|
||||
height: "40em",
|
||||
callback: function () {
|
||||
teaweb.success("保存成功", function () {
|
||||
window.location.reload()
|
||||
@@ -47,7 +47,7 @@ Tea.context(function () {
|
||||
this.updateSet = function (setId) {
|
||||
teaweb.popup("/servers/components/waf/updateSetPopup?firewallPolicyId=" + this.firewallPolicyId + "&groupId=" + this.group.id + "&type=" + this.type + "&setId=" + setId, {
|
||||
width: "50em",
|
||||
height: "30em",
|
||||
height: "40em",
|
||||
callback: function () {
|
||||
teaweb.success("保存成功", function () {
|
||||
window.location.reload()
|
||||
|
||||
@@ -35,7 +35,7 @@ Tea.context(function () {
|
||||
this.createSet = function (groupId) {
|
||||
teaweb.popup("/servers/components/waf/createSetPopup?firewallPolicyId=" + this.firewallPolicyId + "&groupId=" + groupId + "&type=" + this.type, {
|
||||
width: "50em",
|
||||
height: "30em",
|
||||
height: "40em",
|
||||
callback: function () {
|
||||
teaweb.success("保存成功", function () {
|
||||
window.location.reload()
|
||||
@@ -48,7 +48,7 @@ Tea.context(function () {
|
||||
this.updateSet = function (setId) {
|
||||
teaweb.popup("/servers/components/waf/updateSetPopup?firewallPolicyId=" + this.firewallPolicyId + "&groupId=" + this.group.id + "&type=" + this.type + "&setId=" + setId, {
|
||||
width: "50em",
|
||||
height: "30em",
|
||||
height: "40em",
|
||||
callback: function () {
|
||||
teaweb.success("保存成功", function () {
|
||||
window.location.reload()
|
||||
|
||||
@@ -35,7 +35,7 @@ Tea.context(function () {
|
||||
this.createSet = function (groupId) {
|
||||
teaweb.popup("/servers/components/waf/createSetPopup?firewallPolicyId=" + this.firewallPolicyId + "&groupId=" + groupId + "&type=" + this.type, {
|
||||
width: "50em",
|
||||
height: "30em",
|
||||
height: "40em",
|
||||
callback: function () {
|
||||
teaweb.success("保存成功", function () {
|
||||
window.location.reload()
|
||||
@@ -48,7 +48,7 @@ Tea.context(function () {
|
||||
this.updateSet = function (setId) {
|
||||
teaweb.popup("/servers/components/waf/updateSetPopup?firewallPolicyId=" + this.firewallPolicyId + "&groupId=" + this.group.id + "&type=" + this.type + "&setId=" + setId, {
|
||||
width: "50em",
|
||||
height: "30em",
|
||||
height: "40em",
|
||||
callback: function () {
|
||||
teaweb.success("保存成功", function () {
|
||||
window.location.reload()
|
||||
|
||||
Reference in New Issue
Block a user