mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-12-25 19:56:35 +08:00
增加全局查看、检索IP功能
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
|
||||
<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>
|
||||
<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>
|
||||
@@ -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()
|
||||
})
|
||||
}
|
||||
})
|
||||
56
web/views/@default/servers/iplists/lists.html
Normal file
56
web/views/@default/servers/iplists/lists.html
Normal 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>
|
||||
|
||||
<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>
|
||||
<a href="" @click.prevent="deleteList(list.id)">删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div class="page" v-html="page"></div>
|
||||
27
web/views/@default/servers/iplists/lists.js
Normal file
27
web/views/@default/servers/iplists/lists.js
Normal 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()
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user