Initial commit (code only without large binaries)
This commit is contained in:
5
EdgeAdmin/web/views/@default/settings/updates/index.css
Normal file
5
EdgeAdmin/web/views/@default/settings/updates/index.css
Normal file
@@ -0,0 +1,5 @@
|
||||
.version-box {
|
||||
line-height: 1.8;
|
||||
color: #21ba45;
|
||||
}
|
||||
/*# sourceMappingURL=index.css.map */
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["index.less"],"names":[],"mappings":"AAAA;EACC,gBAAA;EACA,cAAA","file":"index.css"}
|
||||
70
EdgeAdmin/web/views/@default/settings/updates/index.html
Normal file
70
EdgeAdmin/web/views/@default/settings/updates/index.html
Normal file
@@ -0,0 +1,70 @@
|
||||
{$layout}
|
||||
|
||||
<div class="ui margin"></div>
|
||||
|
||||
<div v-show="isUpgrading || isUpgraded">
|
||||
<p class="ui message warning" v-if="!isUpgradingDB && !isUpgraded">正在下载并升级到新版本,请耐心等待 {{upgradeProgress}}% ...</p>
|
||||
<p class="ui message warning" v-if="isUpgradingDB">正在升级数据库 ...</p>
|
||||
<p class="ui message warning" v-if="!isUpgradingDB && isUpgraded">升级完成!</p>
|
||||
</div>
|
||||
|
||||
<div v-show="!isUpgrading && !isUpgraded">
|
||||
<form class="ui form">
|
||||
<table class="ui table definition selectable">
|
||||
<tr>
|
||||
<td class="title">当前已安装版本</td>
|
||||
<td>v{{version}}</td>
|
||||
</tr>
|
||||
<tr v-if="config.ignoredVersion.length > 0">
|
||||
<td>已忽略版本</td>
|
||||
<td>
|
||||
v{{config.ignoredVersion}} <a href="" style="font-size: 0.8em" @click.prevent="resetIgnoredVersion()">[重置]</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>自动检查</td>
|
||||
<td>
|
||||
<checkbox v-model="config.autoCheck" @input="changeAutoCheck"></checkbox>
|
||||
<p class="comment">选中后系统将定时检查是否有新版本更新。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="isStarted">
|
||||
<td>最新版本</td>
|
||||
<td>
|
||||
<div v-if="isChecking">
|
||||
<span class="blue">正在连接服务器检查更新...</span>
|
||||
</div>
|
||||
<div v-if="!isChecking">
|
||||
<div class="version-box" v-if="result.isOk">
|
||||
<span class="green">{{result.message}}
|
||||
<span v-if="result.hasNew">:<br/><a :href="result.dlURL">下载地址:{{result.dlURL}}</a> </span>
|
||||
</span>
|
||||
<div v-if="result.hasNew">
|
||||
<div class="ui divider"></div>
|
||||
|
||||
<!-- 操作按钮 -->
|
||||
<button class="ui button tiny" type="button" @click.prevent="install(result.dlURL)">安装此版本</button>
|
||||
|
||||
<button class="ui button tiny basic" type="button" @click.prevent="ignoreVersion(result.version)">忽略此版本</button>
|
||||
<div class="ui divider"></div>
|
||||
|
||||
<div v-if="result.day != null && result.day.length > 0">发布日期:{{result.day}}</div>
|
||||
<div v-if="result.description != null && result.description.length > 0">
|
||||
版本介绍:<pre>{{result.description}}</pre>
|
||||
<div v-if="result.docURL != null && result.docURL.length > 0">
|
||||
<div class="ui divider"></div>
|
||||
<div>完整变更说明:<a :href="result.docURL" target="_blank">{{result.docURL}}</a> </div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<span class="red" v-if="!result.isOk">{{result.message}}</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<button class="ui button primary" type="button" @click.prevent="start" v-show="!isChecking">开始检查</button>
|
||||
<button class="ui button disabled" type="button" v-show="isChecking">正在检查...</button>
|
||||
</form>
|
||||
</div>
|
||||
108
EdgeAdmin/web/views/@default/settings/updates/index.js
Normal file
108
EdgeAdmin/web/views/@default/settings/updates/index.js
Normal file
@@ -0,0 +1,108 @@
|
||||
Tea.context(function () {
|
||||
this.isStarted = false
|
||||
this.isChecking = false
|
||||
this.result = {isOk: false, message: "", hasNew: false, dlURL: ""}
|
||||
this.isUpgraded = false
|
||||
|
||||
this.$delay(function () {
|
||||
if (this.doCheck) {
|
||||
this.start()
|
||||
}
|
||||
})
|
||||
|
||||
this.start = function () {
|
||||
this.isStarted = true
|
||||
this.isChecking = true
|
||||
|
||||
this.$delay(function () {
|
||||
this.check()
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
this.check = function () {
|
||||
this.$post("$")
|
||||
.success(function (resp) {
|
||||
this.result = resp.data.result
|
||||
})
|
||||
.done(function () {
|
||||
this.isChecking = false
|
||||
})
|
||||
}
|
||||
|
||||
this.changeAutoCheck = function () {
|
||||
this.$post(".update")
|
||||
.params({
|
||||
autoCheck: this.config.autoCheck ? 1 : 0
|
||||
})
|
||||
.success(function () {
|
||||
teaweb.successToast("已保存")
|
||||
})
|
||||
}
|
||||
|
||||
this.ignoreVersion = function (version) {
|
||||
teaweb.confirm("确定要忽略版本 v" + version + " 版本更新吗?", function () {
|
||||
this.$post(".ignoreVersion")
|
||||
.params({version: version})
|
||||
.success(function () {
|
||||
teaweb.reload()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
this.resetIgnoredVersion = function (version) {
|
||||
teaweb.confirm("确定要重置已忽略版本吗?", function () {
|
||||
this.$post(".resetIgnoredVersion")
|
||||
.success(function () {
|
||||
teaweb.reload()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
this.install = function (dlURL) {
|
||||
this.$post(".upgrade")
|
||||
.params({
|
||||
url: dlURL
|
||||
})
|
||||
.timeout(3600)
|
||||
.success(function () {
|
||||
this.$delay(function () {
|
||||
let msg = "下载覆盖成功"
|
||||
if (this.isUpgraded) {
|
||||
msg = "升级成功"
|
||||
}
|
||||
teaweb.success(msg + ",当前管理系统将会尝试自动重启,请刷新页面查看重启状态。如果长时间没能重启成功,请使用命令手动重启。", function () {
|
||||
teaweb.reload()
|
||||
})
|
||||
}, 3000)
|
||||
})
|
||||
|
||||
this.isUpgrading = true
|
||||
this.updateUpgradeProgress()
|
||||
}
|
||||
|
||||
if (this.isUpgrading) {
|
||||
this.$delay(function () {
|
||||
this.updateUpgradeProgress()
|
||||
})
|
||||
}
|
||||
|
||||
this.updateUpgradeProgress = function () {
|
||||
if (!this.isUpgrading) {
|
||||
return
|
||||
}
|
||||
this.$get(".upgrade")
|
||||
.success(function (resp) {
|
||||
this.upgradeProgress = resp.data.upgradeProgress
|
||||
this.isUpgrading = resp.data.isUpgrading
|
||||
this.isUpgradingDB = resp.data.isUpgradingDB
|
||||
if (resp.data.isUpgradingDB) {
|
||||
this.isUpgraded = true
|
||||
}
|
||||
})
|
||||
.done(function () {
|
||||
this.$delay(function () {
|
||||
this.updateUpgradeProgress()
|
||||
}, 2000)
|
||||
})
|
||||
}
|
||||
})
|
||||
4
EdgeAdmin/web/views/@default/settings/updates/index.less
Normal file
4
EdgeAdmin/web/views/@default/settings/updates/index.less
Normal file
@@ -0,0 +1,4 @@
|
||||
.version-box {
|
||||
line-height: 1.8;
|
||||
color: #21ba45;
|
||||
}
|
||||
Reference in New Issue
Block a user