mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-14 20:30:25 +08:00
添加DNS账号时自动读取DNS服务商下域名
This commit is contained in:
@@ -34,6 +34,7 @@ func init() {
|
|||||||
GetPost("/updatePopup", new(providers.UpdatePopupAction)).
|
GetPost("/updatePopup", new(providers.UpdatePopupAction)).
|
||||||
Post("/delete", new(providers.DeleteAction)).
|
Post("/delete", new(providers.DeleteAction)).
|
||||||
Get("/provider", new(providers.ProviderAction)).
|
Get("/provider", new(providers.ProviderAction)).
|
||||||
|
Post("/syncDomains", new(providers.SyncDomainsAction)).
|
||||||
EndData().
|
EndData().
|
||||||
|
|
||||||
// 域名
|
// 域名
|
||||||
@@ -56,7 +57,6 @@ func init() {
|
|||||||
GetPost("", new(issues.IndexAction)).
|
GetPost("", new(issues.IndexAction)).
|
||||||
GetPost("/updateNodePopup", new(issues.UpdateNodePopupAction)).
|
GetPost("/updateNodePopup", new(issues.UpdateNodePopupAction)).
|
||||||
EndData().
|
EndData().
|
||||||
|
|
||||||
EndAll()
|
EndAll()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ func (this *ProviderAction) RunGet(params struct {
|
|||||||
"id": domain.Id,
|
"id": domain.Id,
|
||||||
"name": domain.Name,
|
"name": domain.Name,
|
||||||
"isOn": domain.IsOn,
|
"isOn": domain.IsOn,
|
||||||
|
"isUp": domain.IsUp,
|
||||||
"dataUpdatedTime": dataUpdatedTime,
|
"dataUpdatedTime": dataUpdatedTime,
|
||||||
"countRoutes": len(domain.Routes),
|
"countRoutes": len(domain.Routes),
|
||||||
"countServerRecords": domain.CountServerRecords,
|
"countServerRecords": domain.CountServerRecords,
|
||||||
|
|||||||
25
internal/web/actions/default/dns/providers/syncDomains.go
Normal file
25
internal/web/actions/default/dns/providers/syncDomains.go
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
|
||||||
|
|
||||||
|
package providers
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||||
|
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||||
|
)
|
||||||
|
|
||||||
|
type SyncDomainsAction struct {
|
||||||
|
actionutils.ParentAction
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *SyncDomainsAction) RunPost(params struct {
|
||||||
|
ProviderId int64
|
||||||
|
}) {
|
||||||
|
resp, err := this.RPC().DNSDomainRPC().SyncDNSDomainsFromProvider(this.AdminContext(), &pb.SyncDNSDomainsFromProviderRequest{DnsProviderId: params.ProviderId})
|
||||||
|
if err != nil {
|
||||||
|
this.Fail("更新域名失败:" + err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
this.Data["hasChanges"] = resp.HasChanges
|
||||||
|
|
||||||
|
this.Success()
|
||||||
|
}
|
||||||
@@ -94,6 +94,9 @@
|
|||||||
|
|
||||||
|
|
||||||
<h3>管理的域名 <a href="" @click.prevent="createDomain()">[添加域名]</a></h3>
|
<h3>管理的域名 <a href="" @click.prevent="createDomain()">[添加域名]</a></h3>
|
||||||
|
|
||||||
|
<p class="ui message blue" v-if="isUpdatingDomains">正在检查域名状态...</p>
|
||||||
|
|
||||||
<p class="comment" v-if="domains.length == 0">暂时还没有可以管理的域名。</p>
|
<p class="comment" v-if="domains.length == 0">暂时还没有可以管理的域名。</p>
|
||||||
|
|
||||||
<table class="ui table selectable celled" v-if="domains.length > 0">
|
<table class="ui table selectable celled" v-if="domains.length > 0">
|
||||||
@@ -136,6 +139,9 @@
|
|||||||
<a href="" style="border-bottom: 1px #db2828 dashed" title="点击和DNS服务商系统同步" @click.prevent="syncDomain(index,domain)" v-if="!domain.isSyncing"><span class="red">需要同步</span></a>
|
<a href="" style="border-bottom: 1px #db2828 dashed" title="点击和DNS服务商系统同步" @click.prevent="syncDomain(index,domain)" v-if="!domain.isSyncing"><span class="red">需要同步</span></a>
|
||||||
<span v-else>正在同步...</span>
|
<span v-else>正在同步...</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-else-if="!domain.isUp">
|
||||||
|
<a href="" style="border-bottom: 1px #db2828 dashed" @click.prevent="alertDown"><span class="red">已下线</span></a>
|
||||||
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<label-on :v-is-on="domain.isOn"></label-on>
|
<label-on :v-is-on="domain.isOn"></label-on>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,4 +1,28 @@
|
|||||||
Tea.context(function () {
|
Tea.context(function () {
|
||||||
|
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)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
this.updateProvider = function (providerId) {
|
this.updateProvider = function (providerId) {
|
||||||
teaweb.popup(Tea.url(".updatePopup?providerId=" + providerId), {
|
teaweb.popup(Tea.url(".updatePopup?providerId=" + providerId), {
|
||||||
height: "28em",
|
height: "28em",
|
||||||
@@ -88,4 +112,8 @@ Tea.context(function () {
|
|||||||
this.viewServers = function (domainId) {
|
this.viewServers = function (domainId) {
|
||||||
teaweb.popup("/dns/domains/serversPopup?domainId=" + domainId)
|
teaweb.popup("/dns/domains/serversPopup?domainId=" + domainId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.alertDown = function () {
|
||||||
|
teaweb.popupTip("当前域名已从服务商下线")
|
||||||
|
}
|
||||||
})
|
})
|
||||||
Reference in New Issue
Block a user