[SSL证书]实现基本的自动申请证书流程

This commit is contained in:
刘祥超
2020-11-26 16:39:01 +08:00
parent c2d22fb4fb
commit 564f137877
8 changed files with 70 additions and 14 deletions

View File

@@ -103,7 +103,7 @@
<div class="button-group">
<button type="button" class="ui button" @click.prevent="goUser">上一步</button>
<button type="button" class="ui button primary" @click.prevent="doDNS" v-if="!isRequesting">下一步</button>
<button type="button" class="ui button primary disabled" v-if="isRequesting">提交中...</button>
<button type="button" class="ui button primary disabled" v-if="isRequesting">提交中,要花费的时间较长,请耐心等待...</button>
</div>
</div>

View File

@@ -82,6 +82,7 @@ Tea.context(function () {
this.isRequesting = true
this.$post(".run")
.timeout(300)
.params({
taskId: this.taskId
})

View File

@@ -6,6 +6,8 @@
<p class="comment" v-if="tasks.length == 0">暂时还没有证书申请任务。</p>
<div class="ui message blue" v-if="isRunning">有任务在执行中,可能需要的时间较长,请耐心等待。</div>
<table class="ui table selectable" v-if="tasks.length > 0">
<thead>
<tr>
@@ -19,7 +21,7 @@
<th class="three op">操作</th>
</tr>
</thead>
<tr v-for="task in tasks">
<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>
@@ -29,7 +31,10 @@
</div>
</td>
<td>
<div v-if="task.cert != null">
{{task.cert.endTime}}
</div>
<span class="disabled" v-else>-</span>
</td>
<td class="center">
<span class="green" v-if="task.autoRenew">Y</span>
@@ -37,14 +42,14 @@
</td>
<td>
<div v-if="task.cert != null">
<a href="" @click.prevent="viewCert(task.cert.id)">{{task.cert.name}}</a>
{{task.cert.name}}<a href="" @click.prevent="viewCert(task.cert.id)"><link-icon></link-icon></a>
</div>
<span class="disabled" v-else="">-</span>
</td>
<td>
<a href="" @click.prevent="updateTask(task.id)">修改</a> &nbsp;
<a href="">执行</a> &nbsp;
<a href="" @click.prevent="deleteTask(task.id)">删除</a>
<a href="" @click.prevent="updateTask(task.id)" :class="{disabled: isRunning}">修改</a> &nbsp;
<a href="" @click.prevent="runTask(index, task)" :class="{disabled: isRunning}">执行</a> &nbsp;
<a href="" @click.prevent="deleteTask(task.id)" :class="{disabled: isRunning}">删除</a>
</td>
</tr>
</table>

View File

@@ -27,4 +27,32 @@ Tea.context(function () {
.refresh()
})
}
this.isRunning = false
this.runningIndex = -1
this.runTask = function (index, task) {
let that = this
teaweb.confirm("确定要立即执行此任务吗?", function () {
that.isRunning = true
that.runningIndex = index
that.$post(".run")
.timeout(300)
.params({
taskId: task.id
})
.success(function (resp) {
teaweb.success("执行成功", function () {
teaweb.reload()
})
})
.done(function () {
that.isRunning = false
that.runningIndex = -1
})
})
}
})

View File

@@ -30,7 +30,10 @@
<tr v-for="(cert, index) in certs">
<td>{{cert.name}}
<div v-if="cert.isCA" style="margin-top:0.5em">
<span class="ui label olive tiny">CA</span>
<micro-basic-label :class="olive">CA</micro-basic-label>
</div>
<div v-if="cert.isACME" style="margin-top: 0.5em">
<micro-basic-label class="olive" title="通过ACME协议免费申请">ACME</micro-basic-label>
</div>
</td>
<td>