mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-15 04:41:25 +08:00
增加DNS域名管理
This commit is contained in:
@@ -208,6 +208,10 @@ func (this *RPCClient) DNSProviderRPC() pb.DNSProviderServiceClient {
|
|||||||
return pb.NewDNSProviderServiceClient(this.pickConn())
|
return pb.NewDNSProviderServiceClient(this.pickConn())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *RPCClient) DNSDomainRPC() pb.DNSDomainServiceClient {
|
||||||
|
return pb.NewDNSDomainServiceClient(this.pickConn())
|
||||||
|
}
|
||||||
|
|
||||||
// 构造Admin上下文
|
// 构造Admin上下文
|
||||||
func (this *RPCClient) Context(adminId int64) context.Context {
|
func (this *RPCClient) Context(adminId int64) context.Context {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|||||||
60
internal/web/actions/default/dns/domains/createPopup.go
Normal file
60
internal/web/actions/default/dns/domains/createPopup.go
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
package domains
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
|
||||||
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||||
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/dns/domains/domainutils"
|
||||||
|
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||||
|
"github.com/iwind/TeaGo/actions"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
type CreatePopupAction struct {
|
||||||
|
actionutils.ParentAction
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *CreatePopupAction) Init() {
|
||||||
|
this.Nav("", "", "")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *CreatePopupAction) RunGet(params struct {
|
||||||
|
ProviderId int64
|
||||||
|
}) {
|
||||||
|
this.Data["providerId"] = params.ProviderId
|
||||||
|
|
||||||
|
this.Show()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *CreatePopupAction) RunPost(params struct {
|
||||||
|
ProviderId int64
|
||||||
|
Name string
|
||||||
|
|
||||||
|
Must *actions.Must
|
||||||
|
CSRF *actionutils.CSRF
|
||||||
|
}) {
|
||||||
|
// TODO 检查ProviderId
|
||||||
|
|
||||||
|
params.Must.
|
||||||
|
Field("name", params.Name).
|
||||||
|
Require("请输入域名")
|
||||||
|
|
||||||
|
// 校验域名
|
||||||
|
domain := strings.ToLower(params.Name)
|
||||||
|
domain = strings.Replace(domain, " ", "", -1)
|
||||||
|
if !domainutils.ValidateDomainFormat(domain) {
|
||||||
|
this.Fail("域名格式不正确,请修改后重新提交")
|
||||||
|
}
|
||||||
|
|
||||||
|
createResp, err := this.RPC().DNSDomainRPC().CreateDNSDomain(this.AdminContext(), &pb.CreateDNSDomainRequest{
|
||||||
|
DnsProviderId: params.ProviderId,
|
||||||
|
Name: domain,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.CreateLog(oplogs.LevelInfo, "添加管理域名到DNS服务商 %d", createResp.DnsDomainId)
|
||||||
|
|
||||||
|
this.Success()
|
||||||
|
}
|
||||||
38
internal/web/actions/default/dns/domains/delete.go
Normal file
38
internal/web/actions/default/dns/domains/delete.go
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
package domains
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
|
||||||
|
"github.com/TeaOSLab/EdgeAdmin/internal/utils/numberutils"
|
||||||
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||||
|
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||||
|
)
|
||||||
|
|
||||||
|
type DeleteAction struct {
|
||||||
|
actionutils.ParentAction
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *DeleteAction) RunPost(params struct {
|
||||||
|
DomainId int64
|
||||||
|
}) {
|
||||||
|
// 记录日志
|
||||||
|
this.CreateLog(oplogs.LevelInfo, "从DNS服务商中删除域名 %d", params.DomainId)
|
||||||
|
|
||||||
|
// 检查是否正在使用
|
||||||
|
countResp, err := this.RPC().NodeClusterRPC().CountAllEnabledNodeClustersWithDNSDomainId(this.AdminContext(), &pb.CountAllEnabledNodeClustersWithDNSDomainIdRequest{DnsDomainId: params.DomainId})
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if countResp.Count > 0 {
|
||||||
|
this.Fail("当前域名正在被" + numberutils.FormatInt64(countResp.Count) + "个集群所使用,所以不能删除。请修改后再操作。")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 执行删除
|
||||||
|
_, err = this.RPC().DNSDomainRPC().DeleteDNSDomain(this.AdminContext(), &pb.DeleteDNSDomainRequest{DnsDomainId: params.DomainId})
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.Success()
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package domainutils
|
||||||
|
|
||||||
|
import (
|
||||||
|
"regexp"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
// 校验域名格式
|
||||||
|
func ValidateDomainFormat(domain string) bool {
|
||||||
|
pieces := strings.Split(domain, ".")
|
||||||
|
for _, piece := range pieces {
|
||||||
|
if !regexp.MustCompile(`^[a-z0-9-]+$`).MatchString(piece) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
15
internal/web/actions/default/dns/domains/updatePopup.go
Normal file
15
internal/web/actions/default/dns/domains/updatePopup.go
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
package domains
|
||||||
|
|
||||||
|
import "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||||
|
|
||||||
|
type UpdatePopupAction struct {
|
||||||
|
actionutils.ParentAction
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *UpdatePopupAction) Init() {
|
||||||
|
this.Nav("", "", "")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *UpdatePopupAction) RunGet(params struct{}) {
|
||||||
|
this.Show()
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package dns
|
package dns
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/dns/domains"
|
||||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/dns/providers"
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/dns/providers"
|
||||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
|
||||||
"github.com/iwind/TeaGo"
|
"github.com/iwind/TeaGo"
|
||||||
@@ -14,12 +15,22 @@ func init() {
|
|||||||
Prefix("/dns").
|
Prefix("/dns").
|
||||||
Get("", new(IndexAction)).
|
Get("", new(IndexAction)).
|
||||||
|
|
||||||
|
// 服务商
|
||||||
Prefix("/dns/providers").
|
Prefix("/dns/providers").
|
||||||
Data("teaSubMenu", "provider").
|
Data("teaSubMenu", "provider").
|
||||||
Get("", new(providers.IndexAction)).
|
Get("", new(providers.IndexAction)).
|
||||||
GetPost("/createPopup", new(providers.CreatePopupAction)).
|
GetPost("/createPopup", new(providers.CreatePopupAction)).
|
||||||
GetPost("/updatePopup", new(providers.UpdatePopupAction)).
|
GetPost("/updatePopup", new(providers.UpdatePopupAction)).
|
||||||
Post("/delete", new(providers.DeleteAction)).
|
Post("/delete", new(providers.DeleteAction)).
|
||||||
|
Get("/provider", new(providers.ProviderAction)).
|
||||||
|
EndData().
|
||||||
|
|
||||||
|
// 域名
|
||||||
|
Prefix("/dns/domains").
|
||||||
|
Data("teaSubMenu", "provider").
|
||||||
|
GetPost("/createPopup", new(domains.CreatePopupAction)).
|
||||||
|
GetPost("/updatePopup", new(domains.UpdatePopupAction)).
|
||||||
|
Post("/delete", new(domains.DeleteAction)).
|
||||||
EndData().
|
EndData().
|
||||||
|
|
||||||
EndAll()
|
EndAll()
|
||||||
|
|||||||
@@ -71,7 +71,6 @@ func (this *CreatePopupAction) RunPost(params struct {
|
|||||||
Name: params.Name,
|
Name: params.Name,
|
||||||
Type: params.Type,
|
Type: params.Type,
|
||||||
ApiParamsJSON: apiParams.AsJSON(),
|
ApiParamsJSON: apiParams.AsJSON(),
|
||||||
RoutesJSON: nil,
|
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
this.ErrorPage(err)
|
this.ErrorPage(err)
|
||||||
|
|||||||
@@ -40,12 +40,21 @@ func (this *IndexAction) RunGet(params struct{}) {
|
|||||||
dataUpdatedTime = timeutil.FormatTime("Y-m-d H:i:s", provider.DataUpdatedAt)
|
dataUpdatedTime = timeutil.FormatTime("Y-m-d H:i:s", provider.DataUpdatedAt)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 域名
|
||||||
|
countDomainsResp, err := this.RPC().DNSDomainRPC().CountAllEnabledDNSDomainsWithDNSProviderId(this.AdminContext(), &pb.CountAllEnabledDNSDomainsWithDNSProviderIdRequest{DnsProviderId: provider.Id})
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
countDomains := countDomainsResp.Count
|
||||||
|
|
||||||
providerMaps = append(providerMaps, maps.Map{
|
providerMaps = append(providerMaps, maps.Map{
|
||||||
"id": provider.Id,
|
"id": provider.Id,
|
||||||
"name": provider.Name,
|
"name": provider.Name,
|
||||||
"type": provider.Type,
|
"type": provider.Type,
|
||||||
"typeName": provider.TypeName,
|
"typeName": provider.TypeName,
|
||||||
"dataUpdatedTime": dataUpdatedTime,
|
"dataUpdatedTime": dataUpdatedTime,
|
||||||
|
"countDomains": countDomains,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.Data["providers"] = providerMaps
|
this.Data["providers"] = providerMaps
|
||||||
|
|||||||
72
internal/web/actions/default/dns/providers/provider.go
Normal file
72
internal/web/actions/default/dns/providers/provider.go
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
package providers
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||||
|
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||||
|
"github.com/iwind/TeaGo/maps"
|
||||||
|
timeutil "github.com/iwind/TeaGo/utils/time"
|
||||||
|
)
|
||||||
|
|
||||||
|
type ProviderAction struct {
|
||||||
|
actionutils.ParentAction
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *ProviderAction) Init() {
|
||||||
|
this.Nav("", "", "")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *ProviderAction) RunGet(params struct {
|
||||||
|
ProviderId int64
|
||||||
|
}) {
|
||||||
|
providerResp, err := this.RPC().DNSProviderRPC().FindEnabledDNSProvider(this.AdminContext(), &pb.FindEnabledDNSProviderRequest{DnsProviderId: params.ProviderId})
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
provider := providerResp.DnsProvider
|
||||||
|
if provider == nil {
|
||||||
|
this.NotFound("dnsProvider", params.ProviderId)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
apiParams := maps.Map{}
|
||||||
|
if len(provider.ApiParamsJSON) > 0 {
|
||||||
|
err = json.Unmarshal(provider.ApiParamsJSON, &apiParams)
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.Data["provider"] = maps.Map{
|
||||||
|
"id": provider.Id,
|
||||||
|
"name": provider.Name,
|
||||||
|
"type": provider.Type,
|
||||||
|
"typeName": provider.TypeName,
|
||||||
|
"apiParams": apiParams,
|
||||||
|
}
|
||||||
|
|
||||||
|
// 域名
|
||||||
|
domainsResp, err := this.RPC().DNSDomainRPC().FindAllEnabledDNSDomainsWithDNSProviderId(this.AdminContext(), &pb.FindAllEnabledDNSDomainsWithDNSProviderIdRequest{DnsProviderId: provider.Id})
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
domainMaps := []maps.Map{}
|
||||||
|
for _, domain := range domainsResp.DnsDomains {
|
||||||
|
dataUpdatedTime := ""
|
||||||
|
if domain.DataUpdatedAt > 0 {
|
||||||
|
dataUpdatedTime = timeutil.FormatTime("Y-m-d H:i:s", domain.DataUpdatedAt)
|
||||||
|
}
|
||||||
|
domainMaps = append(domainMaps, maps.Map{
|
||||||
|
"id": domain.Id,
|
||||||
|
"name": domain.Name,
|
||||||
|
"isOn": domain.IsOn,
|
||||||
|
"dataUpdatedTime": dataUpdatedTime,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.Data["domains"] = domainMaps
|
||||||
|
|
||||||
|
this.Show()
|
||||||
|
}
|
||||||
@@ -38,7 +38,6 @@ func (this *UpdatePopupAction) RunGet(params struct {
|
|||||||
this.ErrorPage(err)
|
this.ErrorPage(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.Data["provider"] = maps.Map{
|
this.Data["provider"] = maps.Map{
|
||||||
@@ -107,7 +106,6 @@ func (this *UpdatePopupAction) RunPost(params struct {
|
|||||||
DnsProviderId: params.ProviderId,
|
DnsProviderId: params.ProviderId,
|
||||||
Name: params.Name,
|
Name: params.Name,
|
||||||
ApiParamsJSON: apiParams.AsJSON(),
|
ApiParamsJSON: apiParams.AsJSON(),
|
||||||
RoutesJSON: nil,
|
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
this.ErrorPage(err)
|
this.ErrorPage(err)
|
||||||
|
|||||||
19
web/views/@default/dns/domains/createPopup.html
Normal file
19
web/views/@default/dns/domains/createPopup.html
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
{$layout "layout_popup"}
|
||||||
|
|
||||||
|
<h3>添加管理域名</h3>
|
||||||
|
|
||||||
|
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
|
||||||
|
<input type="hidden" name="providerId" :value="providerId"/>
|
||||||
|
<csrf-token></csrf-token>
|
||||||
|
<table class="ui table definition selectable">
|
||||||
|
<tr>
|
||||||
|
<td class="title">域名 *</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" name="name" maxlength="64" ref="focus"/>
|
||||||
|
<p class="comment">在DNS服务商中可以管理的域名。</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<submit-btn></submit-btn>
|
||||||
|
</form>
|
||||||
3
web/views/@default/dns/domains/createPopup.js
Normal file
3
web/views/@default/dns/domains/createPopup.js
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
Tea.context(function () {
|
||||||
|
this.success = NotifyPopup
|
||||||
|
})
|
||||||
@@ -11,21 +11,24 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th>账号说明</th>
|
<th>账号说明</th>
|
||||||
<th>服务商</th>
|
<th>服务商</th>
|
||||||
<th>可用线路</th>
|
<th>域名</th>
|
||||||
<th>最近更新时间</th>
|
<th>数据更新时间</th>
|
||||||
<th class="two op">操作</th>
|
<th class="two op">操作</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tr v-for="provider in providers">
|
<tr v-for="(provider, index) in providers">
|
||||||
<td>{{provider.name}}</td>
|
<td>{{provider.name}}</td>
|
||||||
<td>{{provider.typeName}}</td>
|
<td>{{provider.typeName}}</td>
|
||||||
<td></td>
|
<td>
|
||||||
|
<span v-if="provider.countDomains == 0" class="disabled">0个域名</span>
|
||||||
|
<span v-else>{{provider.countDomains}}个域名</span>
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<span v-if="provider.dataUpdatedTime.length > 0">{{provider.dataUpdatedTime}}</span>
|
<span v-if="provider.dataUpdatedTime.length > 0">{{provider.dataUpdatedTime}}</span>
|
||||||
<span v-else class="disabled">-</span>
|
<span v-else class="disabled">-</span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="" @click.prevent="updateProvider(provider.id)">修改</a> <a href="" @click.prevent="deleteProvider(provider.id)">删除</a>
|
<a :href="'/dns/providers/provider?providerId=' + provider.id">详情</a> <a href="" @click.prevent="deleteProvider(provider.id)">删除</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -10,17 +10,6 @@ Tea.context(function () {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
this.updateProvider = function (providerId) {
|
|
||||||
teaweb.popup(Tea.url(".updatePopup?providerId=" + providerId), {
|
|
||||||
height: "26em",
|
|
||||||
callback: function () {
|
|
||||||
teaweb.success("保存成功", function () {
|
|
||||||
teaweb.reload()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
this.deleteProvider = function (providerId) {
|
this.deleteProvider = function (providerId) {
|
||||||
let that = this
|
let that = this
|
||||||
teaweb.confirm("确定要删除这个DNS服务商账号吗?", function () {
|
teaweb.confirm("确定要删除这个DNS服务商账号吗?", function () {
|
||||||
|
|||||||
59
web/views/@default/dns/providers/provider.html
Normal file
59
web/views/@default/dns/providers/provider.html
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
{$layout}
|
||||||
|
|
||||||
|
<first-menu>
|
||||||
|
<a href="/dns/providers" class="item">DNS账号列表</a>
|
||||||
|
<span class="item">|</span>
|
||||||
|
<a :href="'/dns/providers/provider?providerId=' + provider.id" class="item active">{{provider.name}}</a>
|
||||||
|
</first-menu>
|
||||||
|
|
||||||
|
|
||||||
|
<h3>账号信息 <a href="" @click.prevent="updateProvider(provider.id)">[修改]</a> </h3>
|
||||||
|
|
||||||
|
<table class="ui table selectable definition">
|
||||||
|
<tr>
|
||||||
|
<td class="title">账号说明</td>
|
||||||
|
<td>{{provider.name}}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>服务商</td>
|
||||||
|
<td>{{provider.typeName}}</td>
|
||||||
|
</tr>
|
||||||
|
<!-- DNSPod -->
|
||||||
|
<tbody v-if="provider.type == 'dnspod'">
|
||||||
|
<tr>
|
||||||
|
<td>密钥ID</td>
|
||||||
|
<td>{{provider.apiParams.id}}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>密钥Token</td>
|
||||||
|
<td>{{provider.apiParams.token}}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
<h3>管理的域名 <a href="" @click.prevent="createDomain()">[添加域名]</a> </h3>
|
||||||
|
<p class="comment" v-if="domains.length == 0">暂时还没有可以管理的域名。</p>
|
||||||
|
|
||||||
|
<table class="ui table selectable" v-if="domains.length > 0">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>域名</th>
|
||||||
|
<th>数据更新时间</th>
|
||||||
|
<th>状态</th>
|
||||||
|
<th class="two op">操作</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tr v-for="domain in domains">
|
||||||
|
<td>{{domain.name}}</td>
|
||||||
|
<td>
|
||||||
|
<span v-if="domain.dataUpdatedTime.length > 0">{{domain.dataUpdatedTime}}</span>
|
||||||
|
<span v-else class="disabled">尚未更新</span>
|
||||||
|
</td>
|
||||||
|
<td><label-on :v-is-on="domain.isOn"></label-on></td>
|
||||||
|
<td>
|
||||||
|
<a href="">修改</a>
|
||||||
|
<a href="" @click.prevent="deleteDomain(domain)">删除</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
34
web/views/@default/dns/providers/provider.js
Normal file
34
web/views/@default/dns/providers/provider.js
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
Tea.context(function () {
|
||||||
|
this.updateProvider = function (providerId) {
|
||||||
|
teaweb.popup(Tea.url(".updatePopup?providerId=" + providerId), {
|
||||||
|
height: "26em",
|
||||||
|
callback: function () {
|
||||||
|
teaweb.success("保存成功", function () {
|
||||||
|
teaweb.reload()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
this.createDomain = function () {
|
||||||
|
teaweb.popup("/dns/domains/createPopup?providerId=" + this.provider.id, {
|
||||||
|
callback: function () {
|
||||||
|
teaweb.success("保存成功", function () {
|
||||||
|
teaweb.reload()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
this.deleteDomain = function (domain) {
|
||||||
|
let that = this
|
||||||
|
teaweb.confirm("确定要删除域名\"" + domain.name + "\"吗?", function () {
|
||||||
|
that.$post("/dns/domains/delete")
|
||||||
|
.params({
|
||||||
|
domainId: domain.id
|
||||||
|
})
|
||||||
|
.post()
|
||||||
|
.refresh()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user