diff --git a/web/public/js/components/server/http-firewall-rules-box.js b/web/public/js/components/server/http-firewall-rules-box.js index a61b5c2c..32481ad7 100644 --- a/web/public/js/components/server/http-firewall-rules-box.js +++ b/web/public/js/components/server/http-firewall-rules-box.js @@ -21,7 +21,7 @@ Vue.component("http-firewall-rules-box", { }) }, updateRule: function (index, rule) { - window.UPDATING_RULE = rule + window.UPDATING_RULE = teaweb.clone(rule) let that = this teaweb.popup("/servers/components/waf/createRulePopup?type=" + this.vType, { height: "30em", diff --git a/web/public/js/utils.js b/web/public/js/utils.js index 5605bdd7..c9b8dc79 100644 --- a/web/public/js/utils.js +++ b/web/public/js/utils.js @@ -49,6 +49,10 @@ window.teaweb = { } return true; }, + clone: function (source) { + let s = JSON.stringify(source) + return JSON.parse(s) + }, loadJS: function (file, callback) { let element = document.createElement("script") @@ -940,7 +944,7 @@ window.teaweb = { }, chartMap: {}, // dom id => chart initChart: function (dom, cache) { - if (typeof(cache) != "boolean") { + if (typeof (cache) != "boolean") { cache = true } diff --git a/web/views/@default/servers/components/waf/createRulePopup.js b/web/views/@default/servers/components/waf/createRulePopup.js index 9d1b6b7b..299edb53 100644 --- a/web/views/@default/servers/components/waf/createRulePopup.js +++ b/web/views/@default/servers/components/waf/createRulePopup.js @@ -27,7 +27,7 @@ Tea.context(function () { this.rule.checkpointPrefix = param } this.$delay(function () { - this.changeCheckpoint() + this.loadCheckpoint() if (this.rule.checkpointOptions != null && this.checkpoint != null && this.checkpoint.options != null) { let that = this this.checkpoint.options.forEach(function (option) { @@ -43,6 +43,18 @@ Tea.context(function () { * checkpoint */ this.checkpoint = null + + this.loadCheckpoint = function () { + if (this.rule.checkpointPrefix.length == 0) { + this.checkpoint = null + return + } + let that = this + this.checkpoint = this.checkpoints.$find(function (k, v) { + return v.prefix == that.rule.checkpointPrefix + }) + } + this.changeCheckpoint = function () { if (this.rule.checkpointPrefix.length == 0) { this.checkpoint = null diff --git a/web/views/@default/servers/groups/group/settings/waf/groups.js b/web/views/@default/servers/groups/group/settings/waf/groups.js index f98b7fb2..136c0463 100644 --- a/web/views/@default/servers/groups/group/settings/waf/groups.js +++ b/web/views/@default/servers/groups/group/settings/waf/groups.js @@ -57,7 +57,6 @@ Tea.context(function () { // 添加分组 this.createGroup = function (type) { teaweb.popup("/servers/components/waf/createGroupPopup?firewallPolicyId=" + this.firewallPolicyId + "&type=" + type, { - height: "16em", callback: function () { teaweb.success("保存成功", function () { window.location.reload() diff --git a/web/views/@default/servers/server/settings/waf/groups.js b/web/views/@default/servers/server/settings/waf/groups.js index f98b7fb2..136c0463 100644 --- a/web/views/@default/servers/server/settings/waf/groups.js +++ b/web/views/@default/servers/server/settings/waf/groups.js @@ -57,7 +57,6 @@ Tea.context(function () { // 添加分组 this.createGroup = function (type) { teaweb.popup("/servers/components/waf/createGroupPopup?firewallPolicyId=" + this.firewallPolicyId + "&type=" + type, { - height: "16em", callback: function () { teaweb.success("保存成功", function () { window.location.reload()