fix: 解决面板设置无法选择 https 证书的问题 (#1638)

This commit is contained in:
zhengkunwang 2023-07-13 14:17:18 +08:00 committed by GitHub
parent ef948bca76
commit 1ccc56100c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 43 additions and 20 deletions

View File

@ -4,7 +4,7 @@ import "github.com/1Panel-dev/1Panel/backend/app/dto"
type WebsiteSSLSearch struct {
dto.PageInfo
AcmeAccountID uint `json:"acmeAccountId"`
AcmeAccountID string `json:"acmeAccountID"`
}
type WebsiteSSLCreate struct {

View File

@ -13,6 +13,7 @@ import (
"github.com/1Panel-dev/1Panel/backend/global"
"github.com/1Panel-dev/1Panel/backend/utils/ssl"
"path"
"strconv"
"strings"
)
@ -66,7 +67,14 @@ func (w WebsiteSSLService) Search(search request.WebsiteSSLSearch) ([]response.W
opts []repo.DBOption
result []response.WebsiteSSLDTO
)
opts = append(opts, commonRepo.WithOrderBy("created_at desc"), websiteSSLRepo.WithByAcmeAccountId(search.AcmeAccountID))
opts = append(opts, commonRepo.WithOrderBy("created_at desc"))
if search.AcmeAccountID != "" {
acmeAccountID, err := strconv.ParseUint(search.AcmeAccountID, 10, 64)
if err != nil {
return nil, err
}
opts = append(opts, websiteSSLRepo.WithByAcmeAccountId(uint(acmeAccountID)))
}
sslList, err := websiteSSLRepo.List(opts...)
if err != nil {
return nil, err

View File

@ -1,5 +1,5 @@
// Code generated by swaggo/swag. DO NOT EDIT.
// Package docs GENERATED BY SWAG; DO NOT EDIT
// This file was generated by swaggo/swag
package docs
import "github.com/swaggo/swag"
@ -11068,6 +11068,9 @@ const docTemplate = `{
"$ref": "#/definitions/dto.PortHelper"
}
},
"forcePull": {
"type": "boolean"
},
"image": {
"type": "string"
},
@ -11078,13 +11081,13 @@ const docTemplate = `{
}
},
"memory": {
"type": "integer"
"type": "number"
},
"name": {
"type": "string"
},
"nanoCPUs": {
"type": "integer"
"type": "number"
},
"network": {
"type": "string"
@ -11198,6 +11201,9 @@ const docTemplate = `{
"name"
],
"properties": {
"forcePull": {
"type": "boolean"
},
"image": {
"type": "string"
},
@ -15159,8 +15165,8 @@ const docTemplate = `{
"pageSize"
],
"properties": {
"acmeAccountId": {
"type": "integer"
"acmeAccountID": {
"type": "string"
},
"page": {
"type": "integer"

View File

@ -11061,6 +11061,9 @@
"$ref": "#/definitions/dto.PortHelper"
}
},
"forcePull": {
"type": "boolean"
},
"image": {
"type": "string"
},
@ -11071,13 +11074,13 @@
}
},
"memory": {
"type": "integer"
"type": "number"
},
"name": {
"type": "string"
},
"nanoCPUs": {
"type": "integer"
"type": "number"
},
"network": {
"type": "string"
@ -11191,6 +11194,9 @@
"name"
],
"properties": {
"forcePull": {
"type": "boolean"
},
"image": {
"type": "string"
},
@ -15152,8 +15158,8 @@
"pageSize"
],
"properties": {
"acmeAccountId": {
"type": "integer"
"acmeAccountID": {
"type": "string"
},
"page": {
"type": "integer"

View File

@ -327,6 +327,8 @@ definitions:
items:
$ref: '#/definitions/dto.PortHelper'
type: array
forcePull:
type: boolean
image:
type: string
labels:
@ -334,11 +336,11 @@ definitions:
type: string
type: array
memory:
type: integer
type: number
name:
type: string
nanoCPUs:
type: integer
type: number
network:
type: string
publishAllPorts:
@ -413,6 +415,8 @@ definitions:
type: object
dto.ContainerUpgrade:
properties:
forcePull:
type: boolean
image:
type: string
name:
@ -3063,8 +3067,8 @@ definitions:
type: object
request.WebsiteSSLSearch:
properties:
acmeAccountId:
type: integer
acmeAccountID:
type: string
page:
type: integer
pageSize:

View File

@ -208,7 +208,7 @@ export namespace Website {
export interface SSLReq {
name?: string;
acmeAccountID?: number;
acmeAccountID?: string;
}
export interface HTTPSReq {

View File

@ -207,7 +207,7 @@ const rules = ref({
});
const resData = ref();
const sslReq = reactive({
acmeAccountID: 0,
acmeAccountID: '',
});
const getPrivateKeyPath = (path: string) => {
@ -218,7 +218,7 @@ const getCertificatePath = (path: string) => {
form.certificatePath = path;
};
const listSSL = () => {
sslReq.acmeAccountID = form.acmeAccountID;
sslReq.acmeAccountID = String(form.acmeAccountID);
ListSSL(sslReq).then((res) => {
ssls.value = res.data || [];
if (ssls.value.length > 0) {
@ -278,7 +278,6 @@ const get = () => {
if (res.data.SSL && res.data.SSL.id > 0) {
form.websiteSSLId = res.data.SSL.id;
websiteSSL.value = res.data.SSL;
sslReq.acmeAccountID = res.data.SSL.acmeAccountId;
form.acmeAccountID = res.data.SSL.acmeAccountId;
}
}