mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-03 20:40:26 +08:00
增加置顶集群功能
This commit is contained in:
@@ -145,6 +145,7 @@ func (this *IndexAction) RunGet(params struct {
|
||||
"dnsDomainName": dnsDomainName,
|
||||
"countServers": countServersResp.Count,
|
||||
"timeZone": cluster.TimeZone,
|
||||
"isPinned": cluster.IsPinned,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ func init() {
|
||||
Prefix("/clusters").
|
||||
Get("", new(IndexAction)).
|
||||
GetPost("/create", new(CreateAction)).
|
||||
Post("/pin", new(PinAction)).
|
||||
|
||||
// 只要登录即可访问的Action
|
||||
EndHelpers().
|
||||
|
||||
34
internal/web/actions/default/clusters/pin.go
Normal file
34
internal/web/actions/default/clusters/pin.go
Normal file
@@ -0,0 +1,34 @@
|
||||
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
|
||||
|
||||
package clusters
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||
)
|
||||
|
||||
type PinAction struct {
|
||||
actionutils.ParentAction
|
||||
}
|
||||
|
||||
func (this *PinAction) RunPost(params struct {
|
||||
ClusterId int64
|
||||
IsPinned bool
|
||||
}) {
|
||||
if params.IsPinned {
|
||||
defer this.CreateLogInfo("置顶集群 %d", params.ClusterId)
|
||||
} else {
|
||||
defer this.CreateLogInfo("取消置顶集群 %d", params.ClusterId)
|
||||
}
|
||||
|
||||
_, err := this.RPC().NodeClusterRPC().UpdateNodeClusterPinned(this.AdminContext(), &pb.UpdateNodeClusterPinnedRequest{
|
||||
NodeClusterId: params.ClusterId,
|
||||
IsPinned: params.IsPinned,
|
||||
})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
|
||||
this.Success()
|
||||
}
|
||||
Reference in New Issue
Block a user