mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-18 23:10:25 +08:00
在WAF中增加检查IP状态功能
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
<second-menu style="margin-top:-1em">
|
||||
<menu-item :href="'/servers/components/waf/ipadmin?firewallPolicyId=' + firewallPolicyId" :active="subMenuItem == 'region'">国家/地区封禁</menu-item>
|
||||
<menu-item :href="'/servers/components/waf/ipadmin/provinces?firewallPolicyId=' + firewallPolicyId" :active="subMenuItem == 'province'">省份封禁</menu-item>
|
||||
<span class="item">|</span>
|
||||
<span class="item disabled">|</span>
|
||||
<menu-item :href="'/servers/components/waf/ipadmin/lists?firewallPolicyId=' + firewallPolicyId + '&type=white'" :active="subMenuItem == 'white'">白名单</menu-item>
|
||||
<a href="" class="item" @click.prevent="createIP('white')"><span style="font-size: 0.9em">[添加IP]</span></a>
|
||||
<span class="item">|</span>
|
||||
<span class="item disabled">|</span>
|
||||
<menu-item :href="'/servers/components/waf/ipadmin/lists?firewallPolicyId=' + firewallPolicyId + '&type=black'" :active="subMenuItem == 'black'">黑名单</menu-item>
|
||||
<a href="" class="item" @click.prevent="createIP('black')"><span style="font-size: 0.9em">[添加IP]</span></a>
|
||||
<span class="item disabled">|</span>
|
||||
<menu-item :href="'/servers/components/waf/ipadmin/test?firewallPolicyId=' + firewallPolicyId" :active="subMenuItem == 'test'">IP检查</menu-item>
|
||||
</second-menu>
|
||||
48
web/views/@default/servers/components/waf/ipadmin/test.html
Normal file
48
web/views/@default/servers/components/waf/ipadmin/test.html
Normal file
@@ -0,0 +1,48 @@
|
||||
{$layout}
|
||||
|
||||
{$template "../waf_menu"}
|
||||
{$template "menu"}
|
||||
|
||||
|
||||
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
|
||||
<input type="hidden" name="firewallPolicyId" :value="firewallPolicyId"/>
|
||||
<table class="ui table selectable definition">
|
||||
<tr>
|
||||
<td class="title">IP *</td>
|
||||
<td>
|
||||
<input type="text" name="ip" class="text" maxlength="100" ref="focus" placeholder="x.x.x.x" v-model="ip"/>
|
||||
<p class="comment">要检查的IP</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>检查结果</td>
|
||||
<td>
|
||||
<div v-if="result.isDone">
|
||||
<div v-if="!result.isOk">
|
||||
<span class="red">{{result.error}}</span>
|
||||
</div>
|
||||
<div v-if="result.isFound">
|
||||
<div v-if="result.item != null">
|
||||
<div v-if="result.isAllowed">
|
||||
<span class="green">在白名单中 <ip-item-text :v-item="result.item"></ip-item-text><a href="" @click.prevent="updateItem(result.list.id, result.item.id)" title="查看和修改"><i class="icon pencil small"></i></a></span>
|
||||
</div>
|
||||
<div v-else>
|
||||
<span class="red">在黑名单中 <ip-item-text :v-item="result.item"></ip-item-text><a href="" @click.prevent="updateItem(result.list.id, result.item.id)" title="查看和修改"><i class="icon pencil small"></i></a></span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="result.province != null">
|
||||
<span class="red">在省份封禁中 "{{result.province.name}}"</span>
|
||||
</div>
|
||||
<div v-if="result.country != null && result.province == null">
|
||||
<span class="red">在国家/地区封禁中 "{{result.country.name}}"</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="!result.isFound">
|
||||
没有找到和{{ip}}匹配的配置。
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<submit-btn>检查IP状态</submit-btn>
|
||||
</form>
|
||||
35
web/views/@default/servers/components/waf/ipadmin/test.js
Normal file
35
web/views/@default/servers/components/waf/ipadmin/test.js
Normal file
@@ -0,0 +1,35 @@
|
||||
Tea.context(function () {
|
||||
this.ip = ""
|
||||
this.result = {
|
||||
isDone: false,
|
||||
isOk: false,
|
||||
isFound: false,
|
||||
isAllowed: false,
|
||||
error: "",
|
||||
province: null,
|
||||
country: null,
|
||||
ipItem: null,
|
||||
ipList: null
|
||||
}
|
||||
|
||||
this.$delay(function () {
|
||||
this.$watch("ip", function () {
|
||||
this.result.isDone = false
|
||||
})
|
||||
})
|
||||
|
||||
this.success = function (resp) {
|
||||
this.result = resp.data.result
|
||||
}
|
||||
|
||||
this.updateItem = function (itemId) {
|
||||
teaweb.popup(Tea.url(".updateIPPopup?firewallPolicyId=" + this.firewallPolicyId, {itemId: itemId}), {
|
||||
height: "23em",
|
||||
callback: function () {
|
||||
teaweb.success("保存成功", function () {
|
||||
teaweb.reload()
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user