diff --git a/templates/explore/dataset_left.tmpl b/templates/explore/dataset_left.tmpl new file mode 100644 index 000000000..a6d093fc0 --- /dev/null +++ b/templates/explore/dataset_left.tmpl @@ -0,0 +1,51 @@ +
+
+
+ + + +
+
+

{{.i18n.Tr "dataset.category"}}

+
+
+ {{range $category := categories}} + {{$.i18n.Tr (printf "dataset.category.%s" $category)}} + {{end}} + +
+
+
+
+

{{.i18n.Tr "dataset.task"}}

+
+
+ {{range $task := tasks}} + {{$.i18n.Tr (printf "dataset.task.%s" $task)}} + {{end}} +
+
+
+
+

{{.i18n.Tr "dataset.license"}}

+
+
+ {{range $license := licenses}} + {{$license}} + {{end}} +
+
+ +
+
+
\ No newline at end of file diff --git a/templates/explore/datasets.tmpl b/templates/explore/datasets.tmpl index 748d51ba8..6ba2a19a8 100644 --- a/templates/explore/datasets.tmpl +++ b/templates/explore/datasets.tmpl @@ -1,17 +1,171 @@ {{template "base/head" .}} +
{{template "explore/dataset_search" .}} -
-
- {{template "explore/navbar" .}} -
- {{template "explore/dataset_list" .}} - {{template "base/paginate" .}} -
-
- {{template "explore/repo_right" .}} +
+
+
+ + {{template "explore/dataset_left" .}} + +
+ + {{if .Datasets}} + + {{end}} + +
+
+ {{range $k, $v :=.Datasets}} +
+
+
+ {{.Repo.OwnerName}} / {{.Repo.Alias}} + +
+ +
+ ${starItems[{{$k}}]} +
+
+
{{.Title}}
+
+ {{if .Task}} + {{.Task}} + {{end}} + {{if .Category}} + {{.Category}} + {{end}} + {{if .License}} + {{.License}} + {{end}} +
+ +
+

{{.Description}}

+
+ +
+
+
+ + + + 创建于:{{TimeSinceUnix1 .CreatedUnix}} +
+
+
+ {{end}} + + +
+
+
{{template "base/footer" .}} + \ No newline at end of file diff --git a/templates/repo/attachment/edit.tmpl b/templates/repo/attachment/edit.tmpl new file mode 100644 index 000000000..8e8370fb3 --- /dev/null +++ b/templates/repo/attachment/edit.tmpl @@ -0,0 +1,98 @@ + + {{template "base/head" .}} +
+ {{template "repo/header" .}} +
+ +
+

+ 上传数据集文件 +

+
+
+ + {{.CsrfTokenHtml}} + + CPU/GPU + NPU + + + + + + + + + + + + + + + + +
+
+
+
+
+
+ +

说明:

+

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

+ +
+
+
+ {{template "base/footer" .}} + \ No newline at end of file diff --git a/templates/repo/datasets/create.tmpl b/templates/repo/datasets/create.tmpl index e7a2a4f8e..42c590252 100644 --- a/templates/repo/datasets/create.tmpl +++ b/templates/repo/datasets/create.tmpl @@ -36,20 +36,24 @@ - - + {{range $category := categories}} + + {{end}} + - - + {{range $task := tasks}} + + {{end}} - - + {{range $license := licenses}} + + {{end}} diff --git a/templates/repo/datasets/index.tmpl b/templates/repo/datasets/index.tmpl index 656f22a75..60d248e60 100755 --- a/templates/repo/datasets/index.tmpl +++ b/templates/repo/datasets/index.tmpl @@ -112,7 +112,7 @@

{{.dataset.Title}}

-
+
@@ -147,11 +147,11 @@
- + - - - + + + 上传
@@ -184,13 +184,13 @@
- {{range $k, $v :=.dataset.Attachments}} + {{range $k, $v :=.Attachments}}
- + {{.Name}} @@ -199,13 +199,20 @@ {{.Size | FileSize}}
- {{.Type}} + {{.Type | AttachmentResourceType}}
- {{.IsPrivate}} + {{$x:=.IsPrivate | AttachmentStatus}} + + {{$.i18n.Tr "home.show_private"}} + {{$.i18n.Tr "org.settings.visibility.public"}}
- 创建者 + {{if .Uploader.Name}} + + {{else}} + + {{end}}
{{.CreatedUnix | TimeSinceUnix1}} @@ -224,9 +231,13 @@ --> -
@@ -306,4 +315,5 @@ $('#dataset-range-value').find('.item').each(function(){ }) console.log(items) console.log({{$.IsStaringDataset}}) +console.log({{.Attachments}}) \ No newline at end of file diff --git a/web_src/js/index.js b/web_src/js/index.js index 178c8bd67..9c8289e52 100755 --- a/web_src/js/index.js +++ b/web_src/js/index.js @@ -3682,6 +3682,22 @@ function initVueDataset() { ruleForm._csrf = csrf } console.log(ruleForm) + const starItems = [] + const starActives = [] + $('#datasets-square-range-value').find('.item').each(function(){ + starItems.push($(this).data('num-stars')) + starActives.push($(this).data('star-active')) + }) + const taskLists = [] + const licenseLists = [] + $('#task-square-range-value').find('.item').each(function(){ + taskLists.push($(this).data('task')) + }) + $('#task-square-range-value').find('.item').each(function(){ + licenseLists.push($(this).data('license')) + }) + + // getEditInit(){ // if($('#dataset-edit-value')){ // $this = $('#dataset-edit-value') @@ -3701,8 +3717,16 @@ function initVueDataset() { url:'', type:0, desc:'', - datasetType:'全部', + datasetType:'', privates:[], + starItems:[], + starActives:[], + taskLists:[], + taskShow:[], + licenseLists:[], + licenseShow:[], + hasMoreBthHis: false, + showMoreHis:false, star_active:false, num_stars:0, ruleForm:{ @@ -3755,6 +3779,19 @@ function initVueDataset() { ObsUploader }, mounted(){ + // if(document.getElementById('postPath')){ + // this.url = document.getElementById('postPath').value + // } + // this.privates = items + // this.num_stars = num_stars + // this.star_active = star_active + // this.ruleForm1 = ruleForm + + // // this.getEditInit() + // this.getTypeList() + this.toggleHistoryData() //数据处理 + }, + created(){ if(document.getElementById('postPath')){ this.url = document.getElementById('postPath').value } @@ -3762,9 +3799,12 @@ function initVueDataset() { this.num_stars = num_stars this.star_active = star_active this.ruleForm1 = ruleForm - // this.getEditInit() - + this.getTypeList() + this.starItems = starItems + this.starActives = starActives + this.taskLists = taskLists + this.licenseLists = licenseLists }, methods:{ createDataset(formName){ @@ -3802,6 +3842,10 @@ function initVueDataset() { gotoUpload(datsetId){ location.href = `${AppSubUrl}/attachments/upload?datasetId=${datsetId}` }, + gotoDataset(datsetUrl){ + console.log(datsetUrl) + location.href = datsetUrl + }, uploadGpu(){ this.type=0 }, @@ -3871,31 +3915,91 @@ function initVueDataset() { }) }, - postStar(id,link,IsStaringDataset){ - console.log(id,link,IsStaringDataset) - if(IsStaringDataset){ + postStar(id,link){ + console.log(id,link) + if(this.star_active){ let url = link+'/'+ id + '/unstar' this.$axios.put(url).then((res)=>{ console.log(res) - if(res.Code===0){ - this.num_stars = this.num_stars + 1 + if(res.data.Code===0){ + this.star_active = false + this.num_stars = this.num_stars -1 } }) }else{ let url = link+'/'+ id + '/star' this.$axios.put(url).then((res)=>{ console.log(res) - this.star_active = true - if(res.Code===0){ + if(res.data.Code===0){ + this.star_active = true this.num_stars = this.num_stars + 1 } - }) } + }, + postSquareStar(id,link,index){ + console.log(id,link,index) + if(this.starItems[index]){ + let url = link+'/'+ id + '/unstar' + this.$axios.put(url).then((res)=>{ + console.log(res) + if(res.data.Code===0){ + this.$set(this.starActives,index,false) + this.$set(this.starItems,index,this.starItems[index]-1) + + } + }) + }else{ + let url = link+'/'+ id + '/star' + this.$axios.put(url).then((res)=>{ + console.log(res) + if(res.data.Code===0){ + this.$set(this.starActives,index,true) + this.$set(this.starItems,index,this.starItems[index]+1) + + } + }) + } + }, + getTypeList(){ + const params = new URLSearchParams(window.location.search) + console.log("init---",window.location.search && params.has('type')) + if( window.location.search && params.has('type')){ + if(params.get('type')==0){ + this.datasetType = '0' + } else if(params.get('type')==1){ + this.datasetType = '1' + }else{ + this.datasetType = '-1' + } + }else { + this.datasetType = '-1' + } + }, + changeDatasetType(val){ + console.log("---change",val) + const searchParams = new URLSearchParams(window.location.search) + console.log("-----change--",window.location.search,) + if (!window.location.search) { + window.location.href = window.location.href + '?type='+val + } else if (searchParams.has('type')) { + window.location.href = window.location.href.replace(/type=[0-9]/g,'type='+val) + } else { + window.location.href=window.location.href+'&type='+val + } + + + }, + gotoDatasetEidt(id){ + location.href = `/attachments/edit/${id}` + } + - } + }, + + }); }