mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-19 07:20:25 +08:00
集群健康检查URL中可以输入主机名
This commit is contained in:
@@ -5,6 +5,7 @@ Vue.component("health-check-config-box", {
|
|||||||
let urlProtocol = "http"
|
let urlProtocol = "http"
|
||||||
let urlPort = ""
|
let urlPort = ""
|
||||||
let urlRequestURI = "/"
|
let urlRequestURI = "/"
|
||||||
|
let urlHost = ""
|
||||||
|
|
||||||
if (healthCheckConfig == null) {
|
if (healthCheckConfig == null) {
|
||||||
healthCheckConfig = {
|
healthCheckConfig = {
|
||||||
@@ -27,6 +28,17 @@ Vue.component("health-check-config-box", {
|
|||||||
try {
|
try {
|
||||||
let url = new URL(healthCheckConfig.url)
|
let url = new URL(healthCheckConfig.url)
|
||||||
urlProtocol = url.protocol.substring(0, url.protocol.length - 1)
|
urlProtocol = url.protocol.substring(0, url.protocol.length - 1)
|
||||||
|
|
||||||
|
// 域名
|
||||||
|
urlHost = url.host
|
||||||
|
if (urlHost == "%24%7Bhost%7D") {
|
||||||
|
urlHost = "${host}"
|
||||||
|
}
|
||||||
|
let colonIndex = urlHost.indexOf(":")
|
||||||
|
if (colonIndex > 0) {
|
||||||
|
urlHost = urlHost.substring(0, colonIndex)
|
||||||
|
}
|
||||||
|
|
||||||
urlPort = url.port
|
urlPort = url.port
|
||||||
urlRequestURI = url.pathname
|
urlRequestURI = url.pathname
|
||||||
if (url.search.length > 0) {
|
if (url.search.length > 0) {
|
||||||
@@ -54,11 +66,11 @@ Vue.component("health-check-config-box", {
|
|||||||
healthCheckConfig.countDown = 1
|
healthCheckConfig.countDown = 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log(healthCheckConfig.countUp, healthCheckConfig.countDown)
|
|
||||||
return {
|
return {
|
||||||
healthCheck: healthCheckConfig,
|
healthCheck: healthCheckConfig,
|
||||||
advancedVisible: false,
|
advancedVisible: false,
|
||||||
urlProtocol: urlProtocol,
|
urlProtocol: urlProtocol,
|
||||||
|
urlHost: urlHost,
|
||||||
urlPort: urlPort,
|
urlPort: urlPort,
|
||||||
urlRequestURI: urlRequestURI
|
urlRequestURI: urlRequestURI
|
||||||
}
|
}
|
||||||
@@ -82,6 +94,9 @@ Vue.component("health-check-config-box", {
|
|||||||
urlProtocol: function () {
|
urlProtocol: function () {
|
||||||
this.changeURL()
|
this.changeURL()
|
||||||
},
|
},
|
||||||
|
urlHost: function () {
|
||||||
|
this.changeURL()
|
||||||
|
},
|
||||||
"healthCheck.countTries": function (v) {
|
"healthCheck.countTries": function (v) {
|
||||||
let count = parseInt(v)
|
let count = parseInt(v)
|
||||||
if (!isNaN(count)) {
|
if (!isNaN(count)) {
|
||||||
@@ -112,7 +127,11 @@ Vue.component("health-check-config-box", {
|
|||||||
this.advancedVisible = !this.advancedVisible
|
this.advancedVisible = !this.advancedVisible
|
||||||
},
|
},
|
||||||
changeURL: function () {
|
changeURL: function () {
|
||||||
this.healthCheck.url = this.urlProtocol + "://${host}" + ((this.urlPort.length > 0) ? ":" + this.urlPort : "") + this.urlRequestURI
|
let urlHost = this.urlHost
|
||||||
|
if (urlHost.length == 0) {
|
||||||
|
urlHost = "${host}"
|
||||||
|
}
|
||||||
|
this.healthCheck.url = this.urlProtocol + "://" + urlHost + ((this.urlPort.length > 0) ? ":" + this.urlPort : "") + this.urlRequestURI
|
||||||
},
|
},
|
||||||
changeStatus: function (values) {
|
changeStatus: function (values) {
|
||||||
this.healthCheck.statusCodes = values.$map(function (k, v) {
|
this.healthCheck.statusCodes = values.$map(function (k, v) {
|
||||||
@@ -143,27 +162,39 @@ Vue.component("health-check-config-box", {
|
|||||||
<tr>
|
<tr>
|
||||||
<td>URL *</td>
|
<td>URL *</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="ui fields inline">
|
<table class="ui table">
|
||||||
<div class="ui field">
|
<tr>
|
||||||
<select class="ui dropdown" v-model="urlProtocol">
|
<td class="title">协议</td>
|
||||||
|
<td>
|
||||||
|
<select class="ui dropdown auto-width" v-model="urlProtocol">
|
||||||
<option value="http">http://</option>
|
<option value="http">http://</option>
|
||||||
<option value="https">https://</option>
|
<option value="https">https://</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
|
||||||
<div class="ui field">
|
|
||||||
<var style="color:grey">\${host}</var>
|
|
||||||
</div>
|
|
||||||
<div class="ui field">:</div>
|
|
||||||
<div class="ui field">
|
|
||||||
<input type="text" maxlength="5" style="width:5.4em" placeholder="端口" v-model="urlPort"/>
|
|
||||||
</div>
|
|
||||||
<div class="ui field">
|
|
||||||
<input type="text" v-model="urlRequestURI" placeholder="/" style="width:23em"/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="ui divider"></div>
|
|
||||||
<p class="comment" v-if="healthCheck.url.length > 0">拼接后的URL:<code-label>{{healthCheck.url}}</code-label>,其中\${host}指的是节点地址。</p>
|
|
||||||
</td>
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>域名</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" v-model="urlHost"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>端口</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" maxlength="5" style="width:5.4em" placeholder="端口" v-model="urlPort"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>RequestURI</td>
|
||||||
|
<td><input type="text" v-model="urlRequestURI" placeholder="/" style="width:20em"/></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<div class="ui divider"></div>
|
||||||
|
<p class="comment" v-if="healthCheck.url.length > 0">拼接后的URL:<code-label>{{healthCheck.url}}</code-label>,其中\${host}指的是域名。</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>检测时间间隔</td>
|
<td>检测时间间隔</td>
|
||||||
|
|||||||
Reference in New Issue
Block a user