mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-12-09 07:14:02 +08:00
实现API节点远程升级
This commit is contained in:
35
web/views/@default/api/node/upgradePopup.html
Normal file
35
web/views/@default/api/node/upgradePopup.html
Normal file
@@ -0,0 +1,35 @@
|
||||
{$layout "layout_popup"}
|
||||
|
||||
<h3>远程升级</h3>
|
||||
|
||||
<form class="ui form" data-tea-action="$" data-tea-success="success" data-tea-timeout="3600" data-tea-before="before" data-tea-done="done">
|
||||
<csrf-token></csrf-token>
|
||||
<input type="hidden" name="nodeId" :value="nodeId"/>
|
||||
|
||||
<table class="ui table definition selectable">
|
||||
<tr v-show="nodeName.length > 0">
|
||||
<td class="title">API节点</td>
|
||||
<td>{{nodeName}}</td>
|
||||
</tr>
|
||||
<tr v-show="currentVersion.length > 0">
|
||||
<td>当前版本</td>
|
||||
<td>v{{currentVersion}}</td>
|
||||
</tr>
|
||||
<tr v-show="latestVersion.length > 0">
|
||||
<td>目标版本</td>
|
||||
<td>v{{latestVersion}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title">升级结果</td>
|
||||
<td>
|
||||
<span v-if="currentVersion == latestVersion" class="green">已经升级到最新版本</span>
|
||||
<span :class="{red: !resultIsOk}" v-if="currentVersion != latestVersion">
|
||||
<span v-if="!isRequesting">{{result}}</span>
|
||||
<span v-if="isRequesting">升级中...</span>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<submit-btn v-show="canUpgrade && !isRequesting && !isUpgrading">开始升级</submit-btn>
|
||||
</form>
|
||||
39
web/views/@default/api/node/upgradePopup.js
Normal file
39
web/views/@default/api/node/upgradePopup.js
Normal file
@@ -0,0 +1,39 @@
|
||||
Tea.context(function () {
|
||||
this.$delay(function () {
|
||||
this.checkLoop()
|
||||
})
|
||||
|
||||
this.success = function () {
|
||||
}
|
||||
|
||||
this.isRequesting = false
|
||||
|
||||
this.before = function () {
|
||||
this.isRequesting = true
|
||||
}
|
||||
|
||||
this.done = function () {
|
||||
this.isRequesting = false
|
||||
}
|
||||
|
||||
this.checkLoop = function () {
|
||||
if (this.currentVersion == this.latestVersion) {
|
||||
return
|
||||
}
|
||||
|
||||
this.$post(".upgradeCheck")
|
||||
.params({
|
||||
nodeId: this.nodeId
|
||||
})
|
||||
.success(function (resp) {
|
||||
if (resp.data.isOk) {
|
||||
teaweb.reload()
|
||||
}
|
||||
})
|
||||
.done(function () {
|
||||
this.$delay(function () {
|
||||
this.checkLoop()
|
||||
}, 3000)
|
||||
})
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user