mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-12-10 00:00:26 +08:00
实现完整的集群、域名同步
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
<span v-if="dnsInfo.domainName.length > 0"><var>{{dnsInfo.dnsName}}</var>.{{dnsInfo.domainName}}</span>
|
||||
<span v-else class="disabled">没有设置</span>
|
||||
|
||||
<a href="" @click.prevent="updateClusterDNS(cluster.id)">[修改]</a>
|
||||
<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>
|
||||
@@ -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()
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -1,3 +1,50 @@
|
||||
{$layout}
|
||||
|
||||
<p class="ui message">此功能暂未开放,敬请期待。</p>
|
||||
<first-menu>
|
||||
<span class="item" v-if="issues.length > 0">共<span class="red">{{issues.length}}</span>个问题</span>
|
||||
<span class="item" v-if="issues.length > 0">|</span>
|
||||
<a href="/dns/issues" title="刷新" class="item" @click.prevent="reload">刷新</a>
|
||||
<span class="item">|</span>
|
||||
<span class="item"><tip-icon content="这里是一个全局的DNS解析问题发现页,方便我们诊断并修复问题。"></tip-icon></span>
|
||||
</first-menu>
|
||||
|
||||
<div v-if="isRequesting">
|
||||
<div class="margin"></div>
|
||||
正在检查系统问题,请耐心等待...
|
||||
</div>
|
||||
|
||||
<div v-if="issues.length == 0 && !isRequesting">
|
||||
<div class="margin"></div>
|
||||
<p class="comment">暂时没有发现问题。</p>
|
||||
</div>
|
||||
|
||||
<table class="ui table selectable" v-if="issues.length > 0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 50%">问题对象</th>
|
||||
<th>问题描述</th>
|
||||
<th class="two op">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr v-for="issue in issues">
|
||||
<td>
|
||||
<div v-if="issue.type == 'cluster'">
|
||||
集群 "{{issue.target}}" <link-icon :href="'/clusters/cluster?clusterId=' + issue.targetId"></link-icon>
|
||||
</div>
|
||||
<div v-if="issue.type == 'node'">
|
||||
集群 "{{issue.params.clusterName}}" 节点 "{{issue.target}}" <link-icon :href="'/clusters/cluster/node?clusterId=' + issue.params.clusterId + '&nodeId=' + issue.targetId"></link-icon>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<span>{{issue.description}}</span>
|
||||
</td>
|
||||
<td>
|
||||
<div v-if="issue.type == 'cluster'">
|
||||
<link-red @click.prevent="updateCluster(issue.targetId)">修复</link-red>
|
||||
</div>
|
||||
<div v-if="issue.type == 'node'">
|
||||
<link-red @click.prevent="updateNode(issue.targetId)">修复</link-red>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
41
web/views/@default/dns/issues/index.js
Normal file
41
web/views/@default/dns/issues/index.js
Normal file
@@ -0,0 +1,41 @@
|
||||
Tea.context(function () {
|
||||
this.isRequesting = true
|
||||
|
||||
this.$delay(function () {
|
||||
this.reload()
|
||||
})
|
||||
|
||||
this.updateCluster = function (clusterId) {
|
||||
let that = this
|
||||
teaweb.popup("/dns/updateClusterPopup?clusterId=" + clusterId, {
|
||||
height: "22em",
|
||||
callback: function () {
|
||||
teaweb.success("保存成功", function () {
|
||||
that.reload()
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
this.updateNode = function (nodeId) {
|
||||
let that = this
|
||||
teaweb.popup("/dns/issues/updateNodePopup?nodeId=" + nodeId, {
|
||||
callback: function () {
|
||||
teaweb.success("保存成功", function () {
|
||||
that.reload()
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
this.reload = function () {
|
||||
this.isRequesting = true
|
||||
this.$post("$")
|
||||
.success(function (resp) {
|
||||
this.issues = resp.data.issues;
|
||||
})
|
||||
.done(function () {
|
||||
this.isRequesting = false
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -8,6 +8,12 @@
|
||||
<csrf-token></csrf-token>
|
||||
|
||||
<table class="ui table definition selectable">
|
||||
<tr v-if="domainName.length > 0">
|
||||
<td>主域名</td>
|
||||
<td>{{domainName}}
|
||||
<p class="comment">由当前节点所属集群设置。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title">IP地址 *</td>
|
||||
<td>
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
<tr>
|
||||
<th>域名</th>
|
||||
<th>线路</th>
|
||||
<th>集群域名</th>
|
||||
<th>节点域名</th>
|
||||
<th>服务域名</th>
|
||||
<th>数据更新时间</th>
|
||||
<th>状态</th>
|
||||
@@ -54,11 +54,11 @@
|
||||
<span v-else class="disabled">0个</span>
|
||||
</td>
|
||||
<td>
|
||||
<a href="" v-if="domain.countClusterRecords > 0">{{domain.countClusterRecords}}个</a>
|
||||
<span v-if="domain.countNodeRecords > 0">{{domain.countNodeRecords}}个</span>
|
||||
<span v-else class="disabled">0个</span>
|
||||
</td>
|
||||
<td>
|
||||
<a href="" v-if="domain.countServerRecords > 0">{{domain.countServerRecords}}个</a>
|
||||
<span v-if="domain.countServerRecords > 0">{{domain.countServerRecords}}个</span>
|
||||
<span v-else class="disabled">0个</span>
|
||||
</td>
|
||||
<td>
|
||||
@@ -66,7 +66,7 @@
|
||||
<span v-else class="disabled">尚未更新</span>
|
||||
</td>
|
||||
<td>
|
||||
<div v-if="domain.countRoutes == 0 || !domain.allClustersResolved || !domain.allServersResolved">
|
||||
<div v-if="domain.countRoutes == 0 || domain.nodesChanged || domain.serversChanged">
|
||||
<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>
|
||||
|
||||
@@ -43,29 +43,33 @@ Tea.context(function () {
|
||||
}
|
||||
|
||||
this.syncDomain = function (index, domain) {
|
||||
domain.isSyncing = true
|
||||
Vue.set(this.domains, index, domain)
|
||||
let that = this
|
||||
teaweb.confirm("确定要同步此域名下的所有解析记录吗?", function () {
|
||||
domain.isSyncing = true
|
||||
Vue.set(that.domains, index, domain)
|
||||
|
||||
this.$post("/dns/domains/sync")
|
||||
.params({
|
||||
domainId: domain.id
|
||||
})
|
||||
.success(function () {
|
||||
teaweb.success("同步成功", function () {
|
||||
teaweb.reload()
|
||||
this.$post("/dns/domains/sync")
|
||||
.params({
|
||||
domainId: domain.id
|
||||
})
|
||||
})
|
||||
.fail(function (resp) {
|
||||
teaweb.warn(resp.message, function () {
|
||||
if (resp.data.shouldFix) {
|
||||
window.location = "/dns/issues"
|
||||
}
|
||||
.success(function () {
|
||||
teaweb.success("同步成功", function () {
|
||||
teaweb.reload()
|
||||
})
|
||||
})
|
||||
})
|
||||
.done(function () {
|
||||
domain.isSyncing = false
|
||||
Vue.set(this.domains, index, domain)
|
||||
})
|
||||
.fail(function (resp) {
|
||||
teaweb.warn(resp.message, function () {
|
||||
if (resp.data.shouldFix) {
|
||||
window.location = "/dns/issues"
|
||||
}
|
||||
})
|
||||
})
|
||||
.done(function () {
|
||||
domain.isSyncing = false
|
||||
that.dnsHasChanges = false
|
||||
Vue.set(that.domains, index, domain)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
this.showRoutes = function (domainId) {
|
||||
|
||||
Reference in New Issue
Block a user