mirror of
				https://github.com/TeaOSLab/EdgeAdmin.git
				synced 2025-11-04 13:10:26 +08:00 
			
		
		
		
	WAF策略列表支持搜索
This commit is contained in:
		@@ -16,8 +16,14 @@ func (this *IndexAction) Init() {
 | 
			
		||||
	this.FirstMenu("index")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *IndexAction) RunGet(params struct{}) {
 | 
			
		||||
	countResp, err := this.RPC().HTTPFirewallPolicyRPC().CountAllEnabledHTTPFirewallPolicies(this.AdminContext(), &pb.CountAllEnabledHTTPFirewallPoliciesRequest{})
 | 
			
		||||
func (this *IndexAction) RunGet(params struct {
 | 
			
		||||
	Keyword string
 | 
			
		||||
}) {
 | 
			
		||||
	this.Data["keyword"] = params.Keyword
 | 
			
		||||
 | 
			
		||||
	countResp, err := this.RPC().HTTPFirewallPolicyRPC().CountAllEnabledHTTPFirewallPolicies(this.AdminContext(), &pb.CountAllEnabledHTTPFirewallPoliciesRequest{
 | 
			
		||||
		Keyword: params.Keyword,
 | 
			
		||||
	})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		this.ErrorPage(err)
 | 
			
		||||
		return
 | 
			
		||||
@@ -26,8 +32,9 @@ func (this *IndexAction) RunGet(params struct{}) {
 | 
			
		||||
	page := this.NewPage(count)
 | 
			
		||||
 | 
			
		||||
	listResp, err := this.RPC().HTTPFirewallPolicyRPC().ListEnabledHTTPFirewallPolicies(this.AdminContext(), &pb.ListEnabledHTTPFirewallPoliciesRequest{
 | 
			
		||||
		Offset: page.Offset,
 | 
			
		||||
		Size:   page.Size,
 | 
			
		||||
		Keyword: params.Keyword,
 | 
			
		||||
		Offset:  page.Offset,
 | 
			
		||||
		Size:    page.Size,
 | 
			
		||||
	})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		this.ErrorPage(err)
 | 
			
		||||
 
 | 
			
		||||
@@ -6,6 +6,7 @@
 | 
			
		||||
    <a href="" class="item" @click.prevent="createPolicy()">[创建]</a>
 | 
			
		||||
</first-menu>
 | 
			
		||||
 | 
			
		||||
<!-- 搜索 -->
 | 
			
		||||
<div class="margin"></div>
 | 
			
		||||
<form class="ui form" method="get" action="/servers/components/cache">
 | 
			
		||||
    <div class="ui fields inline">
 | 
			
		||||
@@ -18,7 +19,7 @@
 | 
			
		||||
    </div>
 | 
			
		||||
</form>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<!-- 列表 -->
 | 
			
		||||
<p class="comment" v-if="cachePolicies == null || cachePolicies.length == 0">暂时还没有缓存策略。</p>
 | 
			
		||||
<table class="ui table selectable celled" v-if="cachePolicies != null && cachePolicies.length > 0">
 | 
			
		||||
    <thead>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,35 +1,49 @@
 | 
			
		||||
{$layout}
 | 
			
		||||
 | 
			
		||||
	<second-menu>
 | 
			
		||||
		<menu-item href="/servers/components/waf" code="index">列表</menu-item>
 | 
			
		||||
		<span class="item">|</span>
 | 
			
		||||
		<a href="" class="item" @click.prevent="createPolicy()">[创建]</a>
 | 
			
		||||
	</second-menu>
 | 
			
		||||
<first-menu>
 | 
			
		||||
    <menu-item href="/servers/components/waf" code="index">列表</menu-item>
 | 
			
		||||
    <span class="item">|</span>
 | 
			
		||||
    <a href="" class="item" @click.prevent="createPolicy()">[创建]</a>
 | 
			
		||||
</first-menu>
 | 
			
		||||
 | 
			
		||||
	<p class="comment" v-if="policies.length == 0">暂时还没有WAF策略。</p>
 | 
			
		||||
<!-- 搜索 -->
 | 
			
		||||
<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>
 | 
			
		||||
 | 
			
		||||
	<table class="ui table selectable celled" v-if="policies.length > 0">
 | 
			
		||||
		<thead>
 | 
			
		||||
			<tr>
 | 
			
		||||
				<th>策略名称</th>
 | 
			
		||||
				<th class="center">入站规则分组</th>
 | 
			
		||||
				<th class="center">出站规则分组</th>
 | 
			
		||||
				<th class="center">集群数</th>
 | 
			
		||||
				<th class="two wide center">状态</th>
 | 
			
		||||
				<th class="two op">操作</th>
 | 
			
		||||
			</tr>
 | 
			
		||||
		</thead>
 | 
			
		||||
		<tr v-for="policy in policies">
 | 
			
		||||
			<td>{{policy.name}}</td>
 | 
			
		||||
			<td class="center">{{policy.countInbound}}</td>
 | 
			
		||||
			<td class="center">{{policy.countOutbound}}</td>
 | 
			
		||||
			<td class="center">{{policy.countClusters}}</td>
 | 
			
		||||
			<td class="center"><label-on :v-is-on="policy.isOn"></label-on></td>
 | 
			
		||||
			<td>
 | 
			
		||||
				<a :href="'/servers/components/waf/policy?firewallPolicyId=' + policy.id">详情</a>  
 | 
			
		||||
				<a href="" @click.prevent="deletePolicy(policy.id)">删除</a>
 | 
			
		||||
			</td>
 | 
			
		||||
		</tr>
 | 
			
		||||
	</table>
 | 
			
		||||
<!-- 列表 -->
 | 
			
		||||
<p class="comment" v-if="policies.length == 0">暂时还没有WAF策略。</p>
 | 
			
		||||
 | 
			
		||||
	<div class="page" v-html="page"></div>
 | 
			
		||||
<table class="ui table selectable celled" v-if="policies.length > 0">
 | 
			
		||||
    <thead>
 | 
			
		||||
        <tr>
 | 
			
		||||
            <th>策略名称</th>
 | 
			
		||||
            <th class="center">入站规则分组</th>
 | 
			
		||||
            <th class="center">出站规则分组</th>
 | 
			
		||||
            <th class="center">集群数</th>
 | 
			
		||||
            <th class="two wide center">状态</th>
 | 
			
		||||
            <th class="two op">操作</th>
 | 
			
		||||
        </tr>
 | 
			
		||||
    </thead>
 | 
			
		||||
    <tr v-for="policy in policies">
 | 
			
		||||
        <td><keyword :v-word="keyword">{{policy.name}}</keyword></td>
 | 
			
		||||
        <td class="center">{{policy.countInbound}}</td>
 | 
			
		||||
        <td class="center">{{policy.countOutbound}}</td>
 | 
			
		||||
        <td class="center">{{policy.countClusters}}</td>
 | 
			
		||||
        <td class="center"><label-on :v-is-on="policy.isOn"></label-on></td>
 | 
			
		||||
        <td>
 | 
			
		||||
            <a :href="'/servers/components/waf/policy?firewallPolicyId=' + policy.id">详情</a>  
 | 
			
		||||
            <a href="" @click.prevent="deletePolicy(policy.id)">删除</a>
 | 
			
		||||
        </td>
 | 
			
		||||
    </tr>
 | 
			
		||||
</table>
 | 
			
		||||
 | 
			
		||||
<div class="page" v-html="page"></div>
 | 
			
		||||
		Reference in New Issue
	
	Block a user