Vue.component("http-firewall-rules-box", { props: ["v-rules", "v-type"], data: function () { let rules = this.vRules if (rules == null) { rules = [] } return { rules: rules } }, methods: { addRule: function () { window.UPDATING_RULE = null let that = this teaweb.popup("/servers/components/waf/createRulePopup?type=" + this.vType, { callback: function (resp) { that.rules.push(resp.data.rule) } }) }, updateRule: function (index, rule) { window.UPDATING_RULE = rule let that = this teaweb.popup("/servers/components/waf/createRulePopup?type=" + this.vType, { callback: function (resp) { Vue.set(that.rules, index, resp.data.rule) } }) }, removeRule: function (index) { let that = this teaweb.confirm("确定要删除此规则吗?", function () { that.rules.$remove(index) }) } }, template: `
{{rule.name}}[{{rule.param}}] {{rule.checkpointOptions.period}}秒/{{rule.checkpointOptions.threshold}}请求 {{rule.checkpointOptions.allowDomains}} | {{paramFilter.code}} {{rule.operator}} {{rule.value}} ({{rule.description}})
` })