mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-12-28 13:36:37 +08:00
实现基本的集群DNS列表、设置、简单数据同步
This commit is contained in:
@@ -39,21 +39,46 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th>域名</th>
|
||||
<th>线路</th>
|
||||
<th>集群域名</th>
|
||||
<th>服务域名</th>
|
||||
<th>数据更新时间</th>
|
||||
<th>状态</th>
|
||||
<th class="two op">操作</th>
|
||||
<th class="three op">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr v-for="domain in domains">
|
||||
<tr v-for="(domain, index) in domains">
|
||||
<td>{{domain.name}}</td>
|
||||
<td>
|
||||
<a href="" v-if="domain.countRoutes > 0" @click.prevent="showRoutes(domain.id)">{{domain.countRoutes}}个</a>
|
||||
<span v-else class="disabled">0个</span>
|
||||
</td>
|
||||
<td>
|
||||
<a href="" v-if="domain.countClusterRecords > 0">{{domain.countClusterRecords}}个</a>
|
||||
<span v-else class="disabled">0个</span>
|
||||
</td>
|
||||
<td>
|
||||
<a href="" v-if="domain.countServerRecords > 0">{{domain.countServerRecords}}个</a>
|
||||
<span v-else class="disabled">0个</span>
|
||||
</td>
|
||||
<td>
|
||||
<span v-if="domain.dataUpdatedTime.length > 0">{{domain.dataUpdatedTime}}</span>
|
||||
<span v-else class="disabled">尚未更新</span>
|
||||
</td>
|
||||
<td><label-on :v-is-on="domain.isOn"></label-on></td>
|
||||
<td>
|
||||
<a href="">修改</a>
|
||||
<a href="" @click.prevent="deleteDomain(domain)">删除</a>
|
||||
<div v-if="domain.countRoutes == 0 || !domain.allClustersResolved || !domain.allServersResolved">
|
||||
<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>
|
||||
</div>
|
||||
<div v-else>
|
||||
<label-on :v-is-on="domain.isOn"></label-on>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<a href="" @click.prevent="syncDomain(index, domain)" v-if="!domain.isSyncing">同步</a>
|
||||
<span v-else>正在同步...</span>
|
||||
<a href="" @click.prevent="updateDomain(domain.id)" v-if="!domain.isSyncing">修改</a>
|
||||
<a href="" @click.prevent="deleteDomain(domain)" v-if="!domain.isSyncing">删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -20,6 +20,16 @@ Tea.context(function () {
|
||||
})
|
||||
}
|
||||
|
||||
this.updateDomain = function (domainId) {
|
||||
teaweb.popup("/dns/domains/updatePopup?domainId=" + domainId, {
|
||||
callback: function () {
|
||||
teaweb.success("保存成功", function () {
|
||||
teaweb.reload()
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
this.deleteDomain = function (domain) {
|
||||
let that = this
|
||||
teaweb.confirm("确定要删除域名\"" + domain.name + "\"吗?", function () {
|
||||
@@ -31,4 +41,34 @@ Tea.context(function () {
|
||||
.refresh()
|
||||
})
|
||||
}
|
||||
|
||||
this.syncDomain = function (index, domain) {
|
||||
domain.isSyncing = true
|
||||
Vue.set(this.domains, index, domain)
|
||||
|
||||
this.$post("/dns/domains/sync")
|
||||
.params({
|
||||
domainId: domain.id
|
||||
})
|
||||
.success(function () {
|
||||
teaweb.success("同步成功", function () {
|
||||
teaweb.reload()
|
||||
})
|
||||
})
|
||||
.fail(function (resp) {
|
||||
teaweb.warn(resp.message, function () {
|
||||
if (resp.data.shouldFix) {
|
||||
window.location = "/dns/issues"
|
||||
}
|
||||
})
|
||||
})
|
||||
.done(function () {
|
||||
domain.isSyncing = false
|
||||
Vue.set(this.domains, index, domain)
|
||||
})
|
||||
}
|
||||
|
||||
this.showRoutes = function (domainId) {
|
||||
teaweb.popup("/dns/domains/routesPopup?domainId=" + domainId)
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user