实现远程卸载节点功能

This commit is contained in:
GoEdgeLab
2024-05-07 08:40:18 +08:00
parent 4dde0436a0
commit b7d636baac
4 changed files with 58 additions and 1 deletions

View File

@@ -321,8 +321,12 @@
<tr>
<td>已安装</td>
<td>
<span v-if="node.isInstalled" class="green">已安装</span>
<span v-if="node.isInstalled" class="green">已安装 &nbsp; <a href="" @click.prevent="showMoreOps"><span class="small">[操作]</span></a></span>
<a v-else :href="'/clusters/cluster/installNode?clusterId=' + clusterId + '&nodeId=' + nodeId" class="underline" title="点击进入安装界面"><span class="red">未安装</span></a>
</td>
</tr>
<tr v-show="moreOpsVisible && node.isInstalled">
<td>操作</td>
<td><a href="" @click.prevent="uninstallNode">[卸载]</a> </td>
</tr>
</table>

View File

@@ -36,4 +36,24 @@ Tea.context(function () {
this.round = function (f) {
return Math.round(f * 100) / 100
}
this.moreOpsVisible = false
this.showMoreOps = function () {
this.moreOpsVisible = !this.moreOpsVisible
}
this.uninstallNode = function () {
let that = this
teaweb.confirm("html:确定要卸载当前节点吗?<br/>此操作将会删除节点上除缓存以外的相关文件。", function () {
that.$post("/clusters/cluster/node/uninstall")
.params({
nodeId: that.node.id
})
.success(function () {
teaweb.success("执行成功", function () {
teaweb.reload()
})
})
})
}
})