mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-07 23:30:26 +08:00
36 lines
753 B
Go
36 lines
753 B
Go
|
|
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()
|
||
|
|
}
|