[域名解析]优化解析状态显示

This commit is contained in:
GoEdgeLab
2020-12-23 16:49:53 +08:00
parent 834008448c
commit cb006446a3
17 changed files with 557 additions and 18 deletions

View File

@@ -54,6 +54,7 @@
<th>记录类型</th>
<th>记录值</th>
<th>线路</th>
<th>状态</th>
<th class="two op">操作</th>
</tr>
</thead>
@@ -72,6 +73,10 @@
<span v-if="node.route.code.length > 0">{{node.route.name}}</span>
<link-red v-else title="点击设置" @click.prevent="updateNode(node.id)">没有设置</link-red>
</td>
<td>
<span class="green" v-if="node.isResolved">已解析</span>
<span v-else class="red">未解析</span>
</td>
<td>
<link-popup @click.prevent="updateNode(node.id)">修改</link-popup>
</td>
@@ -87,6 +92,7 @@
<th>子域名</th>
<th>记录类型</th>
<th>记录值</th>
<th>状态</th>
</tr>
</thead>
<tr v-for="server in servers">
@@ -97,5 +103,9 @@
<span v-if="dnsInfo.domainName.length > 0"><var>{{dnsInfo.dnsName}}</var>.{{dnsInfo.domainName}}.</span>
<link-red title="点击设置" v-else @click.prevent="updateCluster(cluster.id)">没有设置</link-red>
</td>
<td>
<span class="green" v-if="server.isResolved">已解析</span>
<span v-else class="red">未解析</span>
</td>
</tr>
</table>

View File

@@ -0,0 +1,20 @@
{$layout "layout_popup"}
<h3>使用域名"{{domain}}"的集群</h3>
<table class="ui table selectable">
<thead>
<tr>
<th>集群</th>
<th>域名</th>
<th class="width10">解析状态</th>
</tr>
</thead>
<tr v-for="cluster in clusters">
<td>{{cluster.name}}<a :href="'/clusters/cluster?clusterId=' + cluster.id" target="_blank"><link-icon></link-icon></a> </td>
<td>{{cluster.dnsName}}.{{domain}}</td>
<td>
<span class="green" v-if="cluster.isOk">已解析</span>
<span class="red" v-else>未解析</span>
</td>
</tr>
</table>

View File

@@ -0,0 +1,41 @@
{$layout "layout_popup"}
<h3>使用域名"{{domain}}"的节点</h3>
<form class="ui form">
<div class="ui fields inline">
<div class="ui field">
<input type="text" placeholder="关键词" v-model="keyword"/>
</div>
<div class="ui field">
<select class="ui dropdown auto-width" v-model="status">
<option value="">[全部状态]</option>
<option value="ok">已解析</option>
<option value="notOk">未解析</option>
</select>
</div>
</div>
</form>
<div class="ui divider"></div>
<table class="ui table selectable">
<thead>
<tr>
<th>集群</th>
<th>节点</th>
<th>子域名</th>
<th>线路</th>
<th>IP</th>
<th class="width10">解析状态</th>
</tr>
</thead>
<tr v-for="node in nodes">
<td>{{node.cluster.name}}<a :href="'/clusters/cluster?clusterId=' + node.cluster.id" target="_blank"><link-icon></link-icon></a> </td>
<td>{{node.name}}<a :href="'/clusters/cluster/node?clusterId=' + node.cluster.id + '&nodeId=' + node.id" target="_blank"><link-icon></link-icon></a></td>
<td>{{node.cluster.dnsName}}</td>
<td>{{node.route.name}}</td>
<td>{{node.ipAddr}}</td>
<td>
<span class="green" v-if="node.isOk">已解析</span>
<span class="red" v-else>未解析</span>
</td>
</tr>
</table>

View File

@@ -0,0 +1,45 @@
Tea.context(function () {
this.keyword = ""
this.status = ""
let allNodes = []
this.clusters.forEach(function (cluster) {
let nodes = cluster.nodes
nodes.forEach(function (node) {
node.cluster = cluster
allNodes.push(node)
})
})
this.nodes = allNodes
this.$delay(function () {
this.$watch("keyword", function () {
this.reloadNodes()
})
this.$watch("status", function () {
this.reloadNodes()
})
})
this.reloadNodes = function () {
let that = this
this.nodes = allNodes.$copy().$findAll(function (k, v) {
if (that.keyword.length > 0
&& !teaweb.match(v.cluster.name, that.keyword)
&& !teaweb.match(v.cluster.dnsName, that.keyword)
&& !teaweb.match(v.name, that.keyword)
&& !teaweb.match(v.ipAddr, that.keyword)
&& !teaweb.match(v.route.name, that.keyword)) {
return false
}
if (that.status == "ok" && !v.isOk) {
return false
}
if (that.status == "notOk" && v.isOk) {
return false
}
return true
})
}
})

View File

@@ -0,0 +1,39 @@
{$layout "layout_popup"}
<h3>使用域名"{{domain}}"的节点</h3>
<form class="ui form">
<div class="ui fields inline">
<div class="ui field">
<input type="text" placeholder="关键词" v-model="keyword"/>
</div>
<div class="ui field">
<select class="ui dropdown auto-width" v-model="status">
<option value="">[全部状态]</option>
<option value="ok">已解析</option>
<option value="notOk">未解析</option>
</select>
</div>
</div>
</form>
<div class="ui divider"></div>
<table class="ui table selectable">
<thead>
<tr>
<th>集群</th>
<th>服务</th>
<th>子域名</th>
<th>CNAME</th>
<th class="width10">解析状态</th>
</tr>
</thead>
<tr v-for="server in servers">
<td>{{server.cluster.name}}<a :href="'/clusters/cluster?clusterId=' + server.cluster.id" target="_blank"><link-icon></link-icon></a> </td>
<td>{{server.name}}<a :href="'/servers/server?clusterId=' + server.cluster.id + '&serverId=' + server.id" target="_blank"><link-icon></link-icon></a></td>
<td>{{server.cluster.dnsName}}</td>
<td>{{server.dnsName}}</td>
<td>
<span class="green" v-if="server.isOk">已解析</span>
<span class="red" v-else>未解析</span>
</td>
</tr>
</table>

View File

@@ -0,0 +1,44 @@
Tea.context(function () {
this.keyword = ""
this.status = ""
let allServers = []
this.clusters.forEach(function (cluster) {
let servers = cluster.servers
servers.forEach(function (server) {
server.cluster = cluster
allServers.push(server)
})
})
this.servers = allServers
this.$delay(function () {
this.$watch("keyword", function () {
this.reloadServers()
})
this.$watch("status", function () {
this.reloadServers()
})
})
this.reloadServers = function () {
let that = this
this.servers = allServers.$copy().$findAll(function (k, v) {
if (that.keyword.length > 0
&& !teaweb.match(v.cluster.name, that.keyword)
&& !teaweb.match(v.cluster.dnsName, that.keyword)
&& !teaweb.match(v.name, that.keyword)
&& !teaweb.match(v.dnsName, that.keyword)) {
return false
}
if (that.status == "ok" && !v.isOk) {
return false
}
if (that.status == "notOk" && v.isOk) {
return false
}
return true
})
}
})

View File

@@ -52,9 +52,10 @@
<thead>
<tr>
<th>域名</th>
<th class="width10 center">线路</th>
<th class="width10 center">节点域名</th>
<th class="width10 center">服务域名</th>
<th class="center" style="width: 7em">线路</th>
<th class="center" style="width: 6em">集群</th>
<th class="center" style="width: 7em">节点域名</th>
<th class="center" style="width: 7em">服务域名</th>
<th>数据更新时间</th>
<th class="center width10">状态</th>
<th class="three op">操作</th>
@@ -63,15 +64,19 @@
<tr v-for="(domain, index) in domains">
<td>{{domain.name}}</td>
<td class="center">
<a href="" v-if="domain.countRoutes > 0" @click.prevent="showRoutes(domain.id)">{{domain.countRoutes}}个</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>
</td>
<td class="center">
<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>
</td>
<td class="center">
<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>
</td>
<td class="center">
<span v-if="domain.countNodeRecords > 0">{{domain.countNodeRecords}}</span>
<span v-else class="disabled">0个</span>
</td>
<td class="center">
<span v-if="domain.countServerRecords > 0">{{domain.countServerRecords}}个</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">0个</span>
</td>
<td>

View File

@@ -73,4 +73,19 @@ Tea.context(function () {
this.showRoutes = function (domainId) {
teaweb.popup("/dns/domains/routesPopup?domainId=" + domainId)
}
this.viewClusters = function (domainId) {
teaweb.popup("/dns/domains/clustersPopup?domainId=" + domainId)
}
this.viewNodes = function (domainId) {
teaweb.popup("/dns/domains/nodesPopup?domainId=" + domainId, {
width: "50em",
height: "30em"
})
}
this.viewServers = function (domainId) {
teaweb.popup("/dns/domains/serversPopup?domainId=" + domainId)
}
})