diff --git a/internal/web/actions/default/clusters/cluster/init.go b/internal/web/actions/default/clusters/cluster/init.go index 2035698c..bf7915ea 100644 --- a/internal/web/actions/default/clusters/cluster/init.go +++ b/internal/web/actions/default/clusters/cluster/init.go @@ -36,6 +36,7 @@ func init() { Get("/node/logs", new(node.LogsAction)). Post("/node/start", new(node.StartAction)). Post("/node/stop", new(node.StopAction)). + Post("/node/up", new(node.UpAction)). // 分组相关 Get("/groups", new(groups.IndexAction)). diff --git a/internal/web/actions/default/clusters/cluster/node/up.go b/internal/web/actions/default/clusters/cluster/node/up.go new file mode 100644 index 00000000..fe582701 --- /dev/null +++ b/internal/web/actions/default/clusters/cluster/node/up.go @@ -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() +} diff --git a/web/views/@default/clusters/cluster/index.html b/web/views/@default/clusters/cluster/index.html index 3fd0f235..4dbb802d 100644 --- a/web/views/@default/clusters/cluster/index.html +++ b/web/views/@default/clusters/cluster/index.html @@ -97,7 +97,10 @@
- 健康问题 + 健康问题下线 +
+ [上线] +
diff --git a/web/views/@default/clusters/cluster/index.js b/web/views/@default/clusters/cluster/index.js index b20b0f5c..a5f8ce0e 100644 --- a/web/views/@default/clusters/cluster/index.js +++ b/web/views/@default/clusters/cluster/index.js @@ -1,11 +1,21 @@ Tea.context(function () { - this.deleteNode = function (nodeId) { - teaweb.confirm("确定要删除这个节点吗?", function () { - this.$post("/nodes/delete") - .params({ - nodeId: nodeId - }) - .refresh(); - }); - }; -}); \ No newline at end of file + this.deleteNode = function (nodeId) { + teaweb.confirm("确定要删除这个节点吗?", function () { + this.$post("/nodes/delete") + .params({ + nodeId: nodeId + }) + .refresh(); + }) + } + + this.upNode = function (nodeId) { + teaweb.confirm("确定要手动上线此节点吗?", function () { + this.$post("/clusters/cluster/node/up") + .params({ + nodeId: nodeId + }) + .refresh() + }) + } +}) \ No newline at end of file