mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-04 05:00:25 +08:00
WAF添加规则:调整界面/增加正则表达式测试功能
This commit is contained in:
@@ -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
|
||||
})
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user