前端页面
This commit is contained in:
@@ -2,6 +2,7 @@ Tea.context(function () {
|
||||
this.newRequest = function () {
|
||||
return {
|
||||
appId: "",
|
||||
clusterId: "",
|
||||
domain: "",
|
||||
clientIp: "",
|
||||
qtype: "A"
|
||||
@@ -20,13 +21,48 @@ Tea.context(function () {
|
||||
}
|
||||
|
||||
this.isRequesting = false
|
||||
this.currentDomains = []
|
||||
|
||||
if (typeof this.apps == "undefined") {
|
||||
if (typeof this.apps === "undefined") {
|
||||
this.apps = []
|
||||
}
|
||||
if (typeof this.clusters === "undefined") {
|
||||
this.clusters = []
|
||||
}
|
||||
|
||||
this.onAppChanged = function () {
|
||||
let selectedApp = null
|
||||
for (let i = 0; i < this.apps.length; i++) {
|
||||
if (this.apps[i].appId === this.request.appId) {
|
||||
selectedApp = this.apps[i]
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (selectedApp == null) {
|
||||
this.currentDomains = []
|
||||
this.request.domain = ""
|
||||
this.request.clusterId = ""
|
||||
return
|
||||
}
|
||||
|
||||
this.currentDomains = Array.isArray(selectedApp.domains) ? selectedApp.domains : []
|
||||
|
||||
if (this.currentDomains.length > 0) {
|
||||
if (this.currentDomains.indexOf(this.request.domain) < 0) {
|
||||
this.request.domain = this.currentDomains[0]
|
||||
}
|
||||
} else {
|
||||
this.request.domain = ""
|
||||
}
|
||||
|
||||
if (typeof selectedApp.clusterId !== "undefined" && selectedApp.clusterId !== null) {
|
||||
this.request.clusterId = String(selectedApp.clusterId)
|
||||
}
|
||||
}
|
||||
|
||||
this.normalizeResultRows = function (data) {
|
||||
if (typeof data == "undefined" || data == null) {
|
||||
if (typeof data === "undefined" || data == null) {
|
||||
return []
|
||||
}
|
||||
|
||||
@@ -35,10 +71,7 @@ Tea.context(function () {
|
||||
}
|
||||
|
||||
let rows = []
|
||||
let ips = []
|
||||
if (Array.isArray(data.ips)) {
|
||||
ips = data.ips
|
||||
}
|
||||
let ips = Array.isArray(data.ips) ? data.ips : []
|
||||
let domain = this.request.domain
|
||||
let qtype = this.request.qtype
|
||||
let ttl = data.ttl || 0
|
||||
@@ -55,16 +88,21 @@ Tea.context(function () {
|
||||
line: line
|
||||
})
|
||||
})
|
||||
|
||||
return rows
|
||||
}
|
||||
|
||||
this.sendTestRequest = function () {
|
||||
if (this.request.appId.length == 0) {
|
||||
teaweb.warn("请选择目标应用")
|
||||
if (this.request.appId.length === 0) {
|
||||
teaweb.warn("Please select target app")
|
||||
return
|
||||
}
|
||||
if (this.request.domain.length == 0) {
|
||||
teaweb.warn("请填写解析域名")
|
||||
if (this.request.clusterId.length === 0) {
|
||||
teaweb.warn("Please select cluster")
|
||||
return
|
||||
}
|
||||
if (this.request.domain.length === 0) {
|
||||
teaweb.warn("Please select domain")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -87,6 +125,7 @@ Tea.context(function () {
|
||||
|
||||
this.resetForm = function () {
|
||||
this.request = this.newRequest()
|
||||
this.currentDomains = []
|
||||
this.response = {
|
||||
hasResult: false,
|
||||
code: -1,
|
||||
|
||||
Reference in New Issue
Block a user