mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-03 20:40:26 +08:00
优化代码
This commit is contained in:
@@ -21,7 +21,9 @@ func (this *CleanAction) Init() {
|
||||
this.Nav("", "", "clean")
|
||||
}
|
||||
|
||||
func (this *CleanAction) RunGet(params struct{}) {
|
||||
func (this *CleanAction) RunGet(params struct {
|
||||
CachePolicyId int64
|
||||
}) {
|
||||
// 默认的集群ID
|
||||
cookie, err := this.Request.Cookie("cache_cluster_id")
|
||||
if cookie != nil && err == nil {
|
||||
@@ -29,13 +31,13 @@ func (this *CleanAction) RunGet(params struct{}) {
|
||||
}
|
||||
|
||||
// 集群列表
|
||||
clustersResp, err := this.RPC().NodeClusterRPC().FindAllEnabledNodeClusters(this.AdminContext(), &pb.FindAllEnabledNodeClustersRequest{})
|
||||
clustersResp, err := this.RPC().NodeClusterRPC().FindAllEnabledNodeClustersWithHTTPCachePolicyId(this.AdminContext(), &pb.FindAllEnabledNodeClustersWithHTTPCachePolicyIdRequest{HttpCachePolicyId: params.CachePolicyId})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
clusterMaps := []maps.Map{}
|
||||
for _, cluster := range clustersResp.Clusters {
|
||||
for _, cluster := range clustersResp.NodeClusters {
|
||||
clusterMaps = append(clusterMaps, maps.Map{
|
||||
"id": cluster.Id,
|
||||
"name": cluster.Name,
|
||||
|
||||
@@ -23,7 +23,9 @@ func (this *PreheatAction) Init() {
|
||||
this.Nav("", "", "preheat")
|
||||
}
|
||||
|
||||
func (this *PreheatAction) RunGet(params struct{}) {
|
||||
func (this *PreheatAction) RunGet(params struct {
|
||||
CachePolicyId int64
|
||||
}) {
|
||||
// 默认的集群ID
|
||||
cookie, err := this.Request.Cookie("cache_cluster_id")
|
||||
if cookie != nil && err == nil {
|
||||
@@ -31,13 +33,13 @@ func (this *PreheatAction) RunGet(params struct{}) {
|
||||
}
|
||||
|
||||
// 集群列表
|
||||
clustersResp, err := this.RPC().NodeClusterRPC().FindAllEnabledNodeClusters(this.AdminContext(), &pb.FindAllEnabledNodeClustersRequest{})
|
||||
clustersResp, err := this.RPC().NodeClusterRPC().FindAllEnabledNodeClustersWithHTTPCachePolicyId(this.AdminContext(), &pb.FindAllEnabledNodeClustersWithHTTPCachePolicyIdRequest{HttpCachePolicyId: params.CachePolicyId})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
clusterMaps := []maps.Map{}
|
||||
for _, cluster := range clustersResp.Clusters {
|
||||
for _, cluster := range clustersResp.NodeClusters {
|
||||
clusterMaps = append(clusterMaps, maps.Map{
|
||||
"id": cluster.Id,
|
||||
"name": cluster.Name,
|
||||
|
||||
@@ -23,7 +23,9 @@ func (this *PurgeAction) Init() {
|
||||
this.Nav("", "", "purge")
|
||||
}
|
||||
|
||||
func (this *PurgeAction) RunGet(params struct{}) {
|
||||
func (this *PurgeAction) RunGet(params struct {
|
||||
CachePolicyId int64
|
||||
}) {
|
||||
// 默认的集群ID
|
||||
cookie, err := this.Request.Cookie("cache_cluster_id")
|
||||
if cookie != nil && err == nil {
|
||||
@@ -31,13 +33,13 @@ func (this *PurgeAction) RunGet(params struct{}) {
|
||||
}
|
||||
|
||||
// 集群列表
|
||||
clustersResp, err := this.RPC().NodeClusterRPC().FindAllEnabledNodeClusters(this.AdminContext(), &pb.FindAllEnabledNodeClustersRequest{})
|
||||
clustersResp, err := this.RPC().NodeClusterRPC().FindAllEnabledNodeClustersWithHTTPCachePolicyId(this.AdminContext(), &pb.FindAllEnabledNodeClustersWithHTTPCachePolicyIdRequest{HttpCachePolicyId: params.CachePolicyId})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
clusterMaps := []maps.Map{}
|
||||
for _, cluster := range clustersResp.Clusters {
|
||||
for _, cluster := range clustersResp.NodeClusters {
|
||||
clusterMaps = append(clusterMaps, maps.Map{
|
||||
"id": cluster.Id,
|
||||
"name": cluster.Name,
|
||||
|
||||
@@ -21,7 +21,9 @@ func (this *StatAction) Init() {
|
||||
this.Nav("", "", "stat")
|
||||
}
|
||||
|
||||
func (this *StatAction) RunGet(params struct{}) {
|
||||
func (this *StatAction) RunGet(params struct {
|
||||
CachePolicyId int64
|
||||
}) {
|
||||
// 默认的集群ID
|
||||
cookie, err := this.Request.Cookie("cache_cluster_id")
|
||||
if cookie != nil && err == nil {
|
||||
@@ -29,13 +31,13 @@ func (this *StatAction) RunGet(params struct{}) {
|
||||
}
|
||||
|
||||
// 集群列表
|
||||
clustersResp, err := this.RPC().NodeClusterRPC().FindAllEnabledNodeClusters(this.AdminContext(), &pb.FindAllEnabledNodeClustersRequest{})
|
||||
clustersResp, err := this.RPC().NodeClusterRPC().FindAllEnabledNodeClustersWithHTTPCachePolicyId(this.AdminContext(), &pb.FindAllEnabledNodeClustersWithHTTPCachePolicyIdRequest{HttpCachePolicyId: params.CachePolicyId})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
clusterMaps := []maps.Map{}
|
||||
for _, cluster := range clustersResp.Clusters {
|
||||
for _, cluster := range clustersResp.NodeClusters {
|
||||
clusterMaps = append(clusterMaps, maps.Map{
|
||||
"id": cluster.Id,
|
||||
"name": cluster.Name,
|
||||
|
||||
@@ -15,7 +15,9 @@ func (this *TestAction) Init() {
|
||||
this.Nav("", "", "test")
|
||||
}
|
||||
|
||||
func (this *TestAction) RunGet(params struct{}) {
|
||||
func (this *TestAction) RunGet(params struct {
|
||||
CachePolicyId int64
|
||||
}) {
|
||||
// 默认的集群ID
|
||||
cookie, err := this.Request.Cookie("cache_cluster_id")
|
||||
if cookie != nil && err == nil {
|
||||
@@ -23,13 +25,13 @@ func (this *TestAction) RunGet(params struct{}) {
|
||||
}
|
||||
|
||||
// 集群列表
|
||||
clustersResp, err := this.RPC().NodeClusterRPC().FindAllEnabledNodeClusters(this.AdminContext(), &pb.FindAllEnabledNodeClustersRequest{})
|
||||
clustersResp, err := this.RPC().NodeClusterRPC().FindAllEnabledNodeClustersWithHTTPCachePolicyId(this.AdminContext(), &pb.FindAllEnabledNodeClustersWithHTTPCachePolicyIdRequest{HttpCachePolicyId: params.CachePolicyId})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
clusterMaps := []maps.Map{}
|
||||
for _, cluster := range clustersResp.Clusters {
|
||||
for _, cluster := range clustersResp.NodeClusters {
|
||||
clusterMaps = append(clusterMaps, maps.Map{
|
||||
"id": cluster.Id,
|
||||
"name": cluster.Name,
|
||||
|
||||
Reference in New Issue
Block a user