mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-03 04:10:27 +08:00
集群节点列表页增加停用/启用操作
This commit is contained in:
@@ -49,6 +49,7 @@ func init() {
|
||||
Post("/start", new(node.StartAction)).
|
||||
Post("/stop", new(node.StopAction)).
|
||||
Post("/up", new(node.UpAction)).
|
||||
Post("/updateIsOn", new(node.UpdateIsOnAction)).
|
||||
Get("/detail", new(node.DetailAction)).
|
||||
GetPost("/updateDNSPopup", new(node.UpdateDNSPopupAction)).
|
||||
Post("/syncDomain", new(node.SyncDomainAction)).
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
// Copyright 2024 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||
|
||||
package node
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||
)
|
||||
|
||||
type UpdateIsOnAction struct {
|
||||
actionutils.ParentAction
|
||||
}
|
||||
|
||||
func (this *UpdateIsOnAction) RunPost(params struct {
|
||||
NodeId int64
|
||||
IsOn bool
|
||||
}) {
|
||||
if params.IsOn {
|
||||
defer this.CreateLogInfo(codes.Node_LogUpdateNodeOn, params.NodeId)
|
||||
} else {
|
||||
defer this.CreateLogInfo(codes.Node_LogUpdateNodeOff, params.NodeId)
|
||||
}
|
||||
|
||||
_, err := this.RPC().NodeRPC().UpdateNodeIsOn(this.AdminContext(), &pb.UpdateNodeIsOnRequest{
|
||||
NodeId: params.NodeId,
|
||||
IsOn: params.IsOn,
|
||||
})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
|
||||
this.Success()
|
||||
}
|
||||
@@ -70,7 +70,7 @@
|
||||
<th class="value-column center" v-if="windowWidth < miniWidth || windowWidth > columnWidth4">连接数<sort-arrow name="connectionsOrder"></sort-arrow></th>
|
||||
<th class="value-column center" v-if="windowWidth < miniWidth || windowWidth > columnWidth5">负载<sort-arrow name="loadOrder"></sort-arrow></th>
|
||||
<th class="width6 center">状态</th>
|
||||
<th class="two op">操作</th>
|
||||
<th class="three op">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr v-for="(node, nodeIndex) in nodes">
|
||||
@@ -172,7 +172,7 @@
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<a :href="'/clusters/cluster/node?clusterId=' + clusterId + '&nodeId=' + node.id">详情</a> <a href="" @click.prevent="deleteNode(node.id)">删除</a>
|
||||
<a :href="'/clusters/cluster/node?clusterId=' + clusterId + '&nodeId=' + node.id">详情</a> <a href="" @click.prevent="updateNodeOn(node.id, !node.isOn)"><span v-if="node.isOn">停用</span><span v-else class="red">启用</span></a> <a href="" @click.prevent="deleteNode(node.id)">删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -49,6 +49,26 @@ Tea.context(function () {
|
||||
})
|
||||
}
|
||||
|
||||
this.updateNodeOn = function (nodeId, isOn) {
|
||||
let that = this
|
||||
let op
|
||||
if (isOn) {
|
||||
op = "启用"
|
||||
} else {
|
||||
op = "停用"
|
||||
}
|
||||
teaweb.confirm("确定要" + op + "此节点吗?", function () {
|
||||
that.$post(".node.updateIsOn")
|
||||
.params({
|
||||
nodeId: nodeId,
|
||||
isOn: isOn
|
||||
})
|
||||
.success(function () {
|
||||
teaweb.successRefresh(op + "成功")
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示和隐藏IP
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user