mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2024-12-18 11:17:49 +08:00
feat: 证书增加备注 (#3092)
This commit is contained in:
parent
10848fb249
commit
22358e161f
@ -18,6 +18,8 @@ type WebsiteSSLCreate struct {
|
||||
Apply bool `json:"apply"`
|
||||
PushDir bool `json:"pushDir"`
|
||||
Dir string `json:"dir"`
|
||||
ID uint `json:"id"`
|
||||
Description string `json:"description"`
|
||||
}
|
||||
|
||||
type WebsiteDNSReq struct {
|
||||
@ -66,9 +68,6 @@ type WebsiteSSLUpdate struct {
|
||||
ID uint `json:"id" validate:"required"`
|
||||
AutoRenew bool `json:"autoRenew"`
|
||||
Description string `json:"description"`
|
||||
PrivateKey string `json:"privateKey"`
|
||||
Certificate string `json:"certificate"`
|
||||
Type string `json:"type" validate:"required,oneof=autoRenew description certificate privateKey"`
|
||||
}
|
||||
|
||||
type WebsiteSSLUpload struct {
|
||||
|
@ -115,6 +115,7 @@ func (w WebsiteSSLService) Create(create request.WebsiteSSLCreate) (request.Webs
|
||||
ExpireDate: time.Now(),
|
||||
KeyType: create.KeyType,
|
||||
PushDir: create.PushDir,
|
||||
Description: create.Description,
|
||||
}
|
||||
if create.PushDir {
|
||||
if !files.NewFileOp().Stat(create.Dir) {
|
||||
@ -150,7 +151,14 @@ func (w WebsiteSSLService) Create(create request.WebsiteSSLCreate) (request.Webs
|
||||
if err := websiteSSLRepo.Create(context.TODO(), &websiteSSL); err != nil {
|
||||
return res, err
|
||||
}
|
||||
|
||||
create.ID = websiteSSL.ID
|
||||
go func() {
|
||||
if err = w.ObtainSSL(request.WebsiteSSLApply{
|
||||
ID: websiteSSL.ID,
|
||||
}); err != nil {
|
||||
global.LOG.Errorf("obtain ssl failed, err: %v", err)
|
||||
}
|
||||
}()
|
||||
return create, nil
|
||||
}
|
||||
|
||||
@ -343,6 +351,7 @@ func (w WebsiteSSLService) Update(update request.WebsiteSSLUpdate) error {
|
||||
return err
|
||||
}
|
||||
websiteSSL.AutoRenew = update.AutoRenew
|
||||
websiteSSL.Description = update.Description
|
||||
return websiteSSLRepo.Save(websiteSSL)
|
||||
}
|
||||
|
||||
|
@ -166,6 +166,7 @@ export namespace Website {
|
||||
acmeAccountId?: number;
|
||||
status: string;
|
||||
domains: string;
|
||||
description: string;
|
||||
}
|
||||
|
||||
export interface SSLDTO extends SSL {
|
||||
@ -178,6 +179,8 @@ export namespace Website {
|
||||
provider: string;
|
||||
acmeAccountId: number;
|
||||
dnsAccountId: number;
|
||||
id?: number;
|
||||
description: string;
|
||||
}
|
||||
|
||||
export interface SSLApply {
|
||||
@ -192,6 +195,7 @@ export namespace Website {
|
||||
export interface SSLUpdate {
|
||||
id: number;
|
||||
autoRenew: boolean;
|
||||
description: string;
|
||||
}
|
||||
|
||||
export interface AcmeAccount extends CommonModel {
|
||||
|
@ -16,6 +16,9 @@
|
||||
v-model="ssl.otherDomains"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('website.remark')" prop="description">
|
||||
<el-input v-model="ssl.description"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('website.acmeAccount')" prop="acmeAccountId">
|
||||
<el-select v-model="ssl.acmeAccountId">
|
||||
<el-option
|
||||
@ -154,12 +157,13 @@ const initData = () => ({
|
||||
keyType: 'P256',
|
||||
pushDir: false,
|
||||
dir: '',
|
||||
description: '',
|
||||
});
|
||||
|
||||
const ssl = ref(initData());
|
||||
const dnsResolve = ref<Website.DNSResolve[]>([]);
|
||||
|
||||
const em = defineEmits(['close']);
|
||||
const em = defineEmits(['close', 'submit']);
|
||||
const handleClose = () => {
|
||||
resetForm();
|
||||
open.value = false;
|
||||
@ -211,8 +215,9 @@ const submit = async (formEl: FormInstance | undefined) => {
|
||||
}
|
||||
loading.value = true;
|
||||
CreateSSL(ssl.value)
|
||||
.then(() => {
|
||||
.then((res: any) => {
|
||||
handleClose();
|
||||
em('submit', res.data.id);
|
||||
MsgSuccess(i18n.global.t('commons.msg.createSuccess'));
|
||||
})
|
||||
.finally(() => {
|
||||
|
@ -109,6 +109,18 @@
|
||||
show-overflow-tooltip
|
||||
prop="organization"
|
||||
></el-table-column>
|
||||
<el-table-column :label="$t('website.remark')" fix show-overflow-tooltip prop="description">
|
||||
<template #default="{ row }">
|
||||
<fu-read-write-switch>
|
||||
<template #read>
|
||||
<MsgInfo :info="row.description" />
|
||||
</template>
|
||||
<template #default="{ read }">
|
||||
<el-input v-model="row.description" @blur="updateDesc(row, read)" />
|
||||
</template>
|
||||
</fu-read-write-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('ssl.autoRenew')" fix width="100px">
|
||||
<template #default="{ row }">
|
||||
<el-switch
|
||||
@ -135,7 +147,7 @@
|
||||
</template>
|
||||
<DnsAccount ref="dnsAccountRef"></DnsAccount>
|
||||
<AcmeAccount ref="acmeAccountRef"></AcmeAccount>
|
||||
<Create ref="sslCreateRef" @close="search()"></Create>
|
||||
<Create ref="sslCreateRef" @close="search()" @submit="openLog"></Create>
|
||||
<Detail ref="detailRef"></Detail>
|
||||
<SSLUpload ref="sslUploadRef" @close="search()"></SSLUpload>
|
||||
<Apply ref="applyRef" @search="search" @submit="openLog" />
|
||||
@ -165,6 +177,7 @@ import SSLUpload from './upload/index.vue';
|
||||
import Apply from './apply/index.vue';
|
||||
import Log from '@/components/log-dialog/index.vue';
|
||||
import Obtain from './obtain/index.vue';
|
||||
import MsgInfo from '@/components/msg-info/index.vue';
|
||||
|
||||
const globalStore = GlobalStore();
|
||||
const paginationConfig = reactive({
|
||||
@ -280,9 +293,14 @@ const search = () => {
|
||||
});
|
||||
};
|
||||
|
||||
const updateDesc = (row: Website.SSLDTO, bulr: Function) => {
|
||||
bulr();
|
||||
updateConfig(row);
|
||||
};
|
||||
|
||||
const updateConfig = (row: Website.SSLDTO) => {
|
||||
loading.value = true;
|
||||
UpdateSSL({ id: row.id, autoRenew: row.autoRenew })
|
||||
UpdateSSL({ id: row.id, autoRenew: row.autoRenew, description: row.description })
|
||||
.then(() => {
|
||||
MsgSuccess(i18n.global.t('commons.msg.updateSuccess'));
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user