2020-08-21 12:32:16 +08:00
|
|
|
package common
|
|
|
|
|
|
|
|
|
|
import (
|
2020-09-13 20:37:07 +08:00
|
|
|
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
2020-08-21 12:32:16 +08:00
|
|
|
"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()
|
|
|
|
|
}
|