SSL/TLS选择证书增加关键词搜索

This commit is contained in:
GoEdgeLab
2021-05-23 20:54:17 +08:00
parent bae6f43f21
commit 0730d04b89
2 changed files with 24 additions and 5 deletions

View File

@@ -13,7 +13,7 @@ import (
"time"
)
// 选择证书
// SelectPopupAction 选择证书
type SelectPopupAction struct {
actionutils.ParentAction
}
@@ -25,10 +25,12 @@ func (this *SelectPopupAction) Init() {
func (this *SelectPopupAction) RunGet(params struct {
ViewSize string
SelectedCertIds string
Keyword string
}) {
// TODO 支持关键词搜索
// TODO 列出常用和最新的证书供用户选择
this.Data["keyword"] = params.Keyword
// 已经选择的证书
selectedCertIds := []string{}
if len(params.SelectedCertIds) > 0 {
@@ -40,7 +42,9 @@ func (this *SelectPopupAction) RunGet(params struct {
}
this.Data["viewSize"] = params.ViewSize
countResp, err := this.RPC().SSLCertRPC().CountSSLCerts(this.AdminContext(), &pb.CountSSLCertRequest{})
countResp, err := this.RPC().SSLCertRPC().CountSSLCerts(this.AdminContext(), &pb.CountSSLCertRequest{
Keyword: params.Keyword,
})
if err != nil {
this.ErrorPage(err)
return
@@ -50,6 +54,7 @@ func (this *SelectPopupAction) RunGet(params struct {
this.Data["page"] = page.AsHTML()
listResp, err := this.RPC().SSLCertRPC().ListSSLCerts(this.AdminContext(), &pb.ListSSLCertsRequest{
Keyword: params.Keyword,
Offset: page.Offset,
Size: page.Size,
})

View File

@@ -1,6 +1,20 @@
{$layout "layout_popup"}
<h3>选择证书</h3>
<!-- 搜索表单 -->
<form class="ui form" action="/servers/certs/selectPopup">
<div class="ui fields inline">
<div class="ui field">
<input type="text" name="keyword" v-model="keyword" placeholder="域名、说明文字等"/>
</div>
<div class="ui field">
<button class="ui button" type="submit">搜索</button>
</div>
</div>
</form>
<!-- 证书列表 -->
<p class="comment" v-if="certs.length == 0">暂时还没有相关的证书。</p>
<table class="ui table selectable celled" v-if="certs.length > 0">
<thead>