mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-14 20:30:25 +08:00
IP列表可以使用级别筛选
This commit is contained in:
@@ -23,16 +23,19 @@ func (this *IndexAction) RunGet(params struct {
|
|||||||
Ip string
|
Ip string
|
||||||
GlobalOnly bool
|
GlobalOnly bool
|
||||||
Unread bool
|
Unread bool
|
||||||
|
EventLevel string
|
||||||
}) {
|
}) {
|
||||||
this.Data["type"] = ""
|
this.Data["type"] = ""
|
||||||
this.Data["ip"] = params.Ip
|
this.Data["ip"] = params.Ip
|
||||||
this.Data["globalOnly"] = params.GlobalOnly
|
this.Data["globalOnly"] = params.GlobalOnly
|
||||||
this.Data["unread"] = params.Unread
|
this.Data["unread"] = params.Unread
|
||||||
|
this.Data["eventLevel"] = params.EventLevel
|
||||||
|
|
||||||
countUnreadResp, err := this.RPC().IPItemRPC().CountAllEnabledIPItems(this.AdminContext(), &pb.CountAllEnabledIPItemsRequest{
|
countUnreadResp, err := this.RPC().IPItemRPC().CountAllEnabledIPItems(this.AdminContext(), &pb.CountAllEnabledIPItemsRequest{
|
||||||
Ip: params.Ip,
|
Ip: params.Ip,
|
||||||
GlobalOnly: params.GlobalOnly,
|
GlobalOnly: params.GlobalOnly,
|
||||||
Unread: true,
|
Unread: true,
|
||||||
|
EventLevel: params.EventLevel,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
this.ErrorPage(err)
|
this.ErrorPage(err)
|
||||||
@@ -44,6 +47,7 @@ func (this *IndexAction) RunGet(params struct {
|
|||||||
Ip: params.Ip,
|
Ip: params.Ip,
|
||||||
GlobalOnly: params.GlobalOnly,
|
GlobalOnly: params.GlobalOnly,
|
||||||
Unread: params.Unread,
|
Unread: params.Unread,
|
||||||
|
EventLevel: params.EventLevel,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
this.ErrorPage(err)
|
this.ErrorPage(err)
|
||||||
@@ -57,6 +61,7 @@ func (this *IndexAction) RunGet(params struct {
|
|||||||
Ip: params.Ip,
|
Ip: params.Ip,
|
||||||
GlobalOnly: params.GlobalOnly,
|
GlobalOnly: params.GlobalOnly,
|
||||||
Unread: params.Unread,
|
Unread: params.Unread,
|
||||||
|
EventLevel: params.EventLevel,
|
||||||
Offset: page.Offset,
|
Offset: page.Offset,
|
||||||
Size: page.Size,
|
Size: page.Size,
|
||||||
})
|
})
|
||||||
@@ -166,5 +171,8 @@ func (this *IndexAction) RunGet(params struct {
|
|||||||
}
|
}
|
||||||
this.Data["items"] = itemMaps
|
this.Data["items"] = itemMaps
|
||||||
|
|
||||||
|
// 所有级别
|
||||||
|
this.Data["eventLevels"] = firewallconfigs.FindAllFirewallEventLevels()
|
||||||
|
|
||||||
this.Show()
|
this.Show()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,10 +20,12 @@ func (this *ItemsAction) Init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *ItemsAction) RunGet(params struct {
|
func (this *ItemsAction) RunGet(params struct {
|
||||||
ListId int64
|
ListId int64
|
||||||
Keyword string
|
Keyword string
|
||||||
|
EventLevel string
|
||||||
}) {
|
}) {
|
||||||
this.Data["keyword"] = params.Keyword
|
this.Data["keyword"] = params.Keyword
|
||||||
|
this.Data["eventLevel"] = params.EventLevel
|
||||||
|
|
||||||
err := InitIPList(this.Parent(), params.ListId)
|
err := InitIPList(this.Parent(), params.ListId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -34,8 +36,9 @@ func (this *ItemsAction) RunGet(params struct {
|
|||||||
// 数量
|
// 数量
|
||||||
var listId = params.ListId
|
var listId = params.ListId
|
||||||
countResp, err := this.RPC().IPItemRPC().CountIPItemsWithListId(this.AdminContext(), &pb.CountIPItemsWithListIdRequest{
|
countResp, err := this.RPC().IPItemRPC().CountIPItemsWithListId(this.AdminContext(), &pb.CountIPItemsWithListIdRequest{
|
||||||
IpListId: listId,
|
IpListId: listId,
|
||||||
Keyword: params.Keyword,
|
Keyword: params.Keyword,
|
||||||
|
EventLevel: params.EventLevel,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
this.ErrorPage(err)
|
this.ErrorPage(err)
|
||||||
@@ -47,10 +50,11 @@ func (this *ItemsAction) RunGet(params struct {
|
|||||||
|
|
||||||
// 列表
|
// 列表
|
||||||
itemsResp, err := this.RPC().IPItemRPC().ListIPItemsWithListId(this.AdminContext(), &pb.ListIPItemsWithListIdRequest{
|
itemsResp, err := this.RPC().IPItemRPC().ListIPItemsWithListId(this.AdminContext(), &pb.ListIPItemsWithListIdRequest{
|
||||||
IpListId: listId,
|
IpListId: listId,
|
||||||
Keyword: params.Keyword,
|
Keyword: params.Keyword,
|
||||||
Offset: page.Offset,
|
EventLevel: params.EventLevel,
|
||||||
Size: page.Size,
|
Offset: page.Offset,
|
||||||
|
Size: page.Size,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
this.ErrorPage(err)
|
this.ErrorPage(err)
|
||||||
@@ -118,5 +122,8 @@ func (this *ItemsAction) RunGet(params struct {
|
|||||||
}
|
}
|
||||||
this.Data["items"] = itemMaps
|
this.Data["items"] = itemMaps
|
||||||
|
|
||||||
|
// 所有级别
|
||||||
|
this.Data["eventLevels"] = firewallconfigs.FindAllFirewallEventLevels()
|
||||||
|
|
||||||
this.Show()
|
this.Show()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,12 @@
|
|||||||
<div class="ui field">
|
<div class="ui field">
|
||||||
<input type="text" name="ip" placeholder="x.x.x.x" v-model="ip"/>
|
<input type="text" name="ip" placeholder="x.x.x.x" v-model="ip"/>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="ui field">
|
||||||
|
<select class="ui dropdown" name="eventLevel" v-model="eventLevel">
|
||||||
|
<option value="">[级别]</option>
|
||||||
|
<option v-for="level in eventLevels" :value="level.code">{{level.name}}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
<div class="ui field">
|
<div class="ui field">
|
||||||
<div class="ui checkbox">
|
<div class="ui checkbox">
|
||||||
<input type="checkbox" name="globalOnly" value="1" v-model="globalOnly"/>
|
<input type="checkbox" name="globalOnly" value="1" v-model="globalOnly"/>
|
||||||
@@ -22,7 +28,7 @@
|
|||||||
<div class="ui field">
|
<div class="ui field">
|
||||||
<button class="ui button" type="submit">搜索</button>
|
<button class="ui button" type="submit">搜索</button>
|
||||||
|
|
||||||
<a href="/servers/iplists" v-if="ip.length > 0 || globalOnly || unread">[清除条件]</a>
|
<a href="/servers/iplists" v-if="ip.length > 0 || globalOnly || unread || eventLevel.length > 0">[清除条件]</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="ui field" v-if="countUnread > 0">
|
<div class="ui field" v-if="countUnread > 0">
|
||||||
<span class="disabled">|</span>
|
<span class="disabled">|</span>
|
||||||
|
|||||||
@@ -11,10 +11,16 @@
|
|||||||
<div class="ui field">
|
<div class="ui field">
|
||||||
<input type="text" size="20" placeholder="x.x.x.x" name="keyword" v-model="keyword"/>
|
<input type="text" size="20" placeholder="x.x.x.x" name="keyword" v-model="keyword"/>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="ui field">
|
||||||
|
<select class="ui dropdown" name="eventLevel" v-model="eventLevel">
|
||||||
|
<option value="">[级别]</option>
|
||||||
|
<option v-for="level in eventLevels" :value="level.code">{{level.name}}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
<div class="ui field">
|
<div class="ui field">
|
||||||
<button class="ui button" type="submit">搜索</button>
|
<button class="ui button" type="submit">搜索</button>
|
||||||
|
|
||||||
<a :href="'/servers/iplists/items?listId=' + list.id" v-if="keyword.length > 0">[清除条件]</a>
|
<a :href="'/servers/iplists/items?listId=' + list.id" v-if="keyword.length > 0 || eventLevel.length > 0">[清除条件]</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="margin"></div>
|
<div class="margin"></div>
|
||||||
|
|||||||
Reference in New Issue
Block a user