可以在IP名单中搜索IP

This commit is contained in:
GoEdgeLab
2021-10-22 12:19:02 +08:00
parent 167fac42e3
commit 8e48852704
3 changed files with 29 additions and 6 deletions

View File

@@ -19,8 +19,11 @@ func (this *ItemsAction) Init() {
}
func (this *ItemsAction) RunGet(params struct {
ListId int64
ListId int64
Keyword string
}) {
this.Data["keyword"] = params.Keyword
err := InitIPList(this.Parent(), params.ListId)
if err != nil {
this.ErrorPage(err)
@@ -29,7 +32,10 @@ func (this *ItemsAction) RunGet(params struct {
// 数量
var listId = params.ListId
countResp, err := this.RPC().IPItemRPC().CountIPItemsWithListId(this.AdminContext(), &pb.CountIPItemsWithListIdRequest{IpListId: listId})
countResp, err := this.RPC().IPItemRPC().CountIPItemsWithListId(this.AdminContext(), &pb.CountIPItemsWithListIdRequest{
IpListId: listId,
Keyword: params.Keyword,
})
if err != nil {
this.ErrorPage(err)
return
@@ -41,6 +47,7 @@ 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,
})

View File

@@ -1,8 +1,9 @@
Vue.component("ip-list-table", {
props: ["v-items"],
props: ["v-items", "v-keyword"],
data: function () {
return {
items: this.vItems
items: this.vItems,
keyword: (this.vKeyword != null) ? this.vKeyword : ""
}
},
methods: {
@@ -33,7 +34,7 @@ Vue.component("ip-list-table", {
</thead>
<tr v-for="item in items">
<td>
<span v-if="item.type != 'all'">{{item.ipFrom}}<span v-if="item.ipTo.length > 0"> - {{item.ipTo}}</span></span>
<span v-if="item.type != 'all'"><keyword :v-word="keyword">{{item.ipFrom}}</keyword><span v-if="item.ipTo.length > 0"> - <keyword :v-word="keyword">{{item.ipTo}}</keyword></span></span>
<span v-else class="disabled">*</span>
</td>
<td>

View File

@@ -5,8 +5,23 @@
<menu-item @click.prevent="createIP">[创建IP]</menu-item>
</second-menu>
<form class="ui form" action="/servers/iplists/items">
<input type="hidden" name="listId" :value="list.id"/>
<div class="ui fields inline">
<div class="ui field">
<input type="text" size="20" placeholder="x.x.x.x" name="keyword" v-model="keyword"/>
</div>
<div class="ui field">
<button class="ui button" type="submit">搜索</button>
&nbsp;
<a :href="'/servers/iplists/items?listId=' + list.id" v-if="keyword.length > 0">[清除条件]</a>
</div>
</div>
<div class="margin"></div>
</form>
<p class="comment" v-if="items.length == 0">暂时还没有IP。</p>
<ip-list-table v-if="items.length > 0" :v-items="items" @update-item="updateItem" @delete-item="deleteItem"></ip-list-table>
<ip-list-table v-if="items.length > 0" :v-items="items" @update-item="updateItem" @delete-item="deleteItem" :v-keyword="keyword"></ip-list-table>
<div class="page" v-html="page"></div>