Files
EdgeAdmin/internal/web/actions/default/common/changedClusters.go

36 lines
761 B
Go
Raw Normal View History

2020-08-21 12:32:16 +08:00
package common
import (
"github.com/TeaOSLab/EdgeAdmin/internal/rpc/pb"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/iwind/TeaGo/maps"
)
type ChangedClustersAction struct {
actionutils.ParentAction
}
func (this *ChangedClustersAction) Init() {
this.Nav("", "", "")
}
func (this *ChangedClustersAction) RunGet(params struct{}) {
2020-09-06 16:19:34 +08:00
resp, err := this.RPC().NodeClusterRPC().FindAllChangedNodeClusters(this.AdminContext(), &pb.FindAllChangedNodeClustersRequest{})
2020-08-21 12:32:16 +08:00
if err != nil {
this.ErrorPage(err)
return
}
result := []maps.Map{}
for _, cluster := range resp.Clusters {
result = append(result, maps.Map{
"id": cluster.Id,
"name": cluster.Name,
})
}
this.Data["clusters"] = result
this.Success()
}