WAF添加规则:调整界面/增加正则表达式测试功能

This commit is contained in:
GoEdgeLab
2021-12-12 20:56:25 +08:00
parent 72f8d139c7
commit 2588c9ee2e
4 changed files with 141 additions and 22 deletions

View File

@@ -68,4 +68,57 @@ Tea.context(function () {
}
};
this.changeOperator()
/**
* caseInsensitive
*/
this.changeCaseInsensitive = function () {
if (this.rule.operator == "match" || this.rule.operator == "not match") {
if (this.regexpTestIsOn) {
this.changeRegexpTestBody()
}
}
}
/**
* value
*/
this.changeRuleValue = function () {
if (this.rule.operator == "match" || this.rule.operator == "not match") {
if (this.regexpTestIsOn) {
this.changeRegexpTestBody()
}
} else {
this.regexpTestIsOn = false
this.regexpTestResult = {isOk: false, message: ""}
}
}
/**
* 正则测试
*/
this.regexpTestIsOn = false
this.regexpTestBody = ""
this.regexpTestResult = {isOk: false, message: ""}
this.changeRegexpTestIsOn = function () {
this.regexpTestIsOn = !this.regexpTestIsOn
if (this.regexpTestIsOn) {
this.$delay(function () {
this.$refs.regexpTestBody.focus()
})
}
}
this.changeRegexpTestBody = function () {
this.$post(".testRegexp")
.params({
"regexp": this.rule.value,
"body": this.regexpTestBody,
"isCaseInsensitive": this.rule.isCaseInsensitive
})
.success(function (resp) {
this.regexpTestResult = resp.data.result
})
}
})