From b1e33ebb1564d087aee2e7e944cb3e953bdbb17c Mon Sep 17 00:00:00 2001 From: zhoupzh Date: Wed, 23 Mar 2022 15:40:44 +0800 Subject: [PATCH] fix issue --- options/locale/locale_en-US.ini | 29 ++++++++- options/locale/locale_zh-CN.ini | 30 ++++++++- templates/custom/select_dataset.tmpl | 63 ++++++++++++++++-- templates/explore/datasets.tmpl | 12 ++-- templates/repo/attachment/edit.tmpl | 6 +- templates/repo/attachment/upload.tmpl | 49 ++++---------- templates/repo/cloudbrain/new.tmpl | 27 +------- templates/repo/datasets/create.tmpl | 28 ++++---- templates/repo/datasets/edit.tmpl | 28 ++++---- templates/repo/datasets/index.tmpl | 97 +++++++++++++++------------ templates/repo/modelarts/notebook/new.tmpl | 27 +++----- web_src/js/components/MinioUploader.vue | 10 ++- web_src/js/index.js | 101 +++++++++++++++++++++++++---- web_src/less/_dataset.less | 35 ++++++++++ 14 files changed, 360 insertions(+), 182 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 5d7517aae..a52f02b79 100755 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -796,6 +796,33 @@ owner_dataset=Owner Dataset public_dataset=Public Dataset I_liked = I Liked use = Use +create_new_dataset = Create New Dataset +dataset_name = Dataset Name +dataset_description = Dataset Description +select_category = Select Category +select_task = Select Research Direction/Application Area +dataset_name_tooltips = Please enter letters, numbers, _ and - up to 64 characters and cannot end with a dash (-). +dataset_no_create = No dataset has been created yet +dataset_explain = Dataset: CloudBrain I provides CPU/GPU resources, Cloudbrain II provides Ascend NPU resources, and the data set used for debugging also needs to be uploaded to the corresponding environment; +dataset_instructions_for_use = Instructions for use: You can refer to Qizhi AI Collaboration Platform +dataset_camp_course = Newcomer Training Camp Course; +dataset_upload = Upload +dataset_file_name = File Name +dataset_available_clusters = Available Clusters +dataset_upload_time = Upload Time +download = Download +modify_description = Modify Description +set_public = Set Public +set_private = Set Private +annotation = Annotation +upload_dataset_file = Upload Dataset File +file_description = File Description +data_upload = Dataset Upload +illustrate = Illustrate +illustrate.only = Only Datasets In +illustrate.zip = Zip Format +illustrate.fisrt_end = Can Initiate Cloudbrain Tasks +modify_dataset = Modify Dataset [repo] owner = Owner repo_name = Repository Name @@ -825,7 +852,7 @@ repo_label_helpe = Press Enter to complete issue_labels = Issue Labels issue_labels_helper = Select an issue label set. license = License -license_helper = Select a license file. +license_helper = Select a license file readme = README readme_helper = Select a README file template. auto_init = Initialize Repository (Adds .gitignore, License and README) diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini index 885d987fc..e1595e36d 100755 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -801,6 +801,34 @@ owner_dataset=我的数据集 public_dataset=公开数据集 I_liked=我收藏的 use=使用 +create_new_dataset = 新建数据集 +dataset_name=数据集名称 +dataset_description = 数据集描述 +select_category = 选择分类 +select_task = 选择研究方向/应用领域 +dataset_name_tooltips = 请输入字母、数字、_和-,最长64个字符,且不能以中划线(-)结尾。 +dataset_no_create = 还未创建过数据集 +dataset_explain = 数据集:云脑1提供 CPU / GPU 资源,云脑2提供 Ascend NPU 资源,调试使用的数据集也需要上传到对应的环境; +dataset_instructions_for_use = 使用说明:可以参考启智AI协作平台 +dataset_camp_course = 小白训练营课程 +dataset_upload = 上传 +dataset_file_name = 文件名字 +dataset_available_clusters = 可用集群 +dataset_upload_time = 上传时间 +download = 下载 +modify_description = 修改描述 +set_public = 设为公开 +set_private = 设为私有 +annotation = 标注 +upload_dataset_file = 上传数据集文件 +file_description = 文件描述 +data_upload = 数据上传 +illustrate = 说明 +illustrate.only = 只有 +illustrate.zip = zip格式 +illustrate.fisrt_end = 的数据集才能发起云脑任务 +modify_dataset = 修改数据集 + [repo] owner=拥有者 repo_name=项目名称 @@ -830,7 +858,7 @@ repo_label_helpe=输入完成后回车键完成标签确定。 issue_labels=任务标签 issue_labels_helper=选择一个任务标签集 license=授权许可 -license_helper=选择授权许可文件。 +license_helper=选择授权许可文件 readme=自述 readme_helper=选择自述文件模板。 auto_init=初始化存储库 (添加. gitignore、许可证和自述文件) diff --git a/templates/custom/select_dataset.tmpl b/templates/custom/select_dataset.tmpl index c782efc28..e63b38202 100644 --- a/templates/custom/select_dataset.tmpl +++ b/templates/custom/select_dataset.tmpl @@ -1,8 +1,27 @@ +
- + {{.i18n.Tr "dataset.select_dataset"}}
- + + + + 解压中 + + + + 解压失败 +
@@ -45,7 +72,15 @@
- + + + + 解压中 + + + + 解压失败 +
@@ -55,14 +90,22 @@
${dataset.Repo.OwnerName}/${dataset.Repo.Alias}${dataset.Name}
- + ${dataset.Description}
- + + + + 解压中 + + + + 解压失败 +
@@ -79,7 +122,15 @@
- + + + + 解压中 + + + + 解压失败 +
diff --git a/templates/explore/datasets.tmpl b/templates/explore/datasets.tmpl index f161b78da..924f6efba 100644 --- a/templates/explore/datasets.tmpl +++ b/templates/explore/datasets.tmpl @@ -117,7 +117,7 @@ {{.i18n.Tr "repo.issues.filter_sort.oldest"}} {{.i18n.Tr "repo.issues.filter_sort.recentupdate"}} {{.i18n.Tr "repo.issues.filter_sort.leastupdate"}} - {{.i18n.Tr "repo.issues.filter_sort.downloadtimes"}} + @@ -155,11 +155,13 @@
{{.Title}}
- {{if .Task}} - {{.Task}} - {{end}} {{if .Category}} - {{.Category}} + {{$category := .Category}} + {{$.i18n.Tr (printf "dataset.category.%s" $category)}} + {{end}} + {{if .Task}} + {{$task := .Task}} + {{$.i18n.Tr (printf "dataset.task.%s" $task)}} {{end}} {{if .License}} {{.License}} diff --git a/templates/repo/attachment/edit.tmpl b/templates/repo/attachment/edit.tmpl index 966e78b34..611447548 100644 --- a/templates/repo/attachment/edit.tmpl +++ b/templates/repo/attachment/edit.tmpl @@ -31,8 +31,8 @@ - 确定 - 取消 + 确定 + 取消 @@ -45,6 +45,6 @@ {{template "base/footer" .}} \ No newline at end of file diff --git a/templates/repo/attachment/upload.tmpl b/templates/repo/attachment/upload.tmpl index 167a65aae..a600d3357 100644 --- a/templates/repo/attachment/upload.tmpl +++ b/templates/repo/attachment/upload.tmpl @@ -1,12 +1,4 @@ - {{template "base/head" .}}
{{template "repo/header" .}} @@ -14,42 +6,28 @@

- 上传数据集文件 + {{$.i18n.Tr "dataset.upload_dataset_file"}}

{{.CsrfTokenHtml}} - + CPU/GPU NPU - + - + - - - - - - - +
@@ -83,16 +63,15 @@ - 只有zip格式zip格式的数据集才能发起云脑任务;
- 云脑1提供 CPU / GPU 资源,云脑2提供 Ascend NPU 资源;调试使用的数据集也需要上传到对应的环境。

--> -

说明:

-

只有zip格式的数据集才能发起云脑任务;
- 云脑1提供CPU / GPU资源,云脑2提供Ascend NPU资源;调试使用的数据集也需要上传到对应的环境;

+

{{$.i18n.Tr "dataset.illustrate"}}:

+

{{$.i18n.Tr "dataset.illustrate.only"}}{{$.i18n.Tr "dataset.illustrate.zip"}}{{$.i18n.Tr "dataset.illustrate.fisrt_end"}};
+ {{$.i18n.Tr "dataset.dataset_explain"}}

{{template "base/footer" .}} \ No newline at end of file diff --git a/templates/repo/cloudbrain/new.tmpl b/templates/repo/cloudbrain/new.tmpl index e179efe7a..08cd6144a 100755 --- a/templates/repo/cloudbrain/new.tmpl +++ b/templates/repo/cloudbrain/new.tmpl @@ -101,32 +101,7 @@ } - .panel_creator_reponam{ - display: inline-block; - border-radius: 4px; - padding: 4px; - font-size: 12px; - text-align: center; - background-color: rgba(161, 220, 255, 0.2); - color: #101010; - } - .panel_dataset_name{ - font-size: 15px; - color: #0366D6; - text-align: center; - margin-left: 1rem; - } - .panel_datset_desc{ - white-space: nowrap; - display: inline-block; - overflow: hidden; - width: 90%; - - text-overflow: ellipsis; - } - .el-dialog__body{ - padding-top:0 - } +
diff --git a/templates/repo/datasets/create.tmpl b/templates/repo/datasets/create.tmpl index 52c6a77d8..bd2a4136d 100644 --- a/templates/repo/datasets/create.tmpl +++ b/templates/repo/datasets/create.tmpl @@ -20,45 +20,45 @@

- {{.i18n.Tr "repo.modelarts.train_job.new_infer"}} + {{.i18n.Tr "dataset.create_new_dataset"}}

{{.CsrfTokenHtml}} - + - 请输入字母、数字、_和-,最长64个字符,且不能以中划线(-)结尾。 + {{.i18n.Tr "dataset.dataset_name_tooltips"}} - + - - + + {{range $category := categories}} - + {{end}} - - + + {{range $task := tasks}} - + {{end}} - - + + {{range $license := licenses}} {{end}} - 确定 - 取消 + {{.i18n.Tr "repo.confirm_choice"}} + {{.i18n.Tr "cancel"}}
diff --git a/templates/repo/datasets/edit.tmpl b/templates/repo/datasets/edit.tmpl index 4aaaa5f24..6de84a4c9 100644 --- a/templates/repo/datasets/edit.tmpl +++ b/templates/repo/datasets/edit.tmpl @@ -20,7 +20,7 @@

- 修改数据集 + {{.i18n.Tr "dataset.modify_dataset"}}

${num_stars} {{end}} - 修改 + {{.i18n.Tr "repo.modelarts.modify"}}
- {{if .dataset.Task}} - {{.dataset.Task}} - {{end}} {{if .dataset.Category}} - {{.dataset.Category}} + {{$category := .dataset.Category}} + {{$.i18n.Tr (printf "dataset.category.%s" $category)}} + {{end}} + {{if .dataset.Task}} + {{$task := .dataset.Task}} + {{$.i18n.Tr (printf "dataset.task.%s" $task)}} {{end}} {{if .dataset.License}} {{.dataset.License}} @@ -157,11 +159,11 @@
- + - 上传 + {{$.i18n.Tr "dataset.dataset_upload"}}
@@ -170,25 +172,25 @@
- 文件名称 + {{$.i18n.Tr "dataset.dataset_file_name"}}
- 大小 + {{$.i18n.Tr "repo.model.manage.size"}}
- 存储位置 + {{$.i18n.Tr "dataset.dataset_available_clusters"}}
- 状态 + {{$.i18n.Tr "repo.modelarts.status"}}
- 创建者 + {{$.i18n.Tr "repo.cloudbrain_creator"}}
- 上传时间 + {{$.i18n.Tr "dataset.dataset_upload_time"}}
- 操作 + {{$.i18n.Tr "repo.cloudbrain_operate"}}
@@ -197,23 +199,26 @@
-
+
{{if .Description}} -
{{.Description}}
下载:{{.DownloadCount}}
- +
{{.Description}}
{{$.i18n.Tr "dataset.download"}}:{{.DownloadCount}}
+
{{.Name}}
{{else}} -
下载:{{.DownloadCount}}
- +
{{$.i18n.Tr "dataset.download"}}:{{.DownloadCount}}
+
{{.Name}}
{{end}} +
{{.Size | FileSize}} @@ -251,32 +256,38 @@ -->
- {{if $.CanRead}} - 下载 - {{else}} - 下载 - {{end}} + + {{$.i18n.Tr "dataset.download"}} + {{if eq .DecompressState 1}} - 预览 + {{$.i18n.Tr "preview"}} {{end}} - {{if $.CanRead}} + {{if .CanDel}} + {{$.i18n.Tr "dataset.set_public"}} + {{$.i18n.Tr "dataset.set_private"}} + {{else}} + {{$.i18n.Tr "dataset.set_public"}} + {{$.i18n.Tr "dataset.set_private"}} + {{end}} + - 更多 + {{$.i18n.Tr "repo.more"}} - 复制下载链接 - 复制文件MD5 + {{$.i18n.Tr "dataset.copy_url"}} + {{$.i18n.Tr "dataset.copy_md5"}} + {{if $.CanWrite}} + {{$.i18n.Tr "dataset.annotation"}} + {{end}} {{if .CanDel}} - 设为公有 - 设为私有 - 修改描述 - 删除 + {{$.i18n.Tr "dataset.modify_description"}} + {{$.i18n.Tr "dataset.delete"}} {{end}} @@ -310,13 +321,13 @@ {{else}}
-
还未创建过数据集
+
{{.i18n.Tr "dataset.dataset_no_create"}}
{{if $.CanWrite}} -
新建数据集 + {{.i18n.Tr "dataset.create_new_dataset"}} {{end}}
-
数据集:云脑1提供 CPU / GPU 资源,云脑2提供 Ascend NPU 资源,调试使用的数据集也需要上传到对应的环境;
-
使用说明:可以参考启智AI协作平台小白训练营课程。
+
{{.i18n.Tr "dataset.dataset_explain"}}
+
{{.i18n.Tr "dataset.dataset_instructions_for_use"}}{{.i18n.Tr "dataset.dataset_camp_course"}}
{{end}} @@ -336,7 +347,7 @@ \ No newline at end of file diff --git a/web_src/js/components/MinioUploader.vue b/web_src/js/components/MinioUploader.vue index 0b73f55ca..6e40c924e 100755 --- a/web_src/js/components/MinioUploader.vue +++ b/web_src/js/components/MinioUploader.vue @@ -8,8 +8,8 @@ {{ file_status_text }} {{ status }}

- 上传 - 取消 + {{upload}} + {{cancel}} @@ -51,7 +51,9 @@ export default { file_status_text: '', file:{}, repoPath:'', - btnFlag:false + btnFlag:false, + cancel:'', + upload:'', }; }, @@ -60,6 +62,8 @@ export default { this.file_status_text = this.dropzoneParams.data('file-status'); this.status = this.dropzoneParams.data('file-init-status'); this.repoPath = this.dropzoneParams.data('repopath'); + this.cancel = this.dropzoneParams.data('cancel'); + this.upload = this.dropzoneParams.data('upload'); // let previewTemplate = ''; // previewTemplate += '
\n '; // previewTemplate += '
\n '; diff --git a/web_src/js/index.js b/web_src/js/index.js index 6e308e973..41ca26a50 100755 --- a/web_src/js/index.js +++ b/web_src/js/index.js @@ -3681,8 +3681,10 @@ function initVueDataset() { }) } const items = [] + const zipStatus = [] $('#dataset-range-value').find('.item').each(function(){ items.push($(this).data('private')) + zipStatus.push($(this).data('decompress-state')) }) let num_stars = $('#dataset-range-value').data('num-stars') let star_active = $('#dataset-range-value').data('star-active') @@ -3739,6 +3741,7 @@ function initVueDataset() { descfile:'', datasetType:'', privates:[], + zipStatus:[], starItems:[], starActives:[], taskLists:[], @@ -3763,6 +3766,7 @@ function initVueDataset() { dataset_uuid:'', dataset_name:'', loadingDataIndex:true, + timer:null, ruleForm:{ title:'', description:'', @@ -3835,6 +3839,7 @@ function initVueDataset() { this.url = document.getElementById('postPath').value } this.privates = items + this.zipStatus = zipStatus this.num_stars = num_stars this.star_active = star_active this.ruleForm1 = ruleForm @@ -3847,7 +3852,7 @@ function initVueDataset() { this.descfile = dataset_file_desc this.repolink = repolink this.cloudbrainType = cloudbrainType - console.log(this.starItems,this.starActives) + console.log(this.starItems,this.starActives,this.zipStatus) }, methods:{ handleCurrentChange(val) { @@ -3904,18 +3909,21 @@ function initVueDataset() { } else{ console.log(attachment) - location.href = '/'+attachment + '/datasets' + location.href = `${AppSubUrl}${attachment}/datasets` } }, - gotoUpload(datsetId){ - location.href = `${AppSubUrl}/attachments/upload?datasetId=${datsetId}` + gotoUpload(repolink,datsetId){ + location.href = `${AppSubUrl}${repolink}/datasets/attachments/upload?datasetId=${datsetId}` }, gotoDataset(datsetUrl){ console.log(datsetUrl) location.href = datsetUrl }, + gotoAnnotate(repolink,uuid,type){ + location.href = `${AppSubUrl}${repolink}/datasets/label/${uuid}?type=${type}` + }, uploadGpu(){ this.type=0 }, @@ -3993,7 +4001,7 @@ function initVueDataset() { // document.getElementById("mask").style.display = "block" this.$axios.post(url,this.qs.stringify(params)).then((res)=>{ if(res.data.Code===0){ - location.href = '/'+backurl + '/datasets' + location.href = `${AppSubUrl}${backurl}/datasets` }else{ console.log(res.data.Message) } @@ -4082,8 +4090,8 @@ function initVueDataset() { }, - gotoDatasetEidt(id){ - location.href = `/attachments/edit/${id}` + gotoDatasetEidt(repolink,id){ + location.href = `${repolink}/datasets/attachments/edit/${id}` }, handleClick(repoLink, tabName,type) { @@ -4110,7 +4118,57 @@ function initVueDataset() { this.getStarDataset(repoLink,type) } }, + polling (checkStatuDataset,repoLink) { + console.log("===polling===checkStatuDataset===",checkStatuDataset,repoLink) + this.timer = window.setInterval(() => { + setTimeout(() => { + this.getDatasetStatus(checkStatuDataset,repoLink) + },0) + },15000) + + }, + + getDatasetStatus(checkStatuDataset,repoLink){ + const getmap = checkStatuDataset.map((item)=>{ + let url = `${AppSubUrl}${repolink}/datasets/status/${item.UUID}` + console.log("map item",item,url) + return this.$axios.get(url) + }) + console.log(getmap) + this.$axios.all(getmap) + .then((res)=>{ + console.log(res,this.timer) + let flag = res.some((item)=>{ + console.log(item.data) + return item.data.AttachmentStatus == 1 + }) + console.log(flag) + flag && clearInterval(this.timer) + flag && this.refreshStatusDataset() + + } + ) + + }, + refreshStatusDataset(){ + console.log("refresh") + switch(this.activeName){ + case 'first': + this.getCurrentRepoDataset(this.repolink,this.cloudbrainType) + break + case 'second': + this.getMyDataset(this.repolink,this.cloudbrainType) + break + case 'third': + this.getPublicDataset(this.repolink,this.cloudbrainType) + break + case 'fourth': + this.getStarDataset(this.repolink,this.cloudbrainType) + break + } + }, getCurrentRepoDataset(repoLink,type){ + clearInterval(this.timer) this.loadingDataIndex = true let url = repoLink + '/datasets/current_repo' this.$axios.get(url,{ @@ -4124,11 +4182,17 @@ function initVueDataset() { console.log(JSON.parse(res.data.data)) console.log(res.data.count) this.currentRepoDataset = JSON.parse(res.data.data) + const checkStatuDataset = this.currentRepoDataset.filter(item=>item.DecompressState===2) + console.log("=========checkStatuDataset",checkStatuDataset,repoLink) + if(checkStatuDataset.length>0){ + this.polling(checkStatuDataset,repoLink) + } this.totalnums = parseInt(res.data.count) this.loadingDataIndex = false }) }, getMyDataset(repoLink,type){ + clearInterval(this.timer) this.loadingDataIndex = true let url = repoLink + '/datasets/my_datasets' this.$axios.get(url,{ @@ -4141,12 +4205,18 @@ function initVueDataset() { console.log(res) console.log(JSON.parse(res.data.data)) this.myDataset = JSON.parse(res.data.data) + const checkStatuDataset = this.myDataset.filter(item=>item.DecompressState===2) + console.log("=========checkStatuDataset",checkStatuDataset,repoLink) + if(checkStatuDataset.length>0){ + this.polling(checkStatuDataset,repoLink) + } this.totalnums = parseInt(res.data.count) this.loadingDataIndex = false }) }, getPublicDataset(repoLink,type){ + clearInterval(this.timer) this.loadingDataIndex = true let url = repoLink + '/datasets/public_datasets' this.$axios.get(url,{ @@ -4159,12 +4229,18 @@ function initVueDataset() { console.log(res) console.log(JSON.parse(res.data.data)) this.publicDataset = JSON.parse(res.data.data) + const checkStatuDataset = this.publicDataset.filter(item=>item.DecompressState===2) + console.log("=========checkStatuDataset",checkStatuDataset,repoLink) + if(checkStatuDataset.length>0){ + this.polling(checkStatuDataset,repoLink) + } this.totalnums = parseInt(res.data.count) this.loadingDataIndex = false }) }, getStarDataset(repoLink,type){ + clearInterval(this.timer) this.loadingDataIndex = true let url = repoLink + '/datasets/my_favorite' this.$axios.get(url,{ @@ -4177,6 +4253,11 @@ function initVueDataset() { console.log(res) console.log(JSON.parse(res.data.data)) this.myFavoriteDataset = JSON.parse(res.data.data) + const checkStatuDataset = this.myFavoriteDataset.filter(item=>item.DecompressState===2) + console.log("=========checkStatuDataset",checkStatuDataset,repoLink) + if(checkStatuDataset.length>0){ + this.polling(checkStatuDataset,repoLink) + } this.totalnums= parseInt(res.data.count) this.loadingDataIndex = false }) @@ -4209,13 +4290,7 @@ function initVueDataset() { break } } - - - - }, - - }); } diff --git a/web_src/less/_dataset.less b/web_src/less/_dataset.less index 3bc19ef63..35a87f89f 100644 --- a/web_src/less/_dataset.less +++ b/web_src/less/_dataset.less @@ -222,3 +222,38 @@ } } } +.panel_creator_reponam{ + display: inline-block; + border-radius: 4px; + padding: 4px; + font-size: 12px; + text-align: center; + background-color: rgba(161, 220, 255, 0.2); + color: #101010; +} +.panel_dataset_name{ + font-size: 15px; + color: #0366D6; + text-align: center; + margin-left: 1rem; +} +.panel_datset_desc{ + white-space: nowrap; + display: inline-block; + overflow: hidden; + width: 90%; + + text-overflow: ellipsis; +} +.el-dialog__body{ + padding-top:0 +} +#dataset-base{ + .active{ + color: #0087f5!important; + border: 1px solid #0087f5!important; + /* margin: -1px!important; */ + background: #fff!important; + + } +} \ No newline at end of file