From c833ac2e96716c89968773c58773e8a70400df3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Wed, 24 Feb 2021 19:27:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=A0=E4=B8=BA=E5=81=A5=E5=BA=B7=E6=A3=80?= =?UTF-8?q?=E6=9F=A5=E4=B8=8B=E7=BA=BF=E7=9A=84=E8=8A=82=E7=82=B9=E5=8F=AF?= =?UTF-8?q?=E4=BB=A5=E6=89=8B=E5=8A=A8=E6=81=A2=E5=A4=8D=E4=B8=8A=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../actions/default/clusters/cluster/init.go | 1 + .../default/clusters/cluster/node/up.go | 28 +++++++++++++++++ .../@default/clusters/cluster/index.html | 5 +++- web/views/@default/clusters/cluster/index.js | 30 ++++++++++++------- 4 files changed, 53 insertions(+), 11 deletions(-) create mode 100644 internal/web/actions/default/clusters/cluster/node/up.go 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