集群支持使用域名搜索

This commit is contained in:
GoEdgeLab
2021-08-25 18:39:35 +08:00
parent 8179e9f7c0
commit a2bf5d5a3e
2 changed files with 26 additions and 8 deletions

View File

@@ -14,8 +14,14 @@ func (this *IndexAction) Init() {
this.Nav("dns", "dns", "")
}
func (this *IndexAction) RunGet(params struct{}) {
countResp, err := this.RPC().NodeClusterRPC().CountAllEnabledNodeClusters(this.AdminContext(), &pb.CountAllEnabledNodeClustersRequest{})
func (this *IndexAction) RunGet(params struct {
Keyword string
}) {
this.Data["keyword"] = params.Keyword
countResp, err := this.RPC().NodeClusterRPC().CountAllEnabledNodeClusters(this.AdminContext(), &pb.CountAllEnabledNodeClustersRequest{
Keyword: params.Keyword,
})
if err != nil {
this.ErrorPage(err)
return
@@ -24,8 +30,9 @@ func (this *IndexAction) RunGet(params struct{}) {
this.Data["page"] = page.AsHTML()
clustersResp, err := this.RPC().NodeClusterRPC().ListEnabledNodeClusters(this.AdminContext(), &pb.ListEnabledNodeClustersRequest{
Offset: page.Offset,
Size: page.Size,
Keyword: params.Keyword,
Offset: page.Offset,
Size: page.Size,
})
if err != nil {
this.ErrorPage(err)

View File

@@ -2,7 +2,18 @@
<div class="margin"></div>
<p class="comment" v-if="clusters.length == 0">暂时还没有集群。</p>
<form class="ui form" method="get" action="/dns">
<div class="ui fields inline">
<div class="ui field">
<input type="text" name="keyword" placeholder="集群、域名..." v-model="keyword"/>
</div>
<div class="ui field">
<button class="ui button" type="submit">搜索</button>
</div>
</div>
</form>
<p class="comment" v-if="clusters.length == 0" style="margin-top: 1em">暂时还没有集群。</p>
<table class="ui table selectable celled" v-if="clusters.length > 0">
<thead>
<tr>
@@ -15,10 +26,10 @@
</thead>
<tr v-for="cluster in clusters">
<td>
<a :href="'/dns/clusters/cluster?clusterId=' + cluster.id">{{cluster.name}}</a><link-icon :href="'/clusters/cluster?clusterId=' + cluster.id"></link-icon>
<a :href="'/dns/clusters/cluster?clusterId=' + cluster.id"><keyword :v-word="keyword">{{cluster.name}}</keyword></a><link-icon :href="'/clusters/cluster?clusterId=' + cluster.id"></link-icon>
</td>
<td>
<span v-if="cluster.dnsName.length > 0 && cluster.domainName.length > 0"><em class="italic">{{cluster.dnsName}}</em>.{{cluster.domainName}}</span>
<span v-if="cluster.dnsName.length > 0 && cluster.domainName.length > 0"><em class="italic"><keyword :v-word="keyword">{{cluster.dnsName}}</keyword></em>.<keyword :v-word="keyword">{{cluster.domainName}}</keyword></span>
<span v-else="" class="disabled">-</span>
</td>
<td>
@@ -34,6 +45,6 @@
</td>
</tr>
</table>
<p class="comment">这里列出了所有集群对应的域名设置。</p>
<p class="comment" v-if="clusters.length > 0">这里列出了所有集群对应的域名设置。</p>
<div class="page" v-html="page"></div>