[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
}
// 证书
var certMap maps.Map = nil
if task.SslCert != nil {
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{
"id": task.Id,
"acmeUser": maps.Map{
@@ -70,6 +82,7 @@ func (this *IndexAction) RunGet(params struct{}) {
"domains": task.Domains,
"autoRenew": task.AutoRenew,
"cert": certMap,
"log": logMap,
})
}
this.Data["tasks"] = taskMaps

View File

@@ -1,7 +1,12 @@
// 使用Icon的链接方式
Vue.component("link-icon", {
props: ["href"],
template: `<span><slot></slot>&nbsp;<a :href="href" title="打开链接" class="link grey"><i class="icon linkify small"></i></a></span>`
props: ["href", "title"],
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>
<tr>
<th>ACME用户</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>
</tr>
</thead>
<tr v-for="(task, index) in tasks" :class="{warning: runningIndex == index}">
<td>{{task.acmeUser.email}}</td>
<td>{{task.dnsProvider.name}}</td>
<td>{{task.dnsDomain}}</td>
<td>
<td nowrap="">
<div v-for="domain in task.domains">
<span class="ui label small basic">{{domain}}</span>
</div>
</td>
<td>
<td nowrap="">
<div v-if="task.cert != null">
{{task.cert.endTime}}
</div>
<span class="disabled" v-else>-</span>
</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">
<span class="green" v-if="task.autoRenew">Y</span>
<span v-else class="disabled">N</span>
</td>
<td>
<td class="center">
<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>
<span class="disabled" v-else="">-</span>
</td>

View File

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