可以修改节点的DNS设置

This commit is contained in:
刘祥超
2020-11-14 09:42:21 +08:00
parent 8b749fbc60
commit cc6123884d
10 changed files with 332 additions and 2 deletions

View File

@@ -0,0 +1,70 @@
{$layout}
<first-menu>
<menu-item :href="'/dns'">所有集群</menu-item>
<span class="item">|</span>
<menu-item :href="'/dns/clusters/cluster?clusterId=' + cluster.id" active="true">{{cluster.name}}</menu-item>
</first-menu>
<table class="ui table definition selectable">
<tr>
<td class="title">集群</td>
<td>{{cluster.name}}</td>
</tr>
<tr>
<td>子域名</td>
<td>
<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>
</td>
</tr>
<tr>
<td>DNS服务商</td>
<td>
<div v-if="dnsInfo.providerName.length > 0">
<a :href="'/dns/providers/provider?providerId=' + dnsInfo.providerId">{{dnsInfo.providerTypeName}} - {{dnsInfo.providerName}}</a>
</div>
<span v-else-if="dnsInfo.domainName.length == 0" class="disabled">请先设置域名</span>
<span v-else class="disabled">没有设置</span>
</td>
</tr>
</table>
<p class="comment">下面的DNS解析记录可以手工在DNS服务商提供的管理平台添加。</p>
<h3>节点DNS解析记录</h3>
<p class="comment" v-if="nodes.length == 0">暂时没有需要设置的DNS记录。</p>
<table class="ui table selectable" v-if="nodes.length > 0">
<thead>
<tr>
<th>节点</th>
<th>记录类型</th>
<th>记录值</th>
<th>线路</th>
<th class="two op">操作</th>
</tr>
</thead>
<tr v-for="node in nodes">
<td><a :href="'/clusters/cluster/node?nodeId=' + node.id">{{node.name}}</a></td>
<td>A</td>
<td>
<span v-if="node.ipAddr.length > 0">{{node.ipAddr}}</span>
<a href="" v-else style="border-bottom: 1px #db2828 dashed" @click.prevent="updateNode(node.id)"><span class="red">没有设置</span></a>
</td>
<td>
<span v-if="node.route.length > 0">{{node.route}}</span>
<a href="" v-else style="border-bottom: 1px #db2828 dashed" @click.prevent="updateNode(node.id)"><span class="red">没有设置</span></a>
</td>
<td>
<a href="" @click.prevent="updateNode(node.id)">修改</a>
</td>
</tr>
</table>
<h3>代理服务解析记录</h3>
<p class="comment" v-if="servers.length == 0">暂时没有需要设置的DNS记录。</p>
<table class="ui table selectable" v-if="servers.length > 0">
</table>

View File

@@ -0,0 +1,22 @@
Tea.context(function () {
this.updateClusterDNS = function (clusterId) {
teaweb.popup("/dns/updateClusterPopup?clusterId=" + clusterId, {
height: "22em",
callback: function () {
teaweb.success("保存成功", function () {
teaweb.reload()
})
}
})
}
this.updateNode = function (nodeId) {
teaweb.popup("/dns/issues/updateNodePopup?nodeId=" + nodeId, {
callback: function () {
teaweb.success("保存成功", function () {
teaweb.reload()
})
}
})
}
})

View File

@@ -7,7 +7,7 @@
<thead>
<tr>
<th>集群</th>
<th>域名解析</th>
<th>域名</th>
<th>DNS服务商</th>
<th>DNS服务商账号</th>
<th class="two op">操作</th>
@@ -30,7 +30,7 @@
<span v-else="" class="disabled">-</span>
</td>
<td>
<a href="" @click.prevent="updateCluster(cluster.id)">修改</a>
<a :href="'/dns/clusters/cluster?clusterId=' + cluster.id">详情</a> &nbsp; <a href="" @click.prevent="updateCluster(cluster.id)">修改</a>
</td>
</tr>
</table>

View File

@@ -0,0 +1,31 @@
{$layout "layout_popup"}
<h3>修改节点DNS设置</h3>
<form class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="nodeId" :value="nodeId"/>
<input type="hidden" name="domainId" :value="domainId"/>
<csrf-token></csrf-token>
<table class="ui table definition selectable">
<tr>
<td class="title">IP地址 *</td>
<td>
<input type="text" name="ipAddr" maxlength="64" ref="focus" v-model="ipAddr"/>
<p class="comment">用于域名解析的节点IP地址。</p>
</td>
</tr>
<tr v-if="domainId > 0">
<td>线路</td>
<td>
<p class="comment" v-if="routes.length == 0">没有可选的线路。</p>
<select class="ui dropdown auto-width" name="route" v-if="routes.length > 0" v-model="route">
<option v-for="route in routes" :value="route">{{route}}</option>
</select>
<p class="comment" v-if="routes.length > 0">当前节点IP对应的线路。</p>
</td>
</tr>
</table>
<submit-btn></submit-btn>
</form>

View File

@@ -0,0 +1,3 @@
Tea.context(function () {
this.success = NotifyPopup
})