IP列表可以使用级别筛选

This commit is contained in:
GoEdgeLab
2022-03-30 09:41:14 +08:00
parent c415c36e86
commit 19dbc31162
4 changed files with 37 additions and 10 deletions

View File

@@ -23,16 +23,19 @@ func (this *IndexAction) RunGet(params struct {
Ip string
GlobalOnly bool
Unread bool
EventLevel string
}) {
this.Data["type"] = ""
this.Data["ip"] = params.Ip
this.Data["globalOnly"] = params.GlobalOnly
this.Data["unread"] = params.Unread
this.Data["eventLevel"] = params.EventLevel
countUnreadResp, err := this.RPC().IPItemRPC().CountAllEnabledIPItems(this.AdminContext(), &pb.CountAllEnabledIPItemsRequest{
Ip: params.Ip,
GlobalOnly: params.GlobalOnly,
Unread: true,
EventLevel: params.EventLevel,
})
if err != nil {
this.ErrorPage(err)
@@ -44,6 +47,7 @@ func (this *IndexAction) RunGet(params struct {
Ip: params.Ip,
GlobalOnly: params.GlobalOnly,
Unread: params.Unread,
EventLevel: params.EventLevel,
})
if err != nil {
this.ErrorPage(err)
@@ -57,6 +61,7 @@ func (this *IndexAction) RunGet(params struct {
Ip: params.Ip,
GlobalOnly: params.GlobalOnly,
Unread: params.Unread,
EventLevel: params.EventLevel,
Offset: page.Offset,
Size: page.Size,
})
@@ -166,5 +171,8 @@ func (this *IndexAction) RunGet(params struct {
}
this.Data["items"] = itemMaps
// 所有级别
this.Data["eventLevels"] = firewallconfigs.FindAllFirewallEventLevels()
this.Show()
}

View File

@@ -20,10 +20,12 @@ func (this *ItemsAction) Init() {
}
func (this *ItemsAction) RunGet(params struct {
ListId int64
Keyword string
ListId int64
Keyword string
EventLevel string
}) {
this.Data["keyword"] = params.Keyword
this.Data["eventLevel"] = params.EventLevel
err := InitIPList(this.Parent(), params.ListId)
if err != nil {
@@ -34,8 +36,9 @@ func (this *ItemsAction) RunGet(params struct {
// 数量
var listId = params.ListId
countResp, err := this.RPC().IPItemRPC().CountIPItemsWithListId(this.AdminContext(), &pb.CountIPItemsWithListIdRequest{
IpListId: listId,
Keyword: params.Keyword,
IpListId: listId,
Keyword: params.Keyword,
EventLevel: params.EventLevel,
})
if err != nil {
this.ErrorPage(err)
@@ -47,10 +50,11 @@ func (this *ItemsAction) RunGet(params struct {
// 列表
itemsResp, err := this.RPC().IPItemRPC().ListIPItemsWithListId(this.AdminContext(), &pb.ListIPItemsWithListIdRequest{
IpListId: listId,
Keyword: params.Keyword,
Offset: page.Offset,
Size: page.Size,
IpListId: listId,
Keyword: params.Keyword,
EventLevel: params.EventLevel,
Offset: page.Offset,
Size: page.Size,
})
if err != nil {
this.ErrorPage(err)
@@ -118,5 +122,8 @@ func (this *ItemsAction) RunGet(params struct {
}
this.Data["items"] = itemMaps
// 所有级别
this.Data["eventLevels"] = firewallconfigs.FindAllFirewallEventLevels()
this.Show()
}