Skip to content

Commit a9aacce

Browse files
committed
feat: store auto-cert log to db
1 parent e9d26de commit a9aacce

File tree

8 files changed

+872
-827
lines changed

8 files changed

+872
-827
lines changed

frontend/src/api/domain.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ class Domain extends Curd {
1414
return http.get('template')
1515
}
1616

17-
add_auto_cert(domain: string) {
18-
return http.post('auto_cert/' + domain)
17+
add_auto_cert(domain: string, data: any) {
18+
return http.post('auto_cert/' + domain, data)
1919
}
2020

2121
remove_auto_cert(domain: string) {

frontend/src/views/cert/Cert.vue

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
import {useGettext} from 'vue3-gettext'
33
import {input} from '@/components/StdDataEntry'
44
import {customRender, datetime} from '@/components/StdDataDisplay/StdTableTransformer'
5-
import {h} from 'vue'
65
import {Badge} from 'ant-design-vue'
76
import cert from '@/api/cert'
87
import StdCurd from '@/components/StdDataDisplay/StdCurd.vue'
98
import Template from '@/views/template/Template.vue'
109
import CodeEditor from '@/components/CodeEditor/CodeEditor.vue'
1110
import CertInfo from '@/views/domain/cert/CertInfo.vue'
11+
import {h} from 'vue'
1212
13-
const {$gettext} = useGettext()
13+
const {$gettext, interpolate} = useGettext()
1414
1515
const columns = [{
1616
title: () => $gettext('Name'),
@@ -81,11 +81,33 @@ const columns = [{
8181
row-key="name"
8282
>
8383
<template #beforeEdit="{data}">
84-
<div v-if="data.auto_cert===1" style="margin-bottom: 15px">
85-
<a-alert
86-
:message="$gettext('Auto cert is enabled, please do not modify this certification.')" type="info"
87-
show-icon/>
88-
</div>
84+
<template v-if="data.auto_cert===1">
85+
<div style="margin-bottom: 15px">
86+
<a-alert
87+
:message="$gettext('Auto cert is enabled, please do not modify this certification.')"
88+
type="info"
89+
show-icon/>
90+
</div>
91+
<div v-if="!data.filename" style="margin-bottom: 15px">
92+
<a-alert
93+
:message="$gettext('This auto-cert item is invalid, please remove it.')"
94+
type="error"
95+
show-icon/>
96+
</div>
97+
<div v-else-if="!data.domains" style="margin-bottom: 15px">
98+
<a-alert
99+
:message="interpolate($gettext('Domains list is empty, try to reopen auto-cert for %{config}'), {config: data.filename})"
100+
type="error"
101+
show-icon/>
102+
</div>
103+
<div v-if="data.log" style="margin-bottom: 15px">
104+
<a-form layout="vertical">
105+
<a-form-item :label="$gettext('Auto-Cert Log')">
106+
<p>{{ data.log }}</p>
107+
</a-form-item>
108+
</a-form>
109+
</div>
110+
</template>
89111
<a-form layout="vertical" v-if="data.certificate_info">
90112
<a-form-item :label="$gettext('Certificate Status')">
91113
<cert-info :cert="data.certificate_info"/>

frontend/src/views/domain/cert/IssueCert.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ function callback(ssl_certificate: string, ssl_certificate_key: string) {
6161
6262
function change_auto_cert(r: boolean) {
6363
if (r) {
64-
domain.add_auto_cert(props.config_name).then(() => {
64+
domain.add_auto_cert(props.config_name, {domains: name.value.trim().split(' ')}).then(() => {
6565
message.success(interpolate($gettext('Auto-renewal enabled for %{name}'), {name: name.value}))
6666
}).catch(e => {
6767
message.error(e.message ?? interpolate($gettext('Enable auto-renewal failed for %{name}'), {name: name.value}))

0 commit comments

Comments
 (0)