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