diff --git a/models/cloudbrain.go b/models/cloudbrain.go index f9897b91d..33e550c0c 100755 --- a/models/cloudbrain.go +++ b/models/cloudbrain.go @@ -372,6 +372,9 @@ type CloudbrainsOptions struct { ComputeResource string BeginTimeUnix int64 EndTimeUnix int64 + AiCenter string + NeedDeleteInfo string + Cluster string } type TaskPod struct { @@ -1403,6 +1406,23 @@ func Cloudbrains(opts *CloudbrainsOptions) ([]*CloudbrainInfo, int64, error) { ) } } + if (opts.AiCenter) != "" { + cond = cond.And( + builder.Like{"cloudbrain.ai_center", opts.AiCenter}, + ) + } + if (opts.Cluster) != "" { + if opts.Cluster == "resource_cluster_openi" { + cond = cond.And( + builder.Or(builder.Eq{"cloudbrain.type": TypeCloudBrainOne}, builder.Eq{"cloudbrain.type": TypeCloudBrainTwo}), + ) + } + if opts.Cluster == "resource_cluster_c2net" { + cond = cond.And( + builder.Eq{"cloudbrain.type": TypeC2Net}, + ) + } + } if (opts.IsLatestVersion) != "" { cond = cond.And(builder.Or(builder.And(builder.Eq{"cloudbrain.is_latest_version": opts.IsLatestVersion}, builder.Eq{"cloudbrain.job_type": "TRAIN"}), builder.Neq{"cloudbrain.job_type": "TRAIN"})) @@ -1944,6 +1964,24 @@ func CloudbrainAll(opts *CloudbrainsOptions) ([]*CloudbrainInfo, int64, error) { } } + if (opts.AiCenter) != "" { + cond = cond.And( + builder.Like{"cloudbrain.ai_center", opts.AiCenter}, + ) + } + if (opts.NeedDeleteInfo) != "" { + if opts.NeedDeleteInfo == "yes" { + cond = cond.And( + builder.And(builder.NotNull{"cloudbrain.deleted_at"}), + ) + } + if opts.NeedDeleteInfo == "no" { + cond = cond.And( + builder.And(builder.IsNull{"cloudbrain.deleted_at"}), + ) + } + } + if (opts.IsLatestVersion) != "" { cond = cond.And(builder.Or(builder.And(builder.Eq{"cloudbrain.is_latest_version": opts.IsLatestVersion}, builder.Eq{"cloudbrain.job_type": "TRAIN"}), builder.Neq{"cloudbrain.job_type": "TRAIN"})) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 0d35cc326..8732ea889 100755 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -3086,6 +3086,8 @@ Platform_Tutorial = Tutorial foot.advice_feedback = Feedback [cloudbrain] +all_resource_cluster=All Cluster +all_ai_center=All Computing NET resource_cluster = Resource Cluster resource_cluster_openi = OpenI Resource Cluster resource_cluster_c2net = China Computing NET diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini index d34a18cc1..032cb04d1 100755 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -3100,6 +3100,8 @@ Platform_Tutorial=新手指引 foot.advice_feedback = 意见反馈 [cloudbrain] +all_resource_cluster=全部集群 +all_ai_center=全部智算中心 resource_cluster = 算力集群 resource_cluster_openi = 启智集群 resource_cluster_c2net = 智算网络集群 diff --git a/routers/admin/cloudbrains.go b/routers/admin/cloudbrains.go index 5876baf18..ec0034f4f 100755 --- a/routers/admin/cloudbrains.go +++ b/routers/admin/cloudbrains.go @@ -35,10 +35,14 @@ func CloudBrains(ctx *context.Context) { listType := ctx.Query("listType") jobType := ctx.Query("jobType") jobStatus := ctx.Query("jobStatus") + aiCenter := ctx.Query("aiCenter") + cluster := ctx.Query("cluster") ctx.Data["ListType"] = listType ctx.Data["JobType"] = jobType ctx.Data["JobStatus"] = jobStatus + ctx.Data["aiCenter"] = aiCenter + ctx.Data["cluster"] = cluster page := ctx.QueryInt("page") if page <= 0 { @@ -80,6 +84,8 @@ func CloudBrains(ctx *context.Context) { IsLatestVersion: modelarts.IsLatestVersion, ComputeResource: listType, Type: models.TypeCloudBrainAll, + AiCenter: aiCenter, + Cluster: cluster, }) if err != nil { ctx.ServerError("Get job failed:", err) diff --git a/routers/api/v1/repo/cloudbrain_dashboard.go b/routers/api/v1/repo/cloudbrain_dashboard.go index c632f3c8b..52ee3ed2c 100755 --- a/routers/api/v1/repo/cloudbrain_dashboard.go +++ b/routers/api/v1/repo/cloudbrain_dashboard.go @@ -679,6 +679,8 @@ func GetCloudbrainsDetailData(ctx *context.Context) { jobType := ctx.Query("jobType") jobStatus := ctx.Query("jobStatus") cloudBrainType := ctx.QueryInt("Type") + aiCenter := ctx.Query("aiCenter") + needDeleteInfo := ctx.Query("needDeleteInfo") page := ctx.QueryInt("page") pageSize := ctx.QueryInt("pagesize") @@ -724,6 +726,8 @@ func GetCloudbrainsDetailData(ctx *context.Context) { NeedRepoInfo: true, BeginTimeUnix: int64(recordBeginTime), EndTimeUnix: endTime.Unix(), + AiCenter: aiCenter, + NeedDeleteInfo: needDeleteInfo, }) if err != nil { ctx.ServerError("Get job failed:", err) diff --git a/routers/user/home.go b/routers/user/home.go index 25b1c518e..d8c2565c6 100755 --- a/routers/user/home.go +++ b/routers/user/home.go @@ -761,10 +761,14 @@ func Cloudbrains(ctx *context.Context) { listType := ctx.Query("listType") jobType := ctx.Query("jobType") jobStatus := ctx.Query("jobStatus") + aiCenter := ctx.Query("aiCenter") + cluster := ctx.Query("cluster") ctx.Data["ListType"] = listType ctx.Data["JobType"] = jobType ctx.Data["JobStatus"] = jobStatus + ctx.Data["aiCenter"] = aiCenter + ctx.Data["cluster"] = cluster page := ctx.QueryInt("page") if page <= 0 { @@ -825,6 +829,8 @@ func Cloudbrains(ctx *context.Context) { RepoIDList: repoIDList, ComputeResource: listType, Type: models.TypeCloudBrainAll, + AiCenter: aiCenter, + Cluster: cluster, }) if err != nil { ctx.ServerError("Get job failed:", err) diff --git a/templates/admin/cloudbrain/list.tmpl b/templates/admin/cloudbrain/list.tmpl index cd5913c40..0340fa725 100755 --- a/templates/admin/cloudbrain/list.tmpl +++ b/templates/admin/cloudbrain/list.tmpl @@ -14,6 +14,10 @@