@@ -2512,6 +2512,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 | |||
@@ -2522,6 +2522,7 @@ datasets.name=名称 | |||
datasets.private=私有 | |||
datasets.recommend=设为推荐 | |||
datasets.unrecommend=取消推荐 | |||
datasets.only_recommend = 仅显示平台推荐 | |||
cloudbrain.all_task_types=全部任务类型 | |||
cloudbrain.all_computing_resources=全部计算资源 | |||
@@ -4,7 +4,6 @@ | |||
<div class="ui container"> | |||
{{template "base/alert" .}} | |||
<div class="ui negative message" style="display: none;"> | |||
</div> | |||
<h4 class="ui top attached header"> | |||
{{.i18n.Tr "admin.datasets.dataset_manage_panel"}} ({{.i18n.Tr "admin.total" .Total}}) | |||
@@ -12,6 +11,15 @@ | |||
<div class="ui attached segment"> | |||
{{template "admin/dataset/search" .}} | |||
</div> | |||
<div class="ui attached segment"> | |||
<div class="ui ten wide column"> | |||
<div class="ui checkbox" id="dataset_check"> | |||
<input type="checkbox"> | |||
<label>{{.i18n.Tr "admin.datasets.only_recommend"}}</label> | |||
</div> | |||
</div> | |||
</div> | |||
<div class="ui attached table segment"> | |||
<table class="ui very basic striped table"> | |||
<thead> | |||
@@ -6,18 +6,18 @@ | |||
<i class="dropdown icon"></i> | |||
</span> | |||
<div class="menu"> | |||
<a class='{{if or (eq .SortType "oldest") (not .SortType)}}active{{end}} item' href='{{$.Link}}?sort=oldest&q={{$.Keyword}}'>{{.i18n.Tr "repo.issues.filter_sort.oldest"}}</a> | |||
<a class='{{if eq .SortType "newest"}}active{{end}} item' href='{{$.Link}}?sort=newest&q={{$.Keyword}}'>{{.i18n.Tr "repo.issues.filter_sort.latest"}}</a> | |||
<a class='{{if eq .SortType "alphabetically"}}active{{end}} item' href='{{$.Link}}?sort=alphabetically&q={{$.Keyword}}'>{{.i18n.Tr "repo.issues.label.filter_sort.alphabetically"}}</a> | |||
<a class='{{if eq .SortType "reversealphabetically"}}active{{end}} item' href='{{$.Link}}?sort=reversealphabetically&q={{$.Keyword}}'>{{.i18n.Tr "repo.issues.label.filter_sort.reverse_alphabetically"}}</a> | |||
<a class='{{if eq .SortType "recentupdate"}}active{{end}} item' href='{{$.Link}}?sort=recentupdate&q={{$.Keyword}}'>{{.i18n.Tr "repo.issues.filter_sort.recentupdate"}}</a> | |||
<a class='{{if eq .SortType "leastupdate"}}active{{end}} item' href='{{$.Link}}?sort=leastupdate&q={{$.Keyword}}'>{{.i18n.Tr "repo.issues.filter_sort.leastupdate"}}</a> | |||
<a class='{{if eq .SortType "moststars"}}active{{end}} item' href='{{$.Link}}?sort=moststars&q={{$.Keyword}}&tab={{$.TabName}}'>{{.i18n.Tr "repo.issues.filter_sort.moststars"}}</a> | |||
<a class='{{if eq .SortType "feweststars"}}active{{end}} item' href='{{$.Link}}?sort=feweststars&q={{$.Keyword}}&tab={{$.TabName}}'>{{.i18n.Tr "repo.issues.filter_sort.feweststars"}}</a> | |||
<a class='{{if eq .SortType "mostforks"}}active{{end}} item' href='{{$.Link}}?sort=mostforks&q={{$.Keyword}}&tab={{$.TabName}}'>{{.i18n.Tr "repo.issues.filter_sort.mostforks"}}</a> | |||
<a class='{{if eq .SortType "fewestforks"}}active{{end}} item' href='{{$.Link}}?sort=fewestforks&q={{$.Keyword}}&tab={{$.TabName}}'>{{.i18n.Tr "repo.issues.filter_sort.fewestforks"}}</a> | |||
<a class='{{if eq .SortType "size"}}active{{end}} item' href='{{$.Link}}?sort=size&q={{$.Keyword}}'>{{.i18n.Tr "repo.issues.label.filter_sort.by_size"}}</a> | |||
<a class='{{if eq .SortType "reversesize"}}active{{end}} item' href='{{$.Link}}?sort=reversesize&q={{$.Keyword}}'>{{.i18n.Tr "repo.issues.label.filter_sort.reverse_by_size"}}</a> | |||
<a class='{{if or (eq .SortType "oldest") (not .SortType)}}active{{end}} item' href='{{$.Link}}?sort=oldest&q={{$.Keyword}}&recommend={{$.Recommend}}'>{{.i18n.Tr "repo.issues.filter_sort.oldest"}}</a> | |||
<a class='{{if eq .SortType "newest"}}active{{end}} item' href='{{$.Link}}?sort=newest&q={{$.Keyword}}&recommend={{$.Recommend}}'>{{.i18n.Tr "repo.issues.filter_sort.latest"}}</a> | |||
<a class='{{if eq .SortType "alphabetically"}}active{{end}} item' href='{{$.Link}}?sort=alphabetically&q={{$.Keyword}}&recommend={{$.Recommend}}'>{{.i18n.Tr "repo.issues.label.filter_sort.alphabetically"}}</a> | |||
<a class='{{if eq .SortType "reversealphabetically"}}active{{end}} item' href='{{$.Link}}?sort=reversealphabetically&q={{$.Keyword}}&recommend={{$.Recommend}}'>{{.i18n.Tr "repo.issues.label.filter_sort.reverse_alphabetically"}}</a> | |||
<a class='{{if eq .SortType "recentupdate"}}active{{end}} item' href='{{$.Link}}?sort=recentupdate&q={{$.Keyword}}&recommend={{$.Recommend}}'>{{.i18n.Tr "repo.issues.filter_sort.recentupdate"}}</a> | |||
<a class='{{if eq .SortType "leastupdate"}}active{{end}} item' href='{{$.Link}}?sort=leastupdate&q={{$.Keyword}}&recommend={{$.Recommend}}'>{{.i18n.Tr "repo.issues.filter_sort.leastupdate"}}</a> | |||
<a class='{{if eq .SortType "moststars"}}active{{end}} item' href='{{$.Link}}?sort=moststars&q={{$.Keyword}}&tab={{$.TabName}}&recommend={{$.Recommend}}'>{{.i18n.Tr "repo.issues.filter_sort.moststars"}}</a> | |||
<a class='{{if eq .SortType "feweststars"}}active{{end}} item' href='{{$.Link}}?sort=feweststars&q={{$.Keyword}}&tab={{$.TabName}}&recommend={{$.Recommend}}'>{{.i18n.Tr "repo.issues.filter_sort.feweststars"}}</a> | |||
<a class='{{if eq .SortType "mostforks"}}active{{end}} item' href='{{$.Link}}?sort=mostforks&q={{$.Keyword}}&tab={{$.TabName}}&recommend={{$.Recommend}}'>{{.i18n.Tr "repo.issues.filter_sort.mostforks"}}</a> | |||
<a class='{{if eq .SortType "fewestforks"}}active{{end}} item' href='{{$.Link}}?sort=fewestforks&q={{$.Keyword}}&tab={{$.TabName}}&recommend={{$.Recommend}}'>{{.i18n.Tr "repo.issues.filter_sort.fewestforks"}}</a> | |||
<a class='{{if eq .SortType "size"}}active{{end}} item' href='{{$.Link}}?sort=size&q={{$.Keyword}}&recommend={{$.Recommend}}'>{{.i18n.Tr "repo.issues.label.filter_sort.by_size"}}</a> | |||
<a class='{{if eq .SortType "reversesize"}}active{{end}} item' href='{{$.Link}}?sort=reversesize&q={{$.Keyword}}&recommend={{$.Recommend}}'>{{.i18n.Tr "repo.issues.label.filter_sort.reverse_by_size"}}</a> | |||
</div> | |||
</div> | |||
</div> | |||
@@ -27,3 +27,6 @@ | |||
<button class="ui blue button">{{.i18n.Tr "explore.search"}}</button> | |||
</div> | |||
</form> | |||
<script> | |||
console.log({{.Recommend}}) | |||
</script> |
@@ -121,12 +121,12 @@ | |||
<i class="dropdown icon"></i> | |||
</span> | |||
<div class="menu"> | |||
<a class="{{if eq .SortType "newest"}}active{{end}} item" href="{{$.Link}}?sort=newest&q={{$.Keyword}}&tab={{$.TabName}}&category={{$.Category}}&task={{$.Task}}&license={{$.License}}">{{.i18n.Tr "repo.issues.filter_sort.latest"}}</a> | |||
<a class="{{if eq .SortType "oldest"}}active{{end}} item" href="{{$.Link}}?sort=oldest&q={{$.Keyword}}&tab={{$.TabName}}&category={{$.Category}}&task={{$.Task}}&license={{$.License}}">{{.i18n.Tr "repo.issues.filter_sort.oldest"}}</a> | |||
<a class="{{if eq .SortType "recentupdate"}}active{{end}} item" href="{{$.Link}}?sort=recentupdate&q={{$.Keyword}}&tab={{$.TabName}}&category={{$.Category}}&task={{$.Task}}&license={{$.License}}">{{.i18n.Tr "repo.issues.filter_sort.recentupdate"}}</a> | |||
<a class="{{if eq .SortType "leastupdate"}}active{{end}} item" href="{{$.Link}}?sort=leastupdate&q={{$.Keyword}}&tab={{$.TabName}}&category={{$.Category}}&task={{$.Task}}&license={{$.License}}">{{.i18n.Tr "repo.issues.filter_sort.leastupdate"}}</a> | |||
<a class="{{if eq .SortType "downloadtimes"}}active{{end}} item" href="{{$.Link}}?sort=downloadtimes&q={{$.Keyword}}&tab={{$.TabName}}&category={{$.Category}}&task={{$.Task}}&license={{$.License}}">{{.i18n.Tr "repo.issues.filter_sort.downloadtimes"}}</a> | |||
<a class="{{if eq .SortType "moststars"}}active{{end}} item" href="{{$.Link}}?sort=moststars&q={{$.Keyword}}&tab={{$.TabName}}&category={{$.Category}}&task={{$.Task}}&license={{$.License}}">{{.i18n.Tr "repo.issues.filter_sort.moststars"}}</a> | |||
<a class="{{if eq .SortType "newest"}}active{{end}} item" href="{{$.Link}}?sort=newest&q={{$.Keyword}}&tab={{$.TabName}}&category={{$.Category}}&task={{$.Task}}&license={{$.License}}&recommend={{$.Recommend}}">{{.i18n.Tr "repo.issues.filter_sort.latest"}}</a> | |||
<a class="{{if eq .SortType "oldest"}}active{{end}} item" href="{{$.Link}}?sort=oldest&q={{$.Keyword}}&tab={{$.TabName}}&category={{$.Category}}&task={{$.Task}}&license={{$.License}}&recommend={{$.Recommend}}">{{.i18n.Tr "repo.issues.filter_sort.oldest"}}</a> | |||
<a class="{{if eq .SortType "recentupdate"}}active{{end}} item" href="{{$.Link}}?sort=recentupdate&q={{$.Keyword}}&tab={{$.TabName}}&category={{$.Category}}&task={{$.Task}}&license={{$.License}}&recommend={{$.Recommend}}">{{.i18n.Tr "repo.issues.filter_sort.recentupdate"}}</a> | |||
<a class="{{if eq .SortType "leastupdate"}}active{{end}} item" href="{{$.Link}}?sort=leastupdate&q={{$.Keyword}}&tab={{$.TabName}}&category={{$.Category}}&task={{$.Task}}&license={{$.License}}&recommend={{$.Recommend}}">{{.i18n.Tr "repo.issues.filter_sort.leastupdate"}}</a> | |||
<a class="{{if eq .SortType "downloadtimes"}}active{{end}} item" href="{{$.Link}}?sort=downloadtimes&q={{$.Keyword}}&tab={{$.TabName}}&category={{$.Category}}&task={{$.Task}}&license={{$.License}}&recommend={{$.Recommend}}">{{.i18n.Tr "repo.issues.filter_sort.downloadtimes"}}</a> | |||
<a class="{{if eq .SortType "moststars"}}active{{end}} item" href="{{$.Link}}?sort=moststars&q={{$.Keyword}}&tab={{$.TabName}}&category={{$.Category}}&task={{$.Task}}&license={{$.License}}&recommend={{$.Recommend}}">{{.i18n.Tr "repo.issues.filter_sort.moststars"}}</a> | |||
</div> | |||
</div> | |||
</div> | |||
@@ -140,6 +140,7 @@ | |||
{{end}} | |||
<div class="ui row" style="clear: both;" id="dataset-base"> | |||
<el-checkbox v-model="checked" style="padding: 0.5rem 1rem;" @change="handleCheckedChange" >仅显示平台推荐</el-checkbox> | |||
<div class="ui two cards"> | |||
{{range $k, $v :=.Datasets}} | |||
<div class="ui card" @click="gotoDataset('{{.Repo.Link}}/datasets')" style="cursor: pointer;box-shadow: 0px 4px 4px 0px rgba(232,232,232,0.6);border: 1px solid rgba(232, 232, 232, 1);"> | |||
@@ -162,7 +163,7 @@ | |||
</span> | |||
{{end}} | |||
</div> | |||
<div style="font-size: 16px;color:#0366D6;font-family: SourceHanSansSC-medium;height: 27px;font-weight: bold;display: flex;align-items: center"><span title="{{.Title}}" class="nowrap" style="width: 80%;display: inline-block;">{{.Title}}</span>{{if .Recommend}}<img src="/img/jian.svg" style="margin-left: 0.5rem;">{{end}}</div> | |||
<div style="font-size: 16px;color:#0366D6;font-family: SourceHanSansSC-medium;height: 27px;font-weight: bold;display: flex;align-items: center"><span title="{{.Title}}" class="nowrap" style="display: inline-block;">{{.Title}}</span>{{if .Recommend}}<img src="/img/jian.svg" style="margin-left: 0.5rem;">{{end}}</div> | |||
{{if or (.Category) (.Task) (.License)}} | |||
<div style="font-size: 12px;margin-top: 5px;"> | |||
{{if .Category}} | |||
@@ -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)=>{ | |||