mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-12-25 11:36:34 +08:00
在网站WAF中,可以导出和导入规则集代码,优化修改规则集交互
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
Tea.context(function () {
|
||||
this.highlightedSetId = 0
|
||||
|
||||
this.$delay(function () {
|
||||
let that = this
|
||||
sortTable(function () {
|
||||
@@ -17,6 +19,14 @@ Tea.context(function () {
|
||||
teaweb.successToast("排序保存成功")
|
||||
})
|
||||
})
|
||||
|
||||
// 跳转到刚操作成功的记录集
|
||||
let opSetId = localStorage.getItem("goHTTPFirewallRuleSet")
|
||||
if (opSetId != null) {
|
||||
this.highlightedSetId = opSetId
|
||||
localStorage.removeItem("goHTTPFirewallRuleSet")
|
||||
document.querySelector("*[data-set-id='" + opSetId + "']").scrollIntoView({behavior: 'smooth'})
|
||||
}
|
||||
})
|
||||
|
||||
// 更改分组
|
||||
@@ -33,12 +43,13 @@ Tea.context(function () {
|
||||
|
||||
// 创建规则集
|
||||
this.createSet = function (groupId) {
|
||||
let that = this
|
||||
teaweb.popup("/servers/components/waf/createSetPopup?firewallPolicyId=" + this.firewallPolicyId + "&groupId=" + groupId + "&type=" + this.type, {
|
||||
width: "50em",
|
||||
height: "40em",
|
||||
callback: function () {
|
||||
callback: function (resp) {
|
||||
teaweb.success("保存成功", function () {
|
||||
window.location.reload()
|
||||
that.goSetId(resp.data.setId)
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -46,12 +57,13 @@ Tea.context(function () {
|
||||
|
||||
// 修改规则集
|
||||
this.updateSet = function (setId) {
|
||||
let that = this
|
||||
teaweb.popup("/servers/components/waf/updateSetPopup?firewallPolicyId=" + this.firewallPolicyId + "&groupId=" + this.group.id + "&type=" + this.type + "&setId=" + setId, {
|
||||
width: "50em",
|
||||
height: "40em",
|
||||
callback: function () {
|
||||
teaweb.success("保存成功", function () {
|
||||
window.location.reload()
|
||||
that.goSetId(setId)
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -59,12 +71,15 @@ Tea.context(function () {
|
||||
|
||||
// 停用|启用规则集
|
||||
this.updateSetOn = function (setId, isOn) {
|
||||
let that = this
|
||||
this.$post("/servers/components/waf/updateSetOn")
|
||||
.params({
|
||||
setId: setId,
|
||||
isOn: isOn ? 1 : 0
|
||||
})
|
||||
.refresh()
|
||||
.success(function () {
|
||||
that.goSetId(setId)
|
||||
})
|
||||
}
|
||||
|
||||
// 删除规则集
|
||||
@@ -79,4 +94,17 @@ Tea.context(function () {
|
||||
.refresh()
|
||||
})
|
||||
}
|
||||
|
||||
// 显示规则集代码
|
||||
this.showSetCode = function (setId) {
|
||||
teaweb.popup("/servers/components/waf/setCodePopup?setId=" + setId, {
|
||||
height: "26em"
|
||||
})
|
||||
}
|
||||
|
||||
// 跳转到刚操作的记录集ID
|
||||
this.goSetId = function (setId) {
|
||||
localStorage.setItem("goHTTPFirewallRuleSet", setId)
|
||||
teaweb.reload()
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user