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 { type WebsiteSSLSearch struct {
dto.PageInfo dto.PageInfo
AcmeAccountID uint `json:"acmeAccountId"` AcmeAccountID string `json:"acmeAccountID"`
} }
type WebsiteSSLCreate struct { type WebsiteSSLCreate struct {

View File

@ -13,6 +13,7 @@ import (
"github.com/1Panel-dev/1Panel/backend/global" "github.com/1Panel-dev/1Panel/backend/global"
"github.com/1Panel-dev/1Panel/backend/utils/ssl" "github.com/1Panel-dev/1Panel/backend/utils/ssl"
"path" "path"
"strconv"
"strings" "strings"
) )
@ -66,7 +67,14 @@ func (w WebsiteSSLService) Search(search request.WebsiteSSLSearch) ([]response.W
opts []repo.DBOption opts []repo.DBOption
result []response.WebsiteSSLDTO 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...) sslList, err := websiteSSLRepo.List(opts...)
if err != nil { if err != nil {
return nil, err 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 package docs
import "github.com/swaggo/swag" import "github.com/swaggo/swag"
@ -11068,6 +11068,9 @@ const docTemplate = `{
"$ref": "#/definitions/dto.PortHelper" "$ref": "#/definitions/dto.PortHelper"
} }
}, },
"forcePull": {
"type": "boolean"
},
"image": { "image": {
"type": "string" "type": "string"
}, },
@ -11078,13 +11081,13 @@ const docTemplate = `{
} }
}, },
"memory": { "memory": {
"type": "integer" "type": "number"
}, },
"name": { "name": {
"type": "string" "type": "string"
}, },
"nanoCPUs": { "nanoCPUs": {
"type": "integer" "type": "number"
}, },
"network": { "network": {
"type": "string" "type": "string"
@ -11198,6 +11201,9 @@ const docTemplate = `{
"name" "name"
], ],
"properties": { "properties": {
"forcePull": {
"type": "boolean"
},
"image": { "image": {
"type": "string" "type": "string"
}, },
@ -15159,8 +15165,8 @@ const docTemplate = `{
"pageSize" "pageSize"
], ],
"properties": { "properties": {
"acmeAccountId": { "acmeAccountID": {
"type": "integer" "type": "string"
}, },
"page": { "page": {
"type": "integer" "type": "integer"

View File

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

View File

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

View File

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

View File

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