[SSL证书]ACME任务中列出最后执行结果

This commit is contained in:
GoEdgeLab
2020-11-26 17:26:26 +08:00
parent 555d5b74de
commit 402e418261
4 changed files with 39 additions and 13 deletions

View File

@@ -46,6 +46,7 @@ func (this *IndexAction) RunGet(params struct{}) {
continue continue
} }
// 证书
var certMap maps.Map = nil var certMap maps.Map = nil
if task.SslCert != nil { if task.SslCert != nil {
certMap = maps.Map{ certMap = maps.Map{
@@ -56,6 +57,17 @@ func (this *IndexAction) RunGet(params struct{}) {
} }
} }
// 日志
var logMap maps.Map = nil
if task.LatestACMETaskLog != nil {
logMap = maps.Map{
"id": task.LatestACMETaskLog.Id,
"isOk": task.LatestACMETaskLog.IsOk,
"error": task.LatestACMETaskLog.Error,
"createdTime": timeutil.FormatTime("m-d", task.CreatedAt),
}
}
taskMaps = append(taskMaps, maps.Map{ taskMaps = append(taskMaps, maps.Map{
"id": task.Id, "id": task.Id,
"acmeUser": maps.Map{ "acmeUser": maps.Map{
@@ -70,6 +82,7 @@ func (this *IndexAction) RunGet(params struct{}) {
"domains": task.Domains, "domains": task.Domains,
"autoRenew": task.AutoRenew, "autoRenew": task.AutoRenew,
"cert": certMap, "cert": certMap,
"log": logMap,
}) })
} }
this.Data["tasks"] = taskMaps this.Data["tasks"] = taskMaps

View File

@@ -1,7 +1,12 @@
// 使用Icon的链接方式 // 使用Icon的链接方式
Vue.component("link-icon", { Vue.component("link-icon", {
props: ["href"], props: ["href", "title"],
template: `<span><slot></slot>&nbsp;<a :href="href" title="打开链接" class="link grey"><i class="icon linkify small"></i></a></span>` data: function () {
return {
vTitle: (this.title == null) ? "打开链接" : this.title
}
},
template: `<span><slot></slot>&nbsp;<a :href="href" :title="vTitle" class="link grey"><i class="icon linkify small"></i></a></span>`
}) })
// 带有下划虚线的连接 // 带有下划虚线的连接

View File

@@ -12,37 +12,41 @@
<thead> <thead>
<tr> <tr>
<th>ACME用户</th> <th>ACME用户</th>
<th>域名服务商</th>
<th>顶级域名</th>
<th>证书域名</th> <th>证书域名</th>
<th>到期时间</th> <th>到期时间</th>
<th class="center width10">自动续期</th> <th>更新时间</th>
<th>关联证书</th> <th class="center" style="width:6em">自动续期</th>
<th class="center" style="width:6em">关联证书</th>
<th class="three op">操作</th> <th class="three op">操作</th>
</tr> </tr>
</thead> </thead>
<tr v-for="(task, index) in tasks" :class="{warning: runningIndex == index}"> <tr v-for="(task, index) in tasks" :class="{warning: runningIndex == index}">
<td>{{task.acmeUser.email}}</td> <td>{{task.acmeUser.email}}</td>
<td>{{task.dnsProvider.name}}</td> <td nowrap="">
<td>{{task.dnsDomain}}</td>
<td>
<div v-for="domain in task.domains"> <div v-for="domain in task.domains">
<span class="ui label small basic">{{domain}}</span> <span class="ui label small basic">{{domain}}</span>
</div> </div>
</td> </td>
<td> <td nowrap="">
<div v-if="task.cert != null"> <div v-if="task.cert != null">
{{task.cert.endTime}} {{task.cert.endTime}}
</div> </div>
<span class="disabled" v-else>-</span> <span class="disabled" v-else>-</span>
</td> </td>
<td nowrap="">
<div v-if="task.log != null">
<span class="green" v-if="task.log.isOk">{{task.log.createdTime}}</span>
<link-red v-if="!task.log.isOk" title="任务执行失败,点击查看详情" @click.prevent="showError(task.log.error)">{{task.log.createdTime}}</link-red>
</div>
<span v-else class="disabled">尚未执行</span>
</td>
<td class="center"> <td class="center">
<span class="green" v-if="task.autoRenew">Y</span> <span class="green" v-if="task.autoRenew">Y</span>
<span v-else class="disabled">N</span> <span v-else class="disabled">N</span>
</td> </td>
<td> <td class="center">
<div v-if="task.cert != null"> <div v-if="task.cert != null">
{{task.cert.name}}<a href="" @click.prevent="viewCert(task.cert.id)"><link-icon></link-icon></a> <a href="" @click.prevent="viewCert(task.cert.id)"><link-icon title="查看关联证书"></link-icon></a>
</div> </div>
<span class="disabled" v-else="">-</span> <span class="disabled" v-else="">-</span>
</td> </td>

View File

@@ -45,7 +45,7 @@ Tea.context(function () {
taskId: task.id taskId: task.id
}) })
.success(function (resp) { .success(function (resp) {
teaweb.success("执行成功", function () { teaweb.success("任务执行成功", function () {
teaweb.reload() teaweb.reload()
}) })
}) })
@@ -55,4 +55,8 @@ Tea.context(function () {
}) })
}) })
} }
this.showError = function (err) {
teaweb.popupTip("任务执行失败:" + err)
}
}) })