Initial commit (code only without large binaries)
This commit is contained in:
66
EdgeAdmin/web/views/@default/ns/test/index.js
Normal file
66
EdgeAdmin/web/views/@default/ns/test/index.js
Normal file
@@ -0,0 +1,66 @@
|
||||
Tea.context(function () {
|
||||
this.ports = []
|
||||
this.port = ""
|
||||
|
||||
this.clusterId = 0
|
||||
if (this.clusters.length > 0) {
|
||||
this.clusterId = this.clusters[0].id
|
||||
this.$delay(function () {
|
||||
this.changeCluster()
|
||||
})
|
||||
}
|
||||
|
||||
this.nodeId = 0
|
||||
this.nodes = []
|
||||
this.selectedNode = null
|
||||
|
||||
this.isDoing = false
|
||||
this.result = null
|
||||
|
||||
this.before = function () {
|
||||
this.isDoing = true
|
||||
this.result = null
|
||||
}
|
||||
|
||||
this.success = function (resp) {
|
||||
this.result = resp.data
|
||||
}
|
||||
|
||||
this.done = function () {
|
||||
this.isDoing = false
|
||||
}
|
||||
|
||||
this.changeCluster = function () {
|
||||
this.nodeId = 0
|
||||
this.$post(".nodeOptions")
|
||||
.params({
|
||||
clusterId: this.clusterId
|
||||
})
|
||||
.success(function (resp) {
|
||||
this.nodes = resp.data.nodes
|
||||
if (this.nodes.length > 0) {
|
||||
this.nodeId = this.nodes[0].id
|
||||
this.changeNode()
|
||||
}
|
||||
this.ports = resp.data.ports
|
||||
if (this.ports.length > 0) {
|
||||
this.port = this.ports[0].port + "/" + this.ports[0].protocol
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
this.changeNode = function () {
|
||||
let that = this
|
||||
this.selectedNode = this.nodes.$find(function (k, v) {
|
||||
return v.id == that.nodeId
|
||||
})
|
||||
}
|
||||
|
||||
this.domain = ""
|
||||
this.changeDomain = function () {
|
||||
let newDomain = this.domain.replace(/\s+/, "")
|
||||
if (newDomain != this.domain) {
|
||||
this.domain = newDomain
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user