2020-11-12 14:41:34 +08:00
|
|
|
Tea.context(function () {
|
2021-08-19 14:26:25 +08:00
|
|
|
this.isUpdatingDomains = false
|
|
|
|
|
|
|
|
|
|
this.$delay(function () {
|
|
|
|
|
this.syncDomains()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
this.syncDomains = function () {
|
|
|
|
|
this.isUpdatingDomains = true
|
|
|
|
|
this.$post(".syncDomains")
|
|
|
|
|
.params({
|
|
|
|
|
providerId: this.provider.id
|
|
|
|
|
})
|
|
|
|
|
.success(function (resp) {
|
|
|
|
|
if (resp.data.hasChanges) {
|
|
|
|
|
teaweb.reload()
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.done(function () {
|
|
|
|
|
this.$delay(function () {
|
|
|
|
|
this.isUpdatingDomains = false
|
|
|
|
|
}, 1000)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-12 14:41:34 +08:00
|
|
|
this.updateProvider = function (providerId) {
|
|
|
|
|
teaweb.popup(Tea.url(".updatePopup?providerId=" + providerId), {
|
2020-11-15 11:57:43 +08:00
|
|
|
height: "28em",
|
2020-11-12 14:41:34 +08:00
|
|
|
callback: function () {
|
|
|
|
|
teaweb.success("保存成功", function () {
|
|
|
|
|
teaweb.reload()
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.createDomain = function () {
|
|
|
|
|
teaweb.popup("/dns/domains/createPopup?providerId=" + this.provider.id, {
|
|
|
|
|
callback: function () {
|
|
|
|
|
teaweb.success("保存成功", function () {
|
|
|
|
|
teaweb.reload()
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-13 18:22:35 +08:00
|
|
|
this.updateDomain = function (domainId) {
|
|
|
|
|
teaweb.popup("/dns/domains/updatePopup?domainId=" + domainId, {
|
|
|
|
|
callback: function () {
|
|
|
|
|
teaweb.success("保存成功", function () {
|
|
|
|
|
teaweb.reload()
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-12 14:41:34 +08:00
|
|
|
this.deleteDomain = function (domain) {
|
|
|
|
|
let that = this
|
|
|
|
|
teaweb.confirm("确定要删除域名\"" + domain.name + "\"吗?", function () {
|
|
|
|
|
that.$post("/dns/domains/delete")
|
|
|
|
|
.params({
|
|
|
|
|
domainId: domain.id
|
|
|
|
|
})
|
|
|
|
|
.post()
|
|
|
|
|
.refresh()
|
|
|
|
|
})
|
|
|
|
|
}
|
2020-11-13 18:22:35 +08:00
|
|
|
|
|
|
|
|
this.syncDomain = function (index, domain) {
|
2020-11-14 21:28:14 +08:00
|
|
|
let that = this
|
|
|
|
|
teaweb.confirm("确定要同步此域名下的所有解析记录吗?", function () {
|
|
|
|
|
domain.isSyncing = true
|
|
|
|
|
Vue.set(that.domains, index, domain)
|
2020-11-13 18:22:35 +08:00
|
|
|
|
2020-11-14 21:28:14 +08:00
|
|
|
this.$post("/dns/domains/sync")
|
|
|
|
|
.params({
|
|
|
|
|
domainId: domain.id
|
2020-11-13 18:22:35 +08:00
|
|
|
})
|
2020-11-14 21:28:14 +08:00
|
|
|
.success(function () {
|
|
|
|
|
teaweb.success("同步成功", function () {
|
|
|
|
|
teaweb.reload()
|
|
|
|
|
})
|
2020-11-13 18:22:35 +08:00
|
|
|
})
|
2020-11-14 21:28:14 +08:00
|
|
|
.fail(function (resp) {
|
|
|
|
|
teaweb.warn(resp.message, function () {
|
|
|
|
|
if (resp.data.shouldFix) {
|
|
|
|
|
window.location = "/dns/issues"
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
.done(function () {
|
|
|
|
|
Vue.set(that.domains, index, domain)
|
|
|
|
|
})
|
|
|
|
|
})
|
2020-11-13 18:22:35 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.showRoutes = function (domainId) {
|
|
|
|
|
teaweb.popup("/dns/domains/routesPopup?domainId=" + domainId)
|
|
|
|
|
}
|
2020-12-23 16:49:53 +08:00
|
|
|
|
|
|
|
|
this.viewClusters = function (domainId) {
|
|
|
|
|
teaweb.popup("/dns/domains/clustersPopup?domainId=" + domainId)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.viewNodes = function (domainId) {
|
|
|
|
|
teaweb.popup("/dns/domains/nodesPopup?domainId=" + domainId, {
|
|
|
|
|
width: "50em",
|
|
|
|
|
height: "30em"
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.viewServers = function (domainId) {
|
|
|
|
|
teaweb.popup("/dns/domains/serversPopup?domainId=" + domainId)
|
|
|
|
|
}
|
2021-08-19 14:26:25 +08:00
|
|
|
|
|
|
|
|
this.alertDown = function () {
|
|
|
|
|
teaweb.popupTip("当前域名已从服务商下线")
|
|
|
|
|
}
|
2020-11-12 14:41:34 +08:00
|
|
|
})
|