增加全局查看、检索IP功能

This commit is contained in:
GoEdgeLab
2021-11-17 19:50:52 +08:00
parent 65c43e72e0
commit 347d36b8bd
10 changed files with 303 additions and 106 deletions

View File

@@ -38,7 +38,24 @@ Vue.component("ip-list-table", {
<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>
<div v-if="item.createdTime != null">
<span class="small disabled">添加于 {{item.createdTime}}</span>
<span class="small grey">添加于 {{item.createdTime}}
<span v-if="item.list != null && item.list.id > 0">
@
<a :href="'/servers/iplists/list?listId=' + item.list.id" v-if="item.policy.id == 0"><span>[<span v-if="item.list.type == 'black'">黑</span><span v-if="item.list.type == 'white'">白</span>名单:{{item.list.name}}]</span></a>
<span v-else>[<span v-if="item.list.type == 'black'">黑</span><span v-if="item.list.type == 'white'">白</span>名单:{{item.list.name}}</span>
<span v-if="item.policy.id > 0">
<span v-if="item.policy.server != null">
<a :href="'/servers/server/settings/waf/ipadmin/allowList?serverId=' + item.policy.server.id + '&firewallPolicyId=' + item.policy.id" v-if="item.list.type == 'white'">[服务:{{item.policy.server.name}}]</a>
<a :href="'/servers/server/settings/waf/ipadmin/denyList?serverId=' + item.policy.server.id + '&firewallPolicyId=' + item.policy.id" v-if="item.list.type == 'black'">[服务:{{item.policy.server.name}}]</a>
</span>
<span v-else>
<a :href="'/servers/components/waf/ipadmin/lists?firewallPolicyId=' + item.policy.id + '&type=' + item.list.type">[策略:{{item.policy.name}}]</a>
</span>
</span>
</span>
</span>
</div>
</td>
<td>
@@ -65,11 +82,11 @@ Vue.component("ip-list-table", {
<span v-else class="disabled">-</span>
<div style="margin-top: 0.4em" v-if="item.sourceServer != null && item.sourceServer.id > 0">
<a :href="'/servers/server?serverId=' + item.sourceServer.id" class="ui label tiny basic grey" target="_blank"><i class="icon clone outline"></i>{{item.sourceServer.name}}</a>
<a :href="'/servers/server?serverId=' + item.sourceServer.id" style="border: 0"><span class="small "><i class="icon clone outline"></i>{{item.sourceServer.name}}</span></a>
</div>
<div v-if="item.sourcePolicy != null && item.sourcePolicy.id > 0" style="margin-top: 0.4em">
<a :href="'/servers/components/waf/group?firewallPolicyId=' + item.sourcePolicy.id + '&type=inbound&groupId=' + item.sourceGroup.id" v-if="item.sourcePolicy.serverId == 0" class="ui label tiny basic grey" target="_blank"><i class="icon shield"></i>{{item.sourcePolicy.name}} &raquo; {{item.sourceGroup.name}} &raquo; {{item.sourceSet.name}}</a>
<a :href="'/servers/server/settings/waf/group?serverId=' + item.sourcePolicy.serverId + '&firewallPolicyId=' + item.sourcePolicy.id + '&type=inbound&groupId=' + item.sourceGroup.id" v-if="item.sourcePolicy.serverId > 0" class="ui label tiny basic grey" target="_blank"><i class="icon shield"></i> {{item.sourcePolicy.name}} &raquo; {{item.sourceGroup.name}} &raquo; {{item.sourceSet.name}}</a>
<a :href="'/servers/components/waf/group?firewallPolicyId=' + item.sourcePolicy.id + '&type=inbound&groupId=' + item.sourceGroup.id" v-if="item.sourcePolicy.serverId == 0"><span class="small "><i class="icon shield"></i>{{item.sourcePolicy.name}} &raquo; {{item.sourceGroup.name}} &raquo; {{item.sourceSet.name}}</span></a>
<a :href="'/servers/server/settings/waf/group?serverId=' + item.sourcePolicy.serverId + '&firewallPolicyId=' + item.sourcePolicy.id + '&type=inbound&groupId=' + item.sourceGroup.id" v-if="item.sourcePolicy.serverId > 0"><span class="small "><i class="icon shield"></i> {{item.sourcePolicy.name}} &raquo; {{item.sourceGroup.name}} &raquo; {{item.sourceSet.name}}</span></a>
</div>
</td>
<td>

View File

@@ -1,5 +1,5 @@
<first-menu>
<menu-item :href="'/servers/iplists?type=' + list.type">{{list.typeName}}</menu-item>
<menu-item :href="'/servers/iplists/lists?type=' + list.type">{{list.typeName}}</menu-item>
<span class="disabled item">|</span>
<menu-item :href="'/servers/iplists/list?listId=' + list.id" code="list">"{{list.name}}"详情</menu-item>
<menu-item :href="'/servers/iplists/items?listId=' + list.id" code="item">IP({{list.countItems}})</menu-item>

View File

@@ -1,8 +1,9 @@
<first-menu>
<menu-item href="/servers/iplists" :active="type == 'black'">黑名单</menu-item>
<menu-item href="/servers/iplists?type=white" :active="type == 'white'">名单</menu-item>
<span class="item disabled">|</span>
<menu-item @click.prevent="createList">[创建]</menu-item>
<span class="item disabled">|</span>
<span class="item"><tip-icon content="可以在WAF策略里直接引用这些公用名单。"></tip-icon></span>
<menu-item href="/servers/iplists" code="index">所有IP</menu-item>
<menu-item href="/servers/iplists/lists?type=black" :active="type == 'black'">公共黑名单</menu-item>
<menu-item href="/servers/iplists/lists?type=white" :active="type == 'white'">公共白名单</menu-item>
<span class="item disabled" v-if="type.length > 0">|</span>
<menu-item @click.prevent="createList" v-if="type.length > 0">[创建]</menu-item>
<span class="item disabled" v-if="type.length > 0">|</span>
<span class="item" v-if="type.length > 0"><tip-icon content="可以在WAF策略里直接引用这些公用名单。"></tip-icon></span>
</first-menu>

View File

@@ -1,56 +1,22 @@
{$layout}
{$template "menu"}
<tip-message-box code="iplist-public-tip">这里是公用的IP名单可以在WAF策略里直接引用。</tip-message-box>
<div class="margin"></div>
<form class="ui form" action="/servers/iplists">
<input type="hidden" name="type" :value="type"/>
<form class="ui form" action="/servers/iplists" method="get">
<div class="ui fields inline">
<div class="ui field">
<input type="text" placeholder="名称..." name="keyword" v-model="keyword"/>
<input type="text" name="ip" placeholder="x.x.x.x" v-model="ip"/>
</div>
<div class="ui field">
<button type="submit" class="ui button">搜索</button>
&nbsp;
<a :href="'/servers/iplists?type=' + type" v-if="keyword.length > 0">[清除条件]</a>
<button class="ui button" type="submit">搜索</button>
</div>
</div>
</form>
<p class="comment" v-if="lists.length == 0">暂时还没有公用IP名单。</p>
<div class="margin"></div>
<table class="ui table selectable celled" v-if="lists.length > 0">
<thead>
<tr>
<th class="one wide center">ID</th>
<th class="three wide">名称</th>
<th class="two wide center">类型</th>
<th>备注</th>
<th class="two wide center">IP数量</th>
<th class="two op">操作</th>
</tr>
</thead>
<tr v-for="list in lists">
<td class="center">{{list.id}}</td>
<td>
<a :href="'/servers/iplists/list?listId=' + list.id"><keyword :v-word="keyword">{{list.name}}</keyword></a>
<div v-if="list.isGlobal" style="margin-top: 0.3em"><grey-label>全局</grey-label></div>
</td>
<td class="center">
<span v-if="list.type == 'black'">黑名单</span>
<span v-if="list.type == 'white'">白名单</span>
</td>
<td>{{list.description}}</td>
<td class="center">
<a :href="'/servers/iplists/items?listId=' + list.id" v-if="list.countItems > 0">{{list.countItems}}</a>
<span v-else class="disabled">0</span>
</td>
<td>
<a :href="'/servers/iplists/list?listId=' + list.id">详情</a> &nbsp;
<a href="" @click.prevent="deleteList(list.id)">删除</a>
</td>
</tr>
</table>
<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" :v-keyword="ip"></ip-list-table>
<div class="page" v-html="page"></div>

View File

@@ -1,27 +1,23 @@
Tea.context(function () {
this.createList = function () {
teaweb.popup(Tea.url(".createPopup", {type: this.type}), {
height: "24em",
callback: function (resp) {
this.updateItem = function (itemId) {
teaweb.popup(Tea.url(".updateIPPopup", {itemId: itemId}), {
height: "26em",
callback: function () {
teaweb.success("保存成功", function () {
window.location = "/servers/iplists?type=" + resp.data.list.type
teaweb.reload()
})
}
})
}
this.deleteList = function (listId) {
this.deleteItem = function (itemId) {
let that = this
teaweb.confirm("确定要删除此IP名单吗?", function () {
that.$post(".delete")
teaweb.confirm("确定要删除这个IP吗?", function () {
that.$post(".deleteIP")
.params({
listId: listId
})
.success(function () {
teaweb.success("删除成功", function () {
teaweb.reload()
})
"itemId": itemId
})
.refresh()
})
}
})

View File

@@ -0,0 +1,56 @@
{$layout}
{$template "menu"}
<tip-message-box code="iplist-public-tip">这里是公用的IP名单可以在WAF策略里直接引用。</tip-message-box>
<div class="margin"></div>
<form class="ui form" action="/servers/iplists">
<input type="hidden" name="type" :value="type"/>
<div class="ui fields inline">
<div class="ui field">
<input type="text" placeholder="名称..." name="keyword" v-model="keyword"/>
</div>
<div class="ui field">
<button type="submit" class="ui button">搜索</button>
&nbsp;
<a :href="'/servers/iplists?type=' + type" v-if="keyword.length > 0">[清除条件]</a>
</div>
</div>
</form>
<p class="comment" v-if="lists.length == 0">暂时还没有公用IP名单。</p>
<table class="ui table selectable celled" v-if="lists.length > 0">
<thead>
<tr>
<th class="one wide center">ID</th>
<th class="three wide">名称</th>
<th class="two wide center">类型</th>
<th>备注</th>
<th class="two wide center">IP数量</th>
<th class="two op">操作</th>
</tr>
</thead>
<tr v-for="list in lists">
<td class="center">{{list.id}}</td>
<td>
<a :href="'/servers/iplists/list?listId=' + list.id"><keyword :v-word="keyword">{{list.name}}</keyword></a>
<div v-if="list.isGlobal" style="margin-top: 0.3em"><grey-label>全局</grey-label></div>
</td>
<td class="center">
<span v-if="list.type == 'black'">黑名单</span>
<span v-if="list.type == 'white'">白名单</span>
</td>
<td>{{list.description}}</td>
<td class="center">
<a :href="'/servers/iplists/items?listId=' + list.id" v-if="list.countItems > 0">{{list.countItems}}</a>
<span v-else class="disabled">0</span>
</td>
<td>
<a :href="'/servers/iplists/list?listId=' + list.id">详情</a> &nbsp;
<a href="" @click.prevent="deleteList(list.id)">删除</a>
</td>
</tr>
</table>
<div class="page" v-html="page"></div>

View File

@@ -0,0 +1,27 @@
Tea.context(function () {
this.createList = function () {
teaweb.popup(Tea.url(".createPopup", {type: this.type}), {
height: "24em",
callback: function (resp) {
teaweb.success("保存成功", function () {
window.location = "/servers/iplists/lists?type=" + resp.data.list.type
})
}
})
}
this.deleteList = function (listId) {
let that = this
teaweb.confirm("确定要删除此IP名单吗", function () {
that.$post(".delete")
.params({
listId: listId
})
.success(function () {
teaweb.success("删除成功", function () {
teaweb.reload()
})
})
})
}
})