Reviewed-on: https://git.openi.org.cn/OpenI/aiforge/pulls/2062 Reviewed-by: lewis <747342561@qq.com> Reviewed-by: wangjr <wangjr@pcl.ac.cn>tags/v1.22.5.1^2
| @@ -0,0 +1,4 @@ | |||
| # Ignore artifacts: | |||
| dist | |||
| build | |||
| coverage | |||
| @@ -0,0 +1 @@ | |||
| {} | |||
| @@ -160,6 +160,7 @@ type Cloudbrain struct { | |||
| User *User `xorm:"-"` | |||
| Repo *Repository `xorm:"-"` | |||
| BenchmarkType string `xorm:"-"` //算法评测,模型评测 | |||
| BenchmarkTypeName string `xorm:"-"` | |||
| BenchmarkTypeRankLink string `xorm:"-"` | |||
| StartTime timeutil.TimeStamp | |||
| @@ -1565,6 +1566,11 @@ func GetCloudbrainCountByUserID(userID int64, jobType string) (int, error) { | |||
| return int(count), err | |||
| } | |||
| func GetBenchmarkCountByUserID(userID int64) (int, error) { | |||
| count, err := x.In("status", JobWaiting, JobRunning).And("(job_type = ? or job_type = ? or job_type = ?) and user_id = ? and type = ?", string(JobTypeBenchmark), string(JobTypeBrainScore), string(JobTypeSnn4imagenet), userID, TypeCloudBrainOne).Count(new(Cloudbrain)) | |||
| return int(count), err | |||
| } | |||
| func GetCloudbrainNotebookCountByUserID(userID int64) (int, error) { | |||
| count, err := x.In("status", ModelArtsCreateQueue, ModelArtsCreating, ModelArtsStarting, ModelArtsReadyToStart, ModelArtsResizing, ModelArtsStartQueuing, ModelArtsRunning, ModelArtsRestarting). | |||
| And("job_type = ? and user_id = ? and type = ?", JobTypeDebug, userID, TypeCloudBrainTwo).Count(new(Cloudbrain)) | |||
| @@ -28,6 +28,8 @@ const ( | |||
| Snn4imagenetMountPath = "/snn4imagenet" | |||
| BrainScoreMountPath = "/brainscore" | |||
| TaskInfoName = "/taskInfo" | |||
| Snn4imagenetCommand = `/opt/conda/bin/python /snn4imagenet/testSNN_script.py --modelname '%s' --modelpath '/dataset' --modeldescription '%s'` | |||
| BrainScoreCommand = `bash /brainscore/brainscore_test_par4shSrcipt.sh -b '%s' -n '%s' -p '/dataset' -d '%s'` | |||
| SubTaskName = "task1" | |||
| @@ -347,7 +349,7 @@ func GenerateTask(ctx *context.Context, displayJobName, jobName, image, command, | |||
| } | |||
| stringId := strconv.FormatInt(task.ID, 10) | |||
| if string(models.JobTypeBenchmark) == jobType { | |||
| if IsBenchmarkJob(jobType) { | |||
| notification.NotifyOtherTask(ctx.User, ctx.Repo.Repository, stringId, displayJobName, models.ActionCreateBenchMarkTask) | |||
| } else if string(models.JobTypeTrain) == jobType { | |||
| notification.NotifyOtherTask(ctx.User, ctx.Repo.Repository, jobID, displayJobName, models.ActionCreateGPUTrainTask) | |||
| @@ -358,6 +360,10 @@ func GenerateTask(ctx *context.Context, displayJobName, jobName, image, command, | |||
| return nil | |||
| } | |||
| func IsBenchmarkJob(jobType string) bool { | |||
| return string(models.JobTypeBenchmark) == jobType || string(models.JobTypeBrainScore) == jobType || string(models.JobTypeSnn4imagenet) == jobType | |||
| } | |||
| func RestartTask(ctx *context.Context, task *models.Cloudbrain, newID *string) error { | |||
| dataActualPath := setting.Attachment.Minio.RealPath + | |||
| setting.Attachment.Minio.Bucket + "/" + | |||
| @@ -478,10 +478,11 @@ var ( | |||
| BenchmarkMaxDuration int64 | |||
| //snn4imagenet config | |||
| IsSnn4imagenetEnabled bool | |||
| Snn4imagenetOwner string | |||
| Snn4imagenetName string | |||
| Snn4imagenetServerHost string | |||
| IsSnn4imagenetEnabled bool | |||
| Snn4imagenetOwner string | |||
| Snn4imagenetName string | |||
| Snn4imagenetServerHost string | |||
| ModelBenchmarkMaxDuration int64 | |||
| //snn4imagenet config | |||
| IsBrainScoreEnabled bool | |||
| @@ -1309,6 +1310,7 @@ func NewContext() { | |||
| Snn4imagenetOwner = sec.Key("OWNER").MustString("") | |||
| Snn4imagenetName = sec.Key("NAME").MustString("") | |||
| Snn4imagenetServerHost = sec.Key("HOST").MustString("") | |||
| ModelBenchmarkMaxDuration = sec.Key("MAX_DURATION").MustInt64(28800) | |||
| sec = Cfg.Section("brainscore") | |||
| IsBrainScoreEnabled = sec.Key("ENABLED").MustBool(false) | |||
| @@ -1116,12 +1116,18 @@ modelarts.train_job_para.connfirm=train_job_para.connfirm | |||
| modelarts.evaluate_job=Model Evaluation | |||
| modelarts.evaluate_job.new_job=New Model Evaluation | |||
| cloudbrain.benchmark.evaluate_type=Evaluation Type | |||
| cloudbrain.benchmark.evaluate_scenes = Evaluation Scenes | |||
| cloudbrain.benchmark.algorithm=Algorithm Evaluation | |||
| cloudbrain.benchmark.model=Model Evaluation | |||
| cloudbrain.benchmark.evaluate_child_type=Child Type | |||
| cloudbrain.benchmark.evaluate_mirror=Mirror | |||
| cloudbrain.benchmark.evaluate_train=Train Script | |||
| cloudbrain.benchmark.evaluate_test=Test Script | |||
| cloudbrain.benchmark.types={"type":[{"id":1,"rank_link":"https://git.openi.org.cn/benchmark/?username=admin&algType=detection","first":"Target detection","second":[{"id":1,"value":"None","attachment":"84cf39c4-d8bc-41aa-aaa3-182ce289b105","owner":"yangzhx","repo_name":"detection_benchmark_script"}]},{"id":2,"rank_link":"https://git.openi.org.cn/benchmark/?username=admin&algType=reid","first":"Target re-identification","second":[{"id":1,"value":"Vehicle re-identification","attachment":"84cf39c4-d8bc-41aa-aaa3-182ce289b105","owner":"JiahongXu","repo_name":"benchmark_reID_script"},{"id":2,"value":"Image-based person re-identification","attachment":"84cf39c4-d8bc-41aa-aaa3-182ce289b105","owner":"JiahongXu","repo_name":"benchmark_reID_script"}]},{"id":3,"rank_link":"https://git.openi.org.cn/benchmark/?username=admin&algType=tracking","first":"Multi-target tracking","second":[{"id":1,"value":"None","attachment":"84cf39c4-d8bc-41aa-aaa3-182ce289b105","owner":"lix07","repo_name":"MOT_benchmark_script"}]}]} | |||
| cloudbrain.morethanonejob=You already have a running or waiting task, create it after that task is over. | |||
| modelarts.infer_job_model = Model | |||
| modelarts.infer_job_model_file = Model File | |||
| @@ -3039,8 +3045,9 @@ shared_memory = Shared Memory | |||
| DEBUG = DEBUG | |||
| SNN4IMAGENET = SNN4IMAGENET | |||
| BRAINSCORE = BRAINSCORE | |||
| SNN4IMAGENET = BENCHMARK | |||
| BRAINSCORE = BENCHMARK | |||
| TRAIN = TRAIN | |||
| INFERENCE = INFERENCE | |||
| BENCHMARK = BENCHMARK | |||
| brain_area = Brain Area | |||
| @@ -1128,12 +1128,17 @@ modelarts.train_job_para.edit=编辑 | |||
| modelarts.train_job_para.connfirm=确定 | |||
| modelarts.evaluate_job=评测任务 | |||
| modelarts.evaluate_job.new_job=新建评测任务 | |||
| cloudbrain.benchmark.evaluate_scenes = 评测场景 | |||
| cloudbrain.benchmark.evaluate_type=评测类型 | |||
| cloudbrain.benchmark.algorithm=算法评测 | |||
| cloudbrain.benchmark.model=模型评测 | |||
| cloudbrain.benchmark.evaluate_child_type=子类型 | |||
| cloudbrain.benchmark.evaluate_mirror=镜像 | |||
| cloudbrain.benchmark.evaluate_train=训练程序 | |||
| cloudbrain.benchmark.evaluate_test=测试程序 | |||
| cloudbrain.benchmark.types={"type":[{"id":1,"rank_link":"https://git.openi.org.cn/benchmark/?username=admin&algType=detection","first":"目标检测","second":[{"id":1,"value":"无","attachment":"84cf39c4-d8bc-41aa-aaa3-182ce289b105","owner":"yangzhx","repo_name":"detection_benchmark_script"}]},{"id":2,"rank_link":"https://git.openi.org.cn/benchmark/?username=admin&algType=reid","first":"目标重识别","second":[{"id":1,"value":"车辆重识别","attachment":"84cf39c4-d8bc-41aa-aaa3-182ce289b105","owner":"JiahongXu","repo_name":"benchmark_reID_script"},{"id":2,"value":"基于图像的行人重识别","attachment":"84cf39c4-d8bc-41aa-aaa3-182ce289b105","owner":"JiahongXu","repo_name":"benchmark_reID_script"}]},{"id":3,"rank_link":"https://git.openi.org.cn/benchmark/?username=admin&algType=tracking","first":"多目标跟踪","second":[{"id":1,"value":"无","attachment":"84cf39c4-d8bc-41aa-aaa3-182ce289b105","owner":"lix07","repo_name":"MOT_benchmark_script"}]}]} | |||
| cloudbrain.benchmark.model.types={"type":[{"id":1,"rank_link":"https://git.openi.org.cn/benchmark/?username=admin&algType=detection","first":"目标检测","second":[{"id":1,"value":"无","attachment":"84cf39c4-d8bc-41aa-aaa3-182ce289b105","owner":"yangzhx","repo_name":"detection_benchmark_script"}]},{"id":2,"rank_link":"https://git.openi.org.cn/benchmark/?username=admin&algType=reid","first":"目标重识别","second":[{"id":1,"value":"车辆重识别","attachment":"84cf39c4-d8bc-41aa-aaa3-182ce289b105","owner":"JiahongXu","repo_name":"benchmark_reID_script"},{"id":2,"value":"基于图像的行人重识别","attachment":"84cf39c4-d8bc-41aa-aaa3-182ce289b105","owner":"JiahongXu","repo_name":"benchmark_reID_script"}]},{"id":3,"rank_link":"https://git.openi.org.cn/benchmark/?username=admin&algType=tracking","first":"多目标跟踪","second":[{"id":1,"value":"无","attachment":"84cf39c4-d8bc-41aa-aaa3-182ce289b105","owner":"lix07","repo_name":"MOT_benchmark_script"}]}]} | |||
| cloudbrain.morethanonejob=您已经创建了一个正在等待或运行中的同类任务,请等待任务结束再创建。 | |||
| modelarts.infer_job_model = 模型名称 | |||
| modelarts.infer_job_model_file = 模型文件 | |||
| @@ -3050,9 +3055,10 @@ memory = 内存 | |||
| shared_memory = 共享内存 | |||
| DEBUG = 调试任务 | |||
| SNN4IMAGENET = 调试任务-脉冲神经网络图片分类测评 | |||
| BRAINSCORE = 调试任务-神经相似性测评 | |||
| SNN4IMAGENET = 评测任务 | |||
| BRAINSCORE = 评测任务 | |||
| TRAIN = 训练任务 | |||
| INFERENCE = 推理任务 | |||
| BENCHMARK = 评测任务 | |||
| brain_area = 脑区 | |||
| @@ -1123,6 +1123,12 @@ | |||
| "vue-template-es2015-compiler": "^1.9.0" | |||
| }, | |||
| "dependencies": { | |||
| "prettier": { | |||
| "version": "1.19.1", | |||
| "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz", | |||
| "integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==", | |||
| "optional": true | |||
| }, | |||
| "source-map": { | |||
| "version": "0.6.1", | |||
| "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", | |||
| @@ -11003,10 +11009,10 @@ | |||
| "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=" | |||
| }, | |||
| "prettier": { | |||
| "version": "1.19.1", | |||
| "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz", | |||
| "integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==", | |||
| "optional": true | |||
| "version": "2.6.2", | |||
| "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.6.2.tgz", | |||
| "integrity": "sha512-PkUpF+qoXTqhOeWL9fu7As8LXsIUZ1WYaJiY/a7McAQzxjk82OF0tibkFXVCDImZtWxbvojFjerkiLb0/q8mew==", | |||
| "dev": true | |||
| }, | |||
| "pretty-error": { | |||
| "version": "2.1.1", | |||
| @@ -68,6 +68,7 @@ | |||
| "eslint-config-airbnb-base": "14.1.0", | |||
| "eslint-plugin-import": "2.20.2", | |||
| "eslint-plugin-vue": "6.2.2", | |||
| "prettier": "2.6.2", | |||
| "script-loader": "0.7.2", | |||
| "stylelint": "13.3.3", | |||
| "stylelint-config-standard": "20.0.0", | |||
| @@ -78,4 +79,4 @@ | |||
| "browserslist": [ | |||
| "defaults" | |||
| ] | |||
| } | |||
| } | |||
| @@ -52,8 +52,8 @@ func CloudBrains(ctx *context.Context) { | |||
| var jobTypes []string | |||
| jobTypeNot := false | |||
| if jobType == string(models.JobTypeDebug) { | |||
| jobTypes = append(jobTypes, string(models.JobTypeSnn4imagenet), string(models.JobTypeBrainScore), string(models.JobTypeDebug)) | |||
| if jobType == string(models.JobTypeBenchmark) { | |||
| jobTypes = append(jobTypes, string(models.JobTypeBenchmark), string(models.JobTypeBrainScore), string(models.JobTypeSnn4imagenet)) | |||
| } else if jobType != "all" && jobType != "" { | |||
| jobTypes = append(jobTypes, jobType) | |||
| } | |||
| @@ -188,6 +188,8 @@ func cloudBrainNewDataPrepare(ctx *context.Context) error { | |||
| ctx.Data["cloudbraintype"] = models.TypeCloudBrainOne | |||
| ctx.Data["benchmarkMode"] = ctx.Query("benchmarkMode") | |||
| return nil | |||
| } | |||
| @@ -249,7 +251,7 @@ func CloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) { | |||
| return | |||
| } | |||
| if jobType != string(models.JobTypeBenchmark) && jobType != string(models.JobTypeDebug) && jobType != string(models.JobTypeSnn4imagenet) && jobType != string(models.JobTypeBrainScore) && jobType != string(models.JobTypeTrain) { | |||
| if jobType != string(models.JobTypeBenchmark) && jobType != string(models.JobTypeDebug) && jobType != string(models.JobTypeTrain) { | |||
| log.Error("jobtype error:", jobType, ctx.Data["MsgID"]) | |||
| cloudBrainNewDataPrepare(ctx) | |||
| ctx.RenderWithErr("jobtype error", tpl, &form) | |||
| @@ -266,7 +268,7 @@ func CloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) { | |||
| if count >= 1 { | |||
| log.Error("the user already has running or waiting task", ctx.Data["MsgID"]) | |||
| cloudBrainNewDataPrepare(ctx) | |||
| ctx.RenderWithErr("you have already a running or waiting task, can not create more", tpl, &form) | |||
| ctx.RenderWithErr(ctx.Tr("repo.cloudbrain.morethanonejob"), tpl, &form) | |||
| return | |||
| } | |||
| } | |||
| @@ -379,7 +381,7 @@ func CloudBrainRestart(ctx *context.Context) { | |||
| if count >= 1 { | |||
| log.Error("the user already has running or waiting task", ctx.Data["MsgID"]) | |||
| resultCode = "-1" | |||
| errorMsg = "you have already a running or waiting task, can not create more" | |||
| errorMsg = ctx.Tr("repo.cloudbrain.morethanonejob") | |||
| break | |||
| } | |||
| } | |||
| @@ -524,6 +526,7 @@ func cloudBrainShow(ctx *context.Context, tpName base.TplName, jobType models.Jo | |||
| for _, benchmarkType := range GetBenchmarkTypes(ctx).BenchmarkType { | |||
| if task.BenchmarkTypeID == benchmarkType.Id { | |||
| ctx.Data["BenchmarkTypeName"] = benchmarkType.First | |||
| task.BenchmarkTypeName = benchmarkType.First | |||
| for _, benchmarkChildType := range benchmarkType.Second { | |||
| if task.BenchmarkChildTypeID == benchmarkChildType.Id { | |||
| ctx.Data["BenchmarkChildTypeName"] = benchmarkChildType.Value | |||
| @@ -534,6 +537,19 @@ func cloudBrainShow(ctx *context.Context, tpName base.TplName, jobType models.Jo | |||
| } | |||
| } | |||
| } | |||
| if task.JobType == string(models.JobTypeBenchmark) { | |||
| task.BenchmarkType = ctx.Tr("repo.cloudbrain.benchmark.algorithm") | |||
| } else if task.JobType == string(models.JobTypeSnn4imagenet) || task.JobType == string(models.JobTypeBrainScore) { | |||
| task.BenchmarkType = ctx.Tr("repo.cloudbrain.benchmark.model") | |||
| task.BenchmarkTypeName = task.JobType | |||
| ctx.Data["BenchmarkTypeName"] = task.JobType | |||
| if task.JobType == string(models.JobTypeBrainScore) { | |||
| ctx.Data["BenchmarkChildTypeName"] = getBrainRegion(task.BenchmarkChildTypeID) | |||
| } | |||
| } | |||
| if task.TrainJobDuration == "" { | |||
| if task.Duration == 0 { | |||
| var duration int64 | |||
| @@ -1385,6 +1401,8 @@ func SyncCloudbrainStatus() { | |||
| var maxDuration int64 | |||
| if task.JobType == string(models.JobTypeBenchmark) { | |||
| maxDuration = setting.BenchmarkMaxDuration | |||
| } else if task.JobType == string(models.JobTypeSnn4imagenet) || task.JobType == string(models.JobTypeBrainScore) { | |||
| maxDuration = setting.ModelBenchmarkMaxDuration | |||
| } else { | |||
| maxDuration = setting.MaxDuration | |||
| } | |||
| @@ -1634,7 +1652,7 @@ func CloudBrainBenchmarkIndex(ctx *context.Context) { | |||
| } | |||
| var jobTypes []string | |||
| jobTypes = append(jobTypes, string(models.JobTypeBenchmark)) | |||
| jobTypes = append(jobTypes, string(models.JobTypeBenchmark), string(models.JobTypeBrainScore), string(models.JobTypeSnn4imagenet)) | |||
| ciTasks, count, err := models.Cloudbrains(&models.CloudbrainsOptions{ | |||
| ListOptions: models.ListOptions{ | |||
| Page: page, | |||
| @@ -1664,8 +1682,21 @@ func CloudBrainBenchmarkIndex(ctx *context.Context) { | |||
| } | |||
| ciTasks[i].TrainJobDuration = models.ConvertDurationToStr(ciTasks[i].Duration) | |||
| } | |||
| ciTasks[i].BenchmarkTypeName = "" | |||
| if ciTasks[i].JobType == string(models.JobTypeBenchmark) { | |||
| ciTasks[i].BenchmarkType = ctx.Tr("repo.cloudbrain.benchmark.algorithm") | |||
| } else if ciTasks[i].JobType == string(models.JobTypeSnn4imagenet) || ciTasks[i].JobType == string(models.JobTypeBrainScore) { | |||
| ciTasks[i].BenchmarkType = ctx.Tr("repo.cloudbrain.benchmark.model") | |||
| ciTasks[i].BenchmarkTypeName = ciTasks[i].JobType | |||
| if ciTasks[i].JobType == string(models.JobTypeSnn4imagenet) { | |||
| ciTasks[i].BenchmarkTypeRankLink = setting.Snn4imagenetServerHost | |||
| } else { | |||
| ciTasks[i].BenchmarkTypeRankLink = setting.BrainScoreServerHost | |||
| } | |||
| } | |||
| if task.BenchmarkTypeID > 0 { | |||
| for _, benchmarkType := range GetBenchmarkTypes(ctx).BenchmarkType { | |||
| if task.BenchmarkTypeID == benchmarkType.Id { | |||
| @@ -1801,6 +1832,16 @@ func getBenchmarkResourceSpec(resourceSpecID int) (int, error) { | |||
| } | |||
| func CloudBrainBenchmarkCreate(ctx *context.Context, form auth.CreateCloudBrainForm) { | |||
| jobType := form.JobType | |||
| if jobType == string(models.JobTypeBenchmark) { | |||
| BenchMarkAlgorithmCreate(ctx, form) | |||
| } else { | |||
| ModelBenchmarkCreate(ctx, form) | |||
| } | |||
| } | |||
| func BenchMarkAlgorithmCreate(ctx *context.Context, form auth.CreateCloudBrainForm) { | |||
| ctx.Data["PageIsCloudBrain"] = true | |||
| displayJobName := form.DisplayJobName | |||
| jobName := util.ConvertDisplayJobNameToJobName(displayJobName) | |||
| @@ -1865,7 +1906,7 @@ func CloudBrainBenchmarkCreate(ctx *context.Context, form auth.CreateCloudBrainF | |||
| return | |||
| } | |||
| count, err := models.GetCloudbrainCountByUserID(ctx.User.ID, string(models.JobTypeBenchmark)) | |||
| count, err := models.GetBenchmarkCountByUserID(ctx.User.ID) | |||
| if err != nil { | |||
| log.Error("GetCloudbrainCountByUserID failed:%v", err, ctx.Data["MsgID"]) | |||
| cloudBrainNewDataPrepare(ctx) | |||
| @@ -1875,7 +1916,7 @@ func CloudBrainBenchmarkCreate(ctx *context.Context, form auth.CreateCloudBrainF | |||
| if count >= 1 { | |||
| log.Error("the user already has running or waiting task", ctx.Data["MsgID"]) | |||
| cloudBrainNewDataPrepare(ctx) | |||
| ctx.RenderWithErr("you have already a running or waiting task, can not create more", tplCloudBrainBenchmarkNew, &form) | |||
| ctx.RenderWithErr(ctx.Tr("repo.cloudbrain.morethanonejob"), tplCloudBrainBenchmarkNew, &form) | |||
| return | |||
| } | |||
| } | |||
| @@ -1953,10 +1994,118 @@ func CloudBrainBenchmarkCreate(ctx *context.Context, form auth.CreateCloudBrainF | |||
| ctx.RenderWithErr(err.Error(), tplCloudBrainBenchmarkNew, &form) | |||
| return | |||
| } | |||
| ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/cloudbrain/benchmark") | |||
| } | |||
| func ModelBenchmarkCreate(ctx *context.Context, form auth.CreateCloudBrainForm) { | |||
| ctx.Data["PageIsCloudBrain"] = true | |||
| displayJobName := form.DisplayJobName | |||
| jobName := util.ConvertDisplayJobNameToJobName(displayJobName) | |||
| image := form.Image | |||
| uuid := form.Attachment | |||
| jobType := form.JobType | |||
| gpuQueue := form.GpuType | |||
| codePath := setting.JobPath + jobName + cloudbrain.CodeMountPath | |||
| resourceSpecId := form.ResourceSpecId | |||
| branchName := cloudbrain.DefaultBranchName | |||
| repo := ctx.Repo.Repository | |||
| tpl := tplCloudBrainBenchmarkNew | |||
| command := cloudbrain.Command | |||
| tasks, err := models.GetCloudbrainsByDisplayJobName(repo.ID, jobType, displayJobName) | |||
| if err == nil { | |||
| if len(tasks) != 0 { | |||
| log.Error("the job name did already exist", ctx.Data["MsgID"]) | |||
| cloudBrainNewDataPrepare(ctx) | |||
| ctx.RenderWithErr("the job name did already exist", tpl, &form) | |||
| return | |||
| } | |||
| } else { | |||
| if !models.IsErrJobNotExist(err) { | |||
| log.Error("system error, %v", err, ctx.Data["MsgID"]) | |||
| cloudBrainNewDataPrepare(ctx) | |||
| ctx.RenderWithErr("system error", tpl, &form) | |||
| return | |||
| } | |||
| } | |||
| if !jobNamePattern.MatchString(displayJobName) { | |||
| ctx.RenderWithErr(ctx.Tr("repo.cloudbrain_jobname_err"), tpl, &form) | |||
| return | |||
| } | |||
| if jobType != string(models.JobTypeSnn4imagenet) && jobType != string(models.JobTypeBrainScore) { | |||
| log.Error("jobtype error:", jobType, ctx.Data["MsgID"]) | |||
| cloudBrainNewDataPrepare(ctx) | |||
| ctx.RenderWithErr("jobtype error", tpl, &form) | |||
| return | |||
| } | |||
| count, err := models.GetBenchmarkCountByUserID(ctx.User.ID) | |||
| if err != nil { | |||
| log.Error("GetCloudbrainCountByUserID failed:%v", err, ctx.Data["MsgID"]) | |||
| cloudBrainNewDataPrepare(ctx) | |||
| ctx.RenderWithErr("system error", tpl, &form) | |||
| return | |||
| } else { | |||
| if count >= 1 { | |||
| log.Error("the user already has running or waiting task", ctx.Data["MsgID"]) | |||
| cloudBrainNewDataPrepare(ctx) | |||
| ctx.RenderWithErr(ctx.Tr("repo.cloudbrain.morethanonejob"), tpl, &form) | |||
| return | |||
| } | |||
| } | |||
| downloadCode(repo, codePath, branchName) | |||
| uploadCodeToMinio(codePath+"/", jobName, cloudbrain.CodeMountPath+"/") | |||
| modelPath := setting.JobPath + jobName + cloudbrain.ModelMountPath + "/" | |||
| mkModelPath(modelPath) | |||
| uploadCodeToMinio(modelPath, jobName, cloudbrain.ModelMountPath+"/") | |||
| snn4imagenetPath := setting.JobPath + jobName + cloudbrain.Snn4imagenetMountPath | |||
| if setting.IsSnn4imagenetEnabled && jobType == string(models.JobTypeSnn4imagenet) { | |||
| downloadRateCode(repo, jobName, setting.Snn4imagenetOwner, setting.Snn4imagenetName, snn4imagenetPath, "", "") | |||
| uploadCodeToMinio(snn4imagenetPath+"/", jobName, cloudbrain.Snn4imagenetMountPath+"/") | |||
| command = fmt.Sprintf(cloudbrain.Snn4imagenetCommand, displayJobName, trimSpaceNewlineInString(form.Description)) | |||
| } | |||
| benchmarkChildTypeID := 0 | |||
| brainScorePath := setting.JobPath + jobName + cloudbrain.BrainScoreMountPath | |||
| if setting.IsBrainScoreEnabled && jobType == string(models.JobTypeBrainScore) { | |||
| downloadRateCode(repo, jobName, setting.BrainScoreOwner, setting.BrainScoreName, brainScorePath, "", "") | |||
| uploadCodeToMinio(brainScorePath+"/", jobName, cloudbrain.BrainScoreMountPath+"/") | |||
| benchmarkChildTypeID = form.BenchmarkChildTypeID | |||
| command = fmt.Sprintf(cloudbrain.BrainScoreCommand, getBrainRegion(benchmarkChildTypeID), displayJobName, trimSpaceNewlineInString(form.Description)) | |||
| } | |||
| err = cloudbrain.GenerateTask(ctx, displayJobName, jobName, image, command, uuid, storage.GetMinioPath(jobName, cloudbrain.CodeMountPath+"/"), | |||
| storage.GetMinioPath(jobName, cloudbrain.ModelMountPath+"/"), | |||
| storage.GetMinioPath(jobName, cloudbrain.BenchMarkMountPath+"/"), storage.GetMinioPath(jobName, cloudbrain.Snn4imagenetMountPath+"/"), | |||
| storage.GetMinioPath(jobName, cloudbrain.BrainScoreMountPath+"/"), jobType, gpuQueue, form.Description, branchName, form.BootFile, form.Params, | |||
| 0, benchmarkChildTypeID, resourceSpecId) | |||
| if err != nil { | |||
| cloudBrainNewDataPrepare(ctx) | |||
| ctx.RenderWithErr(err.Error(), tpl, &form) | |||
| return | |||
| } | |||
| ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/cloudbrain/benchmark") | |||
| } | |||
| func getBrainRegion(benchmarkChildTypeID int) string { | |||
| values := []string{"V1", "V2", "V4", "IT"} | |||
| return values[benchmarkChildTypeID] | |||
| } | |||
| func trimSpaceNewlineInString(s string) string { | |||
| re := regexp.MustCompile(`\r?\n`) | |||
| return re.ReplaceAllString(s, " ") | |||
| } | |||
| func BenchmarkDel(ctx *context.Context) { | |||
| if err := deleteCloudbrainJob(ctx); err != nil { | |||
| log.Error("deleteCloudbrainJob failed: %v", err, ctx.Data["msgID"]) | |||
| @@ -76,7 +76,7 @@ func DebugJobIndex(ctx *context.Context) { | |||
| } | |||
| var jobTypes []string | |||
| jobTypes = append(jobTypes, string(models.JobTypeSnn4imagenet), string(models.JobTypeBrainScore), string(models.JobTypeDebug)) | |||
| jobTypes = append(jobTypes, string(models.JobTypeDebug)) | |||
| ciTasks, count, err := models.Cloudbrains(&models.CloudbrainsOptions{ | |||
| ListOptions: models.ListOptions{ | |||
| Page: page, | |||
| @@ -778,8 +778,8 @@ func Cloudbrains(ctx *context.Context) { | |||
| var jobTypes []string | |||
| jobTypeNot := false | |||
| if jobType == string(models.JobTypeDebug) { | |||
| jobTypes = append(jobTypes, string(models.JobTypeSnn4imagenet), string(models.JobTypeBrainScore), string(models.JobTypeDebug)) | |||
| if jobType == string(models.JobTypeBenchmark) { | |||
| jobTypes = append(jobTypes, string(models.JobTypeBenchmark), string(models.JobTypeBrainScore), string(models.JobTypeSnn4imagenet)) | |||
| } else if jobType != "all" && jobType != "" { | |||
| jobTypes = append(jobTypes, jobType) | |||
| } | |||
| @@ -12,7 +12,8 @@ | |||
| <!-- 提示框 --> | |||
| <div class="alert"></div> | |||
| <div class="admin user"> | |||
| <div class="cloudbrain_debug" style="display: none;" data-debug="{{$.i18n.Tr "repo.debug"}}" data-debug-again="{{$.i18n.Tr "repo.debug_again"}}"></div> | |||
| <div class="cloudbrain_debug" style="display: none;" data-debug="{{$.i18n.Tr "repo.debug"}}" data-debug-again="{{$.i18n.Tr "repo.debug_again"}}" | |||
| 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"}}"></div> | |||
| {{template "admin/navbar" .}} | |||
| <div class="ui container" style="width: 80%;"> | |||
| {{template "base/alert" .}} | |||
| @@ -314,17 +315,4 @@ | |||
| </div> | |||
| </div> | |||
| </div> | |||
| {{template "base/footer" .}} | |||
| <script> | |||
| function getParams(){ | |||
| const params = new URLSearchParams(window.location.search) | |||
| let jobType = !params.get('jobType')? '{{.i18n.Tr "admin.cloudbrain.all_task_types"}}' : params.get('jobType') | |||
| let listType = !params.get('listType')? '{{.i18n.Tr "admin.cloudbrain.all_computing_resources"}}' : params.get('listType') | |||
| let jobStatus = !params.get('jobStatus')? '{{.i18n.Tr "admin.cloudbrain.all_status"}}' : params.get('jobStatus').toUpperCase() | |||
| const dropdownValueArray = [jobType,listType,jobStatus] | |||
| $('#adminCloud .default.text ').each(function(index,e){ | |||
| $(e).text(dropdownValueArray[index]) | |||
| }) | |||
| } | |||
| getParams() | |||
| </script> | |||
| {{template "base/footer" .}} | |||
| @@ -16,8 +16,8 @@ | |||
| <a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType=TRAIN&listType={{$.ListType}}&jobStatus={{$.JobStatus}}" data-value="TRAIN">TRAIN</a> | |||
| <a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType=INFERENCE&listType={{$.ListType}}&jobStatus={{$.JobStatus}}" data-value="INFERENCE">INFERENCE</a> | |||
| <a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType=BENCHMARK&listType={{$.ListType}}&jobStatus={{$.JobStatus}}" data-value="BENCHMARK">BENCHMARK</a> | |||
| <a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType=SNN4IMAGENET&listType={{$.ListType}}&jobStatus={{$.JobStatus}}" data-value="BENCHMARK">SNN4IMAGENET</a> | |||
| <a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType=BRAINSCORE&listType={{$.ListType}}&jobStatus={{$.JobStatus}}" data-value="BENCHMARK">BRAINSCORE</a> | |||
| <a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType=SNN4IMAGENET&listType={{$.ListType}}&jobStatus={{$.JobStatus}}" data-value="SNN4IMAGENET">SNN4IMAGENET</a> | |||
| <a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType=BRAINSCORE&listType={{$.ListType}}&jobStatus={{$.JobStatus}}" data-value="BRAINSCORE">BRAINSCORE</a> | |||
| </div> | |||
| </div> | |||
| <div class="ui selection dropdown" style="min-width: 10em;min-height:2.6em;border-radius: .28571429rem;margin-right: 1em;padding: .67em 3.2em .7em 1em;"> | |||
| @@ -18,7 +18,7 @@ | |||
| <div class="ui container" style="width: 80%;"> | |||
| <div class="ui grid"> | |||
| <div class="row"> | |||
| <div class="ui {{if $.PageIsUserCloudBrain}}sixteen{{else}}six{{end}} wide column" style="margin: 1rem 0;" id="adminCloud"> | |||
| <div class="ui {{if $.PageIsUserCloudBrain}}sixteen{{else}}six{{end}} wide column" style="margin: 1rem 0;" id="userCloud"> | |||
| <div class="ui selection dropdown" style="min-width: 10em;min-height:2.6em;border-radius: .28571429rem;margin-right: 1em;padding: .67em 3.2em .7em 1em;"> | |||
| <div class="default text" style="color: rgba(0,0,0,.87);">{{.i18n.Tr "admin.cloudbrain.all_task_types"}}</div> | |||
| <i class="dropdown icon"></i> | |||
| @@ -28,8 +28,8 @@ | |||
| <a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType=TRAIN&listType={{$.ListType}}&jobStatus={{$.JobStatus}}" data-value="TRAIN">{{.i18n.Tr "cloudbrain.TRAIN"}}</a> | |||
| <a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType=INFERENCE&listType={{$.ListType}}&jobStatus={{$.JobStatus}}" data-value="INFERENCE">{{.i18n.Tr "cloudbrain.INFERENCE"}}</a> | |||
| <a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType=BENCHMARK&listType={{$.ListType}}&jobStatus={{$.JobStatus}}" data-value="BENCHMARK">{{.i18n.Tr "cloudbrain.BENCHMARK"}}</a> | |||
| <a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType=SNN4IMAGENET&listType={{$.ListType}}&jobStatus={{$.JobStatus}}" data-value="BENCHMARK">{{.i18n.Tr "cloudbrain.SNN4IMAGENET"}}</a> | |||
| <a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType=BRAINSCORE&listType={{$.ListType}}&jobStatus={{$.JobStatus}}" data-value="BENCHMARK">{{.i18n.Tr "cloudbrain.BRAINSCORE"}}</a> | |||
| <!-- <a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType=SNN4IMAGENET&listType={{$.ListType}}&jobStatus={{$.JobStatus}}" data-value="BENCHMARK">{{.i18n.Tr "cloudbrain.SNN4IMAGENET"}}</a> | |||
| <a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType=BRAINSCORE&listType={{$.ListType}}&jobStatus={{$.JobStatus}}" data-value="BENCHMARK">{{.i18n.Tr "cloudbrain.BRAINSCORE"}}</a> --> | |||
| </div> | |||
| </div> | |||
| <div class="ui selection dropdown" style="min-width: 10em;min-height:2.6em;border-radius: .28571429rem;margin-right: 1em;padding: .67em 3.2em .7em 1em;"> | |||
| @@ -1,14 +1,17 @@ | |||
| <div class="dataset-repolink" id="dataset-repolink-init" style="display: none;" data-repolink="{{.RepoLink}}" data-cloudranin-type="{{.cloudbraintype}}"></div> | |||
| <div class="inline required unite min_title field" id="dataset-base" style="margin-bottom: 0 !important;"> | |||
| {{if .newInference}} | |||
| <label style="font-weight: normal;">{{.i18n.Tr "dataset.dataset"}}</label> | |||
| {{if or (.benchmarkMode) (.newInference)}} | |||
| <label style="font-weight: normal;">{{if .benchmarkMode}}{{.i18n.Tr "repo.model_manager"}}</label><span> </span>{{else}}{{.i18n.Tr "dataset.dataset"}}</label> {{end}} | |||
| {{else}} | |||
| <label style="font-weight: normal;">{{.i18n.Tr "dataset.dataset"}}</label> | |||
| {{end}} | |||
| <input type="hidden" name="attachment" :value="dataset_uuid"> | |||
| <input class="disabled" type="text" :value="dataset_name" required onfocus="this.blur();" style="width: 48.5%;"> | |||
| <el-button type="text" @click="dialogVisible = true" icon="el-icon-plus" style="color: #0366d6;"> {{.i18n.Tr "dataset.select_dataset"}}</el-button> | |||
| <el-button type="text" @click="dialogVisible = true" icon="el-icon-plus" style="color: #0366d6;"> {{if .benchmarkMode}}{{.i18n.Tr "repo.modelarts.infer_job.select_model"}}{{else}}{{.i18n.Tr "dataset.select_dataset"}}{{end}}</el-button> | |||
| {{if .benchmarkMode}} | |||
| <span class="tooltips" style="display: block;padding-left: 0.5rem;">说明:先使用数据集功能上传模型,然后从数据集列表选模型。</span> | |||
| {{end}} | |||
| <el-dialog | |||
| title="{{.i18n.Tr "dataset.select_dataset"}}" | |||
| :visible.sync="dialogVisible" | |||
| @@ -44,7 +47,7 @@ | |||
| </div> | |||
| </div> | |||
| {{if not .benchmarkMode}} | |||
| </el-tab-pane> | |||
| <el-tab-pane label="{{.i18n.Tr "dataset.owner_dataset"}}" name="second"> | |||
| <div style="display: flex;align-items: center;justify-content: space-between;padding: 1rem 0;border-bottom:1px solid #F5F5F5" v-for="(dataset,index) in myDataset" :key="index"> | |||
| @@ -121,6 +124,7 @@ | |||
| </div> | |||
| </el-tab-pane> | |||
| {{end}} | |||
| </el-tabs> | |||
| <div class="center"> | |||
| <el-pagination | |||
| @@ -2,9 +2,6 @@ | |||
| {{template "base/head" .}} | |||
| <style> | |||
| .fontsize14{ | |||
| font-size: 14px; | |||
| } | |||
| .padding0{ | |||
| padding: 0 !important; | |||
| } | |||
| @@ -69,28 +66,31 @@ | |||
| <!-- 表头 --> | |||
| <div class="ui grid stackable" style="background: #f0f0f0;;"> | |||
| <div class="row"> | |||
| <div class="three wide column padding0"> | |||
| <div class="three wide column padding0" style="width: 18% !important;"> | |||
| <span style="margin:0 6px">{{$.i18n.Tr "repo.cloudbrain_task"}}</span> | |||
| </div> | |||
| <div class="two wide column text center padding0"> | |||
| <div class="two wide column text center padding0" style="width: 10.5% !important;"> | |||
| <span>{{$.i18n.Tr "repo.modelarts.status"}}</span> | |||
| </div> | |||
| <div class="two wide column text center padding0"> | |||
| <div class="two wide column text center padding0" style="width: 10.5% !important;"> | |||
| <span>{{.i18n.Tr "repo.cloudbrain.benchmark.evaluate_scenes"}}</span> | |||
| </div> | |||
| <div class="two wide column text center padding0" style="width: 10.5% !important;"> | |||
| <span>{{.i18n.Tr "repo.cloudbrain.benchmark.evaluate_type"}}</span> | |||
| </div> | |||
| <div class="two wide column text center padding0"> | |||
| <div class="two wide column text center padding0" style="width: 8.5% !important;"> | |||
| <span>{{$.i18n.Tr "repo.modelarts.createtime"}}</span> | |||
| </div> | |||
| <div class="one wide column text center padding0"> | |||
| <div class="one wide column text center padding0" style="width: 8% !important;"> | |||
| <span>{{$.i18n.Tr "repo.cloudbrain_status_runtime"}}</span> | |||
| </div> | |||
| <div class="two wide column text center padding0"> | |||
| <div class="two wide column text center padding0" style="width: 8% !important;"> | |||
| <span>{{$.i18n.Tr "repo.modelarts.computing_resources"}}</span> | |||
| </div> | |||
| <div class="one wide column text center padding0"> | |||
| <div class="one wide column text center padding0" style="width: 6% !important;"> | |||
| <span>{{$.i18n.Tr "repo.cloudbrain_creator"}}</span> | |||
| </div> | |||
| <div class="three wide column text center padding0"> | |||
| <div class="three wide column text center padding0" style="width: 20% !important;"> | |||
| <span>{{$.i18n.Tr "repo.cloudbrain_operate"}}</span> | |||
| </div> | |||
| </div> | |||
| @@ -101,36 +101,39 @@ | |||
| <div class="row"> | |||
| <!-- 任务名 --> | |||
| <div class="three wide column padding0"> | |||
| <div class="three wide column padding0" style="width: 18% !important;"> | |||
| <a class="title" href="{{$.Link}}/{{.Cloudbrain.ID}}" title="{{.DisplayJobName}}" style="font-size: 14px;"> | |||
| <span class="fitted" style="width: 90%;vertical-align: middle;">{{.DisplayJobName}}</span> | |||
| </a> | |||
| </div> | |||
| <!-- 任务状态 --> | |||
| <div class="two wide column padding0" style="padding-left: 2.2rem !important;"> | |||
| <div class="two wide column text center padding0" style="width: 10.5% !important;"> | |||
| <span class="job-status" id="{{.Cloudbrain.ID}}" data-repopath="{{$.RepoRelPath}}{{if eq .ComputeResource "CPU/GPU"}}/cloudbrain{{else}}/modelarts/notebook{{end}}" data-jobid="{{.Cloudbrain.ID}}" data-version="{{.VersionName}}"> | |||
| <span><i id="{{.Cloudbrain.ID}}-icon" style="vertical-align: middle;" class="{{.Status}}"></i><span id="{{.Cloudbrain.ID}}-text" style="margin-left: 0.4em;font-size: 12px;">{{.Status}}</span></span> | |||
| </span> | |||
| </div> | |||
| <div class="two wide column text center padding0"> | |||
| <div class="two wide column text center padding0" style="width: 10.5% !important;"> | |||
| {{.BenchmarkType}} | |||
| </div> | |||
| <div class="two wide column text center padding0" style="width: 10.5% !important;"> | |||
| <a style="font-size: 12px;" href="{{.BenchmarkTypeRankLink}}" target="_blank"> | |||
| {{.BenchmarkTypeName}} | |||
| {{.BenchmarkTypeName}} | |||
| </a> | |||
| </div> | |||
| <!-- 任务创建时间 --> | |||
| <div class="two wide column text center padding0"> | |||
| <div class="two wide column text center padding0" style="width: 8.5% !important;"> | |||
| <span style="font-size: 12px;" class="">{{TimeSinceUnix .Cloudbrain.CreatedUnix $.Lang}}</span> | |||
| </div> | |||
| <!-- 任务运行时间 --> | |||
| <div class="one wide column text center padding0"> | |||
| <div class="one wide column text center padding0" style="width: 8% !important;"> | |||
| <span style="font-size: 12px;" id="duration-{{.Cloudbrain.ID}}">{{.TrainJobDuration}}</span> | |||
| </div> | |||
| <!-- 计算资源 --> | |||
| <div class="two wide column text center padding0"> | |||
| <div class="two wide column text center padding0" style="width: 8% !important;"> | |||
| <span style="font-size: 12px;">{{.ComputeResource}}</span> | |||
| </div> | |||
| <!-- 创建者 --> | |||
| <div class="one wide column text center padding0"> | |||
| <div class="one wide column text center padding0" style="width: 6% !important;"> | |||
| {{if .User.Name}} | |||
| <a href="{{AppSubUrl}}/{{.User.Name}}" title="{{.User.Name}}"><img class="ui avatar image" src="{{.User.RelAvatarLink}}"></a> | |||
| {{else}} | |||
| @@ -138,7 +141,7 @@ | |||
| {{end}} | |||
| </div> | |||
| <div class="three wide column text center padding0"> | |||
| <div class="three wide column text center padding0" style="width: 20% !important;"> | |||
| <div class="ui compact buttons" > | |||
| <!-- 停止任务 --> | |||
| <form id="stopForm-{{.Cloudbrain.ID}}" style="margin-left:-1px;"> | |||
| @@ -154,10 +157,11 @@ | |||
| </a> | |||
| {{end}} | |||
| </form> | |||
| {{if eq .JobType "BENCHMARK"}} | |||
| <a class="ui basic button {{if $.IsSigned}} blue{{else}} disabled{{end}}" href="{{$.RepoLink}}/cloudbrain/{{.Cloudbrain.ID}}/rate" target="_blank"> | |||
| {{$.i18n.Tr "repo.score"}} | |||
| </a> | |||
| {{end}} | |||
| <!-- 删除任务 --> | |||
| <form id="delForm-{{.Cloudbrain.ID}}" action="{{if eq .ComputeResource "CPU/GPU"}}{{$.RepoLink}}/cloudbrain/benchmark{{else}}{{$.RepoLink}}/modelarts/notebook{{end}}/{{.Cloudbrain.ID}}/del" method="post"> | |||
| <input type="hidden" name="debugListType" value="all"> | |||
| @@ -226,4 +230,4 @@ | |||
| </div> | |||
| </div> | |||
| {{template "base/footer" .}} | |||
| {{template "base/footer" .}} | |||
| @@ -1,70 +1,46 @@ | |||
| {{template "base/head" .}} | |||
| <style> | |||
| .unite { | |||
| font-family: SourceHanSansSC-medium !important; | |||
| color: rgba(16, 16, 16, 100) !important; | |||
| } | |||
| .title { | |||
| font-size: 16px !important; | |||
| padding-left: 3rem !important; | |||
| } | |||
| .min_title { | |||
| font-size: 14px !important; | |||
| padding-left: 6rem !important; | |||
| margin-bottom: 2rem !important; | |||
| .unite{ | |||
| font-family: SourceHanSansSC-medium !important; | |||
| color: rgba(16, 16, 16, 100) !important; | |||
| } | |||
| .title{ | |||
| font-size: 16px !important; | |||
| padding-left: 3rem !important; | |||
| } | |||
| .min_title{ | |||
| font-size: 14px !important; | |||
| padding-left: 6rem !important; | |||
| margin-bottom: 2rem !important; | |||
| } | |||
| .width{ | |||
| width:100% !important; | |||
| } | |||
| .width80{ | |||
| width: 80.7% !important; | |||
| margin-left: 10px; | |||
| } | |||
| .width85{ | |||
| width: 85% !important; | |||
| margin-left: 4.5rem !important; | |||
| } | |||
| .width81{ | |||
| margin-left: 1.5rem; | |||
| width: 81% !important; | |||
| } | |||
| .add{font-size: 18px; | |||
| padding: 0.5rem; | |||
| border: 1px solid rgba(187, 187, 187, 100); | |||
| border-radius: 0px 5px 5px 0px; | |||
| line-height: 21px; | |||
| text-align: center; | |||
| color: #C2C7CC; | |||
| } | |||
| .min{ | |||
| font-size: 18px; | |||
| padding: 0.5rem; | |||
| border: 1px solid rgba(187, 187, 187, 100); | |||
| border-radius: 5px 0px 0px 5px; | |||
| line-height: 21px; | |||
| text-align: center; | |||
| color: #C2C7CC; | |||
| } | |||
| .nowrapx { | |||
| white-space: nowrap !important; | |||
| } | |||
| } | |||
| .width81 { | |||
| margin-left: 1.5rem; | |||
| width: 81% !important; | |||
| } | |||
| .width48 { | |||
| width: 48.5% !important; | |||
| } | |||
| .nowrapx { | |||
| white-space: nowrap !important; | |||
| } | |||
| </style> | |||
| <!-- <div class="ui page dimmer"> | |||
| <div class="ui text loader">{{.i18n.Tr "loading"}}</div> | |||
| </div> --> | |||
| <div id="mask"> | |||
| <div id="loadingPage"> | |||
| <div class="rect1"></div> | |||
| <div class="rect2"></div> | |||
| <div class="rect3"></div> | |||
| <div class="rect4"></div> | |||
| <div class="rect5"></div> | |||
| </div> | |||
| <div id="loadingPage"> | |||
| <div class="rect1"></div> | |||
| <div class="rect2"></div> | |||
| <div class="rect3"></div> | |||
| <div class="rect4"></div> | |||
| <div class="rect5"></div> | |||
| </div> | |||
| </div> | |||
| <div class="repository"> | |||
| {{template "repo/header" .}} | |||
| @@ -74,168 +50,297 @@ | |||
| {{.i18n.Tr "repo.modelarts.evaluate_job.new_job"}} | |||
| </h4> | |||
| <div class="ui attached segment"> | |||
| <!-- equal width --> | |||
| <form class="ui form" action="{{.Link}}" method="post"> | |||
| <input type="hidden" name="benchmarkMode" value="{{.benchmarkMode}}"> | |||
| {{if eq .benchmarkMode "model"}} | |||
| <form class="ui form model_form" action="{{.Link}}?benchmarkMode=model" method="post"> | |||
| {{.CsrfTokenHtml}} | |||
| <input type="hidden" name="action" value="update"> | |||
| <div class="required unite min_title inline field"> | |||
| <label style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.job_name"}}</label> | |||
| <input style="width: 80%;" name="display_job_name" id="trainjob_job_name" placeholder={{.i18n.Tr "repo.modelarts.train_job.job_name"}} value="{{.display_job_name}}" tabindex="3" autofocus required maxlength="254"> | |||
| </div> | |||
| <div class="unite min_title inline field"> | |||
| <label style="font-weight: normal;" for="description">{{.i18n.Tr "repo.modelarts.train_job.description"}} </label> | |||
| <textarea style="width: 80%;" id="description" name="description" rows="3" maxlength="254" placeholder={{.i18n.Tr "repo.modelarts.train_job.new_place"}} onchange="this.value=this.value.substring(0, 255)" onkeydown="this.value=this.value.substring(0, 255)" onkeyup="this.value=this.value.substring(0, 255)">{{.description}}</textarea> | |||
| <label style="font-weight: normal;">{{.i18n.Tr "repo.cloudbrain.benchmark.evaluate_scenes"}}</label> | |||
| <div class="ui blue small menu compact selectcloudbrain"> | |||
| <a class="item alogrithm_benchmark" | |||
| href="{{.Link}}?benchmarkMode=alogrithm">{{.i18n.Tr "repo.cloudbrain.benchmark.algorithm"}}</a> | |||
| <a class="active item model_benchmark" | |||
| href="{{.Link}}?benchmarkMode=model">{{.i18n.Tr "repo.cloudbrain.benchmark.model"}}</a> | |||
| </div> | |||
| </div> | |||
| <div> | |||
| <div class="required unite min_title inline field"> | |||
| <label style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.job_name"}}</label> | |||
| <input style="width: 80%;" name="display_job_name" id="trainjob_job_name" | |||
| placeholder={{.i18n.Tr "repo.modelarts.train_job.job_name"}} value="{{.display_job_name}}" | |||
| tabindex="3" autofocus required maxlength="254"> | |||
| </div> | |||
| <div class="required unite min_title inline field"> | |||
| <label style="font-weight: normal;" | |||
| for="description">{{.i18n.Tr "repo.modelarts.train_job.description"}} </label> | |||
| <textarea style="width: 80%;" id="description" name="description" rows="3" required | |||
| maxlength="254" placeholder={{.i18n.Tr "repo.modelarts.train_job.new_place"}} | |||
| onchange="this.value=this.value.substring(0, 255)" | |||
| onkeydown="this.value=this.value.substring(0, 255)" | |||
| onkeyup="this.value=this.value.substring(0, 255)">{{.description}}</textarea> | |||
| </div> | |||
| <div class="required unite min_title inline field"> | |||
| <div class="required unite min_title inline field"> | |||
| <label style="font-weight: normal;">{{.i18n.Tr "cloudbrain.gpu_type"}}</label> | |||
| <select id="cloudbrain_gpu_type" class="ui search dropdown" placeholder="选择GPU类型" style='width:385px' name="gpu_type"> | |||
| <select id="cloudbrain_gpu_type" class="ui search dropdown width48" placeholder="选择GPU类型" | |||
| name="gpu_type"> | |||
| {{range .benchmark_gpu_types}} | |||
| <option value="{{.Queue}}">{{.Value}}</option> | |||
| <option value="{{.Queue}}">{{.Value}}</option> | |||
| {{end}} | |||
| </select> | |||
| </div> | |||
| </div> | |||
| <div class="required unite min_title two inline fields "> | |||
| <div class="required ten wide field" style="width: 26.5% !important;"> | |||
| <label style="font-weight: normal;">{{.i18n.Tr "cloudbrain.task_type"}}</label> | |||
| <select id="cloudbrain_job_type" class="ui search dropdown job_type" | |||
| placeholder="select {{.i18n.Tr "cloudbrain.task_type"}}" name="job_type"> | |||
| <option value="SNN4IMAGENET">SNN4IMAGENET</option> | |||
| <option value="BRAINSCORE">BRAINSCORE</option> | |||
| </select> | |||
| </div> | |||
| <div class="required six widde field" id="brainscore_child_type" | |||
| style="width: 15% !important;display: none;"> | |||
| <label style="font-weight: normal;">{{.i18n.Tr "cloudbrain.brain_area"}}</label> | |||
| <select class="ui search dropdown" placeholder="select {{.i18n.Tr "cloudbrain.brain_area"}}" | |||
| name="benchmark_child_types_id"> | |||
| <option value="0">V1</option> | |||
| <option value="1">V2</option> | |||
| <option value="2">V4</option> | |||
| <option value="3">IT</option> | |||
| </select> | |||
| </div> | |||
| <span> | |||
| <i class="question circle icon link" | |||
| data-content={{.i18n.Tr "repo.modelarts.train_job.boot_file_helper"}} | |||
| data-position="right center" data-variation="mini"></i> | |||
| </span> | |||
| <a id="benchmark_model_example" | |||
| href="https://git.openi.org.cn/BDIP/snn4imagenet">{{.i18n.Tr "cloudbrain.view_sample"}}</a> | |||
| </div> | |||
| <div class="required unite inline min_title fields" style="width: 90%;"> | |||
| <div class="required eight wide field"> | |||
| <label style="font-weight: normal;white-space: nowrap;">{{.i18n.Tr "repo.cloudbrain.benchmark.evaluate_type"}}</label> | |||
| <span> </span> | |||
| <select class="ui fluid selection search dropdown" id="benchmark_types_id" name="benchmark_types_id" > | |||
| {{range .benchmark_types}} | |||
| {{if eq .Id $.benchmarkTypeID}} | |||
| <option value="{{.Id}}" selected="true">{{.First}}</option> | |||
| {{else}} | |||
| <option value="{{.Id}}">{{.First}}</option> | |||
| {{end}} | |||
| <div id="images-new-cb"> | |||
| </div> | |||
| {{template "custom/select_dataset_train" .}} | |||
| <div class="required unite min_title inline field" style="margin-top:2rem;"> | |||
| <label style="font-weight: normal;">{{.i18n.Tr "cloudbrain.resource_specification"}}</label> | |||
| <select id="cloudbrain_resource_spec" class="ui search dropdown" | |||
| placeholder="{{.i18n.Tr "cloudbrain.select_specification"}}" style='width:385px' | |||
| name="resource_spec_id"> | |||
| {{range .benchmark_resource_specs}} | |||
| <option name="resource_spec_id" value="{{.Id}}"> | |||
| {{$.i18n.Tr "cloudbrain.gpu_num"}}:{{.GpuNum}},{{$.i18n.Tr "cloudbrain.cpu_num"}}:{{.CpuNum}},{{$.i18n.Tr "cloudbrain.memory"}}(MB):{{.MemMiB}},{{$.i18n.Tr "cloudbrain.shared_memory"}}(MB):{{.ShareMemMiB}} | |||
| </option> | |||
| {{end}} | |||
| </select> | |||
| </div> | |||
| <div class="eight wide field" id="engine_name"> | |||
| <input type="hidden" id="benchmark_child_types_id_hidden" name="benchmark_child_types_id_hidden" value="{{.benchmark_child_types_id_hidden}}"> | |||
| <label style="font-weight: normal;white-space: nowrap;">{{.i18n.Tr "repo.cloudbrain.benchmark.evaluate_child_type"}}</label> | |||
| <select class="ui fluid selection dropdown nowrapx" id="benchmark_child_types_id" style='width: 100%;' name="benchmark_child_types_id"> | |||
| </select> | |||
| </div> | |||
| </div> | |||
| <div class="inline unite min_title field"> | |||
| <button class="ui create_train_job green button"> | |||
| {{.i18n.Tr "repo.cloudbrain.new"}} | |||
| </button> | |||
| <a class="ui button" href="/">{{.i18n.Tr "repo.cloudbrain.cancel"}}</a> | |||
| </div> | |||
| </div> | |||
| <div id="images-new-cb"> | |||
| </form> | |||
| {{else}} | |||
| <form class="ui form alogrithm_form" action="{{.Link}}?benchmarkMode=alogrithm" method="post"> | |||
| {{.CsrfTokenHtml}} | |||
| <input type="hidden" name="action" value="update"> | |||
| <input type="hidden" name="job_type" value="BENCHMARK"> | |||
| <div class="required unite min_title inline field"> | |||
| <label style="font-weight: normal;">{{.i18n.Tr "repo.cloudbrain.benchmark.evaluate_scenes"}}</label> | |||
| <div class="ui blue small menu compact selectcloudbrain"> | |||
| <a class="active item alogrithm_benchmark" | |||
| href="{{.Link}}?benchmarkMode=alogrithm">{{.i18n.Tr "repo.cloudbrain.benchmark.algorithm"}}</a> | |||
| <a class="item model_benchmark" | |||
| href="{{.Link}}?benchmarkMode=model">{{.i18n.Tr "repo.cloudbrain.benchmark.model"}}</a> | |||
| </div> | |||
| </div> | |||
| <div> | |||
| <div class="required unite min_title inline field"> | |||
| <label style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.job_name"}}</label> | |||
| <input style="width: 80%;" name="display_job_name" id="trainjob_job_name" | |||
| placeholder={{.i18n.Tr "repo.modelarts.train_job.job_name"}} value="{{.display_job_name}}" | |||
| tabindex="3" autofocus required maxlength="254"> | |||
| </div> | |||
| <div class="unite min_title inline field"> | |||
| <label style="font-weight: normal;" | |||
| for="description">{{.i18n.Tr "repo.modelarts.train_job.description"}} </label> | |||
| <textarea style="width: 80%;" id="description" name="description" rows="3" maxlength="254" | |||
| placeholder={{.i18n.Tr "repo.modelarts.train_job.new_place"}} | |||
| onchange="this.value=this.value.substring(0, 255)" | |||
| onkeydown="this.value=this.value.substring(0, 255)" | |||
| onkeyup="this.value=this.value.substring(0, 255)">{{.description}}</textarea> | |||
| </div> | |||
| <div class="required unite min_title inline field"> | |||
| <label style="font-weight: normal;">{{.i18n.Tr "cloudbrain.gpu_type"}}</label> | |||
| <select id="cloudbrain_gpu_type" class="ui search dropdown" placeholder="选择GPU类型" | |||
| style='width:385px' name="gpu_type"> | |||
| {{range .benchmark_gpu_types}} | |||
| <option value="{{.Queue}}">{{.Value}}</option> | |||
| {{end}} | |||
| </select> | |||
| </div> | |||
| <div class="required unite inline min_title fields" style="width: 90%;"> | |||
| <div class="required eight wide field"> | |||
| <label | |||
| style="font-weight: normal;white-space: nowrap;">{{.i18n.Tr "repo.cloudbrain.benchmark.evaluate_type"}}</label> | |||
| <span> </span> | |||
| <select class="ui fluid selection search dropdown" id="benchmark_types_id" | |||
| name="benchmark_types_id"> | |||
| {{range .benchmark_types}} | |||
| {{if eq .Id $.benchmarkTypeID}} | |||
| <option value="{{.Id}}" selected="true">{{.First}}</option> | |||
| {{else}} | |||
| <option value="{{.Id}}">{{.First}}</option> | |||
| {{end}} | |||
| {{end}} | |||
| </select> | |||
| </div> | |||
| <div class="eight wide field" id="engine_name"> | |||
| <input type="hidden" id="benchmark_child_types_id_hidden" | |||
| name="benchmark_child_types_id_hidden" value="{{.benchmark_child_types_id_hidden}}"> | |||
| <label | |||
| style="font-weight: normal;white-space: nowrap;">{{.i18n.Tr "repo.cloudbrain.benchmark.evaluate_child_type"}}</label> | |||
| <select class="ui fluid selection dropdown nowrapx" id="benchmark_child_types_id" | |||
| style='width: 100%;' name="benchmark_child_types_id"> | |||
| </select> | |||
| </div> | |||
| </div> | |||
| <div id="images-new-cb"> | |||
| </div> | |||
| <div class="required unite min_title inline field"> | |||
| <div class="required unite min_title inline field"> | |||
| <label style="font-weight: normal;">{{.i18n.Tr "cloudbrain.resource_specification"}}</label> | |||
| <select id="cloudbrain_resource_spec" class="ui search dropdown" placeholder="{{.i18n.Tr "cloudbrain.select_specification"}}" style='width:385px' name="resource_spec_id"> | |||
| <select id="cloudbrain_resource_spec" class="ui search dropdown" | |||
| placeholder="{{.i18n.Tr "cloudbrain.select_specification"}}" style='width:385px' | |||
| name="resource_spec_id"> | |||
| {{range .benchmark_resource_specs}} | |||
| <option name="resource_spec_id" value="{{.Id}}">{{$.i18n.Tr "cloudbrain.gpu_num"}}:{{.GpuNum}},{{$.i18n.Tr "cloudbrain.cpu_num"}}:{{.CpuNum}},{{$.i18n.Tr "cloudbrain.memory"}}(MB):{{.MemMiB}},{{$.i18n.Tr "cloudbrain.shared_memory"}}(MB):{{.ShareMemMiB}}</option> | |||
| <option name="resource_spec_id" value="{{.Id}}"> | |||
| {{$.i18n.Tr "cloudbrain.gpu_num"}}:{{.GpuNum}},{{$.i18n.Tr "cloudbrain.cpu_num"}}:{{.CpuNum}},{{$.i18n.Tr "cloudbrain.memory"}}(MB):{{.MemMiB}},{{$.i18n.Tr "cloudbrain.shared_memory"}}(MB):{{.ShareMemMiB}} | |||
| </option> | |||
| {{end}} | |||
| </select> | |||
| </div> | |||
| </div> | |||
| <div class="inline unite min_title field required"> | |||
| <label style="font-weight: normal;">{{.i18n.Tr "repo.cloudbrain.benchmark.evaluate_train"}}</label> | |||
| <input disabled="disabled" style="width: 33.5%;" name="train_file" id="train_file" value="train.py" tabindex="3" autofocus required maxlength="254" > | |||
| <a id="train_href_id" href="https://git.openi.org.cn/CV_benchmark/CV_reID_benchmark" target="_blank">{{.i18n.Tr "repo.cloudbrain.benchmark.evaluate_train"}}</a> | |||
| </div> | |||
| <div class="inline unite min_title field required"> | |||
| <label | |||
| style="font-weight: normal;">{{.i18n.Tr "repo.cloudbrain.benchmark.evaluate_train"}}</label> | |||
| <input disabled="disabled" style="width: 33.5%;" name="train_file" id="train_file" | |||
| value="train.py" tabindex="3" autofocus required maxlength="254"> | |||
| <a id="train_href_id" href="https://git.openi.org.cn/CV_benchmark/CV_reID_benchmark" | |||
| target="_blank">{{.i18n.Tr "repo.cloudbrain.benchmark.evaluate_train"}}</a> | |||
| </div> | |||
| <div class="inline unite min_title field required"> | |||
| <label style="font-weight: normal;">{{.i18n.Tr "repo.cloudbrain.benchmark.evaluate_test"}}</label> | |||
| <input disabled="disabled" style="width: 33.5%;" name="test_file" id="test_file" value="test.py" tabindex="3" autofocus required maxlength="254" > | |||
| <a id="test_href_id" href="https://git.openi.org.cn/CV_benchmark/CV_reID_benchmark" target="_blank">{{.i18n.Tr "cloudbrain.view_sample"}}</a> | |||
| </div> | |||
| <div class="inline unite min_title field required"> | |||
| <label | |||
| style="font-weight: normal;">{{.i18n.Tr "repo.cloudbrain.benchmark.evaluate_test"}}</label> | |||
| <input disabled="disabled" style="width: 33.5%;" name="test_file" id="test_file" value="test.py" | |||
| tabindex="3" autofocus required maxlength="254"> | |||
| <a id="test_href_id" href="https://git.openi.org.cn/CV_benchmark/CV_reID_benchmark" | |||
| target="_blank">{{.i18n.Tr "cloudbrain.view_sample"}}</a> | |||
| </div> | |||
| <div class="inline unite min_title field"> | |||
| <button class="ui create_train_job green button"> | |||
| {{.i18n.Tr "repo.cloudbrain.new"}} | |||
| </button> | |||
| <a class="ui button" href="/">{{.i18n.Tr "repo.cloudbrain.cancel"}}</a> | |||
| <div class="inline unite min_title field"> | |||
| <button class="ui create_train_job green button"> | |||
| {{.i18n.Tr "repo.cloudbrain.new"}} | |||
| </button> | |||
| <a class="ui button" href="/">{{.i18n.Tr "repo.cloudbrain.cancel"}}</a> | |||
| </div> | |||
| </div> | |||
| <!-- 模态框 --> | |||
| </form> | |||
| {{end}} | |||
| </div> | |||
| </div> | |||
| </div> | |||
| {{template "base/footer" .}} | |||
| <script> | |||
| let repolink = {{.RepoLink}} | |||
| let repolink = {{.RepoLink }} | |||
| let url_href = window.location.pathname.split('create')[0] | |||
| $(".ui.button").attr('href',url_href) | |||
| $(".ui.button").attr('href', url_href) | |||
| $('.menu .item') | |||
| .tab(); | |||
| $('#benchmark_types_id').change(function(){ | |||
| $('#benchmark_types_id').change(function () { | |||
| setChildType(); | |||
| }) | |||
| function setChildType(){ | |||
| $(document).ready(() => { | |||
| $('.ui.search.dropdown.job_type').dropdown({ | |||
| onChange: function (value, text, $selectedItem) { | |||
| console.log(value, text) | |||
| if (value === "BRAINSCORE") { | |||
| $('#brainscore_child_type').css('display', 'block') | |||
| $('#benchmark_model_example').attr('href', 'https://git.openi.org.cn/BDIP/similarity2brain_ann') | |||
| } else { | |||
| $('#brainscore_child_type').css('display', 'none') | |||
| $('#benchmark_model_example').attr('href', 'https://git.openi.org.cn/BDIP/snn4imagenet') | |||
| } | |||
| } | |||
| }) | |||
| }) | |||
| function setChildType() { | |||
| let type_id = $('#benchmark_types_id').val(); | |||
| if(type_id == 3){ | |||
| $('#train_href_id').attr('href','https://git.openi.org.cn/CV_benchmark/CV_MOT_benchmark'); | |||
| $('#test_href_id').attr('href','https://git.openi.org.cn/CV_benchmark/CV_MOT_benchmark'); | |||
| }else{ | |||
| $('#train_href_id').attr('href','https://git.openi.org.cn/CV_benchmark/CV_reID_benchmark'); | |||
| $('#test_href_id').attr('href','https://git.openi.org.cn/CV_benchmark/CV_reID_benchmark'); | |||
| if (type_id == 3) { | |||
| $('#train_href_id').attr('href', 'https://git.openi.org.cn/CV_benchmark/CV_MOT_benchmark'); | |||
| $('#test_href_id').attr('href', 'https://git.openi.org.cn/CV_benchmark/CV_MOT_benchmark'); | |||
| } else { | |||
| $('#train_href_id').attr('href', 'https://git.openi.org.cn/CV_benchmark/CV_reID_benchmark'); | |||
| $('#test_href_id').attr('href', 'https://git.openi.org.cn/CV_benchmark/CV_reID_benchmark'); | |||
| } | |||
| let child_selected_id = $('#benchmark_child_types_id_hidden').val(); | |||
| let child_selected_id = $('#benchmark_child_types_id_hidden').val(); | |||
| $.get(`${repolink}/cloudbrain/benchmark/get_child_types?benchmark_type_id=${type_id}`, (data) => { | |||
| const n_length = data['child_types'].length | |||
| let html='' | |||
| for (let i=0;i<n_length;i++){ | |||
| if(child_selected_id == data['child_types'][i].id){ | |||
| let html = '' | |||
| for (let i = 0; i < n_length; i++) { | |||
| if (child_selected_id == data['child_types'][i].id) { | |||
| html += `<option value="${data['child_types'][i].id}" selected="true">${data['child_types'][i].value}</option>`; | |||
| }else{ | |||
| } else { | |||
| html += `<option value="${data['child_types'][i].id}">${data['child_types'][i].value}</option>`; | |||
| } | |||
| } | |||
| document.getElementById("benchmark_child_types_id").innerHTML=html; | |||
| document.getElementById("benchmark_child_types_id").innerHTML = html; | |||
| }) | |||
| } | |||
| document.onreadystatechange = function() { | |||
| document.onreadystatechange = function () { | |||
| if (document.readyState === "complete") { | |||
| setChildType(); | |||
| if ($('input[name=benchmarkMode]').val() === 'alogrithm') { | |||
| setChildType(); | |||
| } | |||
| } | |||
| } | |||
| function validate(){ | |||
| function validate() { | |||
| $('.ui.form') | |||
| .form({ | |||
| on: 'blur', | |||
| inline:true, | |||
| fields: { | |||
| image:{ | |||
| identifier : 'image', | |||
| rules: [ | |||
| { | |||
| type: 'empty', | |||
| prompt : '选择一个镜像' | |||
| } | |||
| ] | |||
| .form({ | |||
| on: 'blur', | |||
| inline: true, | |||
| fields: { | |||
| image: { | |||
| identifier: 'image', | |||
| rules: [ | |||
| { | |||
| type: 'empty', | |||
| prompt: '选择一个镜像' | |||
| } | |||
| ] | |||
| } | |||
| }, | |||
| onSuccess: function () { | |||
| // $('.ui.page.dimmer').dimmer('show') | |||
| document.getElementById("mask").style.display = "block" | |||
| }, | |||
| onFailure: function (e) { | |||
| return false; | |||
| } | |||
| }, | |||
| onSuccess: function(){ | |||
| // $('.ui.page.dimmer').dimmer('show') | |||
| document.getElementById("mask").style.display = "block" | |||
| }, | |||
| onFailure: function(e){ | |||
| return false; | |||
| } | |||
| }) | |||
| }) | |||
| } | |||
| $('.ui.create_train_job.green.button').click(function(e) { | |||
| $('.ui.create_train_job.green.button').click(function (e) { | |||
| validate() | |||
| }) | |||
| </script> | |||
| </script> | |||
| @@ -1,165 +1,199 @@ | |||
| {{template "base/head" .}} | |||
| <style> | |||
| .according-panel-heading{ | |||
| box-sizing: border-box; | |||
| padding: 8px 16px; | |||
| color: #252b3a; | |||
| background-color: #f2f5fc; | |||
| line-height: 1.5; | |||
| cursor: pointer; | |||
| -moz-user-select: none; | |||
| -webkit-user-select: none; | |||
| -ms-user-select: none; | |||
| -khtml-user-select: none; | |||
| user-select: none; | |||
| } | |||
| .accordion-panel-title { | |||
| margin-top: 0; | |||
| margin-bottom: 0; | |||
| color: #252b3a; | |||
| } | |||
| .accordion-panel-title-content{ | |||
| vertical-align: middle; | |||
| display: inline-block; | |||
| width: calc(100% - 32px); | |||
| cursor: default; | |||
| } | |||
| .acc-margin-bottom { | |||
| margin-bottom: 5px; | |||
| } | |||
| .title_text { | |||
| font-size: 12px; | |||
| } | |||
| .ac-display-inblock { | |||
| display: inline-block; | |||
| } | |||
| .cti-mgRight-sm { | |||
| margin-right: 8px; | |||
| } | |||
| .ac-text-normal { | |||
| font-size: 14px; | |||
| color: #575d6c; | |||
| } | |||
| .uc-accordionTitle-black { | |||
| color: #333; | |||
| } | |||
| .accordion-border{ | |||
| border:1px solid #cce2ff; | |||
| } | |||
| .padding0{ | |||
| padding: 0 !important; | |||
| } | |||
| .content-pad{ | |||
| padding: 15px 35px; | |||
| } | |||
| .content-margin{ | |||
| margin:10px 5px ; | |||
| } | |||
| .tab_2_content { | |||
| min-height: 360px; | |||
| margin-left: 10px; | |||
| } | |||
| .ac-grid { | |||
| display: block; | |||
| *zoom: 1; | |||
| } | |||
| .ac-grid-col { | |||
| float: left; | |||
| width: 100%; | |||
| } | |||
| .ac-grid-col2 .ac-grid-col { | |||
| width: 50%; | |||
| } | |||
| .ti-form { | |||
| text-align: left; | |||
| max-width: 100%; | |||
| vertical-align: middle; | |||
| } | |||
| .ti-form>tbody { | |||
| font-size: 12px; | |||
| } | |||
| .ti-form>tbody, .ti-form>tbody>tr { | |||
| vertical-align: inherit; | |||
| } | |||
| .ti-text-form-label { | |||
| padding-bottom: 20px; | |||
| padding-right: 20px; | |||
| color: #8a8e99; | |||
| font-size: 12px; | |||
| white-space: nowrap !important; | |||
| width: 80px; | |||
| line-height: 30px; | |||
| } | |||
| .ti-text-form-content{ | |||
| line-height: 30px; | |||
| padding-bottom: 20px; | |||
| } | |||
| .ti-form>tbody>tr>td { | |||
| vertical-align: top; | |||
| white-space: normal; | |||
| } | |||
| td, th { | |||
| padding: 0; | |||
| } | |||
| .ac-grid-col .text-span { | |||
| width: 450px; | |||
| overflow: hidden; | |||
| text-overflow: ellipsis; | |||
| white-space: nowrap; | |||
| } | |||
| .redo-color{ | |||
| color: #3291F8; | |||
| } | |||
| .ti-action-menu-item:not(:last-child){ | |||
| margin-right: 10px; | |||
| padding-right: 11px; | |||
| text-decoration: none!important; | |||
| color: #526ecc; | |||
| cursor: pointer; | |||
| display: inline-block; | |||
| -moz-user-select: none; | |||
| -webkit-user-select: none; | |||
| -ms-user-select: none; | |||
| -khtml-user-select: none; | |||
| user-select: none; | |||
| position: relative; | |||
| } | |||
| .ti-action-menu-item:not(:last-child):after { | |||
| content: ""; | |||
| display: inline-block; | |||
| position: absolute; | |||
| height: 12px; | |||
| right: 0; | |||
| top: 50%; | |||
| -webkit-transform: translateY(-6px); | |||
| -ms-transform: translateY(-6px); | |||
| -o-transform: translateY(-6px); | |||
| transform: translateY(-6px); | |||
| border-right: 1px solid #dfe1e6; | |||
| } | |||
| .text-width80{ | |||
| width: 100px; | |||
| line-height: 30px; | |||
| } | |||
| .border-according{ | |||
| border: 1px solid #dfe1e6; | |||
| } | |||
| .disabled { | |||
| .according-panel-heading { | |||
| box-sizing: border-box; | |||
| padding: 8px 16px; | |||
| color: #252b3a; | |||
| background-color: #f2f5fc; | |||
| line-height: 1.5; | |||
| cursor: pointer; | |||
| -moz-user-select: none; | |||
| -webkit-user-select: none; | |||
| -ms-user-select: none; | |||
| -khtml-user-select: none; | |||
| user-select: none; | |||
| } | |||
| .accordion-panel-title { | |||
| margin-top: 0; | |||
| margin-bottom: 0; | |||
| color: #252b3a; | |||
| } | |||
| .accordion-panel-title-content { | |||
| vertical-align: middle; | |||
| display: inline-block; | |||
| width: calc(100% - 32px); | |||
| cursor: default; | |||
| } | |||
| .acc-margin-bottom { | |||
| margin-bottom: 5px; | |||
| } | |||
| .title_text { | |||
| font-size: 12px; | |||
| } | |||
| .ac-display-inblock { | |||
| display: inline-block; | |||
| } | |||
| .cti-mgRight-sm { | |||
| margin-right: 8px; | |||
| } | |||
| .ac-text-normal { | |||
| font-size: 14px; | |||
| color: #575d6c; | |||
| } | |||
| .uc-accordionTitle-black { | |||
| color: #333; | |||
| } | |||
| .accordion-border { | |||
| border: 1px solid #cce2ff; | |||
| } | |||
| .padding0 { | |||
| padding: 0 !important; | |||
| } | |||
| .content-pad { | |||
| padding: 15px 35px; | |||
| } | |||
| .content-margin { | |||
| margin: 10px 5px; | |||
| } | |||
| .tab_2_content { | |||
| min-height: 425px; | |||
| margin-left: 10px; | |||
| } | |||
| .ac-grid { | |||
| display: block; | |||
| *zoom: 1; | |||
| } | |||
| .ac-grid-col { | |||
| float: left; | |||
| width: 100%; | |||
| } | |||
| .ac-grid-col2 .ac-grid-col { | |||
| width: 50%; | |||
| } | |||
| .ti-form { | |||
| text-align: left; | |||
| max-width: 100%; | |||
| vertical-align: middle; | |||
| } | |||
| .ti-form>tbody { | |||
| font-size: 12px; | |||
| } | |||
| .ti-form>tbody, | |||
| .ti-form>tbody>tr { | |||
| vertical-align: inherit; | |||
| } | |||
| .ti-text-form-label { | |||
| padding-bottom: 20px; | |||
| padding-right: 20px; | |||
| color: #8a8e99; | |||
| font-size: 12px; | |||
| white-space: nowrap !important; | |||
| width: 80px; | |||
| line-height: 30px; | |||
| } | |||
| .ti-text-form-content { | |||
| line-height: 30px; | |||
| padding-bottom: 20px; | |||
| } | |||
| .ti-form>tbody>tr>td { | |||
| vertical-align: top; | |||
| white-space: normal; | |||
| } | |||
| td, | |||
| th { | |||
| padding: 0; | |||
| } | |||
| .ac-grid-col .text-span { | |||
| width: 450px; | |||
| overflow: hidden; | |||
| text-overflow: ellipsis; | |||
| white-space: nowrap; | |||
| } | |||
| .redo-color { | |||
| color: #3291F8; | |||
| } | |||
| .ti-action-menu-item:not(:last-child) { | |||
| margin-right: 10px; | |||
| padding-right: 11px; | |||
| text-decoration: none !important; | |||
| color: #526ecc; | |||
| cursor: pointer; | |||
| display: inline-block; | |||
| -moz-user-select: none; | |||
| -webkit-user-select: none; | |||
| -ms-user-select: none; | |||
| -khtml-user-select: none; | |||
| user-select: none; | |||
| position: relative; | |||
| } | |||
| .ti-action-menu-item:not(:last-child):after { | |||
| content: ""; | |||
| display: inline-block; | |||
| position: absolute; | |||
| height: 12px; | |||
| right: 0; | |||
| top: 50%; | |||
| -webkit-transform: translateY(-6px); | |||
| -ms-transform: translateY(-6px); | |||
| -o-transform: translateY(-6px); | |||
| transform: translateY(-6px); | |||
| border-right: 1px solid #dfe1e6; | |||
| } | |||
| .text-width80 { | |||
| width: 100px; | |||
| line-height: 30px; | |||
| } | |||
| .border-according { | |||
| border: 1px solid #dfe1e6; | |||
| } | |||
| .disabled { | |||
| cursor: default; | |||
| pointer-events: none; | |||
| color: rgba(0,0,0,.6) !important; | |||
| color: rgba(0, 0, 0, .6) !important; | |||
| opacity: .45 !important; | |||
| } | |||
| .pad20{ | |||
| border:0px !important; | |||
| } | |||
| .model_file_bread{ | |||
| margin-bottom: -0.5rem !important; | |||
| padding-left: 1rem; | |||
| padding-top: 0.5rem ; | |||
| } | |||
| } | |||
| .pad20 { | |||
| border: 0px !important; | |||
| } | |||
| .model_file_bread { | |||
| margin-bottom: -0.5rem !important; | |||
| padding-left: 1rem; | |||
| padding-top: 0.5rem; | |||
| } | |||
| </style> | |||
| <div id="mask"> | |||
| <div id="loadingPage"> | |||
| @@ -171,7 +205,7 @@ td, th { | |||
| </div> | |||
| </div> | |||
| <div class="repository"> | |||
| {{template "repo/header" .}} | |||
| {{template "repo/header" .}} | |||
| <div class="ui container"> | |||
| <h4 class="ui header" id="vertical-segment"> | |||
| <div class="ui breadcrumb"> | |||
| @@ -183,11 +217,12 @@ td, th { | |||
| {{$.i18n.Tr "repo.modelarts.evaluate_job"}} | |||
| </a> | |||
| <div class="divider"> / </div> | |||
| <div class="active section">{{.displayJobName}}</div> | |||
| </div> | |||
| <div class="active section">{{.displayJobName}}</div> | |||
| </div> | |||
| </h4> | |||
| {{range $k ,$v := .version_list_task}} | |||
| <div class="ui accordion border-according" id="accordion{{.VersionName}}" data-repopath="{{$.RepoRelPath}}" data-jobid="{{.JobID}}" data-version="{{.VersionName}}"> | |||
| <div class="ui accordion border-according" id="accordion{{.VersionName}}" data-repopath="{{$.RepoRelPath}}" | |||
| data-jobid="{{.JobID}}" data-version="{{.VersionName}}"> | |||
| <input type="hidden" id="jobId_input" name="jobId_input" value="{{.JobID}}"> | |||
| <div class="{{if eq $k 0}}active{{end}} title padding0"> | |||
| <div class="according-panel-heading"> | |||
| @@ -197,18 +232,23 @@ td, th { | |||
| <span> | |||
| <div class="ac-display-inblock title_text acc-margin-bottom"> | |||
| <span class="cti-mgRight-sm"> | |||
| {{if not (eq .StartTime 0)}} | |||
| <td>{{TimeSinceUnix1 .StartTime}}</td> | |||
| {{else}} | |||
| <td>{{TimeSinceUnix1 .CreatedUnix}}<td> | |||
| {{end}} | |||
| </span> | |||
| {{if not (eq .StartTime 0)}} | |||
| <td>{{TimeSinceUnix1 .StartTime}}</td> | |||
| {{else}} | |||
| <td>{{TimeSinceUnix1 .CreatedUnix}} | |||
| <td> | |||
| {{end}} | |||
| </span> | |||
| <span class="cti-mgRight-sm">{{$.i18n.Tr "repo.modelarts.status"}}: | |||
| <span id="{{.VersionName}}-status-span"><i id="icon" style="vertical-align: middle;" class="{{.Status}}"></i><span id="text" style="margin-left: 0.4em;font-size: 12px;">{{.Status}}</span></span> | |||
| <span id="{{.VersionName}}-status-span"><i id="icon" | |||
| style="vertical-align: middle;" class="{{.Status}}"></i><span id="text" | |||
| style="margin-left: 0.4em;font-size: 12px;">{{.Status}}</span></span> | |||
| </span> | |||
| <span class="cti-mgRight-sm">{{$.i18n.Tr "repo.modelarts.train_job.dura_time"}}:</span> | |||
| <span class="cti-mgRight-sm uc-accordionTitle-black" id="{{.VersionName}}-duration-span">{{$.duration}}</span> | |||
| <span | |||
| class="cti-mgRight-sm">{{$.i18n.Tr "repo.modelarts.train_job.dura_time"}}:</span> | |||
| <span class="cti-mgRight-sm uc-accordionTitle-black" | |||
| id="{{.VersionName}}-duration-span">{{$.duration}}</span> | |||
| </div> | |||
| </span> | |||
| @@ -219,8 +259,10 @@ td, th { | |||
| <div class="{{if eq $k 0}}active{{end}} content"> | |||
| <div class="content-pad"> | |||
| <div class="ui pointing secondary menu" style="border-bottom: 1px solid rgba(34,36,38,.15);"> | |||
| <a class="active item" data-tab="first{{$k}}">{{$.i18n.Tr "repo.modelarts.train_job.config"}}</a> | |||
| <a class="item" data-tab="second{{$k}}" onclick="loadLog({{.VersionName}})">{{$.i18n.Tr "repo.modelarts.log"}}</a> | |||
| <a class="active item" | |||
| data-tab="first{{$k}}">{{$.i18n.Tr "repo.modelarts.train_job.config"}}</a> | |||
| <a class="item" data-tab="second{{$k}}" | |||
| onclick="loadLog({{.VersionName}})">{{$.i18n.Tr "repo.modelarts.log"}}</a> | |||
| </div> | |||
| <div class="ui tab active" data-tab="first{{$k}}"> | |||
| <div style="padding-top: 10px;"> | |||
| @@ -250,31 +292,61 @@ td, th { | |||
| </div> | |||
| </td> | |||
| </tr> | |||
| <tr class="ti-no-ng-animate"> | |||
| <td class="ti-no-ng-animate ti-text-form-label text-width80"> | |||
| {{$.i18n.Tr "repo.modelarts.train_job.start_time"}} | |||
| {{$.i18n.Tr "repo.modelarts.createtime"}} | |||
| </td> | |||
| <td class="ti-text-form-content"> | |||
| <div class="text-span text-span-w"> | |||
| <span style="font-size: 12px;" class=""> | |||
| {{if not (eq .StartTime 0)}} | |||
| {{TimeSinceUnix1 .StartTime}} | |||
| {{else}} | |||
| {{TimeSinceUnix1 .CreatedUnix}} | |||
| {{end}} | |||
| {{TimeSinceUnix1 .CreatedUnix}} | |||
| </span> | |||
| </div> | |||
| </td> | |||
| </tr> | |||
| <tr class="ti-no-ng-animate"> | |||
| <td class="ti-no-ng-animate ti-text-form-label text-width80"> | |||
| {{$.i18n.Tr "repo.cloudbrain.time.starttime"}} | |||
| </td> | |||
| <td class="ti-text-form-content"> | |||
| <div class="text-span text-span-w" | |||
| id="{{.VersionName}}-startTime"> | |||
| {{if not (eq .StartTime 0)}} | |||
| {{TimeSinceUnix1 .StartTime}} | |||
| {{else}} | |||
| -- | |||
| {{end}} | |||
| </div> | |||
| </td> | |||
| </tr> | |||
| <tr class="ti-no-ng-animate"> | |||
| <td class="ti-no-ng-animate ti-text-form-label text-width80"> | |||
| {{$.i18n.Tr "repo.cloudbrain.time.endtime"}} | |||
| </td> | |||
| <td class="ti-text-form-content"> | |||
| <div class="text-span text-span-w" | |||
| id="{{.VersionName}}-EndTime"> | |||
| {{if not (eq .EndTime 0)}} | |||
| {{TimeSinceUnix1 .EndTime}} | |||
| {{else}} | |||
| -- | |||
| {{end}} | |||
| </div> | |||
| </td> | |||
| </tr> | |||
| <tr class="ti-no-ng-animate"> | |||
| <td class="ti-no-ng-animate ti-text-form-label text-width80"> | |||
| {{$.i18n.Tr "repo.modelarts.train_job.dura_time"}} | |||
| </td> | |||
| <td class="ti-text-form-content"> | |||
| <div class="text-span text-span-w" id="{{.VersionName}}-duration"> | |||
| <div class="text-span text-span-w" | |||
| id="{{.VersionName}}-duration"> | |||
| {{$.duration}} | |||
| </div> | |||
| </td> | |||
| @@ -290,100 +362,158 @@ td, th { | |||
| </div> | |||
| </td> | |||
| </tr> | |||
| <tr class="ti-no-ng-animate"> | |||
| <td class="ti-no-ng-animate ti-text-form-label text-width80"> | |||
| {{$.i18n.Tr "repo.cloudbrain.benchmark.evaluate_scenes"}} | |||
| </td> | |||
| <td class="ti-text-form-content"> | |||
| <div class="text-span text-span-w" | |||
| id="{{.VersionName}}-BenchmarkTypeName"> | |||
| {{.BenchmarkType}} | |||
| </div> | |||
| </td> | |||
| </tr> | |||
| <tr class="ti-no-ng-animate"> | |||
| <td class="ti-no-ng-animate ti-text-form-label text-width80"> | |||
| {{$.i18n.Tr "repo.cloudbrain.benchmark.evaluate_type"}} | |||
| </td> | |||
| <td class="ti-text-form-content"> | |||
| <div class="text-span text-span-w" id="{{.VersionName}}-BenchmarkTypeName"> | |||
| {{$.BenchmarkTypeName}} | |||
| <div class="text-span text-span-w" | |||
| id="{{.VersionName}}-BenchmarkTypeName"> | |||
| {{.BenchmarkTypeName}} | |||
| </div> | |||
| </td> | |||
| </tr> | |||
| </tbody> | |||
| </table> | |||
| </div> | |||
| <div class="ac-grid-col"> | |||
| <table class="ti-form"> | |||
| <tbody class="ti-text-form"> | |||
| <tr class="ti-no-ng-animate"> | |||
| <td class="ti-no-ng-animate ti-text-form-label text-width80"> | |||
| {{$.i18n.Tr "repo.cloudbrain.benchmark.evaluate_train"}} | |||
| </td> | |||
| <td class="ti-text-form-content"> | |||
| <div class="text-span text-span-w"> | |||
| train.py | |||
| </div> | |||
| </td> | |||
| </tr> | |||
| <tr class="ti-no-ng-animate"> | |||
| <td class="ti-no-ng-animate ti-text-form-label text-width80"> | |||
| {{$.i18n.Tr "repo.cloudbrain.benchmark.evaluate_test"}} | |||
| </td> | |||
| <td class="ti-text-form-content"> | |||
| <div class="text-span text-span-w"> | |||
| test.py | |||
| </div> | |||
| </td> | |||
| </tr> | |||
| <tr class="ti-no-ng-animate"> | |||
| <td class="ti-no-ng-animate ti-text-form-label text-width80"> | |||
| {{$.i18n.Tr "repo.modelarts.train_job.description"}} | |||
| </td> | |||
| <td class="ti-text-form-content"> | |||
| <div class="text-span text-span-w" title="{{.Description}}"> | |||
| {{.Description}} | |||
| </div> | |||
| </td> | |||
| </tr> | |||
| <tr class="ti-no-ng-animate"> | |||
| <td class="ti-no-ng-animate ti-text-form-label text-width80"> | |||
| {{$.i18n.Tr "repo.modelarts.train_job.standard"}} | |||
| </td> | |||
| <td class="ti-text-form-content"> | |||
| <div class="text-span text-span-w"> | |||
| {{$.resource_spec}} | |||
| </div> | |||
| </td> | |||
| </tr> | |||
| <tr class="ti-no-ng-animate"> | |||
| <td class="ti-no-ng-animate ti-text-form-label text-width80"> | |||
| {{$.i18n.Tr "repo.cloudbrain_creator"}} | |||
| </td> | |||
| <td class="ti-text-form-content"> | |||
| <div class="text-span text-span-w" id="{{.VersionName}}-mirror"> | |||
| {{.User.Name}} | |||
| </div> | |||
| </td> | |||
| </tr> | |||
| <tr class="ti-no-ng-animate"> | |||
| <table class="ti-form"> | |||
| <tbody class="ti-text-form"> | |||
| <tr class="ti-no-ng-animate"> | |||
| <td class="ti-no-ng-animate ti-text-form-label text-width80"> | |||
| {{$.i18n.Tr "repo.cloudbrain.benchmark.evaluate_train"}} | |||
| </td> | |||
| <td class="ti-text-form-content"> | |||
| <div class="text-span text-span-w"> | |||
| {{if eq .BenchmarkType "Benchmark"}} | |||
| train.py | |||
| {{else}} | |||
| -- | |||
| {{end}} | |||
| </div> | |||
| </td> | |||
| </tr> | |||
| <tr class="ti-no-ng-animate"> | |||
| <td class="ti-no-ng-animate ti-text-form-label text-width80"> | |||
| {{$.i18n.Tr "repo.cloudbrain.benchmark.evaluate_test"}} | |||
| </td> | |||
| <td class="ti-text-form-content"> | |||
| <div class="text-span text-span-w"> | |||
| {{if eq .BenchmarkType "Benchmark"}} | |||
| test.py | |||
| {{else}} | |||
| -- | |||
| {{end}} | |||
| </div> | |||
| </td> | |||
| </tr> | |||
| <tr class="ti-no-ng-animate"> | |||
| <td class="ti-no-ng-animate ti-text-form-label text-width80"> | |||
| {{$.i18n.Tr "repo.modelarts.train_job.description"}} | |||
| </td> | |||
| <td class="ti-text-form-content"> | |||
| <div class="text-span text-span-w" title="{{.Description}}"> | |||
| {{if .Description}} | |||
| {{.Description}} | |||
| {{else}} | |||
| -- | |||
| {{end}} | |||
| </div> | |||
| </td> | |||
| </tr> | |||
| <tr class="ti-no-ng-animate"> | |||
| <td class="ti-no-ng-animate ti-text-form-label text-width80"> | |||
| {{$.i18n.Tr "cloudbrain.gpu_type"}} | |||
| </td> | |||
| <td class="ti-text-form-content"> | |||
| <div class="text-span text-span-w"> | |||
| {{$.resource_type}} | |||
| </div> | |||
| </td> | |||
| </tr> | |||
| <tr class="ti-no-ng-animate"> | |||
| <td class="ti-no-ng-animate ti-text-form-label text-width80"> | |||
| {{$.i18n.Tr "repo.modelarts.train_job.standard"}} | |||
| </td> | |||
| <td class="ti-text-form-content"> | |||
| <div class="text-span text-span-w"> | |||
| {{$.resource_spec}} | |||
| </div> | |||
| </td> | |||
| </tr> | |||
| <tr class="ti-no-ng-animate"> | |||
| <td class="ti-no-ng-animate ti-text-form-label text-width80"> | |||
| {{$.i18n.Tr "repo.model_manager"}} | |||
| </td> | |||
| <td class="ti-text-form-content"> | |||
| <div class="text-span text-span-w" id="{{.VersionName}}-mirror"> | |||
| {{$.datasetname}} | |||
| </div> | |||
| </td> | |||
| </tr> | |||
| <tr class="ti-no-ng-animate"> | |||
| <td class="ti-no-ng-animate ti-text-form-label text-width80"> | |||
| {{$.i18n.Tr "repo.cloudbrain_creator"}} | |||
| </td> | |||
| <td class="ti-text-form-content"> | |||
| <div class="text-span text-span-w" id="{{.VersionName}}-mirror"> | |||
| {{.User.Name}} | |||
| </div> | |||
| </td> | |||
| </tr> | |||
| <tr class="ti-no-ng-animate"> | |||
| <td class="ti-no-ng-animate ti-text-form-label text-width80"> | |||
| {{if eq .BenchmarkTypeName "BRAINSCORE"}} | |||
| {{$.i18n.Tr "cloudbrain.brain_area"}} | |||
| {{else}} | |||
| {{$.i18n.Tr "repo.cloudbrain.benchmark.evaluate_child_type"}} | |||
| {{end}} | |||
| </td> | |||
| <td class="ti-text-form-content"> | |||
| <div class="text-span text-span-w" id="{{.VersionName}}-BenchmarkChildTypeName"> | |||
| <div class="text-span text-span-w" | |||
| id="{{.VersionName}}-BenchmarkChildTypeName"> | |||
| {{if $.BenchmarkChildTypeName}} | |||
| {{$.BenchmarkChildTypeName}} | |||
| {{else}} | |||
| -- | |||
| {{end}} | |||
| </div> | |||
| </td> | |||
| </tr> | |||
| </tbody> | |||
| </table> | |||
| </div> | |||
| </tr> | |||
| </tbody> | |||
| </table> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| @@ -394,9 +524,10 @@ td, th { | |||
| <div class="ui message message{{.VersionName}}" style="display: none;"> | |||
| <div id="header"></div> | |||
| </div> | |||
| <div class="ui attached log" id="log{{.VersionName}}" style="height: 300px !important; overflow: auto;"> | |||
| <input type="hidden" name="end_line" value> | |||
| <input type="hidden" name="start_line" value> | |||
| <div class="ui attached log" id="log{{.VersionName}}" | |||
| style="height: 300px !important; overflow: auto;"> | |||
| <input type="hidden" name="end_line" value> | |||
| <input type="hidden" name="start_line" value> | |||
| <pre id="log_file{{.VersionName}}"></pre> | |||
| </div> | |||
| @@ -435,19 +566,20 @@ td, th { | |||
| {{template "base/footer" .}} | |||
| <script> | |||
| console.log({{.version_list_task }}) | |||
| $('.menu .item').tab() | |||
| $(document).ready(function(){ | |||
| $('.ui.accordion').accordion({selector:{trigger:'.icon'}}); | |||
| $(document).ready(function () { | |||
| $('.ui.accordion').accordion({ selector: { trigger: '.icon' } }); | |||
| }); | |||
| $(document).ready(function(){ | |||
| $(document).ready(function () { | |||
| $('.secondary.menu .item').tab(); | |||
| }); | |||
| let userName | |||
| let repoPath | |||
| let jobName | |||
| $(document).ready(function(){ | |||
| $(document).ready(function () { | |||
| let url = window.location.href; | |||
| let urlArr = url.split('/') | |||
| userName = urlArr.slice(-5)[0] | |||
| @@ -455,17 +587,17 @@ td, th { | |||
| jobName = urlArr.slice(-1)[0] | |||
| }) | |||
| function loadLog(version_name){ | |||
| function loadLog(version_name) { | |||
| document.getElementById("mask").style.display = "block" | |||
| $.get(`/api/v1/repos/${userName}/${repoPath}/cloudbrain/${jobName}/log?version_name=${version_name}&lines=50&order=asc`, (data) => { | |||
| $('input[name=end_line]').val(data.EndLine) | |||
| $('input[name=start_line]').val(data.StartLine) | |||
| $(`#log_file${version_name}`).text(data.Content) | |||
| document.getElementById("mask").style.display = "none" | |||
| }).fail(function(err) { | |||
| }).fail(function (err) { | |||
| console.log(err); | |||
| document.getElementById("mask").style.display = "none" | |||
| }); | |||
| } | |||
| </script> | |||
| </script> | |||
| @@ -156,12 +156,6 @@ | |||
| <label>{{.i18n.Tr "cloudbrain.task_type"}}</label> | |||
| <select id="cloudbrain_job_type" class="ui search dropdown" placeholder="select {{.i18n.Tr "cloudbrain.task_type"}}" style='width:385px' name="job_type"> | |||
| <option name="job_type" value="DEBUG">DEBUG</option> | |||
| {{if .is_snn4imagenet_enabled}} | |||
| <option name="job_type" value="SNN4IMAGENET">SNN4IMAGENET</option> | |||
| {{end}} | |||
| {{if .is_brainscore_enabled}} | |||
| <option name="job_type" value="BRAINSCORE">BRAINSCORE</option> | |||
| {{end}} | |||
| </select> | |||
| </div> | |||
| @@ -12,7 +12,11 @@ | |||
| <!-- 提示框 --> | |||
| <div class="alert"></div> | |||
| <div class="explore users"> | |||
| <div class="cloudbrain_debug" style="display: none;" data-debug="{{$.i18n.Tr "repo.debug"}}" data-debug-again="{{$.i18n.Tr "repo.debug_again"}}"></div> | |||
| <div class="cloudbrain_debug" style="display: none;" data-debug="{{$.i18n.Tr "repo.debug"}}" 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-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"}}"></div> | |||
| {{template "admin/cloudbrain/search_dashboard" .}} | |||
| <div class="ui container" style="width: 80%;"> | |||
| {{template "base/alert" .}} | |||
| @@ -94,7 +98,7 @@ | |||
| {{$JobType := $.i18n.Tr (printf "cloudbrain.%s" .JobType)}} | |||
| <div class="one wide column text center nowrap" style="width:10%"> | |||
| <span style="font-size: 12px;" title="{{$JobType}}">{{$JobType}}</span> | |||
| <span style="font-size: 12px;" title="{{.JobType}}">{{$JobType}}</span> | |||
| </div> | |||
| <!-- 任务创建时间 --> | |||
| <div class="two wide column text center nowrap" style="width: 11% !important;"> | |||
| @@ -115,7 +119,7 @@ | |||
| </div> | |||
| <div class="three wide column text center nowrap" style="width: 21.5%!important;"> | |||
| {{if eq .JobType "DEBUG" "SNN4IMAGENET" "BRAINSCORE"}} | |||
| {{if eq .JobType "DEBUG"}} | |||
| <div class="ui compact buttons"> | |||
| <form id="debugAgainForm-{{$JobID}}"> | |||
| {{$.CsrfTokenHtml}} | |||
| @@ -146,6 +150,14 @@ | |||
| </a> | |||
| {{end}} | |||
| </div> | |||
| {{if eq .JobType "BENCHMARK"}} | |||
| <div class="ui compact buttons"> | |||
| <a class="ui basic button {{if $.IsSigned}} blue{{else}} disabled{{end}}" href="{{$.RepoLink}}/cloudbrain/{{.Cloudbrain.ID}}/rate" target="_blank"> | |||
| {{$.i18n.Tr "repo.score"}} | |||
| </a> | |||
| </div> | |||
| {{end}} | |||
| <!-- 删除任务 --> | |||
| <form class="ui compact buttons" id="delForm-{{$JobID}}" action='{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}{{if eq .JobType "BENCHMARK"}}/cloudbrain/benchmark{{else if or (eq .JobType "SNN4IMAGENET") (eq .JobType "BRAINSCORE")}}/cloudbrain{{else if eq .JobType "DEBUG"}}{{if eq .ComputeResource "NPU"}}/modelarts/notebook{{else}}/cloudbrain{{end}}{{else if eq .JobType "TRAIN"}}{{if eq .ComputeResource "NPU"}}/modelarts/train-job{{else}}/cloudbrain/train-job{{end}}{{end}}/{{$JobID}}/del?ishomepage=true' method="post"> | |||
| {{$.CsrfTokenHtml}} | |||
| @@ -195,7 +207,7 @@ | |||
| <!-- 任务类型 --> | |||
| {{$JobType := $.i18n.Tr (printf "cloudbrain.%s" .JobType)}} | |||
| <div class="one wide column text center nowrap" style="width:10%"> | |||
| <span style="font-size: 12px;" title="{{$JobType}}">{{$JobType}}</span> | |||
| <span style="font-size: 12px;" title="{{.JobType}}">{{$JobType}}</span> | |||
| </div> | |||
| <!-- 任务创建时间 --> | |||
| <div class="two wide column text center nowrap" style="width: 11% !important;"> | |||
| @@ -291,38 +303,4 @@ | |||
| </div> | |||
| </div> | |||
| </div> | |||
| {{template "base/footer" .}} | |||
| <script> | |||
| function getParams(){ | |||
| const params = new URLSearchParams(window.location.search) | |||
| params.get('jobType') | |||
| let jobType | |||
| if(!params.get('jobType')){ | |||
| jobType = '{{.i18n.Tr "admin.cloudbrain.all_task_types"}}' | |||
| }else{ | |||
| if(params.get('jobType') === 'DEBUG'){ | |||
| jobType = '{{$.i18n.Tr (printf "cloudbrain.DEBUG")}}' | |||
| }else if(params.get('jobType') === 'TRAIN'){ | |||
| jobType = '{{$.i18n.Tr (printf "cloudbrain.TRAIN")}}' | |||
| } | |||
| else if(params.get('jobType') === 'INFERENCE'){ | |||
| jobType = '{{$.i18n.Tr (printf "cloudbrain.INFERENCE")}}' | |||
| } | |||
| else if(params.get('jobType') === 'SNN4IMAGENET'){ | |||
| jobType = '{{$.i18n.Tr (printf "cloudbrain.SNN4IMAGENET")}}' | |||
| }else if(params.get('jobType') === 'BENCHMARK'){ | |||
| jobType = '{{$.i18n.Tr (printf "cloudbrain.BENCHMARK")}}' | |||
| } | |||
| else{ | |||
| jobType = '{{$.i18n.Tr (printf "cloudbrain.BRAINSCORE")}}' | |||
| } | |||
| } | |||
| let listType = !params.get('listType')? '{{.i18n.Tr "admin.cloudbrain.all_computing_resources"}}' : params.get('listType') | |||
| let jobStatus = !params.get('jobStatus')? '{{.i18n.Tr "admin.cloudbrain.all_status"}}' : params.get('jobStatus').toUpperCase() | |||
| const dropdownValueArray = [jobType,listType,jobStatus] | |||
| $('#adminCloud .default.text ').each(function(index,e){ | |||
| $(e).text(dropdownValueArray[index]) | |||
| }) | |||
| } | |||
| getParams() | |||
| </script> | |||
| {{template "base/footer" .}} | |||
| @@ -77,9 +77,11 @@ | |||
| align="center" | |||
| > | |||
| <template slot-scope="scope"> | |||
| <a :href="'/' + scope.row.userName" :title="scope.row.userName"> | |||
| <a v-if="scope.row.userName||scope.row.relAvatarLink" :href="'/' + scope.row.userName" :title="scope.row.userName"> | |||
| <img :src="scope.row.relAvatarLink" class="ui avatar image"> | |||
| </a> | |||
| <a v-else><img class="ui avatar image" title="Ghost" src="/user/avatar/ghost/-1"></a> | |||
| </template> | |||
| </el-table-column> | |||
| <el-table-column | |||
| @@ -1,395 +1,387 @@ | |||
| <template> | |||
| <div > | |||
| <div class="ui container" style="width: 80%;"> | |||
| <div class="ui grid"> | |||
| <div class="row" style="border: 1px solid #d4d4d5;margin-top: 15px;padding-top: 0;"> | |||
| <div class="ui attached segment"> | |||
| <div class="ui form ignore-dirty"> | |||
| <div class="ui fluid action input"> | |||
| <input type="text" placeholder="搜镜像Tag/描述/标签..." v-model="search" @keyup.enter="searchName()"> | |||
| <button class="ui blue button" @click="searchName()">搜索</button> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <div> | |||
| <div class="ui container" style="width: 80%;"> | |||
| <div class="ui grid"> | |||
| <div class="row" style="border: 1px solid #d4d4d5;margin-top: 15px;padding-top: 0;"> | |||
| <div class="ui ten wide column" style="margin: 1rem 0;"> | |||
| <el-checkbox v-model="checked" style="padding: 0.5rem 1rem;">仅显示平台推荐</el-checkbox> | |||
| <el-dropdown @command="handleCommand" trigger="click" style="border: 1px solid rgba(34,36,38,.15);border-radius: 4px;padding: 0.5rem 1rem;"> | |||
| <span class="el-dropdown-link"> | |||
| {{dropdownPrivate}}<i class="el-icon-caret-bottom el-icon--right"></i> | |||
| </span> | |||
| <el-dropdown-menu slot="dropdown"> | |||
| <el-dropdown-item :command="{label:'全部',private:''}">全部</el-dropdown-item> | |||
| <el-dropdown-item :command="{label:'公开',private:false}">公开</el-dropdown-item> | |||
| <el-dropdown-item :command="{label:'私有',private:true}">私有</el-dropdown-item> | |||
| </el-dropdown-menu> | |||
| </el-dropdown> | |||
| </div> | |||
| <div class="ui six wide column right aligned" style="margin: 1rem 0;"> | |||
| <a class="ui blue small button" href="/admin/images/commit_image">创建云脑镜像</a> | |||
| </div> | |||
| <div class="ui sixteen wide column" style="padding: 0;"> | |||
| <el-table | |||
| :data="tableDataCustom" | |||
| style="width: 100%" | |||
| :header-cell-style="tableHeaderStyle" | |||
| > | |||
| <el-table-column | |||
| label="镜像Tag" | |||
| min-width="19%" | |||
| align="left" | |||
| prop="tag" | |||
| > | |||
| <template slot-scope="scope"> | |||
| <div style="display: flex;align-items: center;"> | |||
| <a class="text-over image_title" :title="scope.row.tag">{{ scope.row.tag }}</a> | |||
| <i class="ri-lock-2-line" style="color: #fa8c16;padding: 0 1rem;" v-if="scope.row.isPrivate"></i> | |||
| <img v-if="scope.row.type==5" src="/img/jian.svg" style="margin-left: 0.5rem;"> | |||
| </div> | |||
| </template> | |||
| </el-table-column> | |||
| <el-table-column | |||
| label="镜像描述" | |||
| min-width="28%" | |||
| align="left" | |||
| prop="description" | |||
| > | |||
| <template slot-scope="scope"> | |||
| <div class="image_desc" :title="scope.row.description">{{ scope.row.description}}</div> | |||
| <div v-if="!!scope.row.topics"> | |||
| <span v-for="(topic,index) in scope.row.topics" class="ui repo-topic label topic" style="cursor: default;">{{topic}}</span> | |||
| <div class="ui attached segment"> | |||
| <div class="ui form ignore-dirty"> | |||
| <div class="ui fluid action input"> | |||
| <input type="text" placeholder="搜镜像Tag/描述/标签..." v-model="search" | |||
| @keyup.enter="searchName()"> | |||
| <button class="ui blue button" @click="searchName()">搜索</button> | |||
| </div> | |||
| </template> | |||
| </el-table-column> | |||
| <el-table-column | |||
| prop="cloudbrainType" | |||
| label="可用集群" | |||
| min-width="10%" | |||
| align="center" | |||
| > | |||
| <template slot-scope="scope"> | |||
| {{scope.row.cloudbrainType | transformType}} | |||
| </template> | |||
| </el-table-column> | |||
| <el-table-column | |||
| prop="isPrivate" | |||
| label="状态" | |||
| min-width="8%" | |||
| align="center" | |||
| > | |||
| <template slot-scope="scope"> | |||
| <span v-if="scope.row.isPrivate" style="color: rgb(250, 140, 22);">私有</span> | |||
| <span v-else style="color: rgb(19, 194, 141);">公开</span> | |||
| </template> | |||
| </el-table-column> | |||
| <el-table-column | |||
| prop="creator" | |||
| label="创建者" | |||
| min-width="7%" | |||
| align="center" | |||
| > | |||
| <template slot-scope="scope"> | |||
| <a :href="'/' + scope.row.userName" :title="scope.row.userName"> | |||
| <img :src="scope.row.relAvatarLink" class="ui avatar image"> | |||
| </a> | |||
| </template> | |||
| </el-table-column> | |||
| <el-table-column | |||
| prop="createdUnix" | |||
| label="创建时间" | |||
| align="center" | |||
| min-width="13%" | |||
| > | |||
| <template slot-scope="scope"> | |||
| {{scope.row.createdUnix | transformTimestamp}} | |||
| </template> | |||
| </el-table-column> | |||
| <el-table-column | |||
| align="center" | |||
| min-width="23%" | |||
| label="操作" | |||
| > | |||
| <template slot-scope="scope"> | |||
| <div style="display: flex;justify-content: flex-end;align-items: center;"> | |||
| <div style="display: flex;align-items: center;cursor: default;;padding: 0 1rem;"> | |||
| <svg width="1.4em" height="1.4em" viewBox="0 0 32 32" class="heart-stroke"><path d="M4.4 6.54c-1.761 1.643-2.6 3.793-2.36 6.056.24 2.263 1.507 4.521 3.663 6.534a29110.9 29110.9 0 0010.296 9.633l10.297-9.633c2.157-2.013 3.424-4.273 3.664-6.536.24-2.264-.599-4.412-2.36-6.056-1.73-1.613-3.84-2.29-6.097-1.955-1.689.25-3.454 1.078-5.105 2.394l-.4.319-.398-.319c-1.649-1.316-3.414-2.143-5.105-2.394a7.612 7.612 0 00-1.113-.081c-1.838 0-3.541.694-4.983 2.038z"></path></svg> | |||
| <span style="line-height: 2;margin-left:0.3rem;">{{scope.row.numStars}}</span> | |||
| </div> | |||
| </div> | |||
| <div class="ui ten wide column" style="margin: 1rem 0;"> | |||
| <el-checkbox v-model="checked" style="padding: 0.5rem 1rem;">仅显示平台推荐</el-checkbox> | |||
| <el-dropdown @command="handleCommand" trigger="click" | |||
| style="border: 1px solid rgba(34,36,38,.15);border-radius: 4px;padding: 0.5rem 1rem;"> | |||
| <span class="el-dropdown-link"> | |||
| {{dropdownPrivate}}<i class="el-icon-caret-bottom el-icon--right"></i> | |||
| </span> | |||
| <el-dropdown-menu slot="dropdown"> | |||
| <el-dropdown-item :command="{label:'全部',private:''}">全部</el-dropdown-item> | |||
| <el-dropdown-item :command="{label:'公开',private:false}">公开</el-dropdown-item> | |||
| <el-dropdown-item :command="{label:'私有',private:true}">私有</el-dropdown-item> | |||
| </el-dropdown-menu> | |||
| </el-dropdown> | |||
| </div> | |||
| <div class="ui six wide column right aligned" style="margin: 1rem 0;"> | |||
| <a class="ui blue small button" href="/admin/images/commit_image">创建云脑镜像</a> | |||
| </div> | |||
| <div class="ui sixteen wide column" style="padding: 0;"> | |||
| <el-table :data="tableDataCustom" style="width: 100%" :header-cell-style="tableHeaderStyle"> | |||
| <el-table-column label="镜像Tag" min-width="19%" align="left" prop="tag"> | |||
| <template slot-scope="scope"> | |||
| <div style="display: flex;align-items: center;"> | |||
| <a class="text-over image_title" :title="scope.row.tag">{{ scope.row.tag }}</a> | |||
| <i class="ri-lock-2-line" style="color: #fa8c16;padding: 0 1rem;" | |||
| v-if="scope.row.isPrivate"></i> | |||
| <img v-if="scope.row.type==5" src="/img/jian.svg" style="margin-left: 0.5rem;"> | |||
| </div> | |||
| <span style="padding: 0 1rem;color: rgb(250, 140, 22);cursor:pointer;" v-if="scope.row.type==5" @click="unSetRecommend(scope.$index,scope.row.id)">取消推荐</span> | |||
| <span style="padding: 0 1rem;color: rgb(19, 194, 141);cursor:pointer;" v-if="scope.row.type!==5 && !scope.row.isPrivate" @click="setRecommend(scope.$index,scope.row.id)">设为推荐</span> | |||
| <span style="padding: 0 1rem;color:#0366d6;cursor:pointer;" @click="copyUrl(scope.row.place)">复制地址</span> | |||
| <div style="padding-left:1rem;cursor:pointer;"> | |||
| <el-dropdown size="medium"> | |||
| <span class="el-dropdown-link"> | |||
| 更多<i class="el-icon-arrow-down el-icon--right"></i> | |||
| </span> | |||
| <el-dropdown-menu slot="dropdown"> | |||
| <el-dropdown-item @click.native="eidtImage(scope.row.id)">编辑</el-dropdown-item> | |||
| <el-dropdown-item style="color: red;" @click.native="deleteImage(scope.row.id)">删除</el-dropdown-item> | |||
| </el-dropdown-menu> | |||
| </el-dropdown> | |||
| </template> | |||
| </el-table-column> | |||
| <el-table-column label="镜像描述" min-width="28%" align="left" prop="description"> | |||
| <template slot-scope="scope"> | |||
| <div class="image_desc" :title="scope.row.description">{{ scope.row.description}} | |||
| </div> | |||
| </div> | |||
| </template> | |||
| </el-table-column> | |||
| </el-table> | |||
| </div> | |||
| <div class="ui container" style="padding:2rem 0;text-align:center"> | |||
| <el-pagination | |||
| background | |||
| @size-change="handleSizeChangeCustom" | |||
| @current-change="handleCurrentChangeCustom" | |||
| :current-page="currentPageCustom" | |||
| :page-size="pageSizeCustom" | |||
| :page-sizes="[5,15,20]" | |||
| layout="total, sizes, prev, pager, next, jumper" | |||
| :total="totalNumCustom"> | |||
| </el-pagination> | |||
| <div v-if="!!scope.row.topics"> | |||
| <span v-for="(topic,index) in scope.row.topics" | |||
| class="ui repo-topic label topic" style="cursor: default;">{{topic}}</span> | |||
| </div> | |||
| </template> | |||
| </el-table-column> | |||
| <el-table-column prop="cloudbrainType" label="可用集群" min-width="10%" align="center"> | |||
| <template slot-scope="scope"> | |||
| {{scope.row.cloudbrainType | transformType}} | |||
| </template> | |||
| </el-table-column> | |||
| <el-table-column prop="isPrivate" label="状态" min-width="8%" align="center"> | |||
| <template slot-scope="scope"> | |||
| <span v-if="scope.row.isPrivate" style="color: rgb(250, 140, 22);">私有</span> | |||
| <span v-else style="color: rgb(19, 194, 141);">公开</span> | |||
| </template> | |||
| </el-table-column> | |||
| <el-table-column prop="creator" label="创建者" min-width="7%" align="center"> | |||
| <template slot-scope="scope"> | |||
| <a v-if="scope.row.userName||scope.row.relAvatarLink" | |||
| :href="'/' + scope.row.userName" :title="scope.row.userName"> | |||
| <img :src="scope.row.relAvatarLink" class="ui avatar image"> | |||
| </a> | |||
| <a v-else> | |||
| <img class="ui avatar image" title="Ghost" src="/user/avatar/ghost/-1"> | |||
| </a> | |||
| </template> | |||
| </el-table-column> | |||
| <el-table-column prop="createdUnix" label="创建时间" align="center" min-width="13%"> | |||
| <template slot-scope="scope"> | |||
| {{scope.row.createdUnix | transformTimestamp}} | |||
| </template> | |||
| </el-table-column> | |||
| <el-table-column align="center" min-width="23%" label="操作"> | |||
| <template slot-scope="scope"> | |||
| <div style="display: flex;justify-content: flex-end;align-items: center;"> | |||
| <div | |||
| style="display: flex;align-items: center;cursor: default;;padding: 0 1rem;"> | |||
| <svg width="1.4em" height="1.4em" viewBox="0 0 32 32" class="heart-stroke"> | |||
| <path | |||
| d="M4.4 6.54c-1.761 1.643-2.6 3.793-2.36 6.056.24 2.263 1.507 4.521 3.663 6.534a29110.9 29110.9 0 0010.296 9.633l10.297-9.633c2.157-2.013 3.424-4.273 3.664-6.536.24-2.264-.599-4.412-2.36-6.056-1.73-1.613-3.84-2.29-6.097-1.955-1.689.25-3.454 1.078-5.105 2.394l-.4.319-.398-.319c-1.649-1.316-3.414-2.143-5.105-2.394a7.612 7.612 0 00-1.113-.081c-1.838 0-3.541.694-4.983 2.038z"> | |||
| </path> | |||
| </svg> | |||
| <span | |||
| style="line-height: 2;margin-left:0.3rem;">{{scope.row.numStars}}</span> | |||
| </div> | |||
| <span style="padding: 0 1rem;color: rgb(250, 140, 22);cursor:pointer;" | |||
| v-if="scope.row.type==5" | |||
| @click="unSetRecommend(scope.$index,scope.row.id)">取消推荐</span> | |||
| <span style="padding: 0 1rem;color: rgb(19, 194, 141);cursor:pointer;" | |||
| v-if="scope.row.type!==5 && !scope.row.isPrivate" | |||
| @click="setRecommend(scope.$index,scope.row.id)">设为推荐</span> | |||
| <span style="padding: 0 1rem;color:#0366d6;cursor:pointer;" | |||
| @click="copyUrl(scope.row.place)">复制地址</span> | |||
| <div style="padding-left:1rem;cursor:pointer;"> | |||
| <el-dropdown size="medium"> | |||
| <span class="el-dropdown-link"> | |||
| 更多<i class="el-icon-arrow-down el-icon--right"></i> | |||
| </span> | |||
| <el-dropdown-menu slot="dropdown"> | |||
| <el-dropdown-item @click.native="eidtImage(scope.row.id)">编辑 | |||
| </el-dropdown-item> | |||
| <el-dropdown-item style="color: red;" | |||
| @click.native="deleteImage(scope.row.id)">删除</el-dropdown-item> | |||
| </el-dropdown-menu> | |||
| </el-dropdown> | |||
| </div> | |||
| </div> | |||
| </template> | |||
| </el-table-column> | |||
| </el-table> | |||
| </div> | |||
| <div class="ui container" style="padding:2rem 0;text-align:center"> | |||
| <el-pagination background @size-change="handleSizeChangeCustom" | |||
| @current-change="handleCurrentChangeCustom" :current-page="currentPageCustom" | |||
| :page-size="pageSizeCustom" :page-sizes="[5,15,20]" | |||
| layout="total, sizes, prev, pager, next, jumper" :total="totalNumCustom"> | |||
| </el-pagination> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| </template> | |||
| <script> | |||
| const {_AppSubUrl, _StaticUrlPrefix, csrf} = window.config; | |||
| const { _AppSubUrl, _StaticUrlPrefix, csrf } = window.config; | |||
| export default { | |||
| components: { | |||
| }, | |||
| data() { | |||
| return { | |||
| search:'', | |||
| dropdownPrivate:'全部', | |||
| checked:false, | |||
| currentPageCustom:1, | |||
| pageSizeCustom:15, | |||
| totalNumCustom:0, | |||
| paramsCustom:{page:1,pageSize:15,q:'',recommend:false}, | |||
| tableDataCustom: [], | |||
| starCustom:[], | |||
| loadingCustom:false, | |||
| }; | |||
| }, | |||
| methods: { | |||
| tableHeaderStyle({row,column,rowIndex,columnIndex}){ | |||
| if(rowIndex===0){ | |||
| return 'background:#f5f5f6;color:#606266' | |||
| } | |||
| }, | |||
| handleSizeChangeCustom(val){ | |||
| this.paramsCustom.pageSize = val | |||
| this.getImageListCustom() | |||
| }, | |||
| handleCurrentChangeCustom(val){ | |||
| this.paramsCustom.page = val | |||
| this.getImageListCustom() | |||
| }, | |||
| getImageListCustom(){ | |||
| this.loadingCustom = true | |||
| this.$axios.get('/admin/images/data',{ | |||
| params:this.paramsCustom | |||
| }).then((res)=>{ | |||
| this.totalNumCustom = res.data.count | |||
| this.tableDataCustom = res.data.images | |||
| this.tableDataCustom.forEach(element => { | |||
| this.starCustom.push({id:element.id,}) | |||
| }); | |||
| this.loadingCustom = false | |||
| }) | |||
| }, | |||
| deleteImage(id){ | |||
| let flag=1 | |||
| let _this = this | |||
| $('.ui.basic.modal.images') | |||
| .modal({ | |||
| onDeny: function() { | |||
| flag = false | |||
| export default { | |||
| components: { | |||
| }, | |||
| data() { | |||
| return { | |||
| search: '', | |||
| dropdownPrivate: '全部', | |||
| checked: false, | |||
| currentPageCustom: 1, | |||
| pageSizeCustom: 15, | |||
| totalNumCustom: 0, | |||
| paramsCustom: { page: 1, pageSize: 15, q: '', recommend: false }, | |||
| tableDataCustom: [], | |||
| starCustom: [], | |||
| loadingCustom: false, | |||
| }; | |||
| }, | |||
| methods: { | |||
| tableHeaderStyle({ row, column, rowIndex, columnIndex }) { | |||
| if (rowIndex === 0) { | |||
| return 'background:#f5f5f6;color:#606266' | |||
| } | |||
| }, | |||
| handleSizeChangeCustom(val) { | |||
| this.paramsCustom.pageSize = val | |||
| this.getImageListCustom() | |||
| }, | |||
| onApprove: function() { | |||
| _this.$axios.delete('/image/'+id).then((res)=>{ | |||
| _this.getImageListCustom() | |||
| handleCurrentChangeCustom(val) { | |||
| this.paramsCustom.page = val | |||
| this.getImageListCustom() | |||
| }, | |||
| getImageListCustom() { | |||
| this.loadingCustom = true | |||
| this.$axios.get('/admin/images/data', { | |||
| params: this.paramsCustom | |||
| }).then((res) => { | |||
| this.totalNumCustom = res.data.count | |||
| this.tableDataCustom = res.data.images | |||
| this.tableDataCustom.forEach(element => { | |||
| this.starCustom.push({ id: element.id, }) | |||
| }); | |||
| this.loadingCustom = false | |||
| }) | |||
| flag = true | |||
| }, | |||
| onHidden: function() { | |||
| if (flag == false) { | |||
| $('.alert').html('您已取消操作').removeClass('alert-success').addClass('alert-danger').show().delay(1500).fadeOut(); | |||
| }else{ | |||
| $('.alert').html('删除成功').removeClass('alert-danger').addClass('alert-success').show().delay(1500).fadeOut(); | |||
| deleteImage(id) { | |||
| let flag = 1 | |||
| let _this = this | |||
| $('.ui.basic.modal.images') | |||
| .modal({ | |||
| onDeny: function () { | |||
| flag = false | |||
| }, | |||
| onApprove: function () { | |||
| _this.$axios.delete('/image/' + id).then((res) => { | |||
| _this.getImageListCustom() | |||
| }) | |||
| flag = true | |||
| }, | |||
| onHidden: function () { | |||
| if (flag == false) { | |||
| $('.alert').html('您已取消操作').removeClass('alert-success').addClass('alert-danger').show().delay(1500).fadeOut(); | |||
| } else { | |||
| $('.alert').html('删除成功').removeClass('alert-danger').addClass('alert-success').show().delay(1500).fadeOut(); | |||
| } | |||
| } | |||
| }) | |||
| .modal('show') | |||
| }, | |||
| eidtImage(id) { | |||
| location.href = `/image/${id}/imageAdmin` | |||
| }, | |||
| imageStar(index, id, isStar) { | |||
| if (isStar) { | |||
| this.$axios.put(`/image/${id}/action/unstar`).then((res) => { | |||
| this.tableDataPublic[index].numStars = this.tableDataPublic[index].numStars - 1 | |||
| this.tableDataPublic[index].isStar = false | |||
| }) | |||
| } else { | |||
| this.$axios.put(`/image/${id}/action/star`).then((res) => { | |||
| this.tableDataPublic[index].numStars = this.tableDataPublic[index].numStars + 1 | |||
| this.tableDataPublic[index].isStar = true | |||
| }) | |||
| } | |||
| } | |||
| }) | |||
| .modal('show') | |||
| }, | |||
| eidtImage(id){ | |||
| location.href = `/image/${id}/imageAdmin` | |||
| }, | |||
| imageStar(index,id,isStar){ | |||
| if(isStar){ | |||
| this.$axios.put(`/image/${id}/action/unstar`).then((res)=>{ | |||
| this.tableDataPublic[index].numStars = this.tableDataPublic[index].numStars - 1 | |||
| this.tableDataPublic[index].isStar = false | |||
| }) | |||
| }else{ | |||
| this.$axios.put(`/image/${id}/action/star`).then((res)=>{ | |||
| this.tableDataPublic[index].numStars = this.tableDataPublic[index].numStars + 1 | |||
| this.tableDataPublic[index].isStar = true | |||
| }) | |||
| } | |||
| }, | |||
| copyUrl(url){ | |||
| const cInput = document.createElement('input') | |||
| cInput.value = url | |||
| document.body.appendChild(cInput) | |||
| cInput.select() | |||
| document.execCommand('Copy') | |||
| cInput.remove() | |||
| }, | |||
| searchName(){ | |||
| this.paramsCustom.q = this.search | |||
| this.paramsCustom.page = 1 | |||
| this.getImageListCustom() | |||
| }, | |||
| setRecommend(index,id){ | |||
| this.$axios.put(`/admin/image/${id}/action/recommend`).then((res)=>{ | |||
| this.tableDataCustom[index].type = 5 | |||
| }) | |||
| }, | |||
| unSetRecommend(index,id){ | |||
| this.$axios.put(`/admin/image/${id}/action/unrecommend`).then((res)=>{ | |||
| this.tableDataCustom[index].type = 0 | |||
| }) | |||
| }, | |||
| handleCommand(command){ | |||
| this.dropdownPrivate = command.label | |||
| this.paramsCustom.private = command.private | |||
| this.getImageListCustom() | |||
| } | |||
| }, | |||
| filters:{ | |||
| transformType(val){ | |||
| if(val==0){ | |||
| return "GPU" | |||
| } | |||
| }, | |||
| transformPravite(val){ | |||
| if(val){ | |||
| return "私有" | |||
| }else{ | |||
| return "公开" | |||
| } | |||
| }, | |||
| transformTimestamp(timestamp){ | |||
| }, | |||
| copyUrl(url) { | |||
| const cInput = document.createElement('input') | |||
| cInput.value = url | |||
| document.body.appendChild(cInput) | |||
| cInput.select() | |||
| document.execCommand('Copy') | |||
| cInput.remove() | |||
| }, | |||
| searchName() { | |||
| this.paramsCustom.q = this.search | |||
| this.paramsCustom.page = 1 | |||
| this.getImageListCustom() | |||
| }, | |||
| setRecommend(index, id) { | |||
| this.$axios.put(`/admin/image/${id}/action/recommend`).then((res) => { | |||
| this.tableDataCustom[index].type = 5 | |||
| }) | |||
| }, | |||
| unSetRecommend(index, id) { | |||
| this.$axios.put(`/admin/image/${id}/action/unrecommend`).then((res) => { | |||
| this.tableDataCustom[index].type = 0 | |||
| }) | |||
| }, | |||
| handleCommand(command) { | |||
| this.dropdownPrivate = command.label | |||
| this.paramsCustom.private = command.private | |||
| this.getImageListCustom() | |||
| } | |||
| }, | |||
| filters: { | |||
| transformType(val) { | |||
| if (val == 0) { | |||
| return "GPU" | |||
| } | |||
| }, | |||
| transformPravite(val) { | |||
| if (val) { | |||
| return "私有" | |||
| } else { | |||
| return "公开" | |||
| } | |||
| }, | |||
| transformTimestamp(timestamp) { | |||
| const date = new Date(parseInt(timestamp) * 1000); | |||
| const Y = date.getFullYear() + '-'; | |||
| const M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'; | |||
| const D = (date.getDate() < 10 ? '0'+date.getDate() : date.getDate()) + ' '; | |||
| const h = (date.getHours() < 10 ? '0'+date.getHours() : date.getHours()) + ':'; | |||
| const m = (date.getMinutes() <10 ? '0'+date.getMinutes() : date.getMinutes()) + ':' ; | |||
| const s = (date.getSeconds() <10 ? '0'+date.getSeconds() : date.getSeconds()) ; // 秒 | |||
| const D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + ' '; | |||
| const h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':'; | |||
| const m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':'; | |||
| const s = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()); // 秒 | |||
| const dateString = Y + M + D + h + m + s; | |||
| return dateString; | |||
| }, | |||
| }, | |||
| watch:{ | |||
| checked(val){ | |||
| this.paramsCustom.page = 1 | |||
| this.paramsCustom.recommend = val | |||
| this.getImageListCustom() | |||
| } | |||
| }, | |||
| watch: { | |||
| checked(val) { | |||
| this.paramsCustom.page = 1 | |||
| this.paramsCustom.recommend = val | |||
| this.getImageListCustom() | |||
| } | |||
| }, | |||
| mounted() { | |||
| this.getImageListCustom() | |||
| }, | |||
| created() { | |||
| } | |||
| }, | |||
| mounted() { | |||
| this.getImageListCustom() | |||
| }, | |||
| created() { | |||
| }; | |||
| } | |||
| }; | |||
| </script> | |||
| <style scoped> | |||
| .header-wrapper { | |||
| background-color: #f5f5f6; | |||
| padding-top: 15px; | |||
| } | |||
| .image_text{ | |||
| padding:25px 0 55px 0 ; | |||
| } | |||
| #header{ | |||
| position: relative; | |||
| top:-40px; | |||
| } | |||
| .el-dropdown-menu__item--divided{ | |||
| border-top: 1px solid blue; | |||
| } | |||
| .el-table thead{ | |||
| background-color: #f5f5f6; | |||
| } | |||
| /deep/ .el-tabs__item:hover{ | |||
| color: #000; | |||
| font-weight: 500; | |||
| } | |||
| /deep/ .el-tabs__item.is-active { | |||
| color: #000; | |||
| font-weight: 500; | |||
| } | |||
| /deep/ .el-tabs__active-bar{ | |||
| background-color:#000 | |||
| } | |||
| #success{ | |||
| background-color: #5bb973; | |||
| color: white; | |||
| } | |||
| .text-over{ | |||
| overflow: hidden; | |||
| text-overflow: ellipsis; | |||
| vertical-align: middle; | |||
| white-space: nowrap; | |||
| } | |||
| .image_title{ | |||
| display: inline-block; | |||
| cursor: default; | |||
| color: rgb(66, 98, 144); | |||
| } | |||
| .image_desc{ | |||
| -webkit-line-clamp: 2; | |||
| -webkit-box-orient: vertical; | |||
| display: -webkit-box; | |||
| text-overflow: ellipsis; | |||
| overflow: hidden; | |||
| } | |||
| .heart-stroke{ | |||
| stroke: #FA8C16; | |||
| stroke-width: 2; | |||
| fill: #fff | |||
| } | |||
| .stars_active{ | |||
| fill: #FA8C16 !important; | |||
| stroke:#FA8C16 !important | |||
| } | |||
| .header-new-drop{ | |||
| width: 100%; | |||
| } | |||
| </style> | |||
| .header-wrapper { | |||
| background-color: #f5f5f6; | |||
| padding-top: 15px; | |||
| } | |||
| .image_text { | |||
| padding: 25px 0 55px 0; | |||
| } | |||
| #header { | |||
| position: relative; | |||
| top: -40px; | |||
| } | |||
| .el-dropdown-menu__item--divided { | |||
| border-top: 1px solid blue; | |||
| } | |||
| .el-table thead { | |||
| background-color: #f5f5f6; | |||
| } | |||
| /deep/ .el-tabs__item:hover { | |||
| color: #000; | |||
| font-weight: 500; | |||
| } | |||
| /deep/ .el-tabs__item.is-active { | |||
| color: #000; | |||
| font-weight: 500; | |||
| } | |||
| /deep/ .el-tabs__active-bar { | |||
| background-color: #000 | |||
| } | |||
| #success { | |||
| background-color: #5bb973; | |||
| color: white; | |||
| } | |||
| .text-over { | |||
| overflow: hidden; | |||
| text-overflow: ellipsis; | |||
| vertical-align: middle; | |||
| white-space: nowrap; | |||
| } | |||
| .image_title { | |||
| display: inline-block; | |||
| cursor: default; | |||
| color: rgb(66, 98, 144); | |||
| } | |||
| .image_desc { | |||
| -webkit-line-clamp: 2; | |||
| -webkit-box-orient: vertical; | |||
| display: -webkit-box; | |||
| text-overflow: ellipsis; | |||
| overflow: hidden; | |||
| } | |||
| .heart-stroke { | |||
| stroke: #FA8C16; | |||
| stroke-width: 2; | |||
| fill: #fff | |||
| } | |||
| .stars_active { | |||
| fill: #FA8C16 !important; | |||
| stroke: #FA8C16 !important | |||
| } | |||
| .header-new-drop { | |||
| width: 100%; | |||
| } | |||
| </style> | |||
| @@ -1,76 +1,87 @@ | |||
| <template> | |||
| <div class="inline required field" :class="{ 'unite': benchmarkNew, 'min_title': benchmarkNew}"> | |||
| <label v-if="benchmarkNew" style="font-weight: normal;">镜像</label> | |||
| <label v-else>镜像</label> | |||
| <span v-if="benchmarkNew"> </span> | |||
| <input v-if="benchmarkNew" type="text" name="image" :value="imageAddress" style="width: 48.5%;" placeholder="选择镜像或输入镜像地址"> | |||
| <input v-else type="text" name="image" :value="imageAddress" placeholder="选择镜像或输入镜像地址"> | |||
| <el-button type="text" @click="dialogVisible = true" icon="el-icon-plus" style="color: #0366d6;">选择镜像</el-button> | |||
| <el-dialog | |||
| title="选择镜像" | |||
| :visible.sync="dialogVisible" | |||
| width="50%" | |||
| > | |||
| <div class="ui icon input" style="z-index: 9999;position: absolute;right: 50px;height:30px;"> | |||
| <i class="search icon" style="cursor: pointer;pointer-events:auto"></i> | |||
| <input type="text" placeholder="搜镜像Tag/描述/标签..." v-model="search"> | |||
| </div> | |||
| <el-tabs v-model="activeName" @tab-click="handleClick"> | |||
| <div class="inline required field" :class="{ 'unite': benchmarkNew, 'min_title': benchmarkNew}"> | |||
| <label v-if="benchmarkNew" style="font-weight: normal;">镜像</label> | |||
| <label v-else>镜像</label> | |||
| <span v-if="benchmarkNew"> </span> | |||
| <input v-if="benchmarkNew" type="text" name="image" :value="imageAddress" style="width: 48.5%;" | |||
| placeholder="选择镜像或输入镜像地址"> | |||
| <input v-else type="text" name="image" :value="imageAddress" placeholder="选择镜像或输入镜像地址"> | |||
| <el-button type="text" @click="dialogVisible = true" icon="el-icon-plus" style="color: #0366d6;">选择镜像 | |||
| </el-button> | |||
| <el-dialog title="选择镜像" :visible.sync="dialogVisible" width="50%"> | |||
| <div class="ui icon input" style="z-index: 9999;position: absolute;right: 50px;height:30px;"> | |||
| <i class="search icon" style="cursor: pointer;pointer-events:auto"></i> | |||
| <input type="text" placeholder="搜镜像Tag/描述/标签..." v-model="search"> | |||
| </div> | |||
| <el-tabs v-model="activeName" @tab-click="handleClick"> | |||
| <el-tab-pane label="公开镜像" name="first" v-loading="loadingPublic"> | |||
| <div style="display: flex;align-items: center;justify-content: space-between;padding: 1rem 0;border-bottom:1px solid #F5F5F5" v-for="(publicData,index) in tableDataPublic" :key="index"> | |||
| <div style="display: flex;align-items: center;justify-content: space-between;padding: 1rem 0;border-bottom:1px solid #F5F5F5" | |||
| v-for="(publicData,index) in tableDataPublic" :key="index"> | |||
| <div style="width: 90%;"> | |||
| <div style="display: flex;align-items: center;justify-content: space-between;"> | |||
| <div style="display: flex;align-items: center;"> | |||
| <span class="panel_dataset_name text-over" style="margin-left: 0;">{{publicData.tag}} </span> | |||
| <img v-if="publicData.type==5" src="/img/jian.svg" style="margin-left: 0.5rem;"> | |||
| <span class="panel_dataset_name text-over" | |||
| style="margin-left: 0;">{{publicData.tag}} </span> | |||
| <img v-if="publicData.type==5" src="/img/jian.svg" style="margin-left: 0.5rem;"> | |||
| </div> | |||
| <div v-if="!!publicData.topics" class="text-over"> | |||
| <span v-for="(topic,index) in publicData.topics" class="ui repo-topic label topic">{{topic}}</span> | |||
| <span v-for="(topic,index) in publicData.topics" | |||
| class="ui repo-topic label topic">{{topic}}</span> | |||
| </div> | |||
| </div> | |||
| <div style="margin-top: 8px;display: flex;"> | |||
| <a :title="publicData.userName" style="cursor: default;"> | |||
| <img class="ui avatar mini image" style="width: 20px;height: 20px;" :src="publicData.relAvatarLink"> | |||
| <a v-if="publicData.relAvatarLink||publicData.userName" :title="publicData.userName" | |||
| style="cursor: default;"> | |||
| <img class="ui avatar mini image" style="width: 20px;height: 20px;" | |||
| :src="publicData.relAvatarLink"> | |||
| </a> | |||
| <a v-else><img class="ui avatar mini image" title="Ghost" src="/user/avatar/ghost/-1" | |||
| style="width: 20px;height: 20px;"></a> | |||
| <span class="panel_datset_desc">{{publicData.description}}</span> | |||
| </div> | |||
| </div> | |||
| <div> | |||
| <button class="ui primary basic button mini" @click.stop.prevent="selectImages(publicData.place,publicData.tag)">使用</button> | |||
| <button class="ui primary basic button mini" | |||
| @click.stop.prevent="selectImages(publicData.place,publicData.tag)">使用</button> | |||
| </div> | |||
| </div> | |||
| <div class="ui container" style="margin-top:50px;text-align:center"> | |||
| <el-pagination | |||
| background | |||
| @current-change="handleCurrentChangePublic" | |||
| :current-page="currentPagePublic" | |||
| :page-size="pageSizePublic" | |||
| layout="total, prev, pager, next" | |||
| :total="totalNumPublic"> | |||
| <el-pagination background @current-change="handleCurrentChangePublic" | |||
| :current-page="currentPagePublic" :page-size="pageSizePublic" | |||
| layout="total, prev, pager, next" :total="totalNumPublic"> | |||
| </el-pagination> | |||
| </div> | |||
| </el-tab-pane> | |||
| <el-tab-pane label="我的镜像" name="second" v-loading="loadingCustom"> | |||
| <div style="display: flex;align-items: center;justify-content: space-between;padding: 1rem 0;border-bottom:1px solid #F5F5F5" v-for="(customData,index) in tableDataCustom" :key="index"> | |||
| <div style="display: flex;align-items: center;justify-content: space-between;padding: 1rem 0;border-bottom:1px solid #F5F5F5" | |||
| v-for="(customData,index) in tableDataCustom" :key="index"> | |||
| <div style="width: 90%;"> | |||
| <div style="display: flex;align-items: center;justify-content: space-between;"> | |||
| <span class="panel_dataset_name text-over" style="margin-left: 0;">{{customData.tag}} </span> | |||
| <span class="panel_dataset_name text-over" style="margin-left: 0;">{{customData.tag}} | |||
| </span> | |||
| <div v-if="!!customData.topics" class="text-over"> | |||
| <span v-for="(topic,index) in customData.topics" class="ui repo-topic label topic">{{topic}}</span> | |||
| <span v-for="(topic,index) in customData.topics" | |||
| class="ui repo-topic label topic">{{topic}}</span> | |||
| </div> | |||
| </div> | |||
| <div style="margin-top: 8px;display: flex;"> | |||
| <a :title="customData.userName" style="cursor: default;"> | |||
| <img class="ui avatar mini image" style="width: 20px;height: 20px;" :src="customData.relAvatarLink"> | |||
| <a v-if="customData.relAvatarLink||customData.userName" :title="customData.userName" | |||
| style="cursor: default;"> | |||
| <img class="ui avatar mini image" style="width: 20px;height: 20px;" | |||
| :src="customData.relAvatarLink"> | |||
| </a> | |||
| <a v-else><img class="ui avatar mini image" title="Ghost" src="/user/avatar/ghost/-1" | |||
| style="width: 20px;height: 20px;"></a> | |||
| <span class="panel_datset_desc">{{customData.description}}</span> | |||
| </div> | |||
| </div> | |||
| <div> | |||
| <button v-if="customData.status===1" class="ui primary basic button mini" @click.stop.prevent="selectImages(customData.place,customData.tag)">使用</button> | |||
| <button v-if="customData.status===1" class="ui primary basic button mini" | |||
| @click.stop.prevent="selectImages(customData.place,customData.tag)">使用</button> | |||
| <span v-if="customData.status===0" style="display: flex;align-items: center;"> | |||
| <i class="CREATING"></i> | |||
| <span style="margin-left: 0.4em;font-size: 12px;color: #5A5A5A;">提交中</span> | |||
| @@ -80,278 +91,286 @@ | |||
| <el-tooltip class="item" effect="dark" content="检测提交镜像是否大小超过20G!" placement="left"> | |||
| <span style="margin-left: 0.4em;font-size: 12px;color:red;">提交失败</span> | |||
| </el-tooltip> | |||
| </span> | |||
| </div> | |||
| </div> | |||
| <div class="ui container" style="margin-top:50px;text-align:center"> | |||
| <el-pagination | |||
| background | |||
| @current-change="handleCurrentChangeCustom" | |||
| :current-page="currentPageCustom" | |||
| :page-size="pageSizeCustom" | |||
| layout="total, prev, pager, next" | |||
| :total="totalNumCustom"> | |||
| </el-pagination> | |||
| <el-pagination background @current-change="handleCurrentChangeCustom" | |||
| :current-page="currentPageCustom" :page-size="pageSizeCustom" | |||
| layout="total, prev, pager, next" :total="totalNumCustom"> | |||
| </el-pagination> | |||
| </div> | |||
| </el-tab-pane> | |||
| <el-tab-pane label="我收藏的镜像" name="third"> | |||
| <div style="display: flex;align-items: center;justify-content: space-between;padding: 1rem 0;border-bottom:1px solid #F5F5F5" v-for="(starData,index) in tableDataStar" :key="index"> | |||
| <div style="display: flex;align-items: center;justify-content: space-between;padding: 1rem 0;border-bottom:1px solid #F5F5F5" | |||
| v-for="(starData,index) in tableDataStar" :key="index"> | |||
| <div style="width: 90%;"> | |||
| <div style="display: flex;align-items: center;justify-content: space-between;"> | |||
| <div style="display: flex;align-items: center;"> | |||
| <span class="panel_dataset_name text-over" style="margin-left: 0;">{{starData.tag}} </span> | |||
| <img v-if="starData.type==5" src="/img/jian.svg" style="margin-left: 0.5rem;"> | |||
| <span class="panel_dataset_name text-over" style="margin-left: 0;">{{starData.tag}} | |||
| </span> | |||
| <img v-if="starData.type==5" src="/img/jian.svg" style="margin-left: 0.5rem;"> | |||
| </div> | |||
| <div v-if="!!starData.topics" class="text-over"> | |||
| <span v-for="(topic,index) in starData.topics" class="ui repo-topic label topic">{{topic}}</span> | |||
| <span v-for="(topic,index) in starData.topics" | |||
| class="ui repo-topic label topic">{{topic}}</span> | |||
| </div> | |||
| </div> | |||
| <div style="margin-top: 8px;display: flex;"> | |||
| <a :title="starData.userName" style="cursor: default;"> | |||
| <img class="ui avatar mini image" style="width: 20px;height: 20px;" :src="starData.relAvatarLink"> | |||
| <a v-if="starData.relAvatarLink||starData.userName" :title="starData.userName" | |||
| style="cursor: default;"> | |||
| <img class="ui avatar mini image" style="width: 20px;height: 20px;" | |||
| :src="starData.relAvatarLink"> | |||
| </a> | |||
| <a v-else><img class="ui avatar mini image" title="Ghost" src="/user/avatar/ghost/-1" | |||
| style="width: 20px;height: 20px;"></a> | |||
| <span class="panel_datset_desc">{{starData.description}}</span> | |||
| </div> | |||
| </div> | |||
| <div> | |||
| <button class="ui primary basic button mini" @click.stop.prevent="selectImages(starData.place,starData.tag)">使用</button> | |||
| <button class="ui primary basic button mini" | |||
| @click.stop.prevent="selectImages(starData.place,starData.tag)">使用</button> | |||
| </div> | |||
| </div> | |||
| <div class="ui container" style="margin-top:50px;text-align:center"> | |||
| <el-pagination | |||
| background | |||
| @current-change="handleCurrentChangeStar" | |||
| :current-page="currentPageStar" | |||
| :page-size="pageSizeStar" | |||
| layout="total, prev, pager, next" | |||
| :total="totalNumStar"> | |||
| </el-pagination> | |||
| <el-pagination background @current-change="handleCurrentChangeStar" | |||
| :current-page="currentPageStar" :page-size="pageSizeStar" layout="total, prev, pager, next" | |||
| :total="totalNumStar"> | |||
| </el-pagination> | |||
| </div> | |||
| </el-tab-pane> | |||
| </el-tabs> | |||
| </el-dialog> | |||
| </div> | |||
| </el-tabs> | |||
| </el-dialog> | |||
| </div> | |||
| </template> | |||
| <script> | |||
| const {_AppSubUrl, _StaticUrlPrefix, csrf} = window.config; | |||
| export default { | |||
| components: { | |||
| }, | |||
| data() { | |||
| return { | |||
| dialogVisible:false, | |||
| benchmarkNew:false, | |||
| imageAddress:'', | |||
| activeName: 'first', | |||
| search:'', | |||
| checked:false, | |||
| currentPagePublic:1, | |||
| pageSizePublic:5, | |||
| totalNumPublic:0, | |||
| paramsPublic:{page:1,pageSize:5,q:'',recommend:false}, | |||
| tableDataPublic: [], | |||
| loadingPublic:false, | |||
| currentPageCustom:1, | |||
| pageSizeCustom:5, | |||
| totalNumCustom:0, | |||
| paramsCustom:{page:1,pageSize:5,q:''}, | |||
| tableDataCustom: [], | |||
| starCustom:[], | |||
| loadingCustom:false, | |||
| currentPageStar:1, | |||
| pageSizeStar:5, | |||
| totalNumStar:0, | |||
| paramsStar:{page:1,pageSize:5,q:''}, | |||
| tableDataStar: [], | |||
| loadingStar:false | |||
| }; | |||
| }, | |||
| methods: { | |||
| handleClick(tab, event) { | |||
| this.search = '' | |||
| if(tab.name=="first"){ | |||
| this.paramsPublic.q = '' | |||
| this.getImageListPublic() | |||
| } | |||
| if(tab.name=="second"){ | |||
| this.getImageListCustom() | |||
| } | |||
| if(tab.name=="third"){ | |||
| this.getImageListStar() | |||
| } | |||
| }, | |||
| tableHeaderStyle({row,column,rowIndex,columnIndex}){ | |||
| if(rowIndex===0){ | |||
| return 'background:#f5f5f6;color:#606266' | |||
| } | |||
| }, | |||
| handleCurrentChangePublic(val){ | |||
| this.paramsPublic.page = val | |||
| this.getImageListPublic() | |||
| }, | |||
| handleCurrentChangeCustom(val){ | |||
| this.paramsCustom.page = val | |||
| this.getImageListCustom() | |||
| }, | |||
| handleCurrentChangeStar(val){ | |||
| this.paramsStar.page = val | |||
| this.getImageListStar() | |||
| }, | |||
| getImageListPublic(){ | |||
| this.loadingPublic = true | |||
| this.$axios.get('/explore/images/public',{ | |||
| params:this.paramsPublic | |||
| }).then((res)=>{ | |||
| this.totalNumPublic = res.data.count | |||
| this.tableDataPublic = res.data.images | |||
| this.loadingPublic = false | |||
| }) | |||
| }, | |||
| getImageListCustom(){ | |||
| this.loadingCustom = true | |||
| this.$axios.get('/explore/images/custom',{ | |||
| params:this.paramsCustom | |||
| }).then((res)=>{ | |||
| this.totalNumCustom = res.data.count | |||
| this.tableDataCustom = res.data.images | |||
| this.tableDataCustom.forEach(element => { | |||
| this.starCustom.push({id:element.id,}) | |||
| }); | |||
| this.loadingCustom = false | |||
| }) | |||
| }, | |||
| getImageListStar(){ | |||
| this.loadingStar = true | |||
| this.$axios.get('/explore/images/star',{ | |||
| params:this.paramsStar | |||
| }).then((res)=>{ | |||
| this.totalNumStar = res.data.count | |||
| this.tableDataStar = res.data.images | |||
| this.loadingStar = false | |||
| }) | |||
| }, | |||
| searchName(){ | |||
| if(this.activeName=='first'){ | |||
| this.paramsPublic.q = this.search | |||
| this.paramsPublic.page = 1 | |||
| const { _AppSubUrl, _StaticUrlPrefix, csrf } = window.config; | |||
| export default { | |||
| components: { | |||
| }, | |||
| data() { | |||
| return { | |||
| dialogVisible: false, | |||
| benchmarkNew: false, | |||
| imageAddress: '', | |||
| activeName: 'first', | |||
| search: '', | |||
| checked: false, | |||
| currentPagePublic: 1, | |||
| pageSizePublic: 5, | |||
| totalNumPublic: 0, | |||
| paramsPublic: { page: 1, pageSize: 5, q: '', recommend: false }, | |||
| tableDataPublic: [], | |||
| loadingPublic: false, | |||
| currentPageCustom: 1, | |||
| pageSizeCustom: 5, | |||
| totalNumCustom: 0, | |||
| paramsCustom: { page: 1, pageSize: 5, q: '' }, | |||
| tableDataCustom: [], | |||
| starCustom: [], | |||
| loadingCustom: false, | |||
| currentPageStar: 1, | |||
| pageSizeStar: 5, | |||
| totalNumStar: 0, | |||
| paramsStar: { page: 1, pageSize: 5, q: '' }, | |||
| tableDataStar: [], | |||
| loadingStar: false | |||
| }; | |||
| }, | |||
| methods: { | |||
| handleClick(tab, event) { | |||
| this.search = '' | |||
| if (tab.name == "first") { | |||
| this.paramsPublic.q = '' | |||
| this.getImageListPublic() | |||
| } | |||
| if (tab.name == "second") { | |||
| this.getImageListCustom() | |||
| } | |||
| if (tab.name == "third") { | |||
| this.getImageListStar() | |||
| } | |||
| }, | |||
| tableHeaderStyle({ row, column, rowIndex, columnIndex }) { | |||
| if (rowIndex === 0) { | |||
| return 'background:#f5f5f6;color:#606266' | |||
| } | |||
| }, | |||
| handleCurrentChangePublic(val) { | |||
| this.paramsPublic.page = val | |||
| this.getImageListPublic() | |||
| }, | |||
| handleCurrentChangeCustom(val) { | |||
| this.paramsCustom.page = val | |||
| this.getImageListCustom() | |||
| }, | |||
| handleCurrentChangeStar(val) { | |||
| this.paramsStar.page = val | |||
| this.getImageListStar() | |||
| }, | |||
| getImageListPublic() { | |||
| this.loadingPublic = true | |||
| this.$axios.get('/explore/images/public', { | |||
| params: this.paramsPublic | |||
| }).then((res) => { | |||
| this.totalNumPublic = res.data.count | |||
| this.tableDataPublic = res.data.images | |||
| this.loadingPublic = false | |||
| }) | |||
| }, | |||
| getImageListCustom() { | |||
| this.loadingCustom = true | |||
| this.$axios.get('/explore/images/custom', { | |||
| params: this.paramsCustom | |||
| }).then((res) => { | |||
| this.totalNumCustom = res.data.count | |||
| this.tableDataCustom = res.data.images | |||
| this.tableDataCustom.forEach(element => { | |||
| this.starCustom.push({ id: element.id, }) | |||
| }); | |||
| this.loadingCustom = false | |||
| }) | |||
| }, | |||
| getImageListStar() { | |||
| this.loadingStar = true | |||
| this.$axios.get('/explore/images/star', { | |||
| params: this.paramsStar | |||
| }).then((res) => { | |||
| this.totalNumStar = res.data.count | |||
| this.tableDataStar = res.data.images | |||
| this.loadingStar = false | |||
| }) | |||
| }, | |||
| searchName() { | |||
| if (this.activeName == 'first') { | |||
| this.paramsPublic.q = this.search | |||
| this.paramsPublic.page = 1 | |||
| this.getImageListPublic() | |||
| } | |||
| if (this.activeName == 'second') { | |||
| this.paramsCustom.q = this.search | |||
| this.paramsCustom.page = 1 | |||
| this.getImageListCustom() | |||
| } | |||
| if (this.activeName == 'third') { | |||
| this.paramsStar.q = this.search | |||
| this.paramsStar.page = 1 | |||
| this.getImageListStar() | |||
| } | |||
| }, | |||
| selectImages(place) { | |||
| this.imageAddress = place | |||
| this.dialogVisible = false | |||
| }, | |||
| }, | |||
| watch: { | |||
| search(val) { | |||
| if (this.activeName == 'first') { | |||
| this.paramsPublic.q = val | |||
| this.getImageListPublic() | |||
| } | |||
| if (this.activeName == 'second') { | |||
| this.paramsCustom.q = val | |||
| this.getImageListCustom() | |||
| } | |||
| if (this.activeName == 'third') { | |||
| this.paramsStar.q = val | |||
| this.getImageListStar() | |||
| } | |||
| } | |||
| }, | |||
| mounted() { | |||
| this.getImageListPublic() | |||
| if (location.href.indexOf('benchmark') !== -1 || location.href.indexOf('train-job') !== -1) { | |||
| this.benchmarkNew = true | |||
| } | |||
| }, | |||
| created() { | |||
| } | |||
| if(this.activeName=='second'){ | |||
| this.paramsCustom.q = this.search | |||
| this.paramsCustom.page = 1 | |||
| this.getImageListCustom() | |||
| } | |||
| if(this.activeName=='third'){ | |||
| this.paramsStar.q = this.search | |||
| this.paramsStar.page = 1 | |||
| this.getImageListStar() | |||
| } | |||
| }, | |||
| selectImages(place){ | |||
| this.imageAddress = place | |||
| this.dialogVisible = false | |||
| }, | |||
| }, | |||
| watch:{ | |||
| search(val){ | |||
| if(this.activeName=='first'){ | |||
| this.paramsPublic.q = val | |||
| this.getImageListPublic() | |||
| } | |||
| if(this.activeName=='second'){ | |||
| this.paramsCustom.q = val | |||
| this.getImageListCustom() | |||
| } | |||
| if(this.activeName=='third'){ | |||
| this.paramsStar.q = val | |||
| this.getImageListStar() | |||
| } | |||
| } | |||
| }, | |||
| mounted() { | |||
| this.getImageListPublic() | |||
| if(location.href.indexOf('benchmark')!==-1 || location.href.indexOf('train-job')!==-1){ | |||
| this.benchmarkNew = true | |||
| } | |||
| }, | |||
| created() { | |||
| } | |||
| }; | |||
| }; | |||
| </script> | |||
| <style scoped> | |||
| .header-wrapper { | |||
| background-color: #f5f5f6; | |||
| padding-top: 15px; | |||
| } | |||
| .image_text{ | |||
| padding:25px 0 55px 0 ; | |||
| } | |||
| #header{ | |||
| position: relative; | |||
| top:-40px; | |||
| } | |||
| #success{ | |||
| background-color: #5bb973; | |||
| color: white; | |||
| } | |||
| .text-over{ | |||
| overflow: hidden; | |||
| text-overflow: ellipsis; | |||
| vertical-align: middle; | |||
| white-space: nowrap; | |||
| } | |||
| .image_title{ | |||
| display: inline-block; | |||
| width: 80%; | |||
| cursor: default; | |||
| color: rgb(66, 98, 144); | |||
| } | |||
| .image_desc{ | |||
| -webkit-line-clamp: 2; | |||
| -webkit-box-orient: vertical; | |||
| display: -webkit-box; | |||
| text-overflow: ellipsis; | |||
| overflow: hidden; | |||
| } | |||
| .heart-stroke{ | |||
| stroke: #666; | |||
| stroke-width: 2; | |||
| fill: #fff | |||
| } | |||
| .stars_active{ | |||
| fill: #FA8C16 !important; | |||
| stroke:#FA8C16 !important | |||
| } | |||
| </style> | |||
| .header-wrapper { | |||
| background-color: #f5f5f6; | |||
| padding-top: 15px; | |||
| } | |||
| .image_text { | |||
| padding: 25px 0 55px 0; | |||
| } | |||
| #header { | |||
| position: relative; | |||
| top: -40px; | |||
| } | |||
| #success { | |||
| background-color: #5bb973; | |||
| color: white; | |||
| } | |||
| .text-over { | |||
| overflow: hidden; | |||
| text-overflow: ellipsis; | |||
| vertical-align: middle; | |||
| white-space: nowrap; | |||
| } | |||
| .image_title { | |||
| display: inline-block; | |||
| width: 80%; | |||
| cursor: default; | |||
| color: rgb(66, 98, 144); | |||
| } | |||
| .image_desc { | |||
| -webkit-line-clamp: 2; | |||
| -webkit-box-orient: vertical; | |||
| display: -webkit-box; | |||
| text-overflow: ellipsis; | |||
| overflow: hidden; | |||
| } | |||
| .heart-stroke { | |||
| stroke: #666; | |||
| stroke-width: 2; | |||
| fill: #fff | |||
| } | |||
| .stars_active { | |||
| fill: #FA8C16 !important; | |||
| stroke: #FA8C16 !important | |||
| } | |||
| </style> | |||
| @@ -279,3 +279,52 @@ export default async function initCloudrain() { | |||
| }) | |||
| } | |||
| function userSearchControll() { | |||
| if ($('#userCloud').length === 0) { | |||
| return | |||
| } | |||
| const params = new URLSearchParams(window.location.search) | |||
| let jobType | |||
| if ($('.cloudbrain_debug').length === 1) { | |||
| if (!params.get('jobType')) { | |||
| jobType = $('.cloudbrain_debug').data('allTask') | |||
| } else { | |||
| if (params.get('jobType') === 'DEBUG') { | |||
| jobType = $('.cloudbrain_debug').data('debug-task') | |||
| } else if (params.get('jobType') === 'TRAIN') { | |||
| jobType = $('.cloudbrain_debug').data('train-task') | |||
| } | |||
| else if (params.get('jobType') === 'INFERENCE') { | |||
| jobType = $('.cloudbrain_debug').data('inference-task') | |||
| } | |||
| else { | |||
| jobType = $('.cloudbrain_debug').data('benchmark-task') | |||
| } | |||
| } | |||
| } | |||
| 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] | |||
| $('#userCloud .default.text ').each(function (index, e) { | |||
| $(e).text(dropdownValueArray[index]) | |||
| }) | |||
| } | |||
| function AdaminSearchControll() { | |||
| if ($('#adminCloud').length === 0) { | |||
| return | |||
| } | |||
| const params = new URLSearchParams(window.location.search) | |||
| let jobType = !params.get('jobType') ? $('.cloudbrain_debug').data('all-task') : params.get('jobType') | |||
| 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] | |||
| $('#adminCloud .default.text ').each(function (index, e) { | |||
| $(e).text(dropdownValueArray[index]) | |||
| }) | |||
| } | |||
| userSearchControll() | |||
| AdaminSearchControll() | |||