Browse Source

Merge branch 'V20220616' of git.openi.org.cn:OpenI/aiforge into grampus

tags/v1.22.6.2
lewis 3 years ago
parent
commit
2b92601f38
11 changed files with 284 additions and 185 deletions
  1. +10
    -0
      models/attachment.go
  2. +4
    -0
      models/cloudbrain.go
  3. +15
    -3
      models/dataset.go
  4. +2
    -0
      models/repo_list.go
  5. +6
    -1
      options/locale/locale_en-US.ini
  6. +6
    -1
      options/locale/locale_zh-CN.ini
  7. +4
    -0
      routers/admin/dataset.go
  8. +4
    -0
      routers/home.go
  9. +4
    -0
      routers/repo/dataset.go
  10. +201
    -141
      templates/explore/datasets.tmpl
  11. +28
    -39
      templates/repo/datasets/index.tmpl

+ 10
- 0
models/attachment.go View File

@@ -43,6 +43,7 @@ type Attachment struct {
Name string Name string
Description string `xorm:"TEXT"` Description string `xorm:"TEXT"`
DownloadCount int64 `xorm:"DEFAULT 0"` DownloadCount int64 `xorm:"DEFAULT 0"`
UseNumber int64 `xorm:"DEFAULT 0"`
Size int64 `xorm:"DEFAULT 0"` Size int64 `xorm:"DEFAULT 0"`
IsPrivate bool `xorm:"DEFAULT false"` IsPrivate bool `xorm:"DEFAULT false"`
DecompressState int32 `xorm:"DEFAULT 0"` DecompressState int32 `xorm:"DEFAULT 0"`
@@ -107,6 +108,15 @@ func (a *Attachment) IncreaseDownloadCount() error {
return nil return nil
} }


func IncreaseAttachmentUseNumber(uuid string) error {
// Update use number.
if _, err := x.Exec("UPDATE `attachment` SET use_number=use_number+1 WHERE uuid=?", uuid); err != nil {
return fmt.Errorf("increase attachment use count: %v", err)
}

return nil
}

func (a *Attachment) UpdateDatasetUpdateUnix() error { func (a *Attachment) UpdateDatasetUpdateUnix() error {
// Update download count. // Update download count.
if _, err := x.Exec("UPDATE `dataset` SET updated_unix="+fmt.Sprint(time.Now().Unix())+" WHERE id=?", a.DatasetID); err != nil { if _, err := x.Exec("UPDATE `dataset` SET updated_unix="+fmt.Sprint(time.Now().Unix())+" WHERE id=?", a.DatasetID); err != nil {


+ 4
- 0
models/cloudbrain.go View File

@@ -1491,6 +1491,8 @@ func CreateCloudbrain(cloudbrain *Cloudbrain) (err error) {
if _, err = x.NoAutoTime().Insert(cloudbrain); err != nil { if _, err = x.NoAutoTime().Insert(cloudbrain); err != nil {
return err return err
} }

go IncreaseDatasetUseCount(cloudbrain.Uuid)
return nil return nil
} }


@@ -1735,6 +1737,8 @@ func RestartCloudbrain(old *Cloudbrain, new *Cloudbrain) (err error) {
return err return err
} }


go IncreaseDatasetUseCount(new.Uuid)

return nil return nil
} }
func CloudbrainAll(opts *CloudbrainsOptions) ([]*CloudbrainInfo, int64, error) { func CloudbrainAll(opts *CloudbrainsOptions) ([]*CloudbrainInfo, int64, error) {


+ 15
- 3
models/dataset.go View File

@@ -25,8 +25,9 @@ type Dataset struct {
Category string Category string
Description string `xorm:"TEXT"` Description string `xorm:"TEXT"`
DownloadTimes int64 DownloadTimes int64
NumStars int `xorm:"INDEX NOT NULL DEFAULT 0"`
Recommend bool `xorm:"INDEX NOT NULL DEFAULT false"`
UseCount int64 `xorm:"DEFAULT 0"`
NumStars int `xorm:"INDEX NOT NULL DEFAULT 0"`
Recommend bool `xorm:"INDEX NOT NULL DEFAULT false"`
License string License string
Task string Task string
ReleaseID int64 `xorm:"INDEX"` ReleaseID int64 `xorm:"INDEX"`
@@ -212,7 +213,7 @@ func SearchDatasetByCondition(opts *SearchDatasetOptions, cond builder.Cond) (Da
defer sess.Close() defer sess.Close()


datasets := make(DatasetList, 0, opts.PageSize) datasets := make(DatasetList, 0, opts.PageSize)
selectColumnsSql := "distinct dataset.id,dataset.title, dataset.status, dataset.category, dataset.description, dataset.download_times, dataset.license, dataset.task, dataset.release_id, dataset.user_id, dataset.repo_id, dataset.created_unix,dataset.updated_unix,dataset.num_stars,dataset.recommend"
selectColumnsSql := "distinct dataset.id,dataset.title, dataset.status, dataset.category, dataset.description, dataset.download_times, dataset.license, dataset.task, dataset.release_id, dataset.user_id, dataset.repo_id, dataset.created_unix,dataset.updated_unix,dataset.num_stars,dataset.recommend,dataset.use_count"


count, err := sess.Distinct("dataset.id").Join("INNER", "repository", "repository.id = dataset.repo_id"). count, err := sess.Distinct("dataset.id").Join("INNER", "repository", "repository.id = dataset.repo_id").
Join("INNER", "attachment", "attachment.dataset_id=dataset.id"). Join("INNER", "attachment", "attachment.dataset_id=dataset.id").
@@ -350,6 +351,17 @@ func UpdateDataset(ctx DBContext, rel *Dataset) error {
return err return err
} }


func IncreaseDatasetUseCount(uuid string) {

IncreaseAttachmentUseNumber(uuid)

attachment, _ := GetAttachmentByUUID(uuid)
if attachment != nil {
x.Exec("UPDATE `dataset` SET use_count=use_count+1 WHERE id=?", attachment.DatasetID)
}

}

// GetDatasetByID returns Dataset with given ID. // GetDatasetByID returns Dataset with given ID.
func GetDatasetByID(id int64) (*Dataset, error) { func GetDatasetByID(id int64) (*Dataset, error) {
rel := new(Dataset) rel := new(Dataset)


+ 2
- 0
models/repo_list.go View File

@@ -218,6 +218,8 @@ const (
SearchOrderByForks SearchOrderBy = "num_forks ASC" SearchOrderByForks SearchOrderBy = "num_forks ASC"
SearchOrderByForksReverse SearchOrderBy = "num_forks DESC" SearchOrderByForksReverse SearchOrderBy = "num_forks DESC"
SearchOrderByDownloadTimes SearchOrderBy = "download_times DESC" SearchOrderByDownloadTimes SearchOrderBy = "download_times DESC"
SearchOrderByUseCount SearchOrderBy = "use_count ASC"
SearchOrderByUseCountReverse SearchOrderBy = "use_count DESC"
SearchOrderByHot SearchOrderBy = "(num_watches + num_stars + num_forks + clone_cnt) DESC" SearchOrderByHot SearchOrderBy = "(num_watches + num_stars + num_forks + clone_cnt) DESC"
SearchOrderByActive SearchOrderBy = "(num_issues + num_pulls + num_commit) DESC" SearchOrderByActive SearchOrderBy = "(num_issues + num_pulls + num_commit) DESC"
SearchOrderByWatches SearchOrderBy = "num_watches DESC" SearchOrderByWatches SearchOrderBy = "num_watches DESC"


+ 6
- 1
options/locale/locale_en-US.ini View File

@@ -898,6 +898,10 @@ search_dataset = Search Dataset Files
unzip_tooltips = If it has not been decompressed for a long time, please check whether the compressed package has encrypted files or file errors unzip_tooltips = If it has not been decompressed for a long time, please check whether the compressed package has encrypted files or file errors
zip_failed = Decompression failed, please check whether the compressed package is encrypted or contact technical support zip_failed = Decompression failed, please check whether the compressed package is encrypted or contact technical support
dataset_desc = The description should not exceed 1024 characters dataset_desc = The description should not exceed 1024 characters
unzip_successed=Unzip Successed
unzip_failed=Unzip Failed
unzip_stared=Unzipping
unzip_status=Unzip Status
[repo] [repo]
owner = Owner owner = Owner
repo_name = Repository Name repo_name = Repository Name
@@ -1449,7 +1453,8 @@ issues.filter_sort.feweststars = Fewest stars
issues.filter_sort.mostforks = Most forks issues.filter_sort.mostforks = Most forks
issues.filter_sort.fewestforks = Fewest forks issues.filter_sort.fewestforks = Fewest forks
issues.filter_sort.downloadtimes = Most downloaded issues.filter_sort.downloadtimes = Most downloaded
issues.filter_sort.moststars = Most star
issues.filter_sort.mostusecount = Most Quote
issues.filter_sort.fewestusecount=Fewest Quote
issues.action_open = Open issues.action_open = Open
issues.action_close = Close issues.action_close = Close
issues.action_label = Label issues.action_label = Label


+ 6
- 1
options/locale/locale_zh-CN.ini View File

@@ -903,6 +903,10 @@ search_dataset = 搜索数据集文件
unzip_tooltips = 如果长时间未解压,请检查压缩包是否有加密文件或者文件错误 unzip_tooltips = 如果长时间未解压,请检查压缩包是否有加密文件或者文件错误
zip_failed = 解压失败,请检查压缩包是否有加密或者联系技术支持人员。 zip_failed = 解压失败,请检查压缩包是否有加密或者联系技术支持人员。
dataset_desc = 描述字数不超过1024个字符 dataset_desc = 描述字数不超过1024个字符
unzip_successed=解压成功
unzip_failed=解压失败
unzip_stared=解压中
unzip_status=解压状态


[repo] [repo]
owner=拥有者 owner=拥有者
@@ -1455,12 +1459,13 @@ issues.filter_sort.mostcomment=最多评论
issues.filter_sort.leastcomment=最少评论 issues.filter_sort.leastcomment=最少评论
issues.filter_sort.nearduedate=到期日从近到远 issues.filter_sort.nearduedate=到期日从近到远
issues.filter_sort.farduedate=到期日从远到近 issues.filter_sort.farduedate=到期日从远到近
issues.filter_sort.moststars=点赞由多到少
issues.filter_sort.feweststars=点赞由少到多 issues.filter_sort.feweststars=点赞由少到多
issues.filter_sort.mostforks=派生由多到少 issues.filter_sort.mostforks=派生由多到少
issues.filter_sort.fewestforks=派生由少到多 issues.filter_sort.fewestforks=派生由少到多
issues.filter_sort.downloadtimes=下载次数 issues.filter_sort.downloadtimes=下载次数
issues.filter_sort.moststars=收藏数量 issues.filter_sort.moststars=收藏数量
issues.filter_sort.mostusecount=最多引用
issues.filter_sort.fewestusecount=最少引用
issues.action_open=开启 issues.action_open=开启
issues.action_close=关闭 issues.action_close=关闭
issues.action_label=标签 issues.action_label=标签


+ 4
- 0
routers/admin/dataset.go View File

@@ -61,6 +61,10 @@ func Datasets(ctx *context.Context) {
orderBy = models.SearchOrderByForksReverse orderBy = models.SearchOrderByForksReverse
case "fewestforks": case "fewestforks":
orderBy = models.SearchOrderByForks orderBy = models.SearchOrderByForks
case "mostusecount":
orderBy = models.SearchOrderByUseCountReverse
case "fewestusecount":
orderBy = models.SearchOrderByUseCount
default: default:
ctx.Data["SortType"] = "recentupdate" ctx.Data["SortType"] = "recentupdate"
orderBy = models.SearchOrderByRecentUpdated orderBy = models.SearchOrderByRecentUpdated


+ 4
- 0
routers/home.go View File

@@ -322,6 +322,10 @@ func ExploreDatasets(ctx *context.Context) {
orderBy = models.SearchOrderByStarsReverse orderBy = models.SearchOrderByStarsReverse
case "feweststars": case "feweststars":
orderBy = models.SearchOrderByStars orderBy = models.SearchOrderByStars
case "mostusecount":
orderBy = models.SearchOrderByUseCountReverse
case "fewestusecount":
orderBy = models.SearchOrderByUseCount
case "default": case "default":
orderBy = models.SearchOrderByDefault orderBy = models.SearchOrderByDefault
default: default:


+ 4
- 0
routers/repo/dataset.go View File

@@ -172,6 +172,10 @@ func DatasetIndex(ctx *context.Context) {
for _, attachment := range pageAttachments { for _, attachment := range pageAttachments {
uploader, _ := models.GetUserByID(attachment.UploaderID) uploader, _ := models.GetUserByID(attachment.UploaderID)
attachment.Uploader = uploader attachment.Uploader = uploader
if !strings.HasSuffix(attachment.Name, ".zip") {
attachment.DecompressState = 3 //非zip文件
}

} }


ctx.Data["Page"] = pager ctx.Data["Page"] = pager


+ 201
- 141
templates/explore/datasets.tmpl View File

@@ -1,133 +1,164 @@
{{template "base/head" .}} {{template "base/head" .}}
<style> <style>
.mg-b-1{
margin-bottom: 1rem;
}
.mg-b-2{
margin-bottom: 2rem;
}
.mg-l-1{
margin-left: 1rem;
}
.text-gray-400 {
--tw-text-opacity: 1;
color: rgba(156,163,175,var(--tw-text-opacity));
}
.text-sm {
font-size: .875rem;
line-height: 1.25rem;
}
.underline {
text-decoration: underline;
}
.flex{
display: flex;
}
.font-medium{
font-weight: 500;
}
.flex-wrap{
flex-wrap: wrap;
}
.tag {
background-image: linear-gradient(to bottom,var(--tw-gradient-stops));
border-color: transparent;
border-radius: 0.5rem;
border-width: 1px;
font-size: .875rem;
line-height: 1.25rem;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.tag-red {
--tw-gradient-from: #fef2f2;
--tw-gradient-stops: var(--tw-gradient-from),var(--tw-gradient-to,hsla(0,86%,97%,0));
--tw-gradient-to: #fef2f2;
--tw-text-opacity: 1;
color: rgba(153,27,27,var(--tw-text-opacity));
}
.tag-purple {
--tw-gradient-from: #f5f3ff;
--tw-gradient-stops: var(--tw-gradient-from),var(--tw-gradient-to,rgba(245,243,255,0));
--tw-gradient-to: #f5f3ff;
--tw-text-opacity: 1;
color: rgba(91,33,182,var(--tw-text-opacity));
}
.tag-blue {
--tw-gradient-from: #eff6ff;
--tw-gradient-stops: var(--tw-gradient-from),var(--tw-gradient-to,rgba(239,246,255,0));
--tw-gradient-to: #eff6ff;
--tw-text-opacity: 1;
color: rgba(30,64,175,var(--tw-text-opacity));
}
.tag.inactive {
filter: grayscale(100%);
opacity: .5;
}
.tag.tag-active{
background-color: #0366d6;
color: #ffffff;
}
.tag-gray{
background-color: #f8f9fa;
color: #415058;
}
.tag {
align-items: center;
display: inline-flex;
flex: none;
height: 2rem;
margin-bottom: 0.35rem;
margin-right: 0.35rem;
max-width: 100%;
}
.tag>span {
padding: 0.75rem;
font-size: 14px;
}
.repo_dataset_header{
font-size: 12px;
color: #3291F8;
}
.heart-stroke{
stroke: #666;
stroke-width: 2;
fill: #fff
}
.stars_active{
fill: #FA8C16 !important;
stroke:#FA8C16 !important
}
.mg-b-1 {
margin-bottom: 1rem;
}

.mg-b-2 {
margin-bottom: 2rem;
}

.mg-l-1 {
margin-left: 1rem;
}

.text-gray-400 {
--tw-text-opacity: 1;
color: rgba(156, 163, 175, var(--tw-text-opacity));
}

.text-sm {
font-size: .875rem;
line-height: 1.25rem;
}

.underline {
text-decoration: underline;
}

.flex {
display: flex;
}

.font-medium {
font-weight: 500;
}

.flex-wrap {
flex-wrap: wrap;
}

.tag {
background-image: linear-gradient(to bottom, var(--tw-gradient-stops));
border-color: transparent;
border-radius: 0.5rem;
border-width: 1px;
font-size: .875rem;
line-height: 1.25rem;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}

.tag-red {
--tw-gradient-from: #fef2f2;
--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, hsla(0, 86%, 97%, 0));
--tw-gradient-to: #fef2f2;
--tw-text-opacity: 1;
color: rgba(153, 27, 27, var(--tw-text-opacity));
}

.tag-purple {
--tw-gradient-from: #f5f3ff;
--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgba(245, 243, 255, 0));
--tw-gradient-to: #f5f3ff;
--tw-text-opacity: 1;
color: rgba(91, 33, 182, var(--tw-text-opacity));
}

.tag-blue {
--tw-gradient-from: #eff6ff;
--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgba(239, 246, 255, 0));
--tw-gradient-to: #eff6ff;
--tw-text-opacity: 1;
color: rgba(30, 64, 175, var(--tw-text-opacity));
}

.tag.inactive {
filter: grayscale(100%);
opacity: .5;
}

.tag.tag-active {
background-color: #0366d6;
color: #ffffff;
}

.tag-gray {
background-color: #f8f9fa;
color: #415058;
}

.tag {
align-items: center;
display: inline-flex;
flex: none;
height: 2rem;
margin-bottom: 0.35rem;
margin-right: 0.35rem;
max-width: 100%;
}

.tag>span {
padding: 0.75rem;
font-size: 14px;
}

.repo_dataset_header {
font-size: 12px;
color: #3291F8;
}

.heart-stroke {
stroke: #FA8C16;
stroke-width: 2;
fill: #fff
}

.stars_active {
fill: #FA8C16 !important;
stroke: #FA8C16 !important
}
</style> </style>
<div class="explore repositories"> <div class="explore repositories">
{{template "explore/dataset_search" .}} {{template "explore/dataset_search" .}}
<div> <div>
<div class="ui container"> <div class="ui container">
<div class="ui grid"> <div class="ui grid">
{{template "explore/dataset_left" .}} {{template "explore/dataset_left" .}}
<div class="ui sixteen wide mobile sixteen wide tablet twelve wide computer column"> <div class="ui sixteen wide mobile sixteen wide tablet twelve wide computer column">
<div class="ui row"> <div class="ui row">
<h2 class="ui left floated medium header"> <h2 class="ui left floated medium header">
{{.i18n.Tr "datasets"}}
{{.i18n.Tr "datasets"}}
</h2> </h2>
<div class="ui right floated secondary filter menu"> <div class="ui right floated secondary filter menu">
<!-- Sort --> <!-- Sort -->
<div class="ui right dropdown type jump item"> <div class="ui right dropdown type jump item">
<span class="text"> <span class="text">
{{.i18n.Tr "repo.issues.filter_sort"}}
<i class="dropdown icon"></i>
{{.i18n.Tr "repo.issues.filter_sort"}}
<i class="dropdown icon"></i>
</span> </span>
<div class="menu"> <div class="menu">
<a class="{{if eq .SortType "default"}}active{{end}} item" href="{{$.Link}}?sort=default&q={{$.Keyword}}&tab={{$.TabName}}&category={{$.Category}}&task={{$.Task}}&license={{$.License}}&recommend={{$.Recommend}}">{{.i18n.Tr "repo.issues.filter_sort.default"}}</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>
<a class="{{if eq .SortType "default"}}active{{end}} item"
href="{{$.Link}}?sort=default&q={{$.Keyword}}&tab={{$.TabName}}&category={{$.Category}}&task={{$.Task}}&license={{$.License}}&recommend={{$.Recommend}}">{{.i18n.Tr "repo.issues.filter_sort.default"}}</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>
<a class="{{if eq .SortType "mostusecount"}}active{{end}} item"
href="{{$.Link}}?sort=mostusecount&q={{$.Keyword}}&tab={{$.TabName}}&category={{$.Category}}&task={{$.Task}}&license={{$.License}}&recommend={{$.Recommend}}">{{.i18n.Tr "repo.issues.filter_sort.mostusecount"}}</a>
<a class="{{if eq .SortType "fewestusecount"}}active{{end}} item"
href="{{$.Link}}?sort=fewestusecount&q={{$.Keyword}}&tab={{$.TabName}}&category={{$.Category}}&task={{$.Task}}&license={{$.License}}&recommend={{$.Recommend}}">{{.i18n.Tr "repo.issues.filter_sort.fewestusecount"}}</a>
</div> </div>
</div> </div>
</div> </div>
@@ -141,85 +172,114 @@
{{end}} {{end}}


<div class="ui row" style="clear: both;" id="dataset-base"> <div class="ui row" style="clear: both;" id="dataset-base">
<el-checkbox v-model="checked" style="padding: 0.5rem 1rem;" @change="handleCheckedChange" >仅显示平台推荐</el-checkbox>
<el-checkbox v-model="checked" style="padding: 0.5rem 1rem;" @change="handleCheckedChange">
仅显示平台推荐</el-checkbox>
<div class="ui two cards"> <div class="ui two cards">
{{range $k, $v :=.Datasets}} {{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);">
<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);">
<div class="content" style="border-bottom: none;"> <div class="content" style="border-bottom: none;">
<div class="repo_dataset_header" style="display: flex;align-items: center;justify-content: space-between;">
<a href="{{.Repo.Link}}/datasets" style="font-size: 12px;color: #3291F8;height: 24px;">{{.Repo.OwnerName}} / {{.Repo.Alias}}</a>
<div
style="font-size: 16px;color:#0366D6;font-family: SourceHanSansSC-medium;height: 34px;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}}
{{if $.IsSigned}} {{if $.IsSigned}}
<span style="display: flex;align-items: center;justify-content: flex-end;cursor: pointer;" @click.stop="postSquareStar({{.ID}},'{{.Repo.Link}}/datasets',{{$k}})">
<span style="line-height: 1;color: #101010;margin-bottom: -2px;"><i class="ri-download-line" style="font-size: 1.3em;"></i></span>
<span style="line-height: 1;color: #101010;margin-right: 0.6rem;">{{.DownloadTimes}}</span>
<span
style="display: flex;align-items: center;justify-content: flex-end;cursor: pointer;font-size: 12px;font-weight: normal;flex: 1;"
@click.stop="postSquareStar({{.ID}},'{{.Repo.Link}}/datasets',{{$k}})">

<div style="line-height: 1;margin-right: 4px;margin-bottom: -2px;"> <div style="line-height: 1;margin-right: 4px;margin-bottom: -2px;">
<svg width="1.4em" height="1.4em" viewBox="0 0 32 32" class="heart-stroke" :class='{stars_active:starActives[{{$k}}]}'><path d="M4.4 6.54c-1.761 1.643-2.6 3.793-2.36 6.056.24 2.263 1.507 4.521 3.663 6.534a29110.9 29110.9 0 0010.296 9.633l10.297-9.633c2.157-2.013 3.424-4.273 3.664-6.536.24-2.264-.599-4.412-2.36-6.056-1.73-1.613-3.84-2.29-6.097-1.955-1.689.25-3.454 1.078-5.105 2.394l-.4.319-.398-.319c-1.649-1.316-3.414-2.143-5.105-2.394a7.612 7.612 0 00-1.113-.081c-1.838 0-3.541.694-4.983 2.038z"></path></svg>
<svg width="1.4em" height="1.4em" viewBox="0 0 32 32"
class="heart-stroke" :class='{stars_active:starActives[{{$k}}]}'>
<path
d="M4.4 6.54c-1.761 1.643-2.6 3.793-2.36 6.056.24 2.263 1.507 4.521 3.663 6.534a29110.9 29110.9 0 0010.296 9.633l10.297-9.633c2.157-2.013 3.424-4.273 3.664-6.536.24-2.264-.599-4.412-2.36-6.056-1.73-1.613-3.84-2.29-6.097-1.955-1.689.25-3.454 1.078-5.105 2.394l-.4.319-.398-.319c-1.649-1.316-3.414-2.143-5.105-2.394a7.612 7.612 0 00-1.113-.081c-1.838 0-3.541.694-4.983 2.038z">
</path>
</svg>
</div> </div>
<span style="line-height: 1;color: #101010;">${starItems[{{$k}}]}</span> <span style="line-height: 1;color: #101010;">${starItems[{{$k}}]}</span>
</span> </span>
{{else}} {{else}}
<span style="display: flex;align-items: center;justify-content: flex-end;cursor: pointer;">
<span style="line-height: 1;color: #101010;margin-bottom: -2px;"><i class="ri-download-line" style="font-size: 1.3em;"></i></span>
<span style="line-height: 1;color: #101010;margin-right: 0.6rem;">{{.DownloadTimes}}</span>
<span
style="display: flex;align-items: center;justify-content: flex-end;cursor: pointer;font-size: 12px;font-weight: normal;flex: 1;">
<div style="line-height: 1;margin-right: 4px;margin-bottom: -2px;"> <div style="line-height: 1;margin-right: 4px;margin-bottom: -2px;">
<svg width="1.4em" height="1.4em" viewBox="0 0 32 32" class="heart-stroke" :class='{stars_active:starActives[{{$k}}]}'><path d="M4.4 6.54c-1.761 1.643-2.6 3.793-2.36 6.056.24 2.263 1.507 4.521 3.663 6.534a29110.9 29110.9 0 0010.296 9.633l10.297-9.633c2.157-2.013 3.424-4.273 3.664-6.536.24-2.264-.599-4.412-2.36-6.056-1.73-1.613-3.84-2.29-6.097-1.955-1.689.25-3.454 1.078-5.105 2.394l-.4.319-.398-.319c-1.649-1.316-3.414-2.143-5.105-2.394a7.612 7.612 0 00-1.113-.081c-1.838 0-3.541.694-4.983 2.038z"></path></svg>
<svg width="1.4em" height="1.4em" viewBox="0 0 32 32"
class="heart-stroke" :class='{stars_active:starActives[{{$k}}]}'>
<path
d="M4.4 6.54c-1.761 1.643-2.6 3.793-2.36 6.056.24 2.263 1.507 4.521 3.663 6.534a29110.9 29110.9 0 0010.296 9.633l10.297-9.633c2.157-2.013 3.424-4.273 3.664-6.536.24-2.264-.599-4.412-2.36-6.056-1.73-1.613-3.84-2.29-6.097-1.955-1.689.25-3.454 1.078-5.105 2.394l-.4.319-.398-.319c-1.649-1.316-3.414-2.143-5.105-2.394a7.612 7.612 0 00-1.113-.081c-1.838 0-3.541.694-4.983 2.038z">
</path>
</svg>
</div> </div>
<span style="line-height: 1;color: #101010;">${starItems[{{$k}}]}</span> <span style="line-height: 1;color: #101010;">${starItems[{{$k}}]}</span>
</span> </span>
{{end}} {{end}}

</div> </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)}} {{if or (.Category) (.Task) (.License)}}
<div style="font-size: 12px;margin-top: 5px;"> <div style="font-size: 12px;margin-top: 5px;">
{{if .Category}} {{if .Category}}
{{$category := .Category}} {{$category := .Category}}
<a class="ui repo-topic label topic" href="{{$.Link}}?sort={{$.SortType}}&q={{$.Keyword}}&tab={{$.TabName}}&category={{.Category}}&task={{$.Task}}&license={{$.License}}">{{$.i18n.Tr (printf "dataset.category.%s" $category)}}</a>
<a class="ui repo-topic label topic"
href="{{$.Link}}?sort={{$.SortType}}&q={{$.Keyword}}&tab={{$.TabName}}&category={{.Category}}&task={{$.Task}}&license={{$.License}}">{{$.i18n.Tr (printf "dataset.category.%s" $category)}}</a>
{{end}} {{end}}
{{if .Task}} {{if .Task}}
{{$task := .Task}} {{$task := .Task}}
<a class="ui repo-topic label topic" href="{{$.Link}}?sort={{$.SortType}}&q={{$.Keyword}}&tab={{$.TabName}}&category={{$.Category}}&task={{.Task}}&license={{$.License}}">{{$.i18n.Tr (printf "dataset.task.%s" $task)}}</a>
<a class="ui repo-topic label topic"
href="{{$.Link}}?sort={{$.SortType}}&q={{$.Keyword}}&tab={{$.TabName}}&category={{$.Category}}&task={{.Task}}&license={{$.License}}">{{$.i18n.Tr (printf "dataset.task.%s" $task)}}</a>
{{end}} {{end}}
{{if .License}} {{if .License}}
<a class="ui repo-topic label topic" href="{{$.Link}}?sort={{$.SortType}}&q={{$.Keyword}}&tab={{$.TabName}}&category={{$.Category}}&task={{$.Task}}&license={{.License}}">{{.License}}</a>
<a class="ui repo-topic label topic"
href="{{$.Link}}?sort={{$.SortType}}&q={{$.Keyword}}&tab={{$.TabName}}&category={{$.Category}}&task={{$.Task}}&license={{.License}}">{{.License}}</a>
{{end}} {{end}}
</div> </div>
{{end}} {{end}}
<div class="description" style="-webkit-box-orient: vertical;-webkit-line-clamp: 2;display: -webkit-box;overflow: hidden;color:#999999;font-size: 14px;margin-top: 10px;">
<div class="description"
style="-webkit-box-orient: vertical;-webkit-line-clamp: 2;display: -webkit-box;overflow: hidden;color:#999999;font-size: 14px;margin-top: 10px;">
<p>{{.Description}}</p> <p>{{.Description}}</p>
</div> </div>
</div> </div>
<div class="extra content" style="border-top: none !important;"> <div class="extra content" style="border-top: none !important;">
<div style="display: flex;align-items: center;"> <div style="display: flex;align-items: center;">
{{if eq .UserID 0}} {{if eq .UserID 0}}
<a href="{{AppSubUrl}}/{{.Repo.OwnerName}}" title="{{.Repo.OwnerName}}"> <a href="{{AppSubUrl}}/{{.Repo.OwnerName}}" title="{{.Repo.OwnerName}}">
<img class="ui avatar image" style="width: 22px;height:22px;" src="/user/avatar/{{.Repo.OwnerName}}/-1">
<img class="ui avatar image" style="width: 22px;height:22px;"
src="/user/avatar/{{.Repo.OwnerName}}/-1">
</a> </a>
{{else}} {{else}}
<a href="{{AppSubUrl}}/{{.User.Name}}" title="{{.User.Name}}"> <a href="{{AppSubUrl}}/{{.User.Name}}" title="{{.User.Name}}">
<img class="ui avatar image" style="width: 22px;height:22px;" src="/user/avatar/{{.User.Name}}/-1">
<img class="ui avatar image" style="width: 22px;height:22px;"
src="/user/avatar/{{.User.Name}}/-1">
</a> </a>
{{end}} {{end}}
<span style="color: #999999;font-size: 14px;;">创建于:{{TimeSinceUnix1 .CreatedUnix}}</span>
<span
style="color: #999999;font-size: 12px;margin-left: 0.5rem;">{{TimeSinceUnixShort .CreatedUnix}}</span>
<span
style="display: flex;align-items: center;justify-content: center;margin: 0 1rem;">
<i class="ri-link"></i>
<span
style="color: #101010; font-size: 12px;margin-left: 0.2rem;">{{.UseCount}}</span>
</span>
<span style=" display: flex;align-items: center;justify-content: center;">
<i class="ri-download-line"></i>
<span
style="color: #101010;font-size: 12px;margin-left: 0.2rem;">{{.DownloadTimes}}</span>
</span>
</div> </div>
</div> </div>
</div> </div>
{{end}} {{end}}


</div> </div>
</div> </div>


<div id="app" style="margin-top: 2rem;"> <div id="app" style="margin-top: 2rem;">
<div class="center"> <div class="center">
<el-pagination
background
@current-change="handleCurrentChange"
:current-page="page"
:page-sizes="[30]"
:page-size="30"
layout="total, sizes, prev, pager, next, jumper"
:total="{{.Page.Paginater.Total}}">
<el-pagination background @current-change="handleCurrentChange" :current-page="page"
:page-sizes="[30]" :page-size="30" layout="total, sizes, prev, pager, next, jumper"
:total="{{.Page.Paginater.Total}}">
</el-pagination> </el-pagination>
</div> </div>
</div> </div>


+ 28
- 39
templates/repo/datasets/index.tmpl View File

@@ -105,7 +105,7 @@
} }


.heart-stroke { .heart-stroke {
stroke: #666;
stroke: #FA8C16;
stroke-width: 2; stroke-width: 2;
fill: #fff fill: #fff
} }
@@ -148,7 +148,7 @@
<div class="ui mobile reversed stackable grid"> <div class="ui mobile reversed stackable grid">
<div class="row"> <div class="row">
<div class="column thirteen wide"> <div class="column thirteen wide">
<h2>{{.dataset.Title}}</h2>
<h2 class="nowrap">{{.dataset.Title}}</h2>
</div> </div>
<div class="column three wide right aligned"> <div class="column three wide right aligned">
<span style="display: flex;align-items: center;justify-content: flex-end;height: 36px;"> <span style="display: flex;align-items: center;justify-content: flex-end;height: 36px;">
@@ -276,27 +276,34 @@
<!-- 数据集名称 --> <!-- 数据集名称 -->


<div class="four wide column" style="width: 24% !important;display: flex;align-items: center;"> <div class="four wide column" style="width: 24% !important;display: flex;align-items: center;">
{{if .Description}}
<el-tooltip class="item" effect="dark" placement="top" popper-class="diy-popper"> <el-tooltip class="item" effect="dark" placement="top" popper-class="diy-popper">
<div slot="content">{{.Description}}</br><span><i
class="ri-download-line"></i>{{$.i18n.Tr "dataset.download"}}:{{.DownloadCount}}</span></div>
<a class="dataset_title title" href="{{.DownloadURL}}" title="{{.Name}}" style="border: none;">
{{.Name}}
</a>
</el-tooltip>
{{else}}
<el-tooltip class="item" effect="dark" placement="top" popper-class="diy-popper">
<div slot="content"><span><i
class="ri-download-line"></i>{{$.i18n.Tr "dataset.download"}}:{{.DownloadCount}}</span></div>
<a class="dataset_title title" href="{{.DownloadURL}}" title="{{.Name}}" style="border: none;">
{{.Name}}
</a>
<div slot="content"><span class="wrap">

{{if ne .DecompressState 3}}{{$.i18n.Tr "dataset.unzip_status"}}:{{if eq .DecompressState 1}}{{$.i18n.Tr "dataset.unzip_successed"}}{{else if eq .DecompressState 0}}{{$.i18n.Tr "dataset.unzip_stared"}}{{else}}{{$.i18n.Tr "dataset.unzip_failed"}}{{end}}
&nbsp;&nbsp;{{end}}<i
class="ri-download-line"></i>{{$.i18n.Tr "dataset.download"}}:{{.DownloadCount}}
{{if .Description}}&nbsp;&nbsp;{{$.i18n.Tr "dataset.description"}}:{{.Description}}{{end}}</span>
</div>
<div style="border: none;display: flex;align-items: center;max-width: 100%;">
{{if eq .DecompressState 1}}
<i class="ri-folder-open-line" style="color: #5bb973;"
title='{{$.i18n.Tr "dataset.unzip_successed"}}'></i>
{{else if eq .DecompressState 0}}
<i class="ri-folder-chart-2-line" style="color: #888888;"
title='{{$.i18n.Tr "dataset.unzip_stared"}}'></i>
{{else if eq .DecompressState 2}}
<i class="ri-folder-forbid-line" style="color: #101010;"
title='{{$.i18n.Tr "dataset.unzip_failed"}}'></i>
{{else}}
<i class="ri-folder-forbid-line" style="visibility: hidden;"
title='{{$.i18n.Tr "dataset.unzip_failed"}}'></i>
{{end}}
<a class="dataset_title title" href="{{.DownloadURL}}" title="{{.Name}}">
{{.Name}}
</a>
<i class="ri-lock-2-line" style="color: #fa8c16;" v-if="privates[{{$k}}]"></i>
</div>
</el-tooltip> </el-tooltip>
{{end}}
<i class="ri-lock-2-line" style="color: #fa8c16;" v-if="privates[{{$k}}]"></i>
<!-- <i class="COMPLETED" v-if="zipStatus[{{$k}}]==1"></i>
<i class="WAITING" v-if="zipStatus[{{$k}}]==2"></i>
<i class="FAILED" v-if="zipStatus[{{$k}}]==3"></i> -->
</div> </div>
<div class="one wide column text center" style="width: 7.25% !important;"> <div class="one wide column text center" style="width: 7.25% !important;">
{{.Size | FileSize}} {{.Size | FileSize}}
@@ -322,18 +329,6 @@
{{.CreatedUnix | TimeSinceUnix1}} {{.CreatedUnix | TimeSinceUnix1}}
</div> </div>
<div class="four wide column text right"> <div class="four wide column text right">
<!-- <el-button type="text">下载</el-button>
<el-button type="text">预览</el-button>
<el-button type="text">标注</el-button>
<el-button type="text">
<el-popover
placement="right"
width="400"
trigger="click">
<span>asdasd</span>
<el-button slot="reference" type="text"><i class="ri-more-line"></i></el-button>
</el-popover>
</el-button> -->
<div class="ui compact buttons"> <div class="ui compact buttons">


<a class="ui basic blue button" href="{{.DownloadURL}}">{{$.i18n.Tr "dataset.download"}}</a> <a class="ui basic blue button" href="{{.DownloadURL}}">{{$.i18n.Tr "dataset.download"}}</a>
@@ -350,11 +345,6 @@
@click="setPrivate('{{.UUID}}',true,{{$k}})" @click="setPrivate('{{.UUID}}',true,{{$k}})"
v-else="privates[{{$k}}]">{{$.i18n.Tr "dataset.set_private"}}</span> v-else="privates[{{$k}}]">{{$.i18n.Tr "dataset.set_private"}}</span>
{{end}} {{end}}
<!-- {{if $.CanRead}}
<a class="ui basic blue button" href="datasets/label/{{.UUID}}?type={{$.Type}}" data-tooltip='{{$.i18n.Tr "dataset.create_label_task"}}'>标注</a>
{{else}}
<a class="ui basic disabled button">标注</a>
{{end}} -->
<a class="ui basic blue button"> <a class="ui basic blue button">
<el-dropdown size="medium"> <el-dropdown size="medium">
<span class="el-dropdown-link"> <span class="el-dropdown-link">
@@ -363,7 +353,6 @@
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="copyUrl('{{.DownloadURL}}')">{{$.i18n.Tr "dataset.copy_url"}} <el-dropdown-item @click.native="copyUrl('{{.DownloadURL}}')">{{$.i18n.Tr "dataset.copy_url"}}
</el-dropdown-item> </el-dropdown-item>
<!-- <el-dropdown-item class="clipboard" data-clipboard-text="{{.Md5}}" data-clipboard-action="copy">{{$.i18n.Tr "dataset.copy_md5"}}</el-dropdown-item>-->
{{if and ($.CanWrite) (eq .DecompressState 1) }} {{if and ($.CanWrite) (eq .DecompressState 1) }}
<el-dropdown-item @click.native="gotoAnnotate('{{$.RepoLink}}','{{.UUID}}',{{.Type}})"> <el-dropdown-item @click.native="gotoAnnotate('{{$.RepoLink}}','{{.UUID}}',{{.Type}})">
{{$.i18n.Tr "dataset.annotation"}}</el-dropdown-item> {{$.i18n.Tr "dataset.annotation"}}</el-dropdown-item>


Loading…
Cancel
Save