Files
EdgeAdmin/web/views/@default/dns/providers/provider.js

77 lines
1.8 KiB
JavaScript
Raw Normal View History

2020-11-12 14:41:34 +08:00
Tea.context(function () {
this.updateProvider = function (providerId) {
teaweb.popup(Tea.url(".updatePopup?providerId=" + providerId), {
height: "26em",
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()
})
}
})
}
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()
})
}
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-14 21:28:14 +08:00
this.$post("/dns/domains/sync")
.params({
domainId: domain.id
})
2020-11-14 21:28:14 +08:00
.success(function () {
teaweb.success("同步成功", function () {
teaweb.reload()
})
})
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 () {
domain.isSyncing = false
Vue.set(that.domains, index, domain)
})
})
}
this.showRoutes = function (domainId) {
teaweb.popup("/dns/domains/routesPopup?domainId=" + domainId)
}
2020-11-12 14:41:34 +08:00
})