创建服务和修改服务HTTPS设置时也支持批量上传证书

This commit is contained in:
GoEdgeLab
2023-03-26 12:00:41 +08:00
parent c7f530878f
commit 00f2db10bc
7 changed files with 148 additions and 11 deletions

View File

@@ -97,16 +97,46 @@ Vue.component("ssl-certs-box", {
// 上传证书
uploadCert: function () {
let that = this
teaweb.popup("/servers/certs/uploadPopup", {
let userId = this.vUserId
if (typeof userId != "number" && typeof userId != "string") {
userId = 0
}
teaweb.popup("/servers/certs/uploadPopup?userId=" + userId, {
height: "28em",
callback: function (resp) {
teaweb.success("上传成功", function () {
that.certs.push(resp.data.cert)
if (resp.data.cert != null) {
that.certs.push(resp.data.cert)
}
if (resp.data.certs != null) {
that.certs.$pushAll(resp.data.certs)
}
that.$forceUpdate()
})
}
})
},
// 批量上传
uploadBatch: function () {
let that = this
let userId = this.vUserId
if (typeof userId != "number" && typeof userId != "string") {
userId = 0
}
teaweb.popup("/servers/certs/uploadBatchPopup?userId=" + userId, {
callback: function (resp) {
if (resp.data.cert != null) {
that.certs.push(resp.data.cert)
}
if (resp.data.certs != null) {
that.certs.$pushAll(resp.data.certs)
}
that.$forceUpdate()
}
})
},
// 格式化时间
formatTime: function (timestamp) {
return new Date(timestamp * 1000).format("Y-m-d")
@@ -132,7 +162,9 @@ Vue.component("ssl-certs-box", {
</div>
<div v-if="buttonsVisible()">
<button class="ui button tiny" type="button" @click.prevent="selectCert()">选择已有证书</button> &nbsp;
<span class="disabled">|</span> &nbsp;
<button class="ui button tiny" type="button" @click.prevent="uploadCert()">上传新证书</button> &nbsp;
<button class="ui button tiny" type="button" @click.prevent="uploadBatch()">批量上传证书</button> &nbsp;
</div>
</div>`
})