diff --git a/internal/web/actions/default/servers/components/waf/createSetPopup.go b/internal/web/actions/default/servers/components/waf/createSetPopup.go index 438c4d8a..88bfca03 100644 --- a/internal/web/actions/default/servers/components/waf/createSetPopup.go +++ b/internal/web/actions/default/servers/components/waf/createSetPopup.go @@ -9,7 +9,6 @@ import ( "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/maps" "strconv" - "strings" ) type CreateSetPopupAction struct { @@ -53,6 +52,7 @@ func (this *CreateSetPopupAction) RunGet(params struct { }, } + // 所有可选的动作 actionMaps := []maps.Map{} for _, action := range firewallconfigs.AllActions { actionMaps = append(actionMaps, maps.Map{ @@ -69,10 +69,10 @@ func (this *CreateSetPopupAction) RunGet(params struct { func (this *CreateSetPopupAction) RunPost(params struct { GroupId int64 - Name string - RulesJSON []byte - Connector string - Action string + Name string + RulesJSON []byte + Connector string + ActionsJSON []byte Must *actions.Must }) { @@ -96,32 +96,34 @@ func (this *CreateSetPopupAction) RunPost(params struct { err = json.Unmarshal(params.RulesJSON, &rules) if err != nil { this.ErrorPage(err) + return } if len(rules) == 0 { this.Fail("请添加至少一个规则") } - setConfig := &firewallconfigs.HTTPFirewallRuleSet{ - Id: 0, - IsOn: true, - Name: params.Name, - Code: "", - Description: "", - Connector: params.Connector, - RuleRefs: nil, - Rules: rules, - Action: params.Action, - ActionOptions: maps.Map{}, + var actionConfigs = []*firewallconfigs.HTTPFirewallActionConfig{} + if len(params.ActionsJSON) > 0 { + err = json.Unmarshal(params.ActionsJSON, &actionConfigs) + if err != nil { + this.ErrorPage(err) + return + } + } + if len(actionConfigs) == 0 { + this.Fail("请添加至少一个动作") } - for k, v := range this.ParamsMap { - if len(v) == 0 { - continue - } - index := strings.Index(k, "action_") - if index > -1 { - setConfig.ActionOptions[k[len("action_"):]] = v[0] - } + setConfig := &firewallconfigs.HTTPFirewallRuleSet{ + Id: 0, + IsOn: true, + Name: params.Name, + Code: "", + Description: "", + Connector: params.Connector, + RuleRefs: nil, + Rules: rules, + Actions: actionConfigs, } setConfigJSON, err := json.Marshal(setConfig) diff --git a/internal/web/actions/default/servers/components/waf/group.go b/internal/web/actions/default/servers/components/waf/group.go index c7277722..3a7daa9d 100644 --- a/internal/web/actions/default/servers/components/waf/group.go +++ b/internal/web/actions/default/servers/components/waf/group.go @@ -6,7 +6,6 @@ import ( "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/firewallconfigs" "github.com/iwind/TeaGo/lists" "github.com/iwind/TeaGo/maps" - "strconv" "strings" ) @@ -54,31 +53,19 @@ func (this *GroupAction) RunGet(params struct { set := v.(*firewallconfigs.HTTPFirewallRuleSet) // 动作说明 - actionLinks := []maps.Map{} - if set.Action == firewallconfigs.HTTPFirewallActionGoGroup { - nextGroup := firewallPolicy.FindRuleGroup(set.ActionOptions.GetInt64("groupId")) - if nextGroup != nil { - actionLinks = append(actionLinks, maps.Map{ - "name": nextGroup.Name, - "url": "/servers/components/waf/group?firewallPolicyId=" + strconv.FormatInt(params.FirewallPolicyId, 10) + "&type=" + params.Type + "&groupId=" + strconv.FormatInt(nextGroup.Id, 10), - }) + var actionMaps = []maps.Map{} + for _, action := range set.Actions { + def := firewallconfigs.FindActionDefinition(action.Code) + if def == nil { + continue } - } else if set.Action == firewallconfigs.HTTPFirewallActionGoSet { - nextGroup := firewallPolicy.FindRuleGroup(set.ActionOptions.GetInt64("groupId")) - if nextGroup != nil { - actionLinks = append(actionLinks, maps.Map{ - "name": nextGroup.Name, - "url": "/servers/components/waf/group?firewallPolicyId=" + strconv.FormatInt(params.FirewallPolicyId, 10) + "&type=" + params.Type + "&groupId=" + strconv.FormatInt(nextGroup.Id, 10), - }) - nextSet := nextGroup.FindRuleSet(set.ActionOptions.GetInt64("setId")) - if nextSet != nil { - actionLinks = append(actionLinks, maps.Map{ - "name": nextSet.Name, - "url": "/servers/components/waf/group?firewallPolicyId=" + strconv.FormatInt(params.FirewallPolicyId, 10) + "&type=" + params.Type + "&groupId=" + strconv.FormatInt(nextGroup.Id, 10), - }) - } - } + actionMaps = append(actionMaps, maps.Map{ + "code": strings.ToUpper(action.Code), + "name": def.Name, + "category": def.Category, + "options": action.Options, + }) } return maps.Map{ @@ -95,12 +82,9 @@ func (this *GroupAction) RunGet(params struct { "isComposed": firewallconfigs.CheckCheckpointIsComposed(rule.Prefix()), } }), - "isOn": set.IsOn, - "action": strings.ToUpper(set.Action), - "actionOptions": set.ActionOptions, - "actionName": firewallconfigs.FindActionName(set.Action), - "actionLinks": actionLinks, - "connector": strings.ToUpper(set.Connector), + "isOn": set.IsOn, + "actions": actionMaps, + "connector": strings.ToUpper(set.Connector), } }) diff --git a/internal/web/actions/default/servers/components/waf/updateSetPopup.go b/internal/web/actions/default/servers/components/waf/updateSetPopup.go index 34d2f80d..4029ccfa 100644 --- a/internal/web/actions/default/servers/components/waf/updateSetPopup.go +++ b/internal/web/actions/default/servers/components/waf/updateSetPopup.go @@ -9,7 +9,6 @@ import ( "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/firewallconfigs" "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/maps" - "strings" ) type UpdateSetPopupAction struct { @@ -79,6 +78,14 @@ func (this *UpdateSetPopupAction) RunGet(params struct { } this.Data["setConfig"] = setConfig + // action configs + actionConfigs, err := dao.SharedHTTPFirewallPolicyDAO.FindHTTPFirewallActionConfigs(this.AdminContext(), setConfig.Actions) + if err != nil { + this.ErrorPage(err) + return + } + this.Data["actionConfigs"] = actionConfigs + this.Show() } @@ -86,10 +93,10 @@ func (this *UpdateSetPopupAction) RunPost(params struct { GroupId int64 SetId int64 - Name string - RulesJSON []byte - Connector string - Action string + Name string + RulesJSON []byte + Connector string + ActionsJSON []byte Must *actions.Must }) { @@ -115,26 +122,28 @@ func (this *UpdateSetPopupAction) RunPost(params struct { err = json.Unmarshal(params.RulesJSON, &rules) if err != nil { this.ErrorPage(err) + return } if len(rules) == 0 { this.Fail("请添加至少一个规则") } + var actionConfigs = []*firewallconfigs.HTTPFirewallActionConfig{} + if len(params.ActionsJSON) > 0 { + err = json.Unmarshal(params.ActionsJSON, &actionConfigs) + if err != nil { + this.ErrorPage(err) + return + } + } + if len(actionConfigs) == 0 { + this.Fail("请添加至少一个动作") + } + setConfig.Name = params.Name setConfig.Connector = params.Connector setConfig.Rules = rules - setConfig.Action = params.Action - setConfig.ActionOptions = maps.Map{} - - for k, v := range this.ParamsMap { - if len(v) == 0 { - continue - } - index := strings.Index(k, "action_") - if index > -1 { - setConfig.ActionOptions[k[len("action_"):]] = v[0] - } - } + setConfig.Actions = actionConfigs setConfigJSON, err := json.Marshal(setConfig) if err != nil { diff --git a/internal/web/actions/default/servers/iplists/init.go b/internal/web/actions/default/servers/iplists/init.go index 62b1436e..ab71056c 100644 --- a/internal/web/actions/default/servers/iplists/init.go +++ b/internal/web/actions/default/servers/iplists/init.go @@ -23,6 +23,7 @@ func init() { GetPost("/test", new(TestAction)). GetPost("/update", new(UpdateAction)). Get("/items", new(ItemsAction)). + Get("/selectPopup", new(SelectPopupAction)). // IP相关 GetPost("/createIPPopup", new(CreateIPPopupAction)). @@ -34,6 +35,9 @@ func init() { Post("/unbindHTTPFirewall", new(UnbindHTTPFirewallAction)). Post("/httpFirewall", new(HttpFirewallAction)). + // 选项数据 + Post("/levelOptions", new(LevelOptionsAction)). + EndAll() }) } diff --git a/internal/web/actions/default/servers/iplists/levelOptions.go b/internal/web/actions/default/servers/iplists/levelOptions.go new file mode 100644 index 00000000..6d2c2229 --- /dev/null +++ b/internal/web/actions/default/servers/iplists/levelOptions.go @@ -0,0 +1,18 @@ +// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved. + +package iplists + +import ( + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" + "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/firewallconfigs" +) + +type LevelOptionsAction struct { + actionutils.ParentAction +} + +func (this *LevelOptionsAction) RunPost(params struct{}) { + this.Data["levels"] = firewallconfigs.FindAllFirewallEventLevels() + + this.Success() +} diff --git a/internal/web/actions/default/servers/iplists/selectPopup.go b/internal/web/actions/default/servers/iplists/selectPopup.go new file mode 100644 index 00000000..5aed4f1b --- /dev/null +++ b/internal/web/actions/default/servers/iplists/selectPopup.go @@ -0,0 +1,70 @@ +// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved. + +package iplists + +import ( + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" + "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" + "github.com/iwind/TeaGo/maps" +) + +type SelectPopupAction struct { + actionutils.ParentAction +} + +func (this *SelectPopupAction) Init() { + this.Nav("", "", "") +} + +func (this *SelectPopupAction) RunGet(params struct { + Type string +}) { + // 公共的名单 + countResp, err := this.RPC().IPListRPC().CountAllEnabledIPLists(this.AdminContext(), &pb.CountAllEnabledIPListsRequest{ + Type: params.Type, + IsPublic: true, + Keyword: "", + }) + if err != nil { + this.ErrorPage(err) + return + } + count := countResp.Count + page := this.NewPage(count) + this.Data["page"] = page.AsHTML() + + listsResp, err := this.RPC().IPListRPC().ListEnabledIPLists(this.AdminContext(), &pb.ListEnabledIPListsRequest{ + Type: params.Type, + IsPublic: true, + Keyword: "", + Offset: page.Offset, + Size: page.Size, + }) + if err != nil { + this.ErrorPage(err) + return + } + + var listMaps = []maps.Map{} + for _, list := range listsResp.IpLists { + // 包含的IP数量 + countItemsResp, err := this.RPC().IPItemRPC().CountIPItemsWithListId(this.AdminContext(), &pb.CountIPItemsWithListIdRequest{IpListId: list.Id}) + if err != nil { + this.ErrorPage(err) + return + } + var countItems = countItemsResp.Count + + listMaps = append(listMaps, maps.Map{ + "id": list.Id, + "isOn": list.IsOn, + "name": list.Name, + "description": list.Description, + "countItems": countItems, + "type": list.Type, + }) + } + this.Data["lists"] = listMaps + + this.Show() +} diff --git a/internal/web/actions/default/servers/server/settings/waf/group.go b/internal/web/actions/default/servers/server/settings/waf/group.go index e0b322be..97ce1299 100644 --- a/internal/web/actions/default/servers/server/settings/waf/group.go +++ b/internal/web/actions/default/servers/server/settings/waf/group.go @@ -6,7 +6,6 @@ import ( "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/firewallconfigs" "github.com/iwind/TeaGo/lists" "github.com/iwind/TeaGo/maps" - "strconv" "strings" ) @@ -55,32 +54,19 @@ func (this *GroupAction) RunGet(params struct { this.Data["sets"] = lists.Map(groupConfig.Sets, func(k int, v interface{}) interface{} { set := v.(*firewallconfigs.HTTPFirewallRuleSet) - // 动作说明 - actionLinks := []maps.Map{} - if set.Action == firewallconfigs.HTTPFirewallActionGoGroup { - nextGroup := firewallPolicy.FindRuleGroup(set.ActionOptions.GetInt64("groupId")) - if nextGroup != nil { - actionLinks = append(actionLinks, maps.Map{ - "name": nextGroup.Name, - "url": "/servers/components/waf/group?firewallPolicyId=" + strconv.FormatInt(params.FirewallPolicyId, 10) + "&type=" + params.Type + "&groupId=" + strconv.FormatInt(nextGroup.Id, 10), - }) + var actionMaps = []maps.Map{} + for _, action := range set.Actions { + def := firewallconfigs.FindActionDefinition(action.Code) + if def == nil { + continue } - } else if set.Action == firewallconfigs.HTTPFirewallActionGoSet { - nextGroup := firewallPolicy.FindRuleGroup(set.ActionOptions.GetInt64("groupId")) - if nextGroup != nil { - actionLinks = append(actionLinks, maps.Map{ - "name": nextGroup.Name, - "url": "/servers/components/waf/group?firewallPolicyId=" + strconv.FormatInt(params.FirewallPolicyId, 10) + "&type=" + params.Type + "&groupId=" + strconv.FormatInt(nextGroup.Id, 10), - }) - nextSet := nextGroup.FindRuleSet(set.ActionOptions.GetInt64("setId")) - if nextSet != nil { - actionLinks = append(actionLinks, maps.Map{ - "name": nextSet.Name, - "url": "/servers/components/waf/group?firewallPolicyId=" + strconv.FormatInt(params.FirewallPolicyId, 10) + "&type=" + params.Type + "&groupId=" + strconv.FormatInt(nextGroup.Id, 10), - }) - } - } + actionMaps = append(actionMaps, maps.Map{ + "code": strings.ToUpper(action.Code), + "name": def.Name, + "category": def.Category, + "options": action.Options, + }) } return maps.Map{ @@ -97,12 +83,9 @@ func (this *GroupAction) RunGet(params struct { "isComposed": firewallconfigs.CheckCheckpointIsComposed(rule.Prefix()), } }), - "isOn": set.IsOn, - "action": strings.ToUpper(set.Action), - "actionOptions": set.ActionOptions, - "actionName": firewallconfigs.FindActionName(set.Action), - "actionLinks": actionLinks, - "connector": strings.ToUpper(set.Connector), + "isOn": set.IsOn, + "actions": actionMaps, + "connector": strings.ToUpper(set.Connector), } }) diff --git a/web/public/js/components/common/values-box.js b/web/public/js/components/common/values-box.js index d5956bc2..435119df 100644 --- a/web/public/js/components/common/values-box.js +++ b/web/public/js/components/common/values-box.js @@ -52,6 +52,9 @@ Vue.component("values-box", { this.isUpdating = false; this.isAdding = false; this.value = ""; + }, + updateAll: function (values) { + this.vValeus = values } }, template: `
@@ -78,7 +81,7 @@ Vue.component("values-box", {
- +
` }); \ No newline at end of file diff --git a/web/public/js/components/server/http-firewall-actions-box.js b/web/public/js/components/server/http-firewall-actions-box.js new file mode 100644 index 00000000..db1678be --- /dev/null +++ b/web/public/js/components/server/http-firewall-actions-box.js @@ -0,0 +1,589 @@ +// 动作选择 +Vue.component("http-firewall-actions-box", { + props: ["v-actions", "v-firewall-policy", "v-action-configs"], + mounted: function () { + let that = this + Tea.action("/servers/iplists/levelOptions") + .success(function (resp) { + that.ipListLevels = resp.data.levels + }) + .post() + + this.loadJS(function () { + let box = document.getElementById("actions-box") + Sortable.create(box, { + draggable: ".label", + handle: ".icon.handle", + onStart: function () { + that.cancel() + }, + onUpdate: function (event) { + let labels = box.getElementsByClassName("label") + let newConfigs = [] + for (let i = 0; i < labels.length; i++) { + let index = parseInt(labels[i].getAttribute("data-index")) + newConfigs.push(that.configs[index]) + } + that.configs = newConfigs + } + }) + }) + }, + data: function () { + if (this.vFirewallPolicy.inbound == null) { + this.vFirewallPolicy.inbound = {} + } + if (this.vFirewallPolicy.inbound.groups == null) { + this.vFirewallPolicy.inbound.groups = [] + } + + let id = 0 + let configs = [] + if (this.vActionConfigs != null) { + configs = this.vActionConfigs + configs.forEach(function (v) { + v.id = (id++) + }) + } + + return { + id: id, + + actions: this.vActions, + configs: configs, + isAdding: false, + editingIndex: -1, + + action: null, + actionCode: "", + actionOptions: {}, + + // IPList相关 + ipListLevels: [], + + // 动作参数 + blockLife: "", + captchaLife: "", + get302Life: "", + post307Life: "", + recordIPType: "black", + recordIPLevel: "critical", + recordIPTimeout: "", + recordIPListId: 0, + recordIPListName: "", + + tagTags: [], + + goGroupName: "", + goGroupId: 0, + goGroup: null, + + goSetId: 0, + goSetName: "" + } + }, + watch: { + actionCode: function (code) { + this.action = this.actions.$find(function (k, v) { + return v.code == code + }) + this.actionOptions = {} + }, + blockLife: function (v) { + v = parseInt(v) + if (isNaN(v)) { + this.actionOptions["life"] = 0 + } else { + this.actionOptions["life"] = v + } + }, + captchaLife: function (v) { + v = parseInt(v) + if (isNaN(v)) { + this.actionOptions["life"] = 0 + } else { + this.actionOptions["life"] = v + } + }, + get302Life: function (v) { + v = parseInt(v) + if (isNaN(v)) { + this.actionOptions["life"] = 0 + } else { + this.actionOptions["life"] = v + } + }, + post307Life: function (v) { + v = parseInt(v) + if (isNaN(v)) { + this.actionOptions["life"] = 0 + } else { + this.actionOptions["life"] = v + } + }, + recordIPType: function () { + this.recordIPListId = 0 + }, + recordIPTimeout: function (v) { + v = parseInt(v) + if (isNaN(v)) { + this.actionOptions["timeout"] = 0 + } else { + this.actionOptions["timeout"] = v + } + }, + goGroupId: function (groupId) { + let group = this.vFirewallPolicy.inbound.groups.$find(function (k, v) { + return v.id == groupId + }) + this.goGroup = group + if (group == null) { + this.goGroupName = "" + } else { + this.goGroupName = group.name + } + this.goSetId = 0 + this.goSetName = "" + }, + goSetId: function (setId) { + if (this.goGroup == null) { + return + } + let set = this.goGroup.sets.$find(function (k, v) { + return v.id == setId + }) + if (set == null) { + this.goSetId = 0 + this.goSetName = "" + } else { + this.goSetName = set.name + } + } + }, + methods: { + add: function () { + this.action = null + this.actionCode = "block" + this.isAdding = true + this.actionOptions = {} + + // 动作参数 + this.blockLife = "" + this.captchaLife = "" + this.get302Life = "" + this.post307Life = "" + + this.recordIPLevel = "critical" + this.recordIPType = "black" + this.recordIPTimeout = "" + this.recordIPListId = 0 + this.recordIPListName = "" + + this.tagTags = [] + + this.goGroupName = "" + this.goGroupId = 0 + this.goGroup = null + + this.goSetId = 0 + this.goSetName = "" + + let that = this + this.action = this.vActions.$find(function (k, v) { + return v.code == that.actionCode + }) + }, + remove: function (index) { + this.configs.$remove(index) + }, + update: function (index, config) { + if (this.isAdding && this.editingIndex == index) { + this.cancel() + return + } + + this.add() + + this.isAdding = true + this.editingIndex = index + + this.actionCode = config.code + + switch (config.code) { + case "block": + this.blockLife = "" + if (config.options.life != null || config.options.life > 0) { + this.blockLife = config.options.life.toString() + } + break + case "allow": + break + case "log": + break + case "captcha": + this.captchaLife = "" + if (config.options.life != null || config.options.life > 0) { + this.captchaLife = config.options.life.toString() + } + break + case "notify": + break + case "get_302": + this.get302Life = "" + if (config.options.life != null || config.options.life > 0) { + this.get302Life = config.options.life.toString() + } + break + case "post_307": + this.post307Life = "" + if (config.options.life != null || config.options.life > 0) { + this.post307Life = config.options.life.toString() + } + break; + case "record_ip": + if (config.options != null) { + this.recordIPLevel = config.options.level + this.recordIPType = config.options.type + if (config.options.timeout > 0) { + this.recordIPTimeout = config.options.timeout.toString() + } + this.recordIPListId = config.options.ipListId + this.recordIPListName = config.options.ipListName + } + break + case "tag": + this.tagTags = [] + if (config.options.tags != null) { + this.tagTags = config.options.tags + } + break + case "go_group": + if (config.options != null) { + this.goGroupName = config.options.groupName + this.goGroupId = config.options.groupId + this.goGroup = this.vFirewallPolicy.inbound.groups.$find(function (k, v) { + return v.id == config.options.groupId + }) + } + break + case "go_set": + if (config.options != null) { + this.goGroupName = config.options.groupName + this.goGroupId = config.options.groupId + this.goGroup = this.vFirewallPolicy.inbound.groups.$find(function (k, v) { + return v.id == config.options.groupId + }) + + this.goSetId = config.options.setId + if (this.goGroup != null) { + let set = this.goGroup.sets.$find(function (k, v) { + return v.id == config.options.setId + }) + if (set != null) { + this.goSetName = set.name + } + } + } + break + } + }, + cancel: function () { + this.isAdding = false + this.editingIndex = -1 + }, + confirm: function () { + if (this.action == null) { + return + } + + if (this.actionOptions == null) { + this.actionOptions = {} + } + + // record_ip + if (this.actionCode == "record_ip") { + let timeout = parseInt(this.recordIPTimeout) + if (isNaN(timeout)) { + timeout = 0 + } + if (this.recordIPListId <= 0) { + return + } + this.actionOptions = { + type: this.recordIPType, + level: this.recordIPLevel, + timeout: timeout, + ipListId: this.recordIPListId, + ipListName: this.recordIPListName + } + } else if (this.actionCode == "tag") { // tag + if (this.tagTags == null || this.tagTags.length == 0) { + return + } + this.actionOptions = { + tags: this.tagTags + } + } else if (this.actionCode == "go_group") { // go_group + let groupId = this.goGroupId + if (typeof (groupId) == "string") { + groupId = parseInt(groupId) + if (isNaN(groupId)) { + groupId = 0 + } + } + if (groupId <= 0) { + return + } + this.actionOptions = { + groupId: groupId, + groupName: this.goGroupName + } + } else if (this.actionCode == "go_set") { // go_set + let groupId = this.goGroupId + if (typeof (groupId) == "string") { + groupId = parseInt(groupId) + if (isNaN(groupId)) { + groupId = 0 + } + } + + let setId = this.goSetId + if (typeof (setId) == "string") { + setId = parseInt(setId) + if (isNaN(setId)) { + setId = 0 + } + } + if (setId <= 0) { + return + } + this.actionOptions = { + groupId: groupId, + groupName: this.goGroupName, + setId: setId, + setName: this.goSetName + } + } + + let options = {} + for (let k in this.actionOptions) { + if (this.actionOptions.hasOwnProperty(k)) { + options[k] = this.actionOptions[k] + } + } + if (this.editingIndex > -1) { + this.configs[this.editingIndex] = { + id: this.configs[this.editingIndex].id, + code: this.actionCode, + name: this.action.name, + options: options + } + } else { + this.configs.push({ + id: (this.id++), + code: this.actionCode, + name: this.action.name, + options: options + }) + } + + this.cancel() + }, + removeRecordIPList: function () { + this.recordIPListId = 0 + }, + selectRecordIPList: function () { + let that = this + teaweb.popup("/servers/iplists/selectPopup?type=" + this.recordIPType, { + width: "50em", + height: "30em", + callback: function (resp) { + that.recordIPListId = resp.data.list.id + that.recordIPListName = resp.data.list.name + } + }) + }, + changeTags: function (tags) { + this.tagTags = tags + }, + loadJS: function (callback) { + if (typeof Sortable != "undefined") { + callback() + return + } + + // 引入js + let jsFile = document.createElement("script") + jsFile.setAttribute("src", "/js/sortable.min.js") + jsFile.addEventListener("load", function () { + callback() + }) + document.head.appendChild(jsFile) + } + }, + template: `
+ +
+
+ {{config.name}} ({{config.code.toUpperCase()}}) + + + :{{config.options.ipListName}} + + + :{{config.options.tags.join(", ")}} + + + :{{config.options.groupName}} + + + :{{config.options.groupName}} / {{config.options.setName}} + + +       +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
动作类型 * + +

{{action.description}}

+
封锁时间 +
+ + +
+
有效时间 +
+ + +
+

验证通过后在这个时间内不再验证。

+
有效时间 +
+ + +
+

验证通过后在这个时间内不再验证。

+
有效时间 +
+ + +
+

验证通过后在这个时间内不再验证。

+
IP名单类型 * + +
选择IP名单 +
{{recordIPListName}}
+ +

如不选择,则自动添加到当前策略的IP名单中。

+
级别 + +
超时时间 +
+ + +
+

0表示不超时。

+
标签 * + +
下一个分组 * + +
下一个分组 * + +
下一个规则集 * + +
+   + +
+
+ +
+
` +}) \ No newline at end of file diff --git a/web/public/js/components/server/http-firewall-actions-view.js b/web/public/js/components/server/http-firewall-actions-view.js new file mode 100644 index 00000000..fdb79f8c --- /dev/null +++ b/web/public/js/components/server/http-firewall-actions-view.js @@ -0,0 +1,9 @@ +// Action列表 +Vue.component("http-firewall-actions-view", { + props: ["v-actions"], + template: `
+
+ {{action.name}} ({{action.code.toUpperCase()}}) +
+
` +}) \ No newline at end of file diff --git a/web/views/@default/servers/components/waf/createSetPopup.html b/web/views/@default/servers/components/waf/createSetPopup.html index dbf418ed..92ac5bea 100644 --- a/web/views/@default/servers/components/waf/createSetPopup.html +++ b/web/views/@default/servers/components/waf/createSetPopup.html @@ -26,42 +26,12 @@

{{selectedConnectorDescription}}

- - 动作 - - -

匹配当前规则集后要执行的动作。

- - - - 下一个规则分组 - - -

当动作为"跳到下一个规则分组"时出现此选择。

- - - - 下一个规则分组 - - -

当动作为"跳到下一个规则集"时出现此选择。

- - - - 下一个规则集 - - -

当动作为"跳到下一个规则集"时出现此选择。

- - + + 执行动作 * + + + + \ No newline at end of file diff --git a/web/views/@default/servers/components/waf/group.html b/web/views/@default/servers/components/waf/group.html index 4c5411b2..f43e8fbb 100644 --- a/web/views/@default/servers/components/waf/group.html +++ b/web/views/@default/servers/components/waf/group.html @@ -31,7 +31,7 @@ 规则集名称 规则 - 关系 + 关系 动作 操作 @@ -50,11 +50,12 @@ 暂时还没有规则 - {{set.connector.toUpperCase()}} - {{set.actionName}}[{{set.action.toUpperCase()}}] -
- -> [{{link.name}}]   -
+ + + ({{set.connector.toUpperCase()}}) + + + 修改   停用启用   删除 diff --git a/web/views/@default/servers/iplists/selectPopup.html b/web/views/@default/servers/iplists/selectPopup.html new file mode 100644 index 00000000..8e41da99 --- /dev/null +++ b/web/views/@default/servers/iplists/selectPopup.html @@ -0,0 +1,36 @@ +{$layout "layout_popup"} + +

选择公用IP名单

+ +

暂时还没有可用的公用IP名单。

+ + + + + + + + + + + + + + + + + + + + +
ID名称类型备注IP数量操作
{{list.id}}{{list.name}} + 黑名单 + 白名单 + {{list.description}} + {{list.countItems}} + 0 + + 选择 +
+ +
\ No newline at end of file diff --git a/web/views/@default/servers/iplists/selectPopup.js b/web/views/@default/servers/iplists/selectPopup.js new file mode 100644 index 00000000..5894fb25 --- /dev/null +++ b/web/views/@default/servers/iplists/selectPopup.js @@ -0,0 +1,13 @@ +Tea.context(function () { + this.selectList = function (list) { + NotifyPopup({ + code: 200, + data: { + list: { + id: list.id, + name: list.name + } + } + }) + } +}) \ No newline at end of file