mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-06 06:40:27 +08:00
增加DNS服务商账号管理
This commit is contained in:
@@ -204,6 +204,10 @@ func (this *RPCClient) LogRPC() pb.LogServiceClient {
|
|||||||
return pb.NewLogServiceClient(this.pickConn())
|
return pb.NewLogServiceClient(this.pickConn())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *RPCClient) DNSProviderRPC() pb.DNSProviderServiceClient {
|
||||||
|
return pb.NewDNSProviderServiceClient(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()
|
||||||
|
|||||||
@@ -17,6 +17,9 @@ func init() {
|
|||||||
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("/updatePopup", new(providers.UpdatePopupAction)).
|
||||||
|
Post("/delete", new(providers.DeleteAction)).
|
||||||
EndData().
|
EndData().
|
||||||
|
|
||||||
EndAll()
|
EndAll()
|
||||||
|
|||||||
84
internal/web/actions/default/dns/providers/createPopup.go
Normal file
84
internal/web/actions/default/dns/providers/createPopup.go
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
package providers
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
|
||||||
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||||
|
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||||
|
"github.com/iwind/TeaGo/actions"
|
||||||
|
"github.com/iwind/TeaGo/maps"
|
||||||
|
)
|
||||||
|
|
||||||
|
type CreatePopupAction struct {
|
||||||
|
actionutils.ParentAction
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *CreatePopupAction) Init() {
|
||||||
|
this.Nav("", "", "")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *CreatePopupAction) RunGet(params struct{}) {
|
||||||
|
// 所有厂商
|
||||||
|
typesResp, err := this.RPC().DNSProviderRPC().FindAllDNSProviderTypes(this.AdminContext(), &pb.FindAllDNSProviderTypesRequest{})
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
typeMaps := []maps.Map{}
|
||||||
|
for _, t := range typesResp.ProviderTypes {
|
||||||
|
typeMaps = append(typeMaps, maps.Map{
|
||||||
|
"name": t.Name,
|
||||||
|
"code": t.Code,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.Data["types"] = typeMaps
|
||||||
|
|
||||||
|
this.Show()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *CreatePopupAction) RunPost(params struct {
|
||||||
|
Name string
|
||||||
|
Type string
|
||||||
|
|
||||||
|
// dnspod
|
||||||
|
ParamId string
|
||||||
|
ParamToken string
|
||||||
|
|
||||||
|
Must *actions.Must
|
||||||
|
CSRF *actionutils.CSRF
|
||||||
|
}) {
|
||||||
|
params.Must.
|
||||||
|
Field("name", params.Name).
|
||||||
|
Require("请输入账号说明").
|
||||||
|
Field("type", params.Type).
|
||||||
|
Require("请选择服务商厂家")
|
||||||
|
|
||||||
|
apiParams := maps.Map{}
|
||||||
|
switch params.Type {
|
||||||
|
case "dnspod":
|
||||||
|
params.Must.
|
||||||
|
Field("paramId", params.ParamId).
|
||||||
|
Require("请输入密钥ID").
|
||||||
|
Field("paramToken", params.ParamToken).
|
||||||
|
Require("请输入密钥Token")
|
||||||
|
|
||||||
|
apiParams["id"] = params.ParamId
|
||||||
|
apiParams["token"] = params.ParamToken
|
||||||
|
default:
|
||||||
|
this.Fail("暂时不支持此服务商'" + params.Type + "'")
|
||||||
|
}
|
||||||
|
|
||||||
|
createResp, err := this.RPC().DNSProviderRPC().CreateDNSProvider(this.AdminContext(), &pb.CreateDNSProviderRequest{
|
||||||
|
Name: params.Name,
|
||||||
|
Type: params.Type,
|
||||||
|
ApiParamsJSON: apiParams.AsJSON(),
|
||||||
|
RoutesJSON: nil,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.CreateLog(oplogs.LevelInfo, "创建DNS服务商 %d", createResp.DnsProviderId)
|
||||||
|
|
||||||
|
this.Success()
|
||||||
|
}
|
||||||
40
internal/web/actions/default/dns/providers/delete.go
Normal file
40
internal/web/actions/default/dns/providers/delete.go
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
package providers
|
||||||
|
|
||||||
|
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 {
|
||||||
|
ProviderId int64
|
||||||
|
}) {
|
||||||
|
// TODO 检查权限
|
||||||
|
|
||||||
|
// 记录日志
|
||||||
|
this.CreateLog(oplogs.LevelInfo, "删除DNS服务商 %d", params.ProviderId)
|
||||||
|
|
||||||
|
// 检查是否被使用
|
||||||
|
countClustersResp, err := this.RPC().NodeClusterRPC().CountAllEnabledNodeClustersWithDNSProviderId(this.AdminContext(), &pb.CountAllEnabledNodeClustersWithDNSProviderIdRequest{DnsProviderId: params.ProviderId})
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if countClustersResp.Count > 0 {
|
||||||
|
this.Fail("当前DNS服务商账号正在被" + numberutils.FormatInt64(countClustersResp.Count) + "个集群所使用,所以不能删除。请修改后再操作。")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 执行删除
|
||||||
|
_, err = this.RPC().DNSProviderRPC().DeleteDNSProvider(this.AdminContext(), &pb.DeleteDNSProviderRequest{DnsProviderId: params.ProviderId})
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.Success()
|
||||||
|
}
|
||||||
@@ -1,6 +1,11 @@
|
|||||||
package providers
|
package providers
|
||||||
|
|
||||||
import "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
import (
|
||||||
|
"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 IndexAction struct {
|
type IndexAction struct {
|
||||||
actionutils.ParentAction
|
actionutils.ParentAction
|
||||||
@@ -11,5 +16,39 @@ func (this *IndexAction) Init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *IndexAction) RunGet(params struct{}) {
|
func (this *IndexAction) RunGet(params struct{}) {
|
||||||
|
countResp, err := this.RPC().DNSProviderRPC().CountAllEnabledDNSProviders(this.AdminContext(), &pb.CountAllEnabledDNSProvidersRequest{})
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
count := countResp.Count
|
||||||
|
page := this.NewPage(count)
|
||||||
|
this.Data["page"] = page.AsHTML()
|
||||||
|
|
||||||
|
providersResp, err := this.RPC().DNSProviderRPC().ListEnabledDNSProviders(this.AdminContext(), &pb.ListEnabledDNSProvidersRequest{
|
||||||
|
Offset: page.Offset,
|
||||||
|
Size: page.Size,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
providerMaps := []maps.Map{}
|
||||||
|
for _, provider := range providersResp.DnsProviders {
|
||||||
|
dataUpdatedTime := ""
|
||||||
|
if provider.DataUpdatedAt > 0 {
|
||||||
|
dataUpdatedTime = timeutil.FormatTime("Y-m-d H:i:s", provider.DataUpdatedAt)
|
||||||
|
}
|
||||||
|
|
||||||
|
providerMaps = append(providerMaps, maps.Map{
|
||||||
|
"id": provider.Id,
|
||||||
|
"name": provider.Name,
|
||||||
|
"type": provider.Type,
|
||||||
|
"typeName": provider.TypeName,
|
||||||
|
"dataUpdatedTime": dataUpdatedTime,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.Data["providers"] = providerMaps
|
||||||
|
|
||||||
this.Show()
|
this.Show()
|
||||||
}
|
}
|
||||||
|
|||||||
118
internal/web/actions/default/dns/providers/updatePopup.go
Normal file
118
internal/web/actions/default/dns/providers/updatePopup.go
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
package providers
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
|
||||||
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||||
|
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||||
|
"github.com/iwind/TeaGo/actions"
|
||||||
|
"github.com/iwind/TeaGo/maps"
|
||||||
|
)
|
||||||
|
|
||||||
|
type UpdatePopupAction struct {
|
||||||
|
actionutils.ParentAction
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *UpdatePopupAction) Init() {
|
||||||
|
this.Nav("", "", "")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *UpdatePopupAction) 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,
|
||||||
|
"params": apiParams,
|
||||||
|
}
|
||||||
|
|
||||||
|
// 所有厂商
|
||||||
|
typesResp, err := this.RPC().DNSProviderRPC().FindAllDNSProviderTypes(this.AdminContext(), &pb.FindAllDNSProviderTypesRequest{})
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
typeMaps := []maps.Map{}
|
||||||
|
for _, t := range typesResp.ProviderTypes {
|
||||||
|
typeMaps = append(typeMaps, maps.Map{
|
||||||
|
"name": t.Name,
|
||||||
|
"code": t.Code,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.Data["types"] = typeMaps
|
||||||
|
|
||||||
|
this.Show()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *UpdatePopupAction) RunPost(params struct {
|
||||||
|
ProviderId int64
|
||||||
|
|
||||||
|
Name string
|
||||||
|
Type string
|
||||||
|
|
||||||
|
// dnspod
|
||||||
|
ParamId string
|
||||||
|
ParamToken string
|
||||||
|
|
||||||
|
Must *actions.Must
|
||||||
|
CSRF *actionutils.CSRF
|
||||||
|
}) {
|
||||||
|
this.CreateLog(oplogs.LevelInfo, "修改DNS服务商 %d", params.ProviderId)
|
||||||
|
|
||||||
|
params.Must.
|
||||||
|
Field("name", params.Name).
|
||||||
|
Require("请输入账号说明").
|
||||||
|
Field("type", params.Type).
|
||||||
|
Require("请选择服务商厂家")
|
||||||
|
|
||||||
|
apiParams := maps.Map{}
|
||||||
|
switch params.Type {
|
||||||
|
case "dnspod":
|
||||||
|
params.Must.
|
||||||
|
Field("paramId", params.ParamId).
|
||||||
|
Require("请输入密钥ID").
|
||||||
|
Field("paramToken", params.ParamToken).
|
||||||
|
Require("请输入密钥Token")
|
||||||
|
|
||||||
|
apiParams["id"] = params.ParamId
|
||||||
|
apiParams["token"] = params.ParamToken
|
||||||
|
default:
|
||||||
|
this.Fail("暂时不支持此服务商'" + params.Type + "'")
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err := this.RPC().DNSProviderRPC().UpdateDNSProvider(this.AdminContext(), &pb.UpdateDNSProviderRequest{
|
||||||
|
DnsProviderId: params.ProviderId,
|
||||||
|
Name: params.Name,
|
||||||
|
ApiParamsJSON: apiParams.AsJSON(),
|
||||||
|
RoutesJSON: nil,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.Success()
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ package settings
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
|
||||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||||
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
|
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
|
||||||
@@ -101,6 +102,9 @@ func (this *IndexAction) RunPost(params struct {
|
|||||||
|
|
||||||
Must *actions.Must
|
Must *actions.Must
|
||||||
}) {
|
}) {
|
||||||
|
// 记录日志
|
||||||
|
this.CreateLog(oplogs.LevelInfo, "修改代理服务 %d 基本信息", params.ServerId)
|
||||||
|
|
||||||
params.Must.
|
params.Must.
|
||||||
Field("name", params.Name).
|
Field("name", params.Name).
|
||||||
Require("请输入服务名称")
|
Require("请输入服务名称")
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package serverNames
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
|
||||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/serverutils"
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/serverutils"
|
||||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||||
@@ -36,6 +37,9 @@ func (this *IndexAction) RunGet(params struct {
|
|||||||
}
|
}
|
||||||
this.Data["serverNames"] = serverNamesConfig
|
this.Data["serverNames"] = serverNamesConfig
|
||||||
|
|
||||||
|
// DNS
|
||||||
|
this.Data["dnsName"] = server.DnsName
|
||||||
|
|
||||||
this.Show()
|
this.Show()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,6 +48,9 @@ func (this *IndexAction) RunPost(params struct {
|
|||||||
ServerNames string
|
ServerNames string
|
||||||
Must *actions.Must
|
Must *actions.Must
|
||||||
}) {
|
}) {
|
||||||
|
// 记录日志
|
||||||
|
this.CreateLog(oplogs.LevelInfo, "修改代理服务 %d 域名", params.ServerId)
|
||||||
|
|
||||||
serverNames := []*serverconfigs.ServerNameConfig{}
|
serverNames := []*serverconfigs.ServerNameConfig{}
|
||||||
err := json.Unmarshal([]byte(params.ServerNames), &serverNames)
|
err := json.Unmarshal([]byte(params.ServerNames), &serverNames)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ func (this *UserMustAuth) BeforeAction(actionPtr actions.ActionWrapper, paramNam
|
|||||||
"icon": "globe",
|
"icon": "globe",
|
||||||
"subItems": []maps.Map{
|
"subItems": []maps.Map{
|
||||||
{
|
{
|
||||||
"name": "第三方DNS",
|
"name": "DNS服务商",
|
||||||
"url": "/dns/providers",
|
"url": "/dns/providers",
|
||||||
"code": "provider",
|
"code": "provider",
|
||||||
},
|
},
|
||||||
|
|||||||
46
web/views/@default/dns/providers/createPopup.html
Normal file
46
web/views/@default/dns/providers/createPopup.html
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
{$layout "layout_popup"}
|
||||||
|
|
||||||
|
<h3>添加DNS服务商账号</h3>
|
||||||
|
<form class="ui form" data-tea-action="$" data-tea-success="success">
|
||||||
|
<csrf-token></csrf-token>
|
||||||
|
<table class="ui table definition selectable">
|
||||||
|
<tr>
|
||||||
|
<td class="title">账号说明 *</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" name="name" maxlength="50" ref="focus"/>
|
||||||
|
<p class="comment">用来方便区分不同的账号。</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>服务商厂家 *</td>
|
||||||
|
<td>
|
||||||
|
<select class="ui dropdown auto-width" name="type" v-model="type">
|
||||||
|
<option value="">[请选择]</option>
|
||||||
|
<option v-for="type in types" :value="type.code">{{type.name}}</option>
|
||||||
|
</select>
|
||||||
|
<p class="comment">创建后无法修改此选项。</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">API参数</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<!-- DNSPod -->
|
||||||
|
<tbody v-if="type == 'dnspod'">
|
||||||
|
<tr>
|
||||||
|
<td>密钥ID *</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" name="paramId" maxlength="100"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>密钥Token *</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" name="paramToken" maxlength="100"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<submit-btn></submit-btn>
|
||||||
|
</form>
|
||||||
4
web/views/@default/dns/providers/createPopup.js
Normal file
4
web/views/@default/dns/providers/createPopup.js
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
Tea.context(function () {
|
||||||
|
this.success = NotifyPopup
|
||||||
|
this.type = ""
|
||||||
|
})
|
||||||
@@ -1,3 +1,33 @@
|
|||||||
{$layout}
|
{$layout}
|
||||||
|
|
||||||
<p class="ui message">此功能暂未开放,敬请期待。</p>
|
<first-menu>
|
||||||
|
<a href="" class="item" @click.prevent="createProvider()">[添加DNS账号信息]</a>
|
||||||
|
</first-menu>
|
||||||
|
|
||||||
|
<p class="comment" v-if="providers.length == 0">暂时还没有第三方DNS服务商。</p>
|
||||||
|
|
||||||
|
<table class="ui table selectable" v-if="providers.length > 0">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>账号说明</th>
|
||||||
|
<th>服务商</th>
|
||||||
|
<th>可用线路</th>
|
||||||
|
<th>最近更新时间</th>
|
||||||
|
<th class="two op">操作</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tr v-for="provider in providers">
|
||||||
|
<td>{{provider.name}}</td>
|
||||||
|
<td>{{provider.typeName}}</td>
|
||||||
|
<td></td>
|
||||||
|
<td>
|
||||||
|
<span v-if="provider.dataUpdatedTime.length > 0">{{provider.dataUpdatedTime}}</span>
|
||||||
|
<span v-else class="disabled">-</span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="" @click.prevent="updateProvider(provider.id)">修改</a> <a href="" @click.prevent="deleteProvider(provider.id)">删除</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div class="page" v-html="page"></div>
|
||||||
34
web/views/@default/dns/providers/index.js
Normal file
34
web/views/@default/dns/providers/index.js
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
Tea.context(function () {
|
||||||
|
this.createProvider = function () {
|
||||||
|
teaweb.popup(Tea.url(".createPopup"), {
|
||||||
|
height: "26em",
|
||||||
|
callback: function () {
|
||||||
|
teaweb.success("保存成功", function () {
|
||||||
|
teaweb.reload()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
this.updateProvider = function (providerId) {
|
||||||
|
teaweb.popup(Tea.url(".updatePopup?providerId=" + providerId), {
|
||||||
|
height: "26em",
|
||||||
|
callback: function () {
|
||||||
|
teaweb.success("保存成功", function () {
|
||||||
|
teaweb.reload()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
this.deleteProvider = function (providerId) {
|
||||||
|
let that = this
|
||||||
|
teaweb.confirm("确定要删除这个DNS服务商账号吗?", function () {
|
||||||
|
that.$post(".delete")
|
||||||
|
.params({
|
||||||
|
providerId: providerId
|
||||||
|
})
|
||||||
|
.refresh()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
45
web/views/@default/dns/providers/updatePopup.html
Normal file
45
web/views/@default/dns/providers/updatePopup.html
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
{$layout "layout_popup"}
|
||||||
|
|
||||||
|
<h3>修改DNS服务商账号</h3>
|
||||||
|
<form class="ui form" data-tea-action="$" data-tea-success="success">
|
||||||
|
<csrf-token></csrf-token>
|
||||||
|
<input type="hidden" name="providerId" :value="provider.id"/>
|
||||||
|
<input type="hidden" name="type" :value="provider.type"/>
|
||||||
|
<table class="ui table definition selectable">
|
||||||
|
<tr>
|
||||||
|
<td class="title">账号说明 *</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" name="name" maxlength="50" ref="focus" v-model="provider.name"/>
|
||||||
|
<p class="comment">用来方便区分不同的账号。</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>服务商厂家 *</td>
|
||||||
|
<td>
|
||||||
|
{{provider.typeName}}
|
||||||
|
<p class="comment">创建后无法修改此选项。</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">API参数</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<!-- DNSPod -->
|
||||||
|
<tbody v-if="provider.type == 'dnspod'">
|
||||||
|
<tr>
|
||||||
|
<td>密钥ID *</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" name="paramId" maxlength="100" :value="provider.params.id"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>密钥Token *</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" name="paramToken" maxlength="100" :value="provider.params.token"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<submit-btn></submit-btn>
|
||||||
|
</form>
|
||||||
3
web/views/@default/dns/providers/updatePopup.js
Normal file
3
web/views/@default/dns/providers/updatePopup.js
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
Tea.context(function () {
|
||||||
|
this.success = NotifyPopup
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user