mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2024-11-24 11:09:16 +08:00
feat: 续签同步应用到网站
This commit is contained in:
parent
75756e8bb7
commit
7f71b5f262
@ -4,7 +4,7 @@ type WebsiteDnsAccount struct {
|
||||
BaseModel
|
||||
Name string `gorm:"type:varchar(64);not null" json:"name"`
|
||||
Type string `gorm:"type:varchar(64);not null" json:"type"`
|
||||
Authorization string `gorm:"type:varchar(256);not null" json:"_"`
|
||||
Authorization string `gorm:"type:varchar(256);not null" json:"-"`
|
||||
}
|
||||
|
||||
func (w WebsiteDnsAccount) TableName() string {
|
||||
|
@ -19,6 +19,7 @@ type WebsiteSSL struct {
|
||||
StartDate time.Time `json:"startDate"`
|
||||
|
||||
AcmeAccount WebsiteAcmeAccount `json:"acmeAccount"`
|
||||
Websites []Website `json:"websites"`
|
||||
}
|
||||
|
||||
func (w WebsiteSSL) TableName() string {
|
||||
|
@ -48,7 +48,7 @@ func (w WebsiteSSLRepo) Page(page, size int, opts ...DBOption) (int64, []model.W
|
||||
db := getDb(opts...).Model(&model.WebsiteSSL{})
|
||||
count := int64(0)
|
||||
db = db.Count(&count)
|
||||
err := db.Limit(size).Offset(size * (page - 1)).Preload("AcmeAccount").Find(&sslList).Error
|
||||
err := db.Limit(size).Offset(size * (page - 1)).Preload("AcmeAccount").Preload("Websites").Find(&sslList).Error
|
||||
return count, sslList, err
|
||||
}
|
||||
|
||||
|
@ -169,6 +169,7 @@ export namespace Website {
|
||||
expireDate: string;
|
||||
startDate: string;
|
||||
provider: string;
|
||||
websites?: Website.Website[];
|
||||
}
|
||||
|
||||
export interface SSLCreate {
|
||||
|
@ -1002,6 +1002,7 @@ export default {
|
||||
autoRenew: '自动续签',
|
||||
autoRenewHelper: '距离到期时间7天自动续签',
|
||||
renewSuccess: '续签成功',
|
||||
renewWebsite: '该证书已经和以下网站关联,续签会同步应用到这些网站',
|
||||
},
|
||||
firewall: {
|
||||
ccDeny: 'CC 防护',
|
||||
|
@ -105,7 +105,7 @@ const buttons = [
|
||||
return row.provider === 'manual';
|
||||
},
|
||||
click: function (row: Website.SSL) {
|
||||
openRenewSSL(row.id);
|
||||
openRenewSSL(row.id, row.websites);
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -141,8 +141,8 @@ const openDnsAccount = () => {
|
||||
const openSSL = () => {
|
||||
sslCreateRef.value.acceptParams();
|
||||
};
|
||||
const openRenewSSL = (id: number) => {
|
||||
renewRef.value.acceptParams(id);
|
||||
const openRenewSSL = (id: number, websites: Website.Website[]) => {
|
||||
renewRef.value.acceptParams({ id: id, websites: websites });
|
||||
};
|
||||
const openDetail = (id: number) => {
|
||||
detailRef.value.acceptParams(id);
|
||||
|
@ -8,6 +8,16 @@
|
||||
:before-close="handleClose"
|
||||
>
|
||||
<div style="text-align: center">
|
||||
<span>{{ $t('ssl.renewWebsite') }}</span>
|
||||
<div>
|
||||
<br />
|
||||
<span v-if="websites.length > 0">
|
||||
<span v-for="(website, index) in websites" :key="index">
|
||||
<el-tag>{{ website.primaryDomain }}</el-tag>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
<br />
|
||||
<span>{{ $t('ssl.renewConfirm') }}</span>
|
||||
</div>
|
||||
<template #footer>
|
||||
@ -22,25 +32,32 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { Website } from '@/api/interface/Website';
|
||||
import { RenewSSL } from '@/api/modules/website';
|
||||
import i18n from '@/lang';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { reactive, ref } from 'vue';
|
||||
|
||||
interface RenewProps {
|
||||
id: number;
|
||||
websites: Website.Website[];
|
||||
}
|
||||
|
||||
let open = ref(false);
|
||||
let loading = ref(false);
|
||||
let renewReq = reactive({
|
||||
SSLId: 0,
|
||||
});
|
||||
const em = defineEmits(['close']);
|
||||
|
||||
const handleClose = () => {
|
||||
open.value = false;
|
||||
em('close', false);
|
||||
};
|
||||
const websites = ref([]);
|
||||
|
||||
const acceptParams = async (id: number) => {
|
||||
renewReq.SSLId = id;
|
||||
const acceptParams = async (props: RenewProps) => {
|
||||
renewReq.SSLId = Number(props.id);
|
||||
websites.value = props.websites;
|
||||
open.value = true;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user