mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-12-01 01:10:25 +08:00
因为健康检查下线的节点可以手动恢复上线
This commit is contained in:
@@ -36,6 +36,7 @@ func init() {
|
|||||||
Get("/node/logs", new(node.LogsAction)).
|
Get("/node/logs", new(node.LogsAction)).
|
||||||
Post("/node/start", new(node.StartAction)).
|
Post("/node/start", new(node.StartAction)).
|
||||||
Post("/node/stop", new(node.StopAction)).
|
Post("/node/stop", new(node.StopAction)).
|
||||||
|
Post("/node/up", new(node.UpAction)).
|
||||||
|
|
||||||
// 分组相关
|
// 分组相关
|
||||||
Get("/groups", new(groups.IndexAction)).
|
Get("/groups", new(groups.IndexAction)).
|
||||||
|
|||||||
28
internal/web/actions/default/clusters/cluster/node/up.go
Normal file
28
internal/web/actions/default/clusters/cluster/node/up.go
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
package node
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||||
|
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||||
|
)
|
||||||
|
|
||||||
|
// 手动上线
|
||||||
|
type UpAction struct {
|
||||||
|
actionutils.ParentAction
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *UpAction) RunPost(params struct {
|
||||||
|
NodeId int64
|
||||||
|
}) {
|
||||||
|
defer this.CreateLogInfo("手动上线节点 %d", params.NodeId)
|
||||||
|
|
||||||
|
_, err := this.RPC().NodeRPC().UpdateNodeUp(this.AdminContext(), &pb.UpdateNodeUpRequest{
|
||||||
|
NodeId: params.NodeId,
|
||||||
|
IsUp: true,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.Success()
|
||||||
|
}
|
||||||
@@ -97,7 +97,10 @@
|
|||||||
</td>
|
</td>
|
||||||
<td class="center">
|
<td class="center">
|
||||||
<div v-if="!node.isUp">
|
<div v-if="!node.isUp">
|
||||||
<span class="red">健康问题</span>
|
<span class="red">健康问题下线</span>
|
||||||
|
<div>
|
||||||
|
<a href="" @click.prevent="upNode(node.id)">[上线]</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="!node.isOn">
|
<div v-else-if="!node.isOn">
|
||||||
<label-on :v-is-on="node.isOn"></label-on>
|
<label-on :v-is-on="node.isOn"></label-on>
|
||||||
|
|||||||
@@ -1,11 +1,21 @@
|
|||||||
Tea.context(function () {
|
Tea.context(function () {
|
||||||
this.deleteNode = function (nodeId) {
|
this.deleteNode = function (nodeId) {
|
||||||
teaweb.confirm("确定要删除这个节点吗?", function () {
|
teaweb.confirm("确定要删除这个节点吗?", function () {
|
||||||
this.$post("/nodes/delete")
|
this.$post("/nodes/delete")
|
||||||
.params({
|
.params({
|
||||||
nodeId: nodeId
|
nodeId: nodeId
|
||||||
})
|
})
|
||||||
.refresh();
|
.refresh();
|
||||||
});
|
})
|
||||||
};
|
}
|
||||||
});
|
|
||||||
|
this.upNode = function (nodeId) {
|
||||||
|
teaweb.confirm("确定要手动上线此节点吗?", function () {
|
||||||
|
this.$post("/clusters/cluster/node/up")
|
||||||
|
.params({
|
||||||
|
nodeId: nodeId
|
||||||
|
})
|
||||||
|
.refresh()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user