实现完整的集群、域名同步

This commit is contained in:
GoEdgeLab
2020-11-14 21:28:14 +08:00
parent 28325f45a9
commit c1ec6a0319
17 changed files with 279 additions and 61 deletions

View File

@@ -17,7 +17,7 @@
<span v-if="dnsInfo.domainName.length > 0"><var>{{dnsInfo.dnsName}}</var>.{{dnsInfo.domainName}}</span>
<span v-else class="disabled">没有设置</span>
&nbsp; <a href="" @click.prevent="updateClusterDNS(cluster.id)">[修改]</a>
&nbsp; <a href="" @click.prevent="updateCluster(cluster.id)">[修改]</a>
</td>
</tr>
<tr>
@@ -30,6 +30,16 @@
<span v-else class="disabled">没有设置</span>
</td>
</tr>
<tr v-if="dnsInfo.domainName.length > 0">
<td>操作</td>
<td>
<div v-if="!isSyncing">
<link-red v-if="dnsHasChanges" @click.prevent="syncCluster(cluster.id)">检测到解析记录有变化,需要同步</link-red>
<a href="" @click.prevent="syncCluster(cluster.id)" v-else>DNS服务商同步</a>
</div>
<span v-else>DNS服务商同步中...</span>
</td>
</tr>
</table>
<p class="comment">下面的DNS解析记录也可以手工在DNS服务商提供的管理平台添加。</p>
@@ -48,10 +58,10 @@
</tr>
</thead>
<tr v-for="node in nodes">
<td><link-icon :href="'/clusters/cluster/node?nodeId=' + node.id">{{node.name}}</link-icon></td>
<td><link-icon :href="'/clusters/cluster/node?clusterId=' + node.clusterId + '&nodeId=' + node.id">{{node.name}}</link-icon></td>
<td>
<span v-if="dnsInfo.dnsName.length > 0">{{dnsInfo.dnsName}}</span>
<link-red v-else @click.prevent="updateClusterDNS(cluster.id)">没有设置</link-red>
<link-red v-else @click.prevent="updateCluster(cluster.id)">没有设置</link-red>
</td>
<td>A</td>
<td>
@@ -85,7 +95,7 @@
<td>CNAME</td>
<td>
<span v-if="dnsInfo.domainName.length > 0"><var>{{dnsInfo.dnsName}}</var>.{{dnsInfo.domainName}}.</span>
<link-red title="点击设置" v-else @click.prevent="updateClusterDNS(cluster.id)">没有设置</link-red>
<link-red title="点击设置" v-else @click.prevent="updateCluster(cluster.id)">没有设置</link-red>
</td>
</tr>
</table>

View File

@@ -1,5 +1,5 @@
Tea.context(function () {
this.updateClusterDNS = function (clusterId) {
this.updateCluster = function (clusterId) {
teaweb.popup("/dns/updateClusterPopup?clusterId=" + clusterId, {
height: "22em",
callback: function () {
@@ -19,4 +19,22 @@ Tea.context(function () {
}
})
}
this.isSyncing = false
this.syncCluster = function (clusterId) {
let that = this
teaweb.confirm("确定要执行数据同步吗?", function () {
that.isSyncing = true
that.$post(".sync")
.params({clusterId: clusterId})
.done(function () {
that.isSyncing = false
})
.success(function () {
teaweb.success("同步成功", function () {
teaweb.reload()
})
})
})
}
})