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

36 lines
753 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{}) {
resp, err := this.RPC().NodeClusterRPC().FindAllChangedClusters(this.AdminContext(), &pb.FindAllChangedClustersRequest{})
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()
}