mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-24 10:20:38 +08:00
在各个地方支持IPv6
This commit is contained in:
@@ -42,7 +42,7 @@ Vue.component("api-node-addresses-box", {
|
||||
<div v-if="addrs.length > 0">
|
||||
<div>
|
||||
<div v-for="(addr, index) in addrs" class="ui label small">
|
||||
{{addr.protocol}}://{{addr.host}}:{{addr.portRange}}</span>
|
||||
{{addr.protocol}}://{{addr.host.quoteIP()}}:{{addr.portRange}}</span>
|
||||
<a href="" title="修改" @click.prevent="updateAddr(index, addr)"><i class="icon pencil small"></i></a>
|
||||
<a href="" title="删除" @click.prevent="removeAddr(index)"><i class="icon remove"></i></a>
|
||||
</div>
|
||||
|
||||
@@ -91,7 +91,7 @@ Vue.component("network-addresses-box", {
|
||||
<input type="hidden" :name="name" :value="JSON.stringify(addresses)"/>
|
||||
<div v-if="addresses.length > 0">
|
||||
<div class="ui label small basic" v-for="(addr, index) in addresses">
|
||||
{{addr.protocol}}://<span v-if="addr.host.length > 0">{{addr.host}}</span><span v-if="addr.host.length == 0">*</span>:{{addr.portRange}}
|
||||
{{addr.protocol}}://<span v-if="addr.host.length > 0">{{addr.host.quoteIP()}}</span><span v-if="addr.host.length == 0">*</span>:{{addr.portRange}}
|
||||
<a href="" @click.prevent="updateAddr(index, addr)" title="修改"><i class="icon pencil small"></i></a>
|
||||
<a href="" @click.prevent="removeAddr(index)" title="删除"><i class="icon remove"></i></a> </div>
|
||||
<div class="ui divider"></div>
|
||||
|
||||
@@ -2,7 +2,7 @@ Vue.component("network-addresses-view", {
|
||||
props: ["v-addresses"],
|
||||
template: `<div>
|
||||
<div class="ui label tiny basic" v-if="vAddresses != null" v-for="addr in vAddresses">
|
||||
{{addr.protocol}}://<span v-if="addr.host.length > 0">{{addr.host}}</span><span v-else>*</span>:{{addr.portRange}}
|
||||
{{addr.protocol}}://<span v-if="addr.host.length > 0">{{addr.host.quoteIP()}}</span><span v-else>*</span>:{{addr.portRange}}
|
||||
</div>
|
||||
</div>`
|
||||
})
|
||||
@@ -396,7 +396,7 @@ window.teaweb = {
|
||||
}
|
||||
|
||||
let tooltipFunc = options.tooltip
|
||||
if (typeof(tooltipFunc) != "function") {
|
||||
if (typeof (tooltipFunc) != "function") {
|
||||
throw new Error("'options.tooltip' should be a function")
|
||||
}
|
||||
|
||||
@@ -524,3 +524,17 @@ window.teaweb = {
|
||||
chart.resize()
|
||||
}
|
||||
}
|
||||
|
||||
String.prototype.quoteIP = function () {
|
||||
let ip = this.toString()
|
||||
if (ip.length == 0) {
|
||||
return ""
|
||||
}
|
||||
if (ip.indexOf(":") < 0) {
|
||||
return ip
|
||||
}
|
||||
if (ip.substring(0, 1) == "[") {
|
||||
return ip
|
||||
}
|
||||
return "[" + ip + "]"
|
||||
}
|
||||
Reference in New Issue
Block a user