管理端全部功能跑通
This commit is contained in:
@@ -22,6 +22,7 @@ Tea.context(function () {
|
||||
|
||||
this.isRequesting = false
|
||||
this.currentDomains = []
|
||||
this.currentClusters = []
|
||||
|
||||
if (typeof this.apps === "undefined") {
|
||||
this.apps = []
|
||||
@@ -41,6 +42,7 @@ Tea.context(function () {
|
||||
|
||||
if (selectedApp == null) {
|
||||
this.currentDomains = []
|
||||
this.currentClusters = []
|
||||
this.request.domain = ""
|
||||
this.request.clusterId = ""
|
||||
return
|
||||
@@ -56,8 +58,28 @@ Tea.context(function () {
|
||||
this.request.domain = ""
|
||||
}
|
||||
|
||||
if (typeof selectedApp.clusterId !== "undefined" && selectedApp.clusterId !== null) {
|
||||
this.request.clusterId = String(selectedApp.clusterId)
|
||||
let primaryClusterId = (typeof selectedApp.primaryClusterId !== "undefined" && selectedApp.primaryClusterId !== null) ? Number(selectedApp.primaryClusterId) : 0
|
||||
let backupClusterId = (typeof selectedApp.backupClusterId !== "undefined" && selectedApp.backupClusterId !== null) ? Number(selectedApp.backupClusterId) : 0
|
||||
|
||||
let allowed = []
|
||||
for (let i = 0; i < this.clusters.length; i++) {
|
||||
let cluster = this.clusters[i]
|
||||
let clusterId = Number(cluster.id)
|
||||
if (clusterId <= 0) {
|
||||
continue
|
||||
}
|
||||
if (clusterId === primaryClusterId || clusterId === backupClusterId) {
|
||||
allowed.push(cluster)
|
||||
}
|
||||
}
|
||||
this.currentClusters = allowed
|
||||
|
||||
if (allowed.length > 0) {
|
||||
if (!allowed.some((c) => String(c.id) === String(this.request.clusterId))) {
|
||||
this.request.clusterId = String(allowed[0].id)
|
||||
}
|
||||
} else {
|
||||
this.request.clusterId = ""
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,15 +116,15 @@ Tea.context(function () {
|
||||
|
||||
this.sendTestRequest = function () {
|
||||
if (this.request.appId.length === 0) {
|
||||
teaweb.warn("Please select target app")
|
||||
teaweb.warn("请选择目标应用")
|
||||
return
|
||||
}
|
||||
if (this.request.clusterId.length === 0) {
|
||||
teaweb.warn("Please select cluster")
|
||||
teaweb.warn("当前应用未绑定可用集群,请先在应用设置中配置主集群/备集群")
|
||||
return
|
||||
}
|
||||
if (this.request.domain.length === 0) {
|
||||
teaweb.warn("Please select domain")
|
||||
teaweb.warn("请选择要解析的域名")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -126,6 +148,7 @@ Tea.context(function () {
|
||||
this.resetForm = function () {
|
||||
this.request = this.newRequest()
|
||||
this.currentDomains = []
|
||||
this.currentClusters = []
|
||||
this.response = {
|
||||
hasResult: false,
|
||||
code: -1,
|
||||
|
||||
Reference in New Issue
Block a user