WAF策略列表支持搜索

This commit is contained in:
GoEdgeLab
2021-06-07 08:58:54 +08:00
parent aafd17ea05
commit c58e338c13
3 changed files with 57 additions and 35 deletions

View File

@@ -16,8 +16,14 @@ func (this *IndexAction) Init() {
this.FirstMenu("index") this.FirstMenu("index")
} }
func (this *IndexAction) RunGet(params struct{}) { func (this *IndexAction) RunGet(params struct {
countResp, err := this.RPC().HTTPFirewallPolicyRPC().CountAllEnabledHTTPFirewallPolicies(this.AdminContext(), &pb.CountAllEnabledHTTPFirewallPoliciesRequest{}) Keyword string
}) {
this.Data["keyword"] = params.Keyword
countResp, err := this.RPC().HTTPFirewallPolicyRPC().CountAllEnabledHTTPFirewallPolicies(this.AdminContext(), &pb.CountAllEnabledHTTPFirewallPoliciesRequest{
Keyword: params.Keyword,
})
if err != nil { if err != nil {
this.ErrorPage(err) this.ErrorPage(err)
return return
@@ -26,6 +32,7 @@ func (this *IndexAction) RunGet(params struct{}) {
page := this.NewPage(count) page := this.NewPage(count)
listResp, err := this.RPC().HTTPFirewallPolicyRPC().ListEnabledHTTPFirewallPolicies(this.AdminContext(), &pb.ListEnabledHTTPFirewallPoliciesRequest{ listResp, err := this.RPC().HTTPFirewallPolicyRPC().ListEnabledHTTPFirewallPolicies(this.AdminContext(), &pb.ListEnabledHTTPFirewallPoliciesRequest{
Keyword: params.Keyword,
Offset: page.Offset, Offset: page.Offset,
Size: page.Size, Size: page.Size,
}) })

View File

@@ -6,6 +6,7 @@
<a href="" class="item" @click.prevent="createPolicy()">[创建]</a> <a href="" class="item" @click.prevent="createPolicy()">[创建]</a>
</first-menu> </first-menu>
<!-- 搜索 -->
<div class="margin"></div> <div class="margin"></div>
<form class="ui form" method="get" action="/servers/components/cache"> <form class="ui form" method="get" action="/servers/components/cache">
<div class="ui fields inline"> <div class="ui fields inline">
@@ -18,7 +19,7 @@
</div> </div>
</form> </form>
<!-- 列表 -->
<p class="comment" v-if="cachePolicies == null || cachePolicies.length == 0">暂时还没有缓存策略。</p> <p class="comment" v-if="cachePolicies == null || cachePolicies.length == 0">暂时还没有缓存策略。</p>
<table class="ui table selectable celled" v-if="cachePolicies != null && cachePolicies.length > 0"> <table class="ui table selectable celled" v-if="cachePolicies != null && cachePolicies.length > 0">
<thead> <thead>

View File

@@ -1,11 +1,25 @@
{$layout} {$layout}
<second-menu> <first-menu>
<menu-item href="/servers/components/waf" code="index">列表</menu-item> <menu-item href="/servers/components/waf" code="index">列表</menu-item>
<span class="item">|</span> <span class="item">|</span>
<a href="" class="item" @click.prevent="createPolicy()">[创建]</a> <a href="" class="item" @click.prevent="createPolicy()">[创建]</a>
</second-menu> </first-menu>
<!-- 搜索 -->
<div class="margin"></div>
<form class="ui form" method="get" action="/servers/components/waf">
<div class="ui fields inline">
<div class="ui field">
<input type="text" name="keyword" v-model="keyword" placeholder="策略名称..."/>
</div>
<div class="ui field">
<button type="submit" class="ui button">搜索</button>
</div>
</div>
</form>
<!-- 列表 -->
<p class="comment" v-if="policies.length == 0">暂时还没有WAF策略。</p> <p class="comment" v-if="policies.length == 0">暂时还没有WAF策略。</p>
<table class="ui table selectable celled" v-if="policies.length > 0"> <table class="ui table selectable celled" v-if="policies.length > 0">
@@ -20,7 +34,7 @@
</tr> </tr>
</thead> </thead>
<tr v-for="policy in policies"> <tr v-for="policy in policies">
<td>{{policy.name}}</td> <td><keyword :v-word="keyword">{{policy.name}}</keyword></td>
<td class="center">{{policy.countInbound}}</td> <td class="center">{{policy.countInbound}}</td>
<td class="center">{{policy.countOutbound}}</td> <td class="center">{{policy.countOutbound}}</td>
<td class="center">{{policy.countClusters}}</td> <td class="center">{{policy.countClusters}}</td>