优化WAF动作

This commit is contained in:
刘祥超
2021-07-18 15:52:50 +08:00
parent 9c231a2b8c
commit 63884bc836
6 changed files with 112 additions and 73 deletions

View File

@@ -12,7 +12,7 @@
</td>
</tr>
<tr>
<td>规则</td>
<td>规则 *</td>
<td>
<http-firewall-rules-box :v-rules="rules" :v-type="type"></http-firewall-rules-box>
</td>

View File

@@ -1,44 +1,44 @@
{$layout}
{$template "waf_menu"}
{$template "waf_menu"}
<second-menu style="margin-top:-1em">
<a href="" class="item" @click.prevent="createGroup(type)">[添加分组]</a>
</second-menu>
<second-menu style="margin-top:-1em">
<a href="" class="item" @click.prevent="createGroup(type)">[添加分组]</a>
</second-menu>
<p class="comment" v-if="groups.length == 0">暂时还没有规则分组。</p>
<p class="comment" v-if="groups.length == 0">暂时还没有规则分组。</p>
<table class="ui table selectable celled" v-if="groups.length > 0" id="sortable-table">
<thead>
<tr>
<th style="width:3em"></th>
<th>规则分组</th>
<th class="center">规则集</th>
<th class="three op">操作</th>
</tr>
</thead>
<tbody v-for="group in groups" :data-group-id="group.id">
<tr>
<td style="text-align: center;"><i class="icon bars handle grey" title="拖动排序"></i> </td>
<td><span :class="{disabled:!group.isOn}">{{group.name}}</span>
<p class="comment" v-if="group.description.length > 0" style="padding-bottom:0">{{group.description}}</p>
<p>
<span v-if="group.isOn" class="ui label tiny basic green">启用</span>
<span v-if="!group.isOn" class="ui label tiny basic red">停用</span>
<span v-if="group.code.length > 0" class="ui label basic tiny">预置</span>
<span v-if="group.code.length == 0" class="ui label basic tiny">自定义</span>
</p>
</td>
<td class="center">
<a :href="'/servers/components/waf/group?firewallPolicyId=' + firewallPolicyId + '&type=' + type + '&groupId=' + group.id">{{group.countSets}}</a>
</td>
<td>
<a :href="'/servers/components/waf/group?firewallPolicyId=' + firewallPolicyId + '&type=' + type + '&groupId=' + group.id">详情</a> &nbsp;
<a href="" v-if="!group.isOn" @click.prevent="enableGroup(group.id)">启用</a><a href="" v-if="group.isOn" @click.prevent="disableGroup(group.id)">停用</a> &nbsp;
<a href="" @click.prevent="deleteGroup(group.id)" v-if="group.canDelete">删除</a>
</td>
</tr>
</tbody>
</table>
<table class="ui table selectable celled" v-if="groups.length > 0" id="sortable-table">
<thead>
<tr>
<th style="width:3em"></th>
<th>规则分组</th>
<th class="center">规则集</th>
<th class="three op">操作</th>
</tr>
</thead>
<tbody v-for="group in groups" :data-group-id="group.id">
<tr>
<td style="text-align: center;"><i class="icon bars handle grey" title="拖动排序"></i> </td>
<td><span :class="{disabled:!group.isOn}">{{group.name}}</span>
<p class="comment" v-if="group.description.length > 0" style="padding-bottom:0">{{group.description}}</p>
<p>
<span v-if="group.isOn" class="ui label tiny basic green">启用</span>
<span v-if="!group.isOn" class="ui label tiny basic red">停用</span>
<span v-if="group.code.length > 0" class="ui label basic tiny">预置</span>
<span v-if="group.code.length == 0" class="ui label basic tiny">自定义</span>
</p>
</td>
<td class="center">
<a :href="'/servers/components/waf/group?firewallPolicyId=' + firewallPolicyId + '&type=' + type + '&groupId=' + group.id">{{group.countSets}}</a>
</td>
<td>
<a :href="'/servers/components/waf/group?firewallPolicyId=' + firewallPolicyId + '&type=' + type + '&groupId=' + group.id">详情</a> &nbsp;
<a href="" v-if="!group.isOn" @click.prevent="enableGroup(group.id)">启用</a><a href="" v-if="group.isOn" @click.prevent="disableGroup(group.id)">停用</a> &nbsp;
<a href="" @click.prevent="deleteGroup(group.id)" v-if="group.canDelete">删除</a>
</td>
</tr>
</tbody>
</table>
<p class="comment" v-if="groups.length > 0">所有规则匹配顺序为从上到下,可以拖动左侧的<i class="icon bars"></i>排序。</p>
<p class="comment" v-if="groups.length > 0">所有规则匹配顺序为从上到下,可以拖动左侧的<i class="icon bars"></i>排序。</p>

View File

@@ -12,7 +12,7 @@
</td>
</tr>
<tr>
<td>规则</td>
<td>规则 *</td>
<td>
<http-firewall-rules-box :v-rules="rules" :v-type="type"></http-firewall-rules-box>
</td>

View File

@@ -33,7 +33,7 @@
<th style="width:3em"></th>
<th nowrap="">规则集名称</th>
<th nowrap="">规则</th>
<th nowrap="" class="center">关系</th>
<th nowrap="" class="center one wide">关系</th>
<th nowrap="">动作</th>
<th class="three op">操作</th>
</tr>
@@ -52,11 +52,12 @@
</div>
<span class="ui disabled" v-if="set.rules.length == 0">暂时还没有规则</span>
</td>
<td class="center">{{set.connector.toUpperCase()}}</td>
<td nowrap=""><span :class="{red:set.action == 'BLOCK' || set.action == 'CAPTCHA', green:set.action != 'BLOCK' && set.action != 'CAPTCHA'}">{{set.actionName}}[{{set.action.toUpperCase()}}]</span>
<div v-if="set.actionLinks != null && set.actionLinks.length > 0" style="margin-top:0.3em">
<span class="disabled">-&gt;</span> <span v-for="link in set.actionLinks"><a :href="link.url"><span class="disabled">[{{link.name}}]</span></a> &nbsp;</span>
</div>
<td class="center">
<span v-if="set.connector.toUpperCase() == 'OR'"></span><span v-else></span>
<span class="small grey">({{set.connector.toUpperCase()}})</span>
</td>
<td nowrap="">
<http-firewall-actions-view :v-actions="set.actions"></http-firewall-actions-view>
</td>
<td>
<a href="" @click.prevent="updateSet(set.id)">修改</a> &nbsp; <a href="" @click.prevent="updateSetOn(set.id, false)" v-if="set.isOn">停用</a><a href="" @click.prevent="updateSetOn(set.id, true)" v-if="!set.isOn">启用</a> &nbsp; <a href="" @click.prevent="deleteSet(set.id)">删除</a>