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

View File

@@ -1,6 +1,20 @@
{$layout "layout_popup"} {$layout "layout_popup"}
<h3>选择证书</h3> <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> <p class="comment" v-if="certs.length == 0">暂时还没有相关的证书。</p>
<table class="ui table selectable celled" v-if="certs.length > 0"> <table class="ui table selectable celled" v-if="certs.length > 0">
<thead> <thead>