mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-31 14:08:06 +08:00
feat: 证书增加详情页
This commit is contained in:
parent
0c981b0aa0
commit
a4e6ca01a7
@ -89,7 +89,7 @@ func (b *BaseApi) DeleteWebsiteSSL(c *gin.Context) {
|
||||
helper.SuccessWithData(c, nil)
|
||||
}
|
||||
|
||||
func (b *BaseApi) GetWebsiteSSL(c *gin.Context) {
|
||||
func (b *BaseApi) GetWebsiteSSLByWebsiteId(c *gin.Context) {
|
||||
websiteId, err := helper.GetIntParamByKey(c, "websiteId")
|
||||
if err != nil {
|
||||
helper.ErrorWithDetail(c, constant.CodeErrBadRequest, constant.ErrTypeInvalidParams, err)
|
||||
@ -102,3 +102,17 @@ func (b *BaseApi) GetWebsiteSSL(c *gin.Context) {
|
||||
}
|
||||
helper.SuccessWithData(c, websiteSSL)
|
||||
}
|
||||
|
||||
func (b *BaseApi) GetWebsiteSSLById(c *gin.Context) {
|
||||
id, err := helper.GetParamID(c)
|
||||
if err != nil {
|
||||
helper.ErrorWithDetail(c, constant.CodeErrBadRequest, constant.ErrTypeInvalidParams, err)
|
||||
return
|
||||
}
|
||||
websiteSSL, err := websiteSSLService.GetSSL(id)
|
||||
if err != nil {
|
||||
helper.ErrorWithDetail(c, constant.CodeErrInternalServer, constant.ErrTypeInternalServer, err)
|
||||
return
|
||||
}
|
||||
helper.SuccessWithData(c, websiteSSL)
|
||||
}
|
||||
|
@ -31,6 +31,16 @@ func (w WebsiteSSLService) Page(search request.WebsiteSSLSearch) (int64, []respo
|
||||
return total, sslDTOs, err
|
||||
}
|
||||
|
||||
func (w WebsiteSSLService) GetSSL(id uint) (*response.WebsiteSSLDTO, error) {
|
||||
var res response.WebsiteSSLDTO
|
||||
websiteSSL, err := websiteSSLRepo.GetFirst(commonRepo.WithByID(id))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res.WebsiteSSL = websiteSSL
|
||||
return &res, nil
|
||||
}
|
||||
|
||||
func (w WebsiteSSLService) Search() ([]response.WebsiteSSLDTO, error) {
|
||||
sslList, err := websiteSSLRepo.List()
|
||||
if err != nil {
|
||||
|
@ -20,6 +20,7 @@ func (a *WebsiteSSLRouter) InitWebsiteSSLRouter(Router *gin.RouterGroup) {
|
||||
groupRouter.POST("", baseApi.CreateWebsiteSSL)
|
||||
groupRouter.POST("/resolve", baseApi.GetDNSResolve)
|
||||
groupRouter.POST("/del", baseApi.DeleteWebsiteSSL)
|
||||
groupRouter.GET("/:websiteId", baseApi.GetWebsiteSSL)
|
||||
groupRouter.GET("/website/:websiteId", baseApi.GetWebsiteSSLByWebsiteId)
|
||||
groupRouter.GET("/:id", baseApi.GetWebsiteSSLById)
|
||||
}
|
||||
}
|
||||
|
@ -128,7 +128,11 @@ export const DeleteSSL = (req: Website.DelReq) => {
|
||||
};
|
||||
|
||||
export const GetWebsiteSSL = (websiteId: number) => {
|
||||
return http.get<Website.SSL>(`/websites/ssl/${websiteId}`);
|
||||
return http.get<Website.SSL>(`/websites/ssl/website/${websiteId}`);
|
||||
};
|
||||
|
||||
export const GetSSL = (id: number) => {
|
||||
return http.get<Website.SSL>(`/websites/ssl/${id}`);
|
||||
};
|
||||
|
||||
export const ApplySSL = (req: Website.SSLApply) => {
|
||||
|
@ -971,6 +971,12 @@ export default {
|
||||
err: '错误',
|
||||
value: '记录值',
|
||||
type: '类型',
|
||||
dnsResolveHelper: '请到DNS解析服务商处添加以下解析记录:',
|
||||
detail: '详情',
|
||||
msg: '证书信息',
|
||||
ssl: '证书',
|
||||
key: '私钥',
|
||||
startDate: '生效时间',
|
||||
},
|
||||
firewall: {
|
||||
ccDeny: 'CC 防护',
|
||||
|
@ -49,6 +49,7 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="dnsResolve.length > 0">
|
||||
<span>{{ $t('ssl.dnsResolveHelper') }}</span>
|
||||
<div v-for="(re, index) in dnsResolve" :key="index">
|
||||
<el-descriptions direction="vertical" :column="4" border>
|
||||
<el-descriptions-item :label="$t('website.domain')">{{ re.domain }}</el-descriptions-item>
|
||||
|
66
frontend/src/views/website/ssl/detail/index.vue
Normal file
66
frontend/src/views/website/ssl/detail/index.vue
Normal file
@ -0,0 +1,66 @@
|
||||
<template>
|
||||
<el-dialog v-model="open" :before-close="handleClose" :title="$t('ssl.detail')">
|
||||
<div>
|
||||
<el-radio-group v-model="curr">
|
||||
<el-radio-button label="detail">{{ $t('ssl.msg') }}</el-radio-button>
|
||||
<el-radio-button label="ssl">{{ $t('ssl.ssl') }}</el-radio-button>
|
||||
<el-radio-button label="key">{{ $t('ssl.key') }}</el-radio-button>
|
||||
</el-radio-group>
|
||||
<br />
|
||||
<br />
|
||||
<div v-if="curr === 'detail'">
|
||||
<el-descriptions border :column="1">
|
||||
<el-descriptions-item :label="$t('website.primaryDomain')">
|
||||
{{ ssl.primaryDomain }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="$t('website.otherDomains')">
|
||||
{{ ssl.otherDomains }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="$t('ssl.startDate')">
|
||||
{{ dateFromat(0, 0, ssl.startDate) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="$t('website.expireDate')">
|
||||
{{ dateFromat(0, 0, ssl.expireDate) }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</div>
|
||||
<div v-else-if="curr === 'ssl'">
|
||||
<el-input v-model="ssl.pem" :autosize="{ minRows: 10, maxRows: 15 }" type="textarea" />
|
||||
</div>
|
||||
<div v-else>
|
||||
<el-input v-model="ssl.privateKey" :autosize="{ minRows: 10, maxRows: 15 }" type="textarea" />
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { GetSSL } from '@/api/modules/website';
|
||||
import { ref } from 'vue';
|
||||
import { dateFromat } from '@/utils/util';
|
||||
|
||||
let open = ref(false);
|
||||
let id = ref(0);
|
||||
let curr = ref('detail');
|
||||
let ssl = ref<any>({});
|
||||
|
||||
const handleClose = () => {
|
||||
open.value = false;
|
||||
};
|
||||
|
||||
const acceptParams = (sslId: number) => {
|
||||
ssl.value = {};
|
||||
id.value = sslId;
|
||||
curr.value = 'detail';
|
||||
get();
|
||||
open.value = true;
|
||||
};
|
||||
|
||||
const get = async () => {
|
||||
const res = await GetSSL(id.value);
|
||||
ssl.value = res.data;
|
||||
};
|
||||
|
||||
defineExpose({
|
||||
acceptParams,
|
||||
});
|
||||
</script>
|
@ -48,7 +48,7 @@
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<fu-table-operations
|
||||
:ellipsis="1"
|
||||
:ellipsis="3"
|
||||
:buttons="buttons"
|
||||
:label="$t('commons.table.operate')"
|
||||
fixed="right"
|
||||
@ -59,6 +59,7 @@
|
||||
<AcmeAccount ref="acmeAccountRef"></AcmeAccount>
|
||||
<Create ref="sslCreateRef" @close="search()"></Create>
|
||||
<Renew ref="renewRef" @close="search()"></Renew>
|
||||
<Detail ref="detailRef"></Detail>
|
||||
</LayoutContent>
|
||||
</el-card>
|
||||
</template>
|
||||
@ -72,6 +73,7 @@ import DnsAccount from './dns-account/index.vue';
|
||||
import AcmeAccount from './acme-account/index.vue';
|
||||
import Renew from './renew/index.vue';
|
||||
import Create from './create/index.vue';
|
||||
import Detail from './detail/index.vue';
|
||||
import { dateFromat } from '@/utils/util';
|
||||
import i18n from '@/lang';
|
||||
import { Website } from '@/api/interface/website';
|
||||
@ -86,19 +88,26 @@ const acmeAccountRef = ref();
|
||||
const dnsAccountRef = ref();
|
||||
const sslCreateRef = ref();
|
||||
const renewRef = ref();
|
||||
const detailRef = ref();
|
||||
let data = ref();
|
||||
let loading = ref(false);
|
||||
|
||||
const buttons = [
|
||||
{
|
||||
label: i18n.global.t('ssl.detail'),
|
||||
click: function (row: Website.SSL) {
|
||||
openDetail(row.id);
|
||||
},
|
||||
},
|
||||
{
|
||||
label: i18n.global.t('website.renewSSL'),
|
||||
click: function (row: Website.Website) {
|
||||
click: function (row: Website.SSL) {
|
||||
openRenewSSL(row.id);
|
||||
},
|
||||
},
|
||||
{
|
||||
label: i18n.global.t('app.delete'),
|
||||
click: function (row: Website.Website) {
|
||||
click: function (row: Website.SSL) {
|
||||
deleteSSL(row.id);
|
||||
},
|
||||
},
|
||||
@ -132,6 +141,9 @@ const openSSL = () => {
|
||||
const openRenewSSL = (id: number) => {
|
||||
renewRef.value.acceptParams(id);
|
||||
};
|
||||
const openDetail = (id: number) => {
|
||||
detailRef.value.acceptParams(id);
|
||||
};
|
||||
|
||||
const deleteSSL = async (id: number) => {
|
||||
loading.value = true;
|
||||
|
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="10" :offset="1">
|
||||
<el-col :span="12" :offset="1">
|
||||
<el-form
|
||||
ref="httpsForm"
|
||||
label-position="left"
|
||||
@ -25,7 +25,6 @@
|
||||
<el-select v-model="form.type" @change="changeType(form.type)">
|
||||
<el-option :label="$t('website.oldSSL')" :value="'existed'"></el-option>
|
||||
<el-option :label="$t('website.manualSSL')" :value="'manual'"></el-option>
|
||||
<!-- <el-option :label="'自动生成证书'" :value="'auto'"></el-option> -->
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
|
Loading…
x
Reference in New Issue
Block a user