Browse Source

fix-2633

tags/v1.22.8.1^2
liuzx 3 years ago
parent
commit
cb4b798981
4 changed files with 32 additions and 0 deletions
  1. +26
    -0
      models/cloudbrain.go
  2. +2
    -0
      routers/admin/cloudbrains.go
  3. +2
    -0
      routers/api/v1/repo/cloudbrain_dashboard.go
  4. +2
    -0
      routers/user/home.go

+ 26
- 0
models/cloudbrain.go View File

@@ -373,6 +373,8 @@ type CloudbrainsOptions struct {
BeginTimeUnix int64 BeginTimeUnix int64
EndTimeUnix int64 EndTimeUnix int64
AiCenter string AiCenter string
NeedDeleteInfo string
Cluster string
} }


type TaskPod struct { type TaskPod struct {
@@ -1409,6 +1411,18 @@ func Cloudbrains(opts *CloudbrainsOptions) ([]*CloudbrainInfo, int64, error) {
builder.Like{"cloudbrain.ai_center", opts.AiCenter}, 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) != "" { 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"})) 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}, 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) != "" { if (opts.IsLatestVersion) != "" {
cond = cond.And(builder.Or(builder.And(builder.Eq{"cloudbrain.is_latest_version": opts.IsLatestVersion}, cond = cond.And(builder.Or(builder.And(builder.Eq{"cloudbrain.is_latest_version": opts.IsLatestVersion},


+ 2
- 0
routers/admin/cloudbrains.go View File

@@ -36,6 +36,7 @@ func CloudBrains(ctx *context.Context) {
jobType := ctx.Query("jobType") jobType := ctx.Query("jobType")
jobStatus := ctx.Query("jobStatus") jobStatus := ctx.Query("jobStatus")
aiCenter := ctx.Query("aiCenter") aiCenter := ctx.Query("aiCenter")
cluster := ctx.Query("cluster")


ctx.Data["ListType"] = listType ctx.Data["ListType"] = listType
ctx.Data["JobType"] = jobType ctx.Data["JobType"] = jobType
@@ -82,6 +83,7 @@ func CloudBrains(ctx *context.Context) {
ComputeResource: listType, ComputeResource: listType,
Type: models.TypeCloudBrainAll, Type: models.TypeCloudBrainAll,
AiCenter: aiCenter, AiCenter: aiCenter,
Cluster: cluster,
}) })
if err != nil { if err != nil {
ctx.ServerError("Get job failed:", err) ctx.ServerError("Get job failed:", err)


+ 2
- 0
routers/api/v1/repo/cloudbrain_dashboard.go View File

@@ -680,6 +680,7 @@ func GetCloudbrainsDetailData(ctx *context.Context) {
jobStatus := ctx.Query("jobStatus") jobStatus := ctx.Query("jobStatus")
cloudBrainType := ctx.QueryInt("Type") cloudBrainType := ctx.QueryInt("Type")
aiCenter := ctx.Query("aiCenter") aiCenter := ctx.Query("aiCenter")
needDeleteInfo := ctx.Query("needDeleteInfo")


page := ctx.QueryInt("page") page := ctx.QueryInt("page")
pageSize := ctx.QueryInt("pagesize") pageSize := ctx.QueryInt("pagesize")
@@ -726,6 +727,7 @@ func GetCloudbrainsDetailData(ctx *context.Context) {
BeginTimeUnix: int64(recordBeginTime), BeginTimeUnix: int64(recordBeginTime),
EndTimeUnix: endTime.Unix(), EndTimeUnix: endTime.Unix(),
AiCenter: aiCenter, AiCenter: aiCenter,
NeedDeleteInfo: needDeleteInfo,
}) })
if err != nil { if err != nil {
ctx.ServerError("Get job failed:", err) ctx.ServerError("Get job failed:", err)


+ 2
- 0
routers/user/home.go View File

@@ -762,6 +762,7 @@ func Cloudbrains(ctx *context.Context) {
jobType := ctx.Query("jobType") jobType := ctx.Query("jobType")
jobStatus := ctx.Query("jobStatus") jobStatus := ctx.Query("jobStatus")
aiCenter := ctx.Query("aiCenter") aiCenter := ctx.Query("aiCenter")
cluster := ctx.Query("cluster")


ctx.Data["ListType"] = listType ctx.Data["ListType"] = listType
ctx.Data["JobType"] = jobType ctx.Data["JobType"] = jobType
@@ -827,6 +828,7 @@ func Cloudbrains(ctx *context.Context) {
ComputeResource: listType, ComputeResource: listType,
Type: models.TypeCloudBrainAll, Type: models.TypeCloudBrainAll,
AiCenter: aiCenter, AiCenter: aiCenter,
Cluster: cluster,
}) })
if err != nil { if err != nil {
ctx.ServerError("Get job failed:", err) ctx.ServerError("Get job failed:", err)


Loading…
Cancel
Save