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 @@
diff --git a/templates/admin/cloudbrain/search.tmpl b/templates/admin/cloudbrain/search.tmpl index ddd616eb4..ea406e52d 100644 --- a/templates/admin/cloudbrain/search.tmpl +++ b/templates/admin/cloudbrain/search.tmpl @@ -7,44 +7,68 @@
+ + diff --git a/templates/admin/cloudbrain/search_dashboard.tmpl b/templates/admin/cloudbrain/search_dashboard.tmpl index e4d74836d..31361f36a 100644 --- a/templates/admin/cloudbrain/search_dashboard.tmpl +++ b/templates/admin/cloudbrain/search_dashboard.tmpl @@ -19,44 +19,68 @@
+ + diff --git a/templates/user/dashboard/cloudbrains.tmpl b/templates/user/dashboard/cloudbrains.tmpl index 910531549..fb85c29f1 100755 --- a/templates/user/dashboard/cloudbrains.tmpl +++ b/templates/user/dashboard/cloudbrains.tmpl @@ -6,6 +6,10 @@ data-debug-again="{{$.i18n.Tr "repo.debug_again"}}" data-debug-task="{{$.i18n.Tr "cloudbrain.DEBUG"}}" data-train-task="{{$.i18n.Tr "cloudbrain.TRAIN"}}" data-inference-task="{{$.i18n.Tr "cloudbrain.INFERENCE"}}" data-benchmark-task="{{$.i18n.Tr "cloudbrain.BENCHMARK"}}" + data-all-cluster="{{.i18n.Tr "cloudbrain.all_resource_cluster"}}" + data-all-aiCenter="{{.i18n.Tr "cloudbrain.all_ai_center"}}" + data-cluster-c2net="{{.i18n.Tr "cloudbrain.resource_cluster_c2net"}}" + data-cluster-openi="{{.i18n.Tr "cloudbrain.resource_cluster_openi"}}" data-all-task="{{.i18n.Tr "admin.cloudbrain.all_task_types"}}" data-all-compute="{{.i18n.Tr "admin.cloudbrain.all_computing_resources"}}" data-all-status="{{.i18n.Tr "admin.cloudbrain.all_status"}}">
diff --git a/web_src/js/features/cloudrbanin.js b/web_src/js/features/cloudrbanin.js index a2275f7ad..445f70be3 100644 --- a/web_src/js/features/cloudrbanin.js +++ b/web_src/js/features/cloudrbanin.js @@ -481,6 +481,18 @@ function userSearchControll() { return; } const params = new URLSearchParams(window.location.search); + let cluster; + if ($(".cloudbrain_debug").length === 1) { + if (!params.get("cluster")) { + cluster = $(".cloudbrain_debug").data("all-cluster"); + } else { + if (params.get("cluster") === "resource_cluster_c2net") { + cluster = $(".cloudbrain_debug").data("cluster-c2net"); + } else { + cluster = $(".cloudbrain_debug").data("cluster-openi"); + } + } + } let jobType; if ($(".cloudbrain_debug").length === 1) { if (!params.get("jobType")) { @@ -497,13 +509,16 @@ function userSearchControll() { } } } + let aiCenter = !params.get("aiCenter") + ? $(".cloudbrain_debug").data("all-aiCenter") + : params.get("aiCenter"); let listType = !params.get("listType") ? $(".cloudbrain_debug").data("all-compute") : params.get("listType"); let jobStatus = !params.get("jobStatus") ? $(".cloudbrain_debug").data("all-status") : params.get("jobStatus").toUpperCase(); - const dropdownValueArray = [jobType, listType, jobStatus]; + const dropdownValueArray = [cluster, aiCenter, jobType, listType, jobStatus]; $("#userCloud .default.text ").each(function (index, e) { $(e).text(dropdownValueArray[index]); }); @@ -514,6 +529,21 @@ function AdaminSearchControll() { return; } const params = new URLSearchParams(window.location.search); + let cluster; + if ($(".cloudbrain_debug").length === 1) { + if (!params.get("cluster")) { + cluster = $(".cloudbrain_debug").data("all-cluster"); + } else { + if (params.get("cluster") === "resource_cluster_c2net") { + cluster = $(".cloudbrain_debug").data("cluster-c2net"); + } else { + cluster = $(".cloudbrain_debug").data("cluster-openi"); + } + } + } + let aiCenter = !params.get("aiCenter") + ? $(".cloudbrain_debug").data("all-aiCenter") + : params.get("aiCenter"); let jobType = !params.get("jobType") ? $(".cloudbrain_debug").data("all-task") : params.get("jobType"); @@ -523,7 +553,7 @@ function AdaminSearchControll() { let jobStatus = !params.get("jobStatus") ? $(".cloudbrain_debug").data("all-status") : params.get("jobStatus").toUpperCase(); - const dropdownValueArray = [jobType, listType, jobStatus]; + const dropdownValueArray = [cluster, aiCenter, jobType, listType, jobStatus]; $("#adminCloud .default.text ").each(function (index, e) { $(e).text(dropdownValueArray[index]); });