mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-12 03:10:26 +08:00
集群DNS子域名可以随机生成
This commit is contained in:
@@ -0,0 +1,18 @@
|
|||||||
|
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
|
||||||
|
|
||||||
|
package dns
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||||
|
"github.com/iwind/TeaGo/rands"
|
||||||
|
)
|
||||||
|
|
||||||
|
type RandomNameAction struct {
|
||||||
|
actionutils.ParentAction
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *RandomNameAction) RunPost(params struct{}) {
|
||||||
|
this.Data["name"] = "cluster" + rands.HexString(8)
|
||||||
|
|
||||||
|
this.Success()
|
||||||
|
}
|
||||||
@@ -39,6 +39,7 @@ func init() {
|
|||||||
// DNS
|
// DNS
|
||||||
Prefix("/clusters/cluster/settings/dns").
|
Prefix("/clusters/cluster/settings/dns").
|
||||||
GetPost("", new(dns.IndexAction)).
|
GetPost("", new(dns.IndexAction)).
|
||||||
|
Post("/randomName", new(dns.RandomNameAction)).
|
||||||
|
|
||||||
// 消息
|
// 消息
|
||||||
Prefix("/clusters/cluster/settings/message").
|
Prefix("/clusters/cluster/settings/message").
|
||||||
@@ -78,7 +79,6 @@ func init() {
|
|||||||
// WebP
|
// WebP
|
||||||
Prefix("/clusters/cluster/settings/webp").
|
Prefix("/clusters/cluster/settings/webp").
|
||||||
GetPost("", new(webp.IndexAction)).
|
GetPost("", new(webp.IndexAction)).
|
||||||
|
|
||||||
EndAll()
|
EndAll()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,11 +20,11 @@
|
|||||||
<td class="title">DNS子域名 *</td>
|
<td class="title">DNS子域名 *</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="ui input right labeled">
|
<div class="ui input right labeled">
|
||||||
<input type="text" name="dnsName" maxlength="64" style="width:10em" v-model="dnsName"/>
|
<input type="text" name="dnsName" maxlength="64" style="width:12em" v-model="dnsName"/>
|
||||||
<span class="ui label" v-if="domain != null && domain.name != null && domain.name.length > 0">.{{domain.name}}</span>
|
<span class="ui label" v-if="domain != null && domain.name != null && domain.name.length > 0">.{{domain.name}}</span>
|
||||||
<span class="ui label" v-else>.主域名</span>
|
<span class="ui label" v-else>.主域名</span>
|
||||||
</div>
|
</div>
|
||||||
<p class="comment">当前集群的子域名,和主域名一起组成集群节点的子域名。</p>
|
<p class="comment">当前集群的子域名,和主域名一起组成集群节点的子域名。<a href="" @click.prevent="generateRandName()">[随机生成]</a>。</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -10,4 +10,11 @@ Tea.context(function () {
|
|||||||
this.addCnameRecord = function (name) {
|
this.addCnameRecord = function (name) {
|
||||||
this.$refs.cnameRecords.addValue(name)
|
this.$refs.cnameRecords.addValue(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.generateRandName = function () {
|
||||||
|
this.$post(".randomName")
|
||||||
|
.success(function (resp) {
|
||||||
|
this.dnsName = resp.data.name
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
Reference in New Issue
Block a user