集群界面数据改成异步加载

This commit is contained in:
GoEdgeLab
2021-08-20 10:51:01 +08:00
parent ec4468cb55
commit 01d2809323
11 changed files with 58 additions and 13 deletions

View File

@@ -10,7 +10,6 @@ import (
"github.com/iwind/TeaGo/maps"
"github.com/iwind/TeaGo/types"
timeutil "github.com/iwind/TeaGo/utils/time"
"strconv"
)
type IndexAction struct {
@@ -23,10 +22,17 @@ func (this *IndexAction) Init() {
func (this *IndexAction) RunGet(params struct {
ClusterId int64
}) {
this.Data["clusterId"] = params.ClusterId
this.Show()
}
func (this *IndexAction) RunPost(params struct {
ClusterId int64
}) {
if !teaconst.IsPlus {
this.RedirectURL("/clusters/cluster?clusterId=" + strconv.FormatInt(params.ClusterId, 10))
return
this.Fail("only for commercial users")
}
resp, err := this.RPC().ServerStatBoardRPC().ComposeServerStatNodeClusterBoard(this.AdminContext(), &pb.ComposeServerStatNodeClusterBoardRequest{NodeClusterId: params.ClusterId})
@@ -178,5 +184,5 @@ func (this *IndexAction) RunGet(params struct {
this.Data["metricCharts"] = chartMaps
}
this.Show()
this.Success()
}

View File

@@ -59,7 +59,7 @@ func init() {
// 看板相关
Prefix("/clusters/cluster/boards").
Get("", new(boards.IndexAction)).
GetPost("", new(boards.IndexAction)).
EndAll()
})
}