mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-16 05:30:27 +08:00
实现公用的IP名单
This commit is contained in:
37
web/public/js/components/common/tip-message-box.js
Normal file
37
web/public/js/components/common/tip-message-box.js
Normal file
@@ -0,0 +1,37 @@
|
||||
// 信息提示窗口
|
||||
Vue.component("tip-message-box", {
|
||||
props: ["code"],
|
||||
mounted: function () {
|
||||
let that = this
|
||||
Tea.action("/ui/showTip")
|
||||
.params({
|
||||
code: this.code
|
||||
})
|
||||
.success(function (resp) {
|
||||
that.visible = resp.data.visible
|
||||
})
|
||||
.post()
|
||||
},
|
||||
data: function () {
|
||||
return {
|
||||
visible: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
close: function () {
|
||||
this.visible = false
|
||||
Tea.action("/ui/hideTip")
|
||||
.params({
|
||||
code: this.code
|
||||
})
|
||||
.post()
|
||||
}
|
||||
},
|
||||
template: `<div class="ui icon message" v-if="visible">
|
||||
<i class="icon info circle"></i>
|
||||
<i class="close icon" title="取消" @click.prevent="close"></i>
|
||||
<div class="content">
|
||||
<slot></slot>
|
||||
</div>
|
||||
</div>`
|
||||
})
|
||||
62
web/public/js/components/iplist/ip-list-bind-box.js
Normal file
62
web/public/js/components/iplist/ip-list-bind-box.js
Normal file
@@ -0,0 +1,62 @@
|
||||
// 绑定IP列表
|
||||
Vue.component("ip-list-bind-box", {
|
||||
props: ["v-http-firewall-policy-id", "v-type"],
|
||||
mounted: function () {
|
||||
this.refresh()
|
||||
},
|
||||
data: function () {
|
||||
return {
|
||||
policyId: this.vHttpFirewallPolicyId,
|
||||
type: this.vType,
|
||||
lists: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
bind: function () {
|
||||
let that = this
|
||||
teaweb.popup("/servers/iplists/bindHTTPFirewallPopup?httpFirewallPolicyId=" + this.policyId + "&type=" + this.type, {
|
||||
width: "50em",
|
||||
height: "34em",
|
||||
callback: function () {
|
||||
|
||||
},
|
||||
onClose: function () {
|
||||
that.refresh()
|
||||
}
|
||||
})
|
||||
},
|
||||
remove: function (index, listId) {
|
||||
let that = this
|
||||
teaweb.confirm("确定要删除这个绑定的IP名单吗?", function () {
|
||||
Tea.action("/servers/iplists/unbindHTTPFirewall")
|
||||
.params({
|
||||
httpFirewallPolicyId: that.policyId,
|
||||
listId: listId
|
||||
})
|
||||
.post()
|
||||
.success(function (resp) {
|
||||
that.lists.$remove(index)
|
||||
})
|
||||
})
|
||||
},
|
||||
refresh: function () {
|
||||
let that = this
|
||||
Tea.action("/servers/iplists/httpFirewall")
|
||||
.params({
|
||||
httpFirewallPolicyId: this.policyId,
|
||||
type: this.vType
|
||||
})
|
||||
.post()
|
||||
.success(function (resp) {
|
||||
that.lists = resp.data.lists
|
||||
})
|
||||
}
|
||||
},
|
||||
template: `<div>
|
||||
<a href="" @click.prevent="bind()">绑定+</a> <span v-if="lists.length > 0"><span class="disabled small">| </span> 已绑定:</span>
|
||||
<div class="ui label basic small" v-for="(list, index) in lists">
|
||||
{{list.name}}
|
||||
<a href="" title="删除" @click.prevent="remove(index, list.id)"><i class="icon remove small"></i></a>
|
||||
</div>
|
||||
</div>`
|
||||
})
|
||||
@@ -34,7 +34,7 @@ Vue.component("http-access-log-box", {
|
||||
this.select()
|
||||
teaweb.popup("/servers/server/log/viewPopup?requestId=" + requestId, {
|
||||
width: "50em",
|
||||
height: "24em",
|
||||
height: "28em",
|
||||
onClose: function () {
|
||||
that.deselect()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user