mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-12-08 06:00:24 +08:00
DNS服务商增加厂家筛选
This commit is contained in:
@@ -20,9 +20,11 @@ func (this *IndexAction) Init() {
|
||||
func (this *IndexAction) RunGet(params struct {
|
||||
Keyword string
|
||||
Domain string
|
||||
ProviderType string
|
||||
}) {
|
||||
this.Data["keyword"] = params.Keyword
|
||||
this.Data["domain"] = params.Domain
|
||||
this.Data["providerType"] = params.ProviderType
|
||||
|
||||
// 格式化域名
|
||||
var domain = params.Domain
|
||||
@@ -33,6 +35,7 @@ func (this *IndexAction) RunGet(params struct {
|
||||
AdminId: this.AdminId(),
|
||||
Keyword: params.Keyword,
|
||||
Domain: domain,
|
||||
Type: params.ProviderType,
|
||||
})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
@@ -46,6 +49,7 @@ func (this *IndexAction) RunGet(params struct {
|
||||
AdminId: this.AdminId(),
|
||||
Keyword: params.Keyword,
|
||||
Domain: domain,
|
||||
Type: params.ProviderType,
|
||||
Offset: page.Offset,
|
||||
Size: page.Size,
|
||||
})
|
||||
@@ -53,7 +57,7 @@ func (this *IndexAction) RunGet(params struct {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
providerMaps := []maps.Map{}
|
||||
var providerMaps = []maps.Map{}
|
||||
for _, provider := range providersResp.DnsProviders {
|
||||
dataUpdatedTime := ""
|
||||
if provider.DataUpdatedAt > 0 {
|
||||
@@ -61,7 +65,9 @@ func (this *IndexAction) RunGet(params struct {
|
||||
}
|
||||
|
||||
// 域名
|
||||
countDomainsResp, err := this.RPC().DNSDomainRPC().CountAllEnabledDNSDomainsWithDNSProviderId(this.AdminContext(), &pb.CountAllEnabledDNSDomainsWithDNSProviderIdRequest{DnsProviderId: provider.Id})
|
||||
countDomainsResp, err := this.RPC().DNSDomainRPC().CountAllEnabledDNSDomainsWithDNSProviderId(this.AdminContext(), &pb.CountAllEnabledDNSDomainsWithDNSProviderIdRequest{
|
||||
DnsProviderId: provider.Id,
|
||||
})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
@@ -79,5 +85,30 @@ func (this *IndexAction) RunGet(params struct {
|
||||
}
|
||||
this.Data["providers"] = providerMaps
|
||||
|
||||
// 类型
|
||||
typesResponse, err := this.RPC().DNSProviderRPC().FindAllDNSProviderTypes(this.AdminContext(), &pb.FindAllDNSProviderTypesRequest{})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
var providerTypeMaps = []maps.Map{}
|
||||
for _, providerType := range typesResponse.ProviderTypes {
|
||||
countProvidersWithTypeResp, err := this.RPC().DNSProviderRPC().CountAllEnabledDNSProviders(this.AdminContext(), &pb.CountAllEnabledDNSProvidersRequest{
|
||||
Type: providerType.Code,
|
||||
})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
if countProvidersWithTypeResp.Count > 0 {
|
||||
providerTypeMaps = append(providerTypeMaps, maps.Map{
|
||||
"name": providerType.Name,
|
||||
"code": providerType.Code,
|
||||
"count": countProvidersWithTypeResp.Count,
|
||||
})
|
||||
}
|
||||
}
|
||||
this.Data["providerTypes"] = providerTypeMaps
|
||||
|
||||
this.Show()
|
||||
}
|
||||
|
||||
@@ -14,10 +14,16 @@
|
||||
<div class="ui field">
|
||||
<input type="text" name="domain" placeholder="域名..." v-model="domain"/>
|
||||
</div>
|
||||
<div class="ui field" v-if="providerTypes.length > 0">
|
||||
<select class="ui dropdown auto-width" name="providerType" v-model="providerType">
|
||||
<option value="">[DNS厂家]</option>
|
||||
<option v-for="p in providerTypes" :value="p.code">{{p.name}}({{p.count}})</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="ui field">
|
||||
<button class="ui button" type="submit">搜索</button>
|
||||
|
||||
<a :href="Tea.url('.')" v-if="keyword.length > 0 || domain.length > 0">[清除条件]</a>
|
||||
<a :href="Tea.url('.')" v-if="keyword.length > 0 || domain.length > 0 || providerType.length > 0">[清除条件]</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@@ -28,13 +34,13 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th>账号说明</th>
|
||||
<th class="width10">服务商</th>
|
||||
<th class="three wide">服务商</th>
|
||||
<th class="width5 center">域名</th>
|
||||
<th class="two op">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr v-for="(provider, index) in providers">
|
||||
<td><a :href="'/dns/providers/provider?providerId=' + provider.id">{{provider.name}}</a></td>
|
||||
<td><a :href="'/dns/providers/provider?providerId=' + provider.id"><keyword :v-word="keyword">{{provider.name}}</keyword></a></td>
|
||||
<td>{{provider.typeName}}</td>
|
||||
<td class="center">
|
||||
<span v-if="provider.countDomains == 0" class="disabled">0</span>
|
||||
|
||||
Reference in New Issue
Block a user