mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-15 13:00:25 +08:00
[SSL证书]选择证书表格中显示是否已经选择
This commit is contained in:
@@ -2,11 +2,14 @@ package certs
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"github.com/TeaOSLab/EdgeAdmin/internal/utils/numberutils"
|
||||||
"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/sslconfigs"
|
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/sslconfigs"
|
||||||
|
"github.com/iwind/TeaGo/lists"
|
||||||
"github.com/iwind/TeaGo/maps"
|
"github.com/iwind/TeaGo/maps"
|
||||||
timeutil "github.com/iwind/TeaGo/utils/time"
|
timeutil "github.com/iwind/TeaGo/utils/time"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -21,9 +24,16 @@ func (this *SelectPopupAction) Init() {
|
|||||||
|
|
||||||
func (this *SelectPopupAction) RunGet(params struct {
|
func (this *SelectPopupAction) RunGet(params struct {
|
||||||
ViewSize string
|
ViewSize string
|
||||||
|
SelectedCertIds string
|
||||||
}) {
|
}) {
|
||||||
// TODO 支持关键词搜索
|
// TODO 支持关键词搜索
|
||||||
// TODO 列出常用的证书供用户选择
|
// TODO 列出常用和最新的证书供用户选择
|
||||||
|
|
||||||
|
// 已经选择的证书
|
||||||
|
selectedCertIds := []string{}
|
||||||
|
if len(params.SelectedCertIds) > 0 {
|
||||||
|
selectedCertIds = strings.Split(params.SelectedCertIds, ",")
|
||||||
|
}
|
||||||
|
|
||||||
if len(params.ViewSize) == 0 {
|
if len(params.ViewSize) == 0 {
|
||||||
params.ViewSize = "normal"
|
params.ViewSize = "normal"
|
||||||
@@ -67,6 +77,7 @@ func (this *SelectPopupAction) RunGet(params struct {
|
|||||||
"isExpired": nowTime > certConfig.TimeEndAt,
|
"isExpired": nowTime > certConfig.TimeEndAt,
|
||||||
"isAvailable": nowTime <= certConfig.TimeEndAt,
|
"isAvailable": nowTime <= certConfig.TimeEndAt,
|
||||||
"countServers": countServersResp.Count,
|
"countServers": countServersResp.Count,
|
||||||
|
"isSelected": lists.ContainsString(selectedCertIds, numberutils.FormatInt64(certConfig.Id)),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.Data["certInfos"] = certMaps
|
this.Data["certInfos"] = certMaps
|
||||||
|
|||||||
@@ -95,7 +95,13 @@ Vue.component("ssl-config-box", {
|
|||||||
// 选择证书
|
// 选择证书
|
||||||
selectCert: function () {
|
selectCert: function () {
|
||||||
let that = this
|
let that = this
|
||||||
teaweb.popup("/servers/certs/selectPopup", {
|
let selectedCertIds = []
|
||||||
|
if (this.policy != null && this.policy.certs.length > 0) {
|
||||||
|
this.policy.certs.forEach(function (cert) {
|
||||||
|
selectedCertIds.push(cert.id.toString())
|
||||||
|
})
|
||||||
|
}
|
||||||
|
teaweb.popup("/servers/certs/selectPopup?selectedCertIds=" + selectedCertIds, {
|
||||||
width: "50em",
|
width: "50em",
|
||||||
height: "30em",
|
height: "30em",
|
||||||
callback: function (resp) {
|
callback: function (resp) {
|
||||||
|
|||||||
@@ -35,7 +35,8 @@
|
|||||||
<span class="ui label green tiny basic" v-else>有效中</span>
|
<span class="ui label green tiny basic" v-else>有效中</span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="" @click.prevent="selectCert(cert)">选择</a>
|
<a href="" @click.prevent="selectCert(cert)" v-if="!certInfos[index].isSelected">选择</a>
|
||||||
|
<span v-else>已选</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
Reference in New Issue
Block a user