From 7a347946b6594ac5df94a1274df5381971315539 Mon Sep 17 00:00:00 2001 From: zouap Date: Mon, 29 Aug 2022 11:25:41 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96=E7=9B=B8=E5=85=B3=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- options/locale/locale_en-US.ini | 10 +++++----- options/locale/locale_zh-CN.ini | 4 ++-- templates/repo/modelmanage/index.tmpl | 4 ++-- web_src/js/components/Model.vue | 2 +- web_src/js/features/i18nVue.js | 4 ++++ 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index a2e714465..1ea652a0b 100755 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1140,7 +1140,7 @@ modelarts.train_job.compute_node=Compute Node modelarts.create_model = Create Model modelarts.model_label=Model Label modelarts.infer_dataset = Inference Dataset - +modelarts.train_job.label_place=Input labels, multiple labels are separated by spaces modelarts.train_job.basic_info=Basic Info modelarts.train_job.job_status=Job Status @@ -1221,7 +1221,7 @@ model_Evaluation_not_created = Model evaluation has not been created repo_not_initialized = Code version: You have not initialized the code repository, please initialized first ; debug_task_running_limit =Running time: no more than 4 hours, it will automatically stop if it exceeds 4 hours; dataset_desc = Dataset: Cloud Brain 1 provides CPU/GPU,Cloud Brain 2 provides Ascend NPU.And dataset also needs to be uploaded to the corresponding environment; -platform_instructions = Instructions for use: You can refer to the Xiaobai training camp course of Openi AI collaboration platform. +platform_instructions = Instructions for use: You can refer to the "Xiaobai training camp "course of Openi AI collaboration platform. model_not_exist = Model file: You do not have a model file yet, please generate and export the model through the training task first ; benchmark_leaderboards = Benchmark leaderboards @@ -1244,11 +1244,11 @@ model.convert=Model Transformation model.list=Model List model.manage.create_new_convert_task=Create Model Transformation Task -model.manage.notcreatemodel=No model has been created. +model.manage.notcreatemodel=No model has been created model.manage.init1=Code version: You have not initialized the code repository, please model.manage.init2=initialized first ; model.manage.createtrainjob_tip=Training task: you haven't created a training task, please create it first -model.manage.createtrainjob=Training task +model.manage.createtrainjob=Training task. model.manage.delete=Delete Model model.manage.delete_confirm=Are you sure to delete this model? Once this model is deleted, it cannot be restored. model.manage.select.trainjob=Select train task @@ -1261,7 +1261,7 @@ model.manage.modeldesc=Model description model.manage.baseinfo=Base Information modelconvert.notcreate=No model conversion task has been created. modelconvert.importfirst1=Please import first -modelconvert.importfirst2=download model +modelconvert.importfirst2=model modelconvert.importfirst3=, then converts it. modelconvert.download=Download modelconvert.taskname=Task name diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini index c6cb6a576..8e09f6948 100755 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -1261,7 +1261,7 @@ model.manage.notcreatemodel=未创建过模型 model.manage.init1=代码版本:您还没有初始化代码仓库,请先 model.manage.init2=创建代码版本; model.manage.createtrainjob_tip=训练任务:您还没创建过训练任务,请先创建 -model.manage.createtrainjob=训练任务 +model.manage.createtrainjob=训练任务。 model.manage.delete=删除模型 model.manage.delete_confirm=你确认删除该模型么?此模型一旦删除不可恢复。 model.manage.select.trainjob=选择训练任务 @@ -1274,7 +1274,7 @@ model.manage.modeldesc=模型描述 model.manage.baseinfo=基本信息 modelconvert.notcreate=未创建过模型转换任务 modelconvert.importfirst1=请您先导入 -modelconvert.importfirst2=模型下载 +modelconvert.importfirst2=模型 modelconvert.importfirst3=,然后再对其进行转换。 modelconvert.download=下载 modelconvert.taskname=任务名称 diff --git a/templates/repo/modelmanage/index.tmpl b/templates/repo/modelmanage/index.tmpl index 76739d80f..e03031abb 100644 --- a/templates/repo/modelmanage/index.tmpl +++ b/templates/repo/modelmanage/index.tmpl @@ -71,7 +71,7 @@ {{end}} {{if eq $.TRAIN_COUNT 0}}
{{$.i18n.Tr "repo.model.manage.createtrainjob_tip"}}{{$.i18n.Tr "repo.model.manage.createtrainjob"}}
+ href="{{.RepoLink}}/modelarts/train-job">{{$.i18n.Tr "repo.model.manage.createtrainjob"}} {{end}}
{{$.i18n.Tr "repo.platform_instructions"}}
@@ -330,7 +330,7 @@ .modal({ centered: false, onShow: function () { - $('#model_header').text("导入新模型") + $('#model_header').text({{.i18n.Tr "repo.model.manage.import_new_model"}}) $('input[name="Version"]').addClass('model_disabled') $('.ui.dimmer').css({ "background-color": "rgb(136, 136, 136,0.7)" }) $("#job-name").empty() diff --git a/web_src/js/components/Model.vue b/web_src/js/components/Model.vue index a76fe324b..0c2de478b 100644 --- a/web_src/js/components/Model.vue +++ b/web_src/js/components/Model.vue @@ -201,7 +201,7 @@ export default { .modal({ centered: false, onShow:function(){ - $('#model_header').text("创建模型新版本") + $('#model_header').text(this.i18n.model_create_version_title) $('input[name="Name"]').addClass('model_disabled') $('input[name="Name"]').attr('readonly','readonly') $('input[name="modelSelectedFile"]').attr('readonly','readonly') diff --git a/web_src/js/features/i18nVue.js b/web_src/js/features/i18nVue.js index 4740f01cb..b556152c0 100644 --- a/web_src/js/features/i18nVue.js +++ b/web_src/js/features/i18nVue.js @@ -95,6 +95,8 @@ export const i18nVue = { model_create_new_ver: "创建新版本", model_download: "下载", model_delete: "删除", + model_create_title: "导入新模型", + model_create_version_title: "创建模型新版本", }, US: { computer_vision: "computer vision", @@ -196,5 +198,7 @@ export const i18nVue = { model_create_new_ver: "New Version", model_download: "Download", model_delete: "Delete", + model_create_title: "Import new model", + model_create_version_title: "Create a new version of the model", }, }; From 9f25a8e92d3bc23aac890766ec113c27c58041ac Mon Sep 17 00:00:00 2001 From: zouap Date: Mon, 29 Aug 2022 11:35:19 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96=E7=9B=B8=E5=85=B3=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- options/locale/locale_en-US.ini | 4 +++- options/locale/locale_zh-CN.ini | 5 ++++- templates/repo/modelmanage/convertIndex.tmpl | 2 +- templates/repo/modelmanage/index.tmpl | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 1ea652a0b..983b5b9c6 100755 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1221,7 +1221,9 @@ model_Evaluation_not_created = Model evaluation has not been created repo_not_initialized = Code version: You have not initialized the code repository, please initialized first ; debug_task_running_limit =Running time: no more than 4 hours, it will automatically stop if it exceeds 4 hours; dataset_desc = Dataset: Cloud Brain 1 provides CPU/GPU,Cloud Brain 2 provides Ascend NPU.And dataset also needs to be uploaded to the corresponding environment; -platform_instructions = Instructions for use: You can refer to the "Xiaobai training camp "course of Openi AI collaboration platform. +platform_instructions1 = Instructions for use: You can refer to the +platform_instructions2 = OpenI_Learning +platform_instructions3 = course of Openi AI collaboration platform. model_not_exist = Model file: You do not have a model file yet, please generate and export the model through the training task first ; benchmark_leaderboards = Benchmark leaderboards diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini index 8e09f6948..527df52d5 100755 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -1234,7 +1234,10 @@ model_Evaluation_not_created = 未创建过评测任务 repo_not_initialized = 代码版本:您还没有初始化代码仓库,请先创建代码版本; debug_task_running_limit = 运行时长:最长不超过4个小时,超过4个小时将自动停止; dataset_desc = 数据集:云脑1提供 CPU / GPU 资源,云脑2提供 Ascend NPU 资源,调试使用的数据集也需要上传到对应的环境; -platform_instructions = 使用说明:可以参考启智AI协作平台小白训练营课程。 +platform_instructions1 = 使用说明:可以参考启智AI协作平台 +platform_instructions2 = 小白训练营课程 +platform_instructions3 = 。 + model_not_exist = 模型文件:您还没有模型文件,请先通过训练任务产生并 导出模型 ; benchmark_leaderboards = 基准测试排行榜 diff --git a/templates/repo/modelmanage/convertIndex.tmpl b/templates/repo/modelmanage/convertIndex.tmpl index 78806dff7..e093a1012 100644 --- a/templates/repo/modelmanage/convertIndex.tmpl +++ b/templates/repo/modelmanage/convertIndex.tmpl @@ -52,7 +52,7 @@ {{if eq .MODEL_COUNT 0}}
{{$.i18n.Tr "repo.modelconvert.importfirst1"}}{{$.i18n.Tr "repo.modelconvert.importfirst2"}}{{$.i18n.Tr "repo.modelconvert.importfirst3"}}
{{end}} -
{{$.i18n.Tr "repo.platform_instructions"}}
+
{{$.i18n.Tr "repo.platform_instructions1"}}{{$.i18n.Tr "repo.platform_instructions2"}}{{$.i18n.Tr "repo.platform_instructions3"}}
diff --git a/templates/repo/modelmanage/index.tmpl b/templates/repo/modelmanage/index.tmpl index e03031abb..fa1720904 100644 --- a/templates/repo/modelmanage/index.tmpl +++ b/templates/repo/modelmanage/index.tmpl @@ -73,7 +73,7 @@
{{$.i18n.Tr "repo.model.manage.createtrainjob_tip"}}{{$.i18n.Tr "repo.model.manage.createtrainjob"}}
{{end}} -
{{$.i18n.Tr "repo.platform_instructions"}}
+
{{$.i18n.Tr "repo.platform_instructions1"}}{{$.i18n.Tr "repo.platform_instructions2"}}{{$.i18n.Tr "repo.platform_instructions3"}}
From 08c847d3deb9b7a5d27e46f1ed49ea0c5e8efafc Mon Sep 17 00:00:00 2001 From: zouap Date: Mon, 29 Aug 2022 14:11:35 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96=E7=9B=B8=E5=85=B3=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- web_src/js/components/Model.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/web_src/js/components/Model.vue b/web_src/js/components/Model.vue index 0c2de478b..0a555588a 100644 --- a/web_src/js/components/Model.vue +++ b/web_src/js/components/Model.vue @@ -197,11 +197,12 @@ export default { this.getModelList() }, showcreateVue(name,version,label){ + let title= this.i18n.model_create_version_title; $('.ui.modal.second') .modal({ centered: false, onShow:function(){ - $('#model_header').text(this.i18n.model_create_version_title) + $('#model_header').text(title) $('input[name="Name"]').addClass('model_disabled') $('input[name="Name"]').attr('readonly','readonly') $('input[name="modelSelectedFile"]').attr('readonly','readonly') From 6de04e8b1f8d044910c84d910159a769ef62dd5e Mon Sep 17 00:00:00 2001 From: zouap Date: Mon, 29 Aug 2022 14:45:12 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96=E7=9B=B8=E5=85=B3=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- options/locale/locale_en-US.ini | 6 +++--- templates/repo/modelmanage/convertIndex.tmpl | 4 ++-- templates/repo/modelmanage/index.tmpl | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 983b5b9c6..42f0e938a 100755 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1221,7 +1221,7 @@ model_Evaluation_not_created = Model evaluation has not been created repo_not_initialized = Code version: You have not initialized the code repository, please initialized first ; debug_task_running_limit =Running time: no more than 4 hours, it will automatically stop if it exceeds 4 hours; dataset_desc = Dataset: Cloud Brain 1 provides CPU/GPU,Cloud Brain 2 provides Ascend NPU.And dataset also needs to be uploaded to the corresponding environment; -platform_instructions1 = Instructions for use: You can refer to the +platform_instructions1 = Instructions for use: You can refer to the platform_instructions2 = OpenI_Learning platform_instructions3 = course of Openi AI collaboration platform. model_not_exist = Model file: You do not have a model file yet, please generate and export the model through the training task first ; @@ -1262,9 +1262,9 @@ model.manage.modellabel=Model label model.manage.modeldesc=Model description model.manage.baseinfo=Base Information modelconvert.notcreate=No model conversion task has been created. -modelconvert.importfirst1=Please import first +modelconvert.importfirst1=Please import the modelconvert.importfirst2=model -modelconvert.importfirst3=, then converts it. +modelconvert.importfirst3=first, then converts it. modelconvert.download=Download modelconvert.taskname=Task name modelconvert.modelname=Model name diff --git a/templates/repo/modelmanage/convertIndex.tmpl b/templates/repo/modelmanage/convertIndex.tmpl index e093a1012..2f5ee6c35 100644 --- a/templates/repo/modelmanage/convertIndex.tmpl +++ b/templates/repo/modelmanage/convertIndex.tmpl @@ -50,9 +50,9 @@
{{$.i18n.Tr "repo.modelconvert.notcreate"}}
{{if eq .MODEL_COUNT 0}} -
{{$.i18n.Tr "repo.modelconvert.importfirst1"}}{{$.i18n.Tr "repo.modelconvert.importfirst2"}}{{$.i18n.Tr "repo.modelconvert.importfirst3"}}
+
{{$.i18n.Tr "repo.modelconvert.importfirst1"}} {{$.i18n.Tr "repo.modelconvert.importfirst2"}} {{$.i18n.Tr "repo.modelconvert.importfirst3"}}
{{end}} -
{{$.i18n.Tr "repo.platform_instructions1"}}{{$.i18n.Tr "repo.platform_instructions2"}}{{$.i18n.Tr "repo.platform_instructions3"}}
+
{{$.i18n.Tr "repo.platform_instructions1"}} {{$.i18n.Tr "repo.platform_instructions2"}} {{$.i18n.Tr "repo.platform_instructions3"}}
diff --git a/templates/repo/modelmanage/index.tmpl b/templates/repo/modelmanage/index.tmpl index fa1720904..3a5240768 100644 --- a/templates/repo/modelmanage/index.tmpl +++ b/templates/repo/modelmanage/index.tmpl @@ -71,9 +71,9 @@ {{end}} {{if eq $.TRAIN_COUNT 0}}
{{$.i18n.Tr "repo.model.manage.createtrainjob_tip"}}{{$.i18n.Tr "repo.model.manage.createtrainjob"}}
+ href="{{.RepoLink}}/modelarts/train-job"> {{$.i18n.Tr "repo.model.manage.createtrainjob"}} {{end}} -
{{$.i18n.Tr "repo.platform_instructions1"}}{{$.i18n.Tr "repo.platform_instructions2"}}{{$.i18n.Tr "repo.platform_instructions3"}}
+
{{$.i18n.Tr "repo.platform_instructions1"}} {{$.i18n.Tr "repo.platform_instructions2"}} {{$.i18n.Tr "repo.platform_instructions3"}}
From 9aa0c172d3fa0a644b6c391c0acb7f321c87ecae Mon Sep 17 00:00:00 2001 From: zouap Date: Mon, 29 Aug 2022 15:21:26 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96=E7=9B=B8=E5=85=B3=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- options/locale/locale_en-US.ini | 2 ++ options/locale/locale_zh-CN.ini | 2 ++ routers/repo/cloudbrain.go | 2 +- routers/repo/grampus.go | 2 +- routers/repo/modelarts.go | 42 +++++++++++++++++++-------------- 5 files changed, 30 insertions(+), 20 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index bb9edf61e..5eac4cf2e 100755 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -959,6 +959,7 @@ unfavorite=Unlike favorite=Like disassociate=Disassociate benchmark_dataset_tip=Note: first use the dataset function to upload the model, and then select the model from the dataset list. +file_deleted=The file has been deleted [repo] owner = Owner @@ -1221,6 +1222,7 @@ model_Evaluation_not_created = Model evaluation has not been created repo_not_initialized = Code version: You have not initialized the code repository, please initialized first ; debug_task_running_limit =Running time: no more than 4 hours, it will automatically stop if it exceeds 4 hours; dataset_desc = Dataset: Cloud Brain 1 provides CPU/GPU,Cloud Brain 2 provides Ascend NPU.And dataset also needs to be uploaded to the corresponding environment; +platform_instructions = Instructions for use: You can refer to the OpenI_Learning course of Qizhi AI collaboration platform. platform_instructions1 = Instructions for use: You can refer to the platform_instructions2 = OpenI_Learning platform_instructions3 = course of Openi AI collaboration platform. diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini index 527df52d5..2fbd3ab52 100755 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -965,6 +965,7 @@ unfavorite=取消收藏 favorite=收藏 disassociate=取消关联 benchmark_dataset_tip=说明:先使用数据集功能上传模型,然后从数据集列表选模型。 +file_deleted=文件已经被删除 [repo] owner=拥有者 @@ -1234,6 +1235,7 @@ model_Evaluation_not_created = 未创建过评测任务 repo_not_initialized = 代码版本:您还没有初始化代码仓库,请先创建代码版本; debug_task_running_limit = 运行时长:最长不超过4个小时,超过4个小时将自动停止; dataset_desc = 数据集:云脑1提供 CPU / GPU 资源,云脑2提供 Ascend NPU 资源,调试使用的数据集也需要上传到对应的环境; +platform_instructions = 使用说明:可以参考启智AI协作平台小白训练营课程。 platform_instructions1 = 使用说明:可以参考启智AI协作平台 platform_instructions2 = 小白训练营课程 platform_instructions3 = 。 diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go index c1e89dde5..181ad6302 100755 --- a/routers/repo/cloudbrain.go +++ b/routers/repo/cloudbrain.go @@ -928,7 +928,7 @@ func cloudBrainShow(ctx *context.Context, tpName base.TplName, jobType models.Jo } } - ctx.Data["datasetDownload"] = GetCloudBrainDataSetInfo(task.Uuid, false) + ctx.Data["datasetDownload"] = GetCloudBrainDataSetInfo(task.Uuid, task.DatasetName, false, ctx) ctx.Data["task"] = task labelName := strings.Fields(task.LabelName) ctx.Data["LabelName"] = labelName diff --git a/routers/repo/grampus.go b/routers/repo/grampus.go index 33e111df2..3b19d9344 100755 --- a/routers/repo/grampus.go +++ b/routers/repo/grampus.go @@ -713,7 +713,7 @@ func GrampusTrainJobShow(ctx *context.Context) { taskList := make([]*models.Cloudbrain, 0) taskList = append(taskList, task) ctx.Data["version_list_task"] = taskList - ctx.Data["datasetDownload"] = GetCloudBrainDataSetInfo(task.Uuid, false) + ctx.Data["datasetDownload"] = GetCloudBrainDataSetInfo(task.Uuid, task.DatasetName, false, ctx) ctx.Data["canDownload"] = cloudbrain.CanModifyJob(ctx, task) ctx.Data["displayJobName"] = task.DisplayJobName diff --git a/routers/repo/modelarts.go b/routers/repo/modelarts.go index 40e8076fb..a4ce70b58 100755 --- a/routers/repo/modelarts.go +++ b/routers/repo/modelarts.go @@ -285,7 +285,7 @@ func NotebookShow(ctx *context.Context) { datasetDownload := make([]models.DatasetDownload, 0) if ctx.IsSigned { if task.Uuid != "" && task.UserID == ctx.User.ID { - datasetDownload = GetCloudBrainDataSetInfo(task.Uuid, true) + datasetDownload = GetCloudBrainDataSetInfo(task.Uuid, task.DatasetName, true, ctx) } } user, err := models.GetUserByID(task.UserID) @@ -331,34 +331,40 @@ func NotebookShow(ctx *context.Context) { ctx.HTML(200, tplModelArtsNotebookShow) } -func GetCloudBrainDataSetInfo(uuid string, isNeedDown bool) []models.DatasetDownload { +func GetCloudBrainDataSetInfo(uuid string, datasetname string, isNeedDown bool, ctx *context.Context) []models.DatasetDownload { datasetDownload := make([]models.DatasetDownload, 0) uuidList := strings.Split(uuid, ";") - for _, uuidStr := range uuidList { + datasetnameList := strings.Split(datasetname, ";") + for i, uuidStr := range uuidList { + name := "" + link := "" attachment, err := models.GetAttachmentByUUID(uuidStr) if err != nil { log.Error("GetAttachmentByUUID failed:%v", err.Error()) - return datasetDownload - } - dataset, err := models.GetDatasetByID(attachment.DatasetID) - if err != nil { - log.Error("GetDatasetByID failed:%v", err.Error()) - return datasetDownload - } - repo, err := models.GetRepositoryByID(dataset.RepoID) - if err != nil { - log.Error("GetRepositoryByID failed:%v", err.Error()) - return datasetDownload + name = datasetnameList[i] + "(" + ctx.Tr("dataset.file_deleted") + ")" + } else { + name = attachment.Name + dataset, err := models.GetDatasetByID(attachment.DatasetID) + if err != nil { + log.Error("GetDatasetByID failed:%v", err.Error()) + } else { + repo, err := models.GetRepositoryByID(dataset.RepoID) + if err != nil { + log.Error("GetRepositoryByID failed:%v", err.Error()) + } else { + link = repo.Link() + "/datasets" + } + } } url := "" if isNeedDown { url = attachment.S3DownloadURL() } datasetDownload = append(datasetDownload, models.DatasetDownload{ - DatasetName: attachment.Name, + DatasetName: name, DatasetDownloadLink: url, - RepositoryLink: repo.Link() + "/datasets", + RepositoryLink: link, }) } return datasetDownload @@ -1810,7 +1816,7 @@ func TrainJobShow(ctx *context.Context) { } else { VersionListTasks[i].Parameters = "" } - datasetList = append(datasetList, GetCloudBrainDataSetInfo(task.Uuid, false)) + datasetList = append(datasetList, GetCloudBrainDataSetInfo(task.Uuid, task.DatasetName, false, ctx)) VersionListTasks[i].CanDel = cloudbrain.CanDeleteJob(ctx, &task.Cloudbrain) VersionListTasks[i].CanModify = cloudbrain.CanModifyJob(ctx, &task.Cloudbrain) } @@ -2526,7 +2532,7 @@ func InferenceJobShow(ctx *context.Context) { ctx.Data["displayJobName"] = task.DisplayJobName ctx.Data["task"] = task ctx.Data["canDownload"] = cloudbrain.CanModifyJob(ctx, task) - ctx.Data["datasetDownload"] = GetCloudBrainDataSetInfo(task.Uuid, false) + ctx.Data["datasetDownload"] = GetCloudBrainDataSetInfo(task.Uuid, task.DatasetName, false, ctx) tempUids := []int64{} tempUids = append(tempUids, task.UserID) JobCreater, err := models.GetUserNamesByIDs(tempUids) From 7d9783847fd76be6af641e349ef2d9e0bc1b0c8c Mon Sep 17 00:00:00 2001 From: zouap Date: Mon, 29 Aug 2022 15:46:24 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96=E7=9B=B8=E5=85=B3=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- models/cloudbrain.go | 1 + routers/repo/cloudbrain.go | 2 +- routers/repo/grampus.go | 2 +- routers/repo/modelarts.go | 13 ++++++++----- templates/repo/cloudbrain/inference/show.tmpl | 8 +++++++- templates/repo/cloudbrain/show.tmpl | 8 +++++++- templates/repo/cloudbrain/trainjob/show.tmpl | 8 +++++++- templates/repo/grampus/trainjob/show.tmpl | 7 ++++++- templates/repo/modelarts/inferencejob/show.tmpl | 9 ++++++++- templates/repo/modelarts/notebook/show.tmpl | 9 ++++++++- 10 files changed, 54 insertions(+), 13 deletions(-) diff --git a/models/cloudbrain.go b/models/cloudbrain.go index a53bf0287..29b55b97e 100755 --- a/models/cloudbrain.go +++ b/models/cloudbrain.go @@ -1092,6 +1092,7 @@ type DatasetDownload struct { DatasetName string `json:"dataset_name"` DatasetDownloadLink string `json:"dataset_download_link"` RepositoryLink string `json:"repository_link"` + IsDelete bool `json:"is_delete"` } type DataSource struct { diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go index 181ad6302..2d8bebf4b 100755 --- a/routers/repo/cloudbrain.go +++ b/routers/repo/cloudbrain.go @@ -928,7 +928,7 @@ func cloudBrainShow(ctx *context.Context, tpName base.TplName, jobType models.Jo } } - ctx.Data["datasetDownload"] = GetCloudBrainDataSetInfo(task.Uuid, task.DatasetName, false, ctx) + ctx.Data["datasetDownload"] = GetCloudBrainDataSetInfo(task.Uuid, task.DatasetName, false) ctx.Data["task"] = task labelName := strings.Fields(task.LabelName) ctx.Data["LabelName"] = labelName diff --git a/routers/repo/grampus.go b/routers/repo/grampus.go index 3b19d9344..6fc77a454 100755 --- a/routers/repo/grampus.go +++ b/routers/repo/grampus.go @@ -713,7 +713,7 @@ func GrampusTrainJobShow(ctx *context.Context) { taskList := make([]*models.Cloudbrain, 0) taskList = append(taskList, task) ctx.Data["version_list_task"] = taskList - ctx.Data["datasetDownload"] = GetCloudBrainDataSetInfo(task.Uuid, task.DatasetName, false, ctx) + ctx.Data["datasetDownload"] = GetCloudBrainDataSetInfo(task.Uuid, task.DatasetName, false) ctx.Data["canDownload"] = cloudbrain.CanModifyJob(ctx, task) ctx.Data["displayJobName"] = task.DisplayJobName diff --git a/routers/repo/modelarts.go b/routers/repo/modelarts.go index a4ce70b58..4a9b8c56f 100755 --- a/routers/repo/modelarts.go +++ b/routers/repo/modelarts.go @@ -285,7 +285,7 @@ func NotebookShow(ctx *context.Context) { datasetDownload := make([]models.DatasetDownload, 0) if ctx.IsSigned { if task.Uuid != "" && task.UserID == ctx.User.ID { - datasetDownload = GetCloudBrainDataSetInfo(task.Uuid, task.DatasetName, true, ctx) + datasetDownload = GetCloudBrainDataSetInfo(task.Uuid, task.DatasetName, true) } } user, err := models.GetUserByID(task.UserID) @@ -331,7 +331,7 @@ func NotebookShow(ctx *context.Context) { ctx.HTML(200, tplModelArtsNotebookShow) } -func GetCloudBrainDataSetInfo(uuid string, datasetname string, isNeedDown bool, ctx *context.Context) []models.DatasetDownload { +func GetCloudBrainDataSetInfo(uuid string, datasetname string, isNeedDown bool) []models.DatasetDownload { datasetDownload := make([]models.DatasetDownload, 0) uuidList := strings.Split(uuid, ";") @@ -339,10 +339,12 @@ func GetCloudBrainDataSetInfo(uuid string, datasetname string, isNeedDown bool, for i, uuidStr := range uuidList { name := "" link := "" + isDelete := false attachment, err := models.GetAttachmentByUUID(uuidStr) if err != nil { log.Error("GetAttachmentByUUID failed:%v", err.Error()) - name = datasetnameList[i] + "(" + ctx.Tr("dataset.file_deleted") + ")" + name = datasetnameList[i] + isDelete = true } else { name = attachment.Name dataset, err := models.GetDatasetByID(attachment.DatasetID) @@ -365,6 +367,7 @@ func GetCloudBrainDataSetInfo(uuid string, datasetname string, isNeedDown bool, DatasetName: name, DatasetDownloadLink: url, RepositoryLink: link, + IsDelete: isDelete, }) } return datasetDownload @@ -1816,7 +1819,7 @@ func TrainJobShow(ctx *context.Context) { } else { VersionListTasks[i].Parameters = "" } - datasetList = append(datasetList, GetCloudBrainDataSetInfo(task.Uuid, task.DatasetName, false, ctx)) + datasetList = append(datasetList, GetCloudBrainDataSetInfo(task.Uuid, task.DatasetName, false)) VersionListTasks[i].CanDel = cloudbrain.CanDeleteJob(ctx, &task.Cloudbrain) VersionListTasks[i].CanModify = cloudbrain.CanModifyJob(ctx, &task.Cloudbrain) } @@ -2532,7 +2535,7 @@ func InferenceJobShow(ctx *context.Context) { ctx.Data["displayJobName"] = task.DisplayJobName ctx.Data["task"] = task ctx.Data["canDownload"] = cloudbrain.CanModifyJob(ctx, task) - ctx.Data["datasetDownload"] = GetCloudBrainDataSetInfo(task.Uuid, task.DatasetName, false, ctx) + ctx.Data["datasetDownload"] = GetCloudBrainDataSetInfo(task.Uuid, task.DatasetName, false) tempUids := []int64{} tempUids = append(tempUids, task.UserID) JobCreater, err := models.GetUserNamesByIDs(tempUids) diff --git a/templates/repo/cloudbrain/inference/show.tmpl b/templates/repo/cloudbrain/inference/show.tmpl index 848ccfc20..4d7a3c1b6 100644 --- a/templates/repo/cloudbrain/inference/show.tmpl +++ b/templates/repo/cloudbrain/inference/show.tmpl @@ -500,7 +500,13 @@ {{range $m ,$n := $.datasetDownload}} - {{.DatasetName}} + + {{if .IsDelete}} + {{.DatasetName}}({{$.i18n.Tr "dataset.file_deleted"}}) + {{else}} + {{.DatasetName}} + {{end}} + {{end}} diff --git a/templates/repo/cloudbrain/show.tmpl b/templates/repo/cloudbrain/show.tmpl index bdde80772..3c9a34127 100755 --- a/templates/repo/cloudbrain/show.tmpl +++ b/templates/repo/cloudbrain/show.tmpl @@ -498,7 +498,13 @@ {{range $m ,$n := $.datasetDownload}} - {{.DatasetName}} + + {{if .IsDelete}} + {{.DatasetName}}({{$.i18n.Tr "dataset.file_deleted"}}) + {{else}} + {{.DatasetName}} + {{end}} + {{end}} diff --git a/templates/repo/cloudbrain/trainjob/show.tmpl b/templates/repo/cloudbrain/trainjob/show.tmpl index 14967c900..233a184cd 100644 --- a/templates/repo/cloudbrain/trainjob/show.tmpl +++ b/templates/repo/cloudbrain/trainjob/show.tmpl @@ -464,7 +464,13 @@ {{range $m ,$n := $.datasetDownload}} - {{.DatasetName}} + + {{if .IsDelete}} + {{.DatasetName}}({{$.i18n.Tr "dataset.file_deleted"}}) + {{else}} + {{.DatasetName}} + {{end}} + {{end}} diff --git a/templates/repo/grampus/trainjob/show.tmpl b/templates/repo/grampus/trainjob/show.tmpl index 148de401c..5162acc84 100755 --- a/templates/repo/grampus/trainjob/show.tmpl +++ b/templates/repo/grampus/trainjob/show.tmpl @@ -419,7 +419,12 @@
{{range $m ,$n := $.datasetDownload}} - {{.DatasetName}} + {{if .IsDelete}} + {{.DatasetName}}({{$.i18n.Tr "dataset.file_deleted"}}) + {{else}} + {{.DatasetName}} + {{end}} + {{end}}
diff --git a/templates/repo/modelarts/inferencejob/show.tmpl b/templates/repo/modelarts/inferencejob/show.tmpl index e578e139c..b6ff20fc4 100644 --- a/templates/repo/modelarts/inferencejob/show.tmpl +++ b/templates/repo/modelarts/inferencejob/show.tmpl @@ -441,7 +441,14 @@ td, th { {{range $m ,$n := $.datasetDownload}} - {{.DatasetName}} + + {{if .IsDelete}} + {{.DatasetName}}({{$.i18n.Tr "dataset.file_deleted"}}) + {{else}} + {{.DatasetName}} + {{end}} + + {{end}} diff --git a/templates/repo/modelarts/notebook/show.tmpl b/templates/repo/modelarts/notebook/show.tmpl index a75fb6f89..516e6aeb0 100755 --- a/templates/repo/modelarts/notebook/show.tmpl +++ b/templates/repo/modelarts/notebook/show.tmpl @@ -439,7 +439,14 @@ {{range $.datasetDownload}} - {{.DatasetName}} + + + {{if .IsDelete}} + {{.DatasetName}}({{$.i18n.Tr "dataset.file_deleted"}}) + {{else}} + {{.DatasetName}} + {{end}} + {{.DatasetDownloadLink}} {{$.i18n.Tr "dataset.download_copy"}} From aa704e441c1a3e7001dff1ed058c919dca28cd0b Mon Sep 17 00:00:00 2001 From: zouap Date: Mon, 29 Aug 2022 15:58:43 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96=E7=9B=B8=E5=85=B3=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- templates/repo/cloudbrain/inference/show.tmpl | 2 +- templates/repo/cloudbrain/show.tmpl | 2 +- templates/repo/cloudbrain/trainjob/show.tmpl | 2 +- templates/repo/grampus/trainjob/show.tmpl | 2 +- templates/repo/modelarts/inferencejob/show.tmpl | 2 +- templates/repo/modelarts/notebook/show.tmpl | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/templates/repo/cloudbrain/inference/show.tmpl b/templates/repo/cloudbrain/inference/show.tmpl index 4d7a3c1b6..3ec01417e 100644 --- a/templates/repo/cloudbrain/inference/show.tmpl +++ b/templates/repo/cloudbrain/inference/show.tmpl @@ -501,7 +501,7 @@ {{range $m ,$n := $.datasetDownload}} - {{if .IsDelete}} + {{if eq .IsDelete true}} {{.DatasetName}}({{$.i18n.Tr "dataset.file_deleted"}}) {{else}} {{.DatasetName}} diff --git a/templates/repo/cloudbrain/show.tmpl b/templates/repo/cloudbrain/show.tmpl index 3c9a34127..76363314d 100755 --- a/templates/repo/cloudbrain/show.tmpl +++ b/templates/repo/cloudbrain/show.tmpl @@ -499,7 +499,7 @@ {{range $m ,$n := $.datasetDownload}} - {{if .IsDelete}} + {{if eq .IsDelete true}} {{.DatasetName}}({{$.i18n.Tr "dataset.file_deleted"}}) {{else}} {{.DatasetName}} diff --git a/templates/repo/cloudbrain/trainjob/show.tmpl b/templates/repo/cloudbrain/trainjob/show.tmpl index 233a184cd..96f7c7380 100644 --- a/templates/repo/cloudbrain/trainjob/show.tmpl +++ b/templates/repo/cloudbrain/trainjob/show.tmpl @@ -465,7 +465,7 @@ {{range $m ,$n := $.datasetDownload}} - {{if .IsDelete}} + {{if eq .IsDelete true}} {{.DatasetName}}({{$.i18n.Tr "dataset.file_deleted"}}) {{else}} {{.DatasetName}} diff --git a/templates/repo/grampus/trainjob/show.tmpl b/templates/repo/grampus/trainjob/show.tmpl index 5162acc84..152d7a67f 100755 --- a/templates/repo/grampus/trainjob/show.tmpl +++ b/templates/repo/grampus/trainjob/show.tmpl @@ -419,7 +419,7 @@
{{range $m ,$n := $.datasetDownload}} - {{if .IsDelete}} + {{if eq .IsDelete true}} {{.DatasetName}}({{$.i18n.Tr "dataset.file_deleted"}}) {{else}} {{.DatasetName}} diff --git a/templates/repo/modelarts/inferencejob/show.tmpl b/templates/repo/modelarts/inferencejob/show.tmpl index b6ff20fc4..c3855cafd 100644 --- a/templates/repo/modelarts/inferencejob/show.tmpl +++ b/templates/repo/modelarts/inferencejob/show.tmpl @@ -442,7 +442,7 @@ td, th { {{range $m ,$n := $.datasetDownload}} - {{if .IsDelete}} + {{if eq .IsDelete true}} {{.DatasetName}}({{$.i18n.Tr "dataset.file_deleted"}}) {{else}} {{.DatasetName}} diff --git a/templates/repo/modelarts/notebook/show.tmpl b/templates/repo/modelarts/notebook/show.tmpl index 516e6aeb0..a86724380 100755 --- a/templates/repo/modelarts/notebook/show.tmpl +++ b/templates/repo/modelarts/notebook/show.tmpl @@ -441,7 +441,7 @@ - {{if .IsDelete}} + {{if eq .IsDelete true}} {{.DatasetName}}({{$.i18n.Tr "dataset.file_deleted"}}) {{else}} {{.DatasetName}} From 81b32161b6faf470d465419073bed562d1d4baed Mon Sep 17 00:00:00 2001 From: zouap Date: Mon, 29 Aug 2022 16:03:08 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96=E7=9B=B8=E5=85=B3=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- templates/repo/modelarts/trainjob/show.tmpl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/templates/repo/modelarts/trainjob/show.tmpl b/templates/repo/modelarts/trainjob/show.tmpl index 9cc7332d6..c1aaba6ad 100755 --- a/templates/repo/modelarts/trainjob/show.tmpl +++ b/templates/repo/modelarts/trainjob/show.tmpl @@ -489,7 +489,13 @@ {{if eq $k $m}} {{range $f ,$g := $n}} - {{.DatasetName}} + + {{if eq .IsDelete true}} + {{.DatasetName}}({{$.i18n.Tr "dataset.file_deleted"}}) + {{else}} + {{.DatasetName}} + {{end}} + {{end}} {{end}}