diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index c96e6af3fc..3b352652c7 100755 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -2520,6 +2520,7 @@ datasets.name=name datasets.private=Private datasets.recommend=Set recommend datasets.unrecommend=Set unrecommend +datasets.only_recommend = Only show platform recommendations cloudbrain.all_task_types=All Task Types cloudbrain.all_computing_resources=All Computing Resources diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini index 27ba96c510..c9336310ae 100755 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -2530,6 +2530,7 @@ datasets.name=名称 datasets.private=私有 datasets.recommend=设为推荐 datasets.unrecommend=取消推荐 +datasets.only_recommend = 仅显示平台推荐 cloudbrain.all_task_types=全部任务类型 cloudbrain.all_computing_resources=全部计算资源 diff --git a/templates/admin/cloudbrain/imagecommit.tmpl b/templates/admin/cloudbrain/imagecommit.tmpl index e504f08b06..21ab73104a 100644 --- a/templates/admin/cloudbrain/imagecommit.tmpl +++ b/templates/admin/cloudbrain/imagecommit.tmpl @@ -29,7 +29,7 @@

{{.i18n.Tr "repo.submit_image"}}

- +
@@ -125,5 +125,4 @@
-{{template "base/footer" .}} - \ No newline at end of file +{{template "base/footer" .}} \ No newline at end of file diff --git a/templates/admin/dataset/list.tmpl b/templates/admin/dataset/list.tmpl index 3d32ec7a70..9e4e72b683 100644 --- a/templates/admin/dataset/list.tmpl +++ b/templates/admin/dataset/list.tmpl @@ -4,7 +4,6 @@
{{template "base/alert" .}}

{{.i18n.Tr "admin.datasets.dataset_manage_panel"}} ({{.i18n.Tr "admin.total" .Total}}) @@ -12,6 +11,15 @@
{{template "admin/dataset/search" .}}
+
+
+
+ + +
+
+
+
@@ -27,7 +35,7 @@ {{range .Datasets}} - + @@ -40,4 +48,4 @@ {{template "base/paginate" .}} -{{template "base/footer" .}} \ No newline at end of file +{{template "base/footer" .}} diff --git a/templates/admin/dataset/search.tmpl b/templates/admin/dataset/search.tmpl index 5d01d836c5..6b42fb6cf8 100644 --- a/templates/admin/dataset/search.tmpl +++ b/templates/admin/dataset/search.tmpl @@ -6,18 +6,18 @@ @@ -26,4 +26,4 @@ - + \ No newline at end of file diff --git a/templates/explore/datasets.tmpl b/templates/explore/datasets.tmpl index 3ffb0ec73b..7b2577900f 100644 --- a/templates/explore/datasets.tmpl +++ b/templates/explore/datasets.tmpl @@ -121,12 +121,12 @@ @@ -140,13 +140,13 @@ {{end}}
+ 仅显示平台推荐
{{range $k, $v :=.Datasets}}
- {{.Repo.OwnerName}} / {{.Repo.Alias}}{{if .Recommend}}{{end}} - + {{.Repo.OwnerName}} / {{.Repo.Alias}} {{if $.IsSigned}}
@@ -163,7 +163,7 @@ {{end}}
-
{{.Title}}
+
{{.Title}}{{if .Recommend}}{{end}}
{{if or (.Category) (.Task) (.License)}}
{{if .Category}} diff --git a/web_src/js/components/images/adminImages.vue b/web_src/js/components/images/adminImages.vue index 57d1c90eb4..3b372114c3 100644 --- a/web_src/js/components/images/adminImages.vue +++ b/web_src/js/components/images/adminImages.vue @@ -27,7 +27,7 @@
{{scope.row.numStars}}
- - - + 设为推荐 复制地址
diff --git a/web_src/js/features/images.js b/web_src/js/features/images.js index a6631f69c8..0cafb39011 100644 --- a/web_src/js/features/images.js +++ b/web_src/js/features/images.js @@ -165,12 +165,13 @@ export default async function initImage(){ return false }) $('#cancel_submit_image').click(()=>{ + console.log(pageform) if(link.includes('cloudbrain')){ let repoLink = link.split('cloudbrain')[0] location.href = `${window.config.AppSubUrl}${repoLink}debugjob?debugListType=all` }else if(pageform=='imageSquare'){ location.href = `${window.config.AppSubUrl}/explore/images?type=myimage` - }else if(pageform=='imageAdmin'){ + }else if(pageform){ location.href = `${window.config.AppSubUrl}/admin/images` } }) diff --git a/web_src/js/index.js b/web_src/js/index.js index 59024912d8..cfc27109e2 100755 --- a/web_src/js/index.js +++ b/web_src/js/index.js @@ -3700,6 +3700,37 @@ function initVueEditAbout() { } function initVueDataset() { + if($('#dataset_check').length){ + if(location.search.indexOf('recommend=true')!==-1){ + $('#dataset_check').checkbox('set checked') + }else{ + $('#dataset_check').checkbox('set unchecked') + } + $('#dataset_check').checkbox({ + onChecked: function() { + if(location.search){ + const params = new URLSearchParams(location.search) + if(params.has('recommend')){ + params.delete('recommend') + location.href = AppSubUrl + location.pathname + '?' + params.toString() + '&recommend=true' + }else{ + location.href = `${window.config.AppSubUrl}/admin/datasets${location.search}&recommend=true` + } + }else{ + location.href = `${window.config.AppSubUrl}/admin/datasets?recommend=true` + } + }, + onUnchecked: function() { + if(location.search=='?recommend=true'){ + location.href = AppSubUrl + location.pathname + }else{ + const params = new URLSearchParams(location.search) + params.delete('recommend') + location.href = AppSubUrl + location.pathname + '?' + params.toString() + } + }, + }) + } $('.set_dataset').on('click', function(){ const $this = $(this); let link = $this.data('url') @@ -3783,24 +3814,13 @@ function initVueDataset() { if(document.getElementById('dataset-file-desc')){ dataset_file_desc = document.getElementById('dataset-file-desc').value } - - // getEditInit(){ - // if($('#dataset-edit-value')){ - // $this = $('#dataset-edit-value') - // this.ruleForm.title = $this.data('edit-title') || '' - // this.ruleForm.description = $this.data('edit-description') || '' - // this.ruleForm.category = $this.data('edit-category') || '' - // this.ruleForm.task = $this.data('edit-task') || '' - // this.ruleForm.license = $this.data('edit-license') || '' - // this.ruleForm.id = $this.data('edit-id')|| '' - // } - // }, new Vue({ delimiters: ['${', '}'], el, data: { suburl: AppSubUrl, url:'', + checked:false, type:0, desc:'', descfile:'', @@ -3897,6 +3917,12 @@ function initVueDataset() { this.getCurrentRepoDataset(this.repolink,this.cloudbrainType) } + const params = new URLSearchParams(location.search) + if (params.has('recommend') && params.get('recommend')=='true'){ + this.checked = true + }else{ + this.checked = false + } }, created(){ if(document.getElementById('postPath')){ @@ -3937,6 +3963,30 @@ function initVueDataset() { } }, + handleCheckedChange(val){ + if(val){ + if(location.search){ + const params = new URLSearchParams(location.search) + if(params.has('recommend')){ + params.delete('recommend') + let search = params.toString() + location.href = `${AppSubUrl}/explore/datasets?${search}&recommend=${val}` + }else{ + location.href = `${AppSubUrl}/explore/datasets${location.search}&recommend=${val}` + } + }else{ + location.href = `${AppSubUrl}/explore/datasets?recommend=${val}` + } + }else{ + if(location.search=='?recommend=true'){ + location.href = AppSubUrl + location.pathname + }else{ + const params = new URLSearchParams(location.search) + params.delete('recommend') + location.href = AppSubUrl + location.pathname + '?' + params.toString() + } + } + }, createDataset(formName){ let _this = this this.$refs[formName].validate((valid)=>{
{{.ID}}{{.Title}}{{if .Recommend}}{{end}}{{.Title}}{{if .Recommend}}{{end}} {{.CreatedUnix.FormatShort}} {{if .Recommend}}{{$.i18n.Tr "admin.datasets.unrecommend"}}{{else}}{{$.i18n.Tr "admin.datasets.recommend"}}{{end}}