mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-19 23:50:25 +08:00
可以在IP名单中搜索IP
This commit is contained in:
@@ -19,8 +19,11 @@ func (this *ItemsAction) Init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *ItemsAction) RunGet(params struct {
|
func (this *ItemsAction) RunGet(params struct {
|
||||||
ListId int64
|
ListId int64
|
||||||
|
Keyword string
|
||||||
}) {
|
}) {
|
||||||
|
this.Data["keyword"] = params.Keyword
|
||||||
|
|
||||||
err := InitIPList(this.Parent(), params.ListId)
|
err := InitIPList(this.Parent(), params.ListId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
this.ErrorPage(err)
|
this.ErrorPage(err)
|
||||||
@@ -29,7 +32,10 @@ func (this *ItemsAction) RunGet(params struct {
|
|||||||
|
|
||||||
// 数量
|
// 数量
|
||||||
var listId = params.ListId
|
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 {
|
if err != nil {
|
||||||
this.ErrorPage(err)
|
this.ErrorPage(err)
|
||||||
return
|
return
|
||||||
@@ -41,6 +47,7 @@ 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,
|
||||||
Offset: page.Offset,
|
Offset: page.Offset,
|
||||||
Size: page.Size,
|
Size: page.Size,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
Vue.component("ip-list-table", {
|
Vue.component("ip-list-table", {
|
||||||
props: ["v-items"],
|
props: ["v-items", "v-keyword"],
|
||||||
data: function () {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
items: this.vItems
|
items: this.vItems,
|
||||||
|
keyword: (this.vKeyword != null) ? this.vKeyword : ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -33,7 +34,7 @@ Vue.component("ip-list-table", {
|
|||||||
</thead>
|
</thead>
|
||||||
<tr v-for="item in items">
|
<tr v-for="item in items">
|
||||||
<td>
|
<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>
|
<span v-else class="disabled">*</span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|||||||
@@ -5,8 +5,23 @@
|
|||||||
<menu-item @click.prevent="createIP">[创建IP]</menu-item>
|
<menu-item @click.prevent="createIP">[创建IP]</menu-item>
|
||||||
</second-menu>
|
</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>
|
||||||
|
|
||||||
|
<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>
|
<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>
|
<div class="page" v-html="page"></div>
|
||||||
Reference in New Issue
Block a user