mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-07 15:20:25 +08:00
在集群中可以设置自动加入DNS的CNAME记录
This commit is contained in:
@@ -46,6 +46,12 @@ func (this *IndexAction) RunGet(params struct {
|
|||||||
this.Data["domainName"] = dnsInfoResp.Domain.Name
|
this.Data["domainName"] = dnsInfoResp.Domain.Name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(dnsInfoResp.CnameRecords) == 0 {
|
||||||
|
this.Data["cnameRecords"] = []string{}
|
||||||
|
} else {
|
||||||
|
this.Data["cnameRecords"] = dnsInfoResp.CnameRecords
|
||||||
|
}
|
||||||
|
|
||||||
this.Show()
|
this.Show()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,6 +62,7 @@ func (this *IndexAction) RunPost(params struct {
|
|||||||
DnsName string
|
DnsName string
|
||||||
NodesAutoSync bool
|
NodesAutoSync bool
|
||||||
ServersAutoSync bool
|
ServersAutoSync bool
|
||||||
|
CnameRecords []string
|
||||||
|
|
||||||
Must *actions.Must
|
Must *actions.Must
|
||||||
CSRF *actionutils.CSRF
|
CSRF *actionutils.CSRF
|
||||||
@@ -97,6 +104,7 @@ func (this *IndexAction) RunPost(params struct {
|
|||||||
DnsDomainId: params.DnsDomainId,
|
DnsDomainId: params.DnsDomainId,
|
||||||
NodesAutoSync: params.NodesAutoSync,
|
NodesAutoSync: params.NodesAutoSync,
|
||||||
ServersAutoSync: params.ServersAutoSync,
|
ServersAutoSync: params.ServersAutoSync,
|
||||||
|
CnameRecords: params.CnameRecords,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
this.ErrorPage(err)
|
this.ErrorPage(err)
|
||||||
|
|||||||
@@ -61,6 +61,12 @@ func (this *ClusterAction) RunGet(params struct {
|
|||||||
dnsMap["providerTypeName"] = dnsResp.Provider.TypeName
|
dnsMap["providerTypeName"] = dnsResp.Provider.TypeName
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(dnsResp.CnameRecords) > 0 {
|
||||||
|
dnsMap["cnameRecords"] = dnsResp.CnameRecords
|
||||||
|
} else {
|
||||||
|
dnsMap["cnameRecords"] = []string{}
|
||||||
|
}
|
||||||
|
|
||||||
this.Data["dnsInfo"] = dnsMap
|
this.Data["dnsInfo"] = dnsMap
|
||||||
|
|
||||||
// 节点DNS解析记录
|
// 节点DNS解析记录
|
||||||
|
|||||||
@@ -46,6 +46,12 @@ func (this *UpdateClusterPopupAction) RunGet(params struct {
|
|||||||
this.Data["providerId"] = 0
|
this.Data["providerId"] = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(dnsResp.CnameRecords) == 0 {
|
||||||
|
this.Data["cnameRecords"] = []string{}
|
||||||
|
} else {
|
||||||
|
this.Data["cnameRecords"] = dnsResp.CnameRecords
|
||||||
|
}
|
||||||
|
|
||||||
// 所有服务商
|
// 所有服务商
|
||||||
providerTypesResp, err := this.RPC().DNSProviderRPC().FindAllDNSProviderTypes(this.AdminContext(), &pb.FindAllDNSProviderTypesRequest{})
|
providerTypesResp, err := this.RPC().DNSProviderRPC().FindAllDNSProviderTypes(this.AdminContext(), &pb.FindAllDNSProviderTypesRequest{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -70,6 +76,7 @@ func (this *UpdateClusterPopupAction) RunPost(params struct {
|
|||||||
DomainId int64
|
DomainId int64
|
||||||
NodesAutoSync bool
|
NodesAutoSync bool
|
||||||
ServersAutoSync bool
|
ServersAutoSync bool
|
||||||
|
CnameRecords []string
|
||||||
|
|
||||||
Must *actions.Must
|
Must *actions.Must
|
||||||
CSRF *actionutils.CSRF
|
CSRF *actionutils.CSRF
|
||||||
@@ -103,6 +110,7 @@ func (this *UpdateClusterPopupAction) RunPost(params struct {
|
|||||||
DnsDomainId: params.DomainId,
|
DnsDomainId: params.DomainId,
|
||||||
NodesAutoSync: params.NodesAutoSync,
|
NodesAutoSync: params.NodesAutoSync,
|
||||||
ServersAutoSync: params.ServersAutoSync,
|
ServersAutoSync: params.ServersAutoSync,
|
||||||
|
CnameRecords: params.CnameRecords,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
this.ErrorPage(err)
|
this.ErrorPage(err)
|
||||||
|
|||||||
@@ -6,7 +6,12 @@ Vue.component("label-on", {
|
|||||||
|
|
||||||
// 文字代码标签
|
// 文字代码标签
|
||||||
Vue.component("code-label", {
|
Vue.component("code-label", {
|
||||||
template: `<span class="ui label basic tiny" style="padding: 3px;margin-left:2px;margin-right:2px"><slot></slot></span>`
|
methods: {
|
||||||
|
click: function (args) {
|
||||||
|
this.$emit("click", args)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
template: `<span class="ui label basic tiny" style="padding: 3px;margin-left:2px;margin-right:2px" @click.prevent="click"><slot></slot></span>`
|
||||||
})
|
})
|
||||||
|
|
||||||
// tiny标签
|
// tiny标签
|
||||||
|
|||||||
@@ -55,6 +55,9 @@ Vue.component("values-box", {
|
|||||||
},
|
},
|
||||||
updateAll: function (values) {
|
updateAll: function (values) {
|
||||||
this.vValeus = values
|
this.vValeus = values
|
||||||
|
},
|
||||||
|
addValue: function (v) {
|
||||||
|
this.vValues.push(v)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
template: `<div>
|
template: `<div>
|
||||||
|
|||||||
@@ -26,6 +26,13 @@
|
|||||||
<p class="comment">当前集群的子域名,和主域名一起组成集群节点的子域名。</p>
|
<p class="comment">当前集群的子域名,和主域名一起组成集群节点的子域名。</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>自动设置CNAME记录</td>
|
||||||
|
<td>
|
||||||
|
<values-box :values="cnameRecords" name="cnameRecords" placeholder="记录名" ref="cnameRecords"></values-box>
|
||||||
|
<p class="comment">除了集群节点记录之外,自动加入的CNAME记录,比如<code-label @click.prevent="addCnameRecord('@')">@</code-label>、<code-label @click.prevent="addCnameRecord('www')">www</code-label>。</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2"><more-options-indicator></more-options-indicator></td>
|
<td colspan="2"><more-options-indicator></more-options-indicator></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -6,4 +6,8 @@ Tea.context(function () {
|
|||||||
this.domain.id = domain.id
|
this.domain.id = domain.id
|
||||||
this.domain.name = domain.name
|
this.domain.name = domain.name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.addCnameRecord = function (name) {
|
||||||
|
this.$refs.cnameRecords.addValue(name)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
@@ -31,6 +31,15 @@
|
|||||||
<span v-else class="disabled">没有设置</span>
|
<span v-else class="disabled">没有设置</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>自动设置CNAME记录</td>
|
||||||
|
<td>
|
||||||
|
<span v-if="dnsInfo.cnameRecords.length == 0" class="disabled">暂时还没有设置。</span>
|
||||||
|
<div v-else>
|
||||||
|
<span v-for="record in dnsInfo.cnameRecords" class="ui label basic small">{{record}}</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr v-if="dnsInfo.domainName.length > 0">
|
<tr v-if="dnsInfo.domainName.length > 0">
|
||||||
<td>操作</td>
|
<td>操作</td>
|
||||||
<td>
|
<td>
|
||||||
|
|||||||
@@ -44,6 +44,13 @@
|
|||||||
<p class="comment">子域名和主域名共同组成集群的域名。</p>
|
<p class="comment">子域名和主域名共同组成集群的域名。</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>自动设置CNAME记录</td>
|
||||||
|
<td>
|
||||||
|
<values-box :values="cnameRecords" name="cnameRecords" placeholder="记录名" ref="cnameRecords"></values-box>
|
||||||
|
<p class="comment">除了集群节点记录之外,自动加入的CNAME记录,比如<code-label @click.prevent="addCnameRecord('@')">@</code-label>、<code-label @click.prevent="addCnameRecord('www')">www</code-label>。</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2"><more-options-indicator></more-options-indicator></td>
|
<td colspan="2"><more-options-indicator></more-options-indicator></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -77,4 +77,11 @@ Tea.context(function () {
|
|||||||
this.domain = domainInfo.name
|
this.domain = domainInfo.name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自动设置CNAME
|
||||||
|
*/
|
||||||
|
this.addCnameRecord = function (name) {
|
||||||
|
this.$refs.cnameRecords.addValue(name)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
Reference in New Issue
Block a user