mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-09 00:20:26 +08:00
域名解析中可以删除和恢复某个域名
This commit is contained in:
@@ -6,7 +6,7 @@ import (
|
|||||||
"github.com/iwind/TeaGo/maps"
|
"github.com/iwind/TeaGo/maps"
|
||||||
)
|
)
|
||||||
|
|
||||||
// 域名列表选项
|
// DomainOptionsAction 域名列表选项
|
||||||
type DomainOptionsAction struct {
|
type DomainOptionsAction struct {
|
||||||
actionutils.ParentAction
|
actionutils.ParentAction
|
||||||
}
|
}
|
||||||
@@ -23,8 +23,8 @@ func (this *DomainOptionsAction) RunPost(params struct {
|
|||||||
}
|
}
|
||||||
domainMaps := []maps.Map{}
|
domainMaps := []maps.Map{}
|
||||||
for _, domain := range domainsResp.DnsDomains {
|
for _, domain := range domainsResp.DnsDomains {
|
||||||
// 未开启的先跳过
|
// 未开启或者已删除的先跳过
|
||||||
if !domain.IsOn {
|
if !domain.IsOn || domain.IsDeleted {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
27
internal/web/actions/default/dns/domains/recover.go
Normal file
27
internal/web/actions/default/dns/domains/recover.go
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
package domains
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
|
||||||
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||||
|
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||||
|
)
|
||||||
|
|
||||||
|
type RecoverAction struct {
|
||||||
|
actionutils.ParentAction
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *RecoverAction) RunPost(params struct {
|
||||||
|
DomainId int64
|
||||||
|
}) {
|
||||||
|
// 记录日志
|
||||||
|
defer this.CreateLog(oplogs.LevelInfo, "从DNS服务商中恢复域名 %d", params.DomainId)
|
||||||
|
|
||||||
|
// 执行恢复
|
||||||
|
_, err := this.RPC().DNSDomainRPC().RecoverDNSDomain(this.AdminContext(), &pb.RecoverDNSDomainRequest{DnsDomainId: params.DomainId})
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.Success()
|
||||||
|
}
|
||||||
@@ -52,7 +52,7 @@ func (this *UpdatePopupAction) RunPost(params struct {
|
|||||||
// TODO 检查DomainId
|
// TODO 检查DomainId
|
||||||
|
|
||||||
// 记录日志
|
// 记录日志
|
||||||
defer this.CreateLog(oplogs.LevelInfo, "修改管理域名到DNS服务商 %d", params.DomainId)
|
defer this.CreateLog(oplogs.LevelInfo, "修改DNS服务商域名 %d", params.DomainId)
|
||||||
|
|
||||||
params.Must.
|
params.Must.
|
||||||
Field("name", params.Name).
|
Field("name", params.Name).
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ func init() {
|
|||||||
GetPost("/createPopup", new(domains.CreatePopupAction)).
|
GetPost("/createPopup", new(domains.CreatePopupAction)).
|
||||||
GetPost("/updatePopup", new(domains.UpdatePopupAction)).
|
GetPost("/updatePopup", new(domains.UpdatePopupAction)).
|
||||||
Post("/delete", new(domains.DeleteAction)).
|
Post("/delete", new(domains.DeleteAction)).
|
||||||
|
Post("/recover", new(domains.RecoverAction)).
|
||||||
Post("/sync", new(domains.SyncAction)).
|
Post("/sync", new(domains.SyncAction)).
|
||||||
Get("/routesPopup", new(domains.RoutesPopupAction)).
|
Get("/routesPopup", new(domains.RoutesPopupAction)).
|
||||||
GetPost("/selectPopup", new(domains.SelectPopupAction)).
|
GetPost("/selectPopup", new(domains.SelectPopupAction)).
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ func (this *ProviderAction) RunGet(params struct {
|
|||||||
"name": domain.Name,
|
"name": domain.Name,
|
||||||
"isOn": domain.IsOn,
|
"isOn": domain.IsOn,
|
||||||
"isUp": domain.IsUp,
|
"isUp": domain.IsUp,
|
||||||
|
"isDeleted": domain.IsDeleted,
|
||||||
"dataUpdatedTime": dataUpdatedTime,
|
"dataUpdatedTime": dataUpdatedTime,
|
||||||
"countRoutes": len(domain.Routes),
|
"countRoutes": len(domain.Routes),
|
||||||
"countServerRecords": domain.CountServerRecords,
|
"countServerRecords": domain.CountServerRecords,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{$layout "layout_popup"}
|
{$layout "layout_popup"}
|
||||||
|
|
||||||
<h3>添加管理域名</h3>
|
<h3>修改管理域名</h3>
|
||||||
|
|
||||||
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
|
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
|
||||||
<input type="hidden" name="domainId" :value="domain.id"/>
|
<input type="hidden" name="domainId" :value="domain.id"/>
|
||||||
|
|||||||
@@ -99,58 +99,62 @@
|
|||||||
|
|
||||||
<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">
|
<div v-for="state in [1, 0]">
|
||||||
<thead>
|
<div v-if="state == 0 && hasDeletedDomains">
|
||||||
<tr>
|
<h4 style="margin-top: 2em">已删除的域名</h4>
|
||||||
<th>域名</th>
|
</div>
|
||||||
<th class="center" style="width: 7em">线路</th>
|
<table class="ui table selectable celled" v-if="domains.length > 0 && (state == 1 || hasDeletedDomains)">
|
||||||
<th class="center" style="width: 6em">集群</th>
|
<thead>
|
||||||
<th class="center" style="width: 7em">节点域名</th>
|
<tr>
|
||||||
<th class="center" style="width: 7em">服务域名</th>
|
<th>域名</th>
|
||||||
<th>数据更新时间</th>
|
<th class="center" style="width: 7em">线路</th>
|
||||||
<th class="center width10">状态</th>
|
<th class="center" style="width: 6em">集群</th>
|
||||||
<th class="three op">操作</th>
|
<th class="center" style="width: 7em">节点域名</th>
|
||||||
</tr>
|
<th class="center" style="width: 7em">服务域名</th>
|
||||||
</thead>
|
<th>数据更新时间</th>
|
||||||
<tr v-for="(domain, index) in domains">
|
<th class="center width10">状态</th>
|
||||||
<td>{{domain.name}}</td>
|
<th class="three op">操作</th>
|
||||||
<td class="center">
|
</tr>
|
||||||
<a href="" v-if="domain.countRoutes > 0" @click.prevent="showRoutes(domain.id)">{{domain.countRoutes}}个<popup-icon></popup-icon></a>
|
</thead>
|
||||||
<span v-else class="disabled">0个</span>
|
<tr v-for="(domain, index) in domains" v-if="(state == 1 && !domain.isDeleted) || (state == 0 && domain.isDeleted)">
|
||||||
</td>
|
<td>{{domain.name}}</td>
|
||||||
<td class="center">
|
<td class="center">
|
||||||
<a href="" v-if="domain.countClusters > 0" @click.prevent="viewClusters(domain.id)">{{domain.countClusters}}<popup-icon></popup-icon></a>
|
<a href="" v-if="domain.countRoutes > 0" @click.prevent="showRoutes(domain.id)">{{domain.countRoutes}}个<popup-icon></popup-icon></a>
|
||||||
<span v-else class="disabled">0个</span>
|
<span v-else class="disabled">0个</span>
|
||||||
</td>
|
</td>
|
||||||
<td class="center">
|
<td class="center">
|
||||||
<a href="" v-if="domain.countAllNodes > 0" @click.prevent="viewNodes(domain.id)">{{domain.countNodeRecords}}/{{domain.countAllNodes}}个<popup-icon></popup-icon></a>
|
<a href="" v-if="domain.countClusters > 0" @click.prevent="viewClusters(domain.id)">{{domain.countClusters}}<popup-icon></popup-icon></a>
|
||||||
<span v-else class="disabled">0个</span>
|
<span v-else class="disabled">0个</span>
|
||||||
</td>
|
</td>
|
||||||
<td class="center">
|
<td class="center">
|
||||||
<a href="" v-if="domain.countAllServers > 0" @click.prevent="viewServers(domain.id)">{{domain.countServerRecords}}/{{domain.countAllServers}}个<popup-icon></popup-icon></a>
|
<a href="" v-if="domain.countAllNodes > 0" @click.prevent="viewNodes(domain.id)">{{domain.countNodeRecords}}/{{domain.countAllNodes}}个<popup-icon></popup-icon></a>
|
||||||
<span v-else class="disabled">0个</span>
|
<span v-else class="disabled">0个</span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td class="center">
|
||||||
<span v-if="domain.dataUpdatedTime.length > 0">{{domain.dataUpdatedTime}}</span>
|
<a href="" v-if="domain.countAllServers > 0" @click.prevent="viewServers(domain.id)">{{domain.countServerRecords}}/{{domain.countAllServers}}个<popup-icon></popup-icon></a>
|
||||||
<span v-else class="disabled">尚未更新</span>
|
<span v-else class="disabled">0个</span>
|
||||||
</td>
|
</td>
|
||||||
<td class="center">
|
<td>
|
||||||
<div v-if="domain.countRoutes == 0 || domain.nodesChanged || domain.serversChanged">
|
<span v-if="domain.dataUpdatedTime.length > 0">{{domain.dataUpdatedTime}}</span>
|
||||||
<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 class="disabled">尚未更新</span>
|
||||||
<span v-else>正在同步...</span>
|
</td>
|
||||||
</div>
|
<td class="center">
|
||||||
<div v-else-if="!domain.isUp">
|
<span v-if="!domain.isOn"><label-on :v-is-on="domain.isOn"></label-on></span>
|
||||||
<a href="" style="border-bottom: 1px #db2828 dashed" @click.prevent="alertDown"><span class="red">已下线</span></a>
|
<div v-else-if="domain.countRoutes == 0 || domain.nodesChanged || domain.serversChanged">
|
||||||
</div>
|
<a href="" style="border-bottom: 1px #db2828 dashed" title="点击和DNS服务商系统同步" @click.prevent="syncDomain(index,domain)" v-if="!domain.isSyncing"><span class="red">需要同步</span></a>
|
||||||
<div v-else>
|
<span v-else>正在同步...</span>
|
||||||
<label-on :v-is-on="domain.isOn"></label-on>
|
</div>
|
||||||
</div>
|
<div v-else-if="!domain.isUp">
|
||||||
</td>
|
<a href="" style="border-bottom: 1px #db2828 dashed" @click.prevent="alertDown"><span class="red">已下线</span></a>
|
||||||
<td>
|
</div>
|
||||||
<a href="" @click.prevent="syncDomain(index, domain)" v-if="!domain.isSyncing">同步</a>
|
</td>
|
||||||
<span v-else>正在同步...</span>
|
<td>
|
||||||
<a href="" @click.prevent="updateDomain(domain.id)" v-if="!domain.isSyncing">修改</a>
|
<a href="" @click.prevent="syncDomain(index, domain)" v-if="!domain.isSyncing">同步</a>
|
||||||
<a href="" @click.prevent="deleteDomain(domain)" v-if="!domain.isSyncing">删除</a>
|
<span v-else>正在同步...</span>
|
||||||
</td>
|
<a href="" @click.prevent="updateDomain(domain.id)" v-if="!domain.isSyncing">修改</a>
|
||||||
</tr>
|
<a href="" @click.prevent="deleteDomain(domain)" v-if="!domain.isSyncing && !domain.isDeleted">删除</a>
|
||||||
</table>
|
<a href="" @click.prevent="recoverDomain(domain)" v-if="!domain.isSyncing && domain.isDeleted">恢复</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
Tea.context(function () {
|
Tea.context(function () {
|
||||||
this.isUpdatingDomains = false
|
this.isUpdatingDomains = false
|
||||||
|
this.hasDeletedDomains = this.domains.$find(function (k, v) {return v.isDeleted}) != null
|
||||||
|
|
||||||
this.$delay(function () {
|
this.$delay(function () {
|
||||||
this.syncDomains()
|
this.syncDomains()
|
||||||
@@ -66,6 +67,18 @@ Tea.context(function () {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.recoverDomain = function (domain) {
|
||||||
|
let that = this
|
||||||
|
teaweb.confirm("确定要恢复域名\"" + domain.name + "\"吗?", function () {
|
||||||
|
that.$post("/dns/domains/recover")
|
||||||
|
.params({
|
||||||
|
domainId: domain.id
|
||||||
|
})
|
||||||
|
.post()
|
||||||
|
.refresh()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
this.syncDomain = function (index, domain) {
|
this.syncDomain = function (index, domain) {
|
||||||
let that = this
|
let that = this
|
||||||
teaweb.confirm("确定要同步此域名下的所有解析记录吗?", function () {
|
teaweb.confirm("确定要同步此域名下的所有解析记录吗?", function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user