diff --git a/models/cloudbrain.go b/models/cloudbrain.go index db1a85981..33e550c0c 100755 --- a/models/cloudbrain.go +++ b/models/cloudbrain.go @@ -373,6 +373,8 @@ type CloudbrainsOptions struct { BeginTimeUnix int64 EndTimeUnix int64 AiCenter string + NeedDeleteInfo string + Cluster string } type TaskPod struct { @@ -1409,6 +1411,18 @@ func Cloudbrains(opts *CloudbrainsOptions) ([]*CloudbrainInfo, int64, error) { 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"})) @@ -1955,6 +1969,18 @@ func CloudbrainAll(opts *CloudbrainsOptions) ([]*CloudbrainInfo, int64, error) { 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}, diff --git a/routers/admin/cloudbrains.go b/routers/admin/cloudbrains.go index 016ec7f8b..4d8bdd576 100755 --- a/routers/admin/cloudbrains.go +++ b/routers/admin/cloudbrains.go @@ -36,6 +36,7 @@ func CloudBrains(ctx *context.Context) { jobType := ctx.Query("jobType") jobStatus := ctx.Query("jobStatus") aiCenter := ctx.Query("aiCenter") + cluster := ctx.Query("cluster") ctx.Data["ListType"] = listType ctx.Data["JobType"] = jobType @@ -82,6 +83,7 @@ func CloudBrains(ctx *context.Context) { 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 18dfe2621..52ee3ed2c 100755 --- a/routers/api/v1/repo/cloudbrain_dashboard.go +++ b/routers/api/v1/repo/cloudbrain_dashboard.go @@ -680,6 +680,7 @@ func GetCloudbrainsDetailData(ctx *context.Context) { jobStatus := ctx.Query("jobStatus") cloudBrainType := ctx.QueryInt("Type") aiCenter := ctx.Query("aiCenter") + needDeleteInfo := ctx.Query("needDeleteInfo") page := ctx.QueryInt("page") pageSize := ctx.QueryInt("pagesize") @@ -726,6 +727,7 @@ func GetCloudbrainsDetailData(ctx *context.Context) { 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 40062b2de..100fbf665 100755 --- a/routers/user/home.go +++ b/routers/user/home.go @@ -762,6 +762,7 @@ func Cloudbrains(ctx *context.Context) { jobType := ctx.Query("jobType") jobStatus := ctx.Query("jobStatus") aiCenter := ctx.Query("aiCenter") + cluster := ctx.Query("cluster") ctx.Data["ListType"] = listType ctx.Data["JobType"] = jobType @@ -827,6 +828,7 @@ func Cloudbrains(ctx *context.Context) { ComputeResource: listType, Type: models.TypeCloudBrainAll, AiCenter: aiCenter, + Cluster: cluster, }) if err != nil { ctx.ServerError("Get job failed:", err)