diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 265e7ed36..7288f2ce8 100755 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -2946,6 +2946,7 @@ raw_minutes = minutes [dropzone] default_message = Drop files or click here to upload. +default_dataset_message = Click to add files or directly drag and drop files here invalid_input_type = You can not upload files of this type. file_too_big = File size ({{filesize}} MB) exceeds the maximum size of ({{maxFilesize}} MB). remove_file = Remove file diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini index 1b26a930c..9a89d194a 100755 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -2956,6 +2956,7 @@ raw_minutes=分钟 [dropzone] default_message=拖动文件或者点击此处上传。 +default_dataset_message=点击添加文件或直接拖拽文件到此处。 invalid_input_type=您不能上传该类型的文件 file_too_big=文件体积({{filesize}} MB)超过了最大允许体积({{maxFilesize}} MB) remove_file=移除文件 diff --git a/routers/repo/dataset.go b/routers/repo/dataset.go index 73036a2cc..0e57fe1a0 100755 --- a/routers/repo/dataset.go +++ b/routers/repo/dataset.go @@ -106,6 +106,8 @@ func DatasetIndex(ctx *context.Context) { MustEnableDataset(ctx) ctx.Data["PageIsDataset"] = true + ctx.Data["SortType"] = ctx.Query("sort") + repo := ctx.Repo.Repository dataset, err := models.GetDatasetByRepo(repo) @@ -128,9 +130,31 @@ func DatasetIndex(ctx *context.Context) { attachments := newFilterPrivateAttachments(ctx, dataset.Attachments, repo) - sort.Slice(attachments, func(i, j int) bool { - return attachments[i].CreatedUnix > attachments[j].CreatedUnix - }) + if ctx.Data["SortType"] == "nameAsc" { + sort.Slice(attachments, func(i, j int) bool { + return strings.ToLower(attachments[i].Name) < strings.ToLower(attachments[j].Name) + }) + } else if ctx.Data["SortType"] == "nameDesc" { + sort.Slice(attachments, func(i, j int) bool { + return strings.ToLower(attachments[i].Name) > strings.ToLower(attachments[j].Name) + }) + } else if ctx.Data["SortType"] == "sizeAsc" { + sort.Slice(attachments, func(i, j int) bool { + return attachments[i].Size < attachments[j].Size + }) + } else if ctx.Data["SortType"] == "sizeDesc" { + sort.Slice(attachments, func(i, j int) bool { + return attachments[i].Size > attachments[j].Size + }) + } else if ctx.Data["SortType"] == "timeAsc" { + sort.Slice(attachments, func(i, j int) bool { + return attachments[i].CreatedUnix < attachments[j].CreatedUnix + }) + } else { + sort.Slice(attachments, func(i, j int) bool { + return attachments[i].CreatedUnix > attachments[j].CreatedUnix + }) + } page := ctx.QueryInt("page") if page <= 0 { diff --git a/templates/repo/attachment/upload.tmpl b/templates/repo/attachment/upload.tmpl index 56dc52417..a78931b13 100644 --- a/templates/repo/attachment/upload.tmpl +++ b/templates/repo/attachment/upload.tmpl @@ -1,60 +1,58 @@ - {{template "base/head" .}}
-{{template "repo/header" .}} + {{template "repo/header" .}}
-

- {{$.i18n.Tr "dataset.upload_dataset_file"}} -

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

+ {{$.i18n.Tr "dataset.upload_dataset_file"}} +

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

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

-

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

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

-{{template "base/footer" .}} +{{template "base/footer" .}} \ No newline at end of file diff --git a/templates/repo/datasets/index.tmpl b/templates/repo/datasets/index.tmpl index f9f6a10fc..4cc84bbe8 100755 --- a/templates/repo/datasets/index.tmpl +++ b/templates/repo/datasets/index.tmpl @@ -7,6 +7,8 @@ background: #FFF !important; } + + .dataset_title { font-size: 14px; max-width: 80%; @@ -211,11 +213,22 @@
-
- {{$.i18n.Tr "dataset.dataset_file_name"}} +
+ {{$.i18n.Tr "dataset.dataset_file_name"}} + + + +
-
+
{{$.i18n.Tr "repo.model.manage.size"}} + + + +
{{$.i18n.Tr "dataset.dataset_available_clusters"}} @@ -226,8 +239,13 @@
{{$.i18n.Tr "repo.cloudbrain_creator"}}
-
+
{{$.i18n.Tr "dataset.dataset_upload_time"}} + + + +
{{$.i18n.Tr "repo.cloudbrain_operate"}} diff --git a/web_src/js/index.js b/web_src/js/index.js index f3f25c03a..b7434885e 100755 --- a/web_src/js/index.js +++ b/web_src/js/index.js @@ -1225,10 +1225,7 @@ async function initRepository() { const $content = $segment.parent(); if (!$content.find('.ui.small.images').length) { if (data.attachments !== '') { - $content.append( - '
' - ); - $content.find('.ui.small.images').html(data.attachments); + } } else if (data.attachments === '') { $content @@ -3923,19 +3920,10 @@ function initVueDataset() { MinioUploader }, 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.getTypeList() if (!!document.getElementById('dataset-repolink-init')) { + this.cloudbrainType = location.href.indexOf('cloudbrain/train-job/create') !== -1 ? 0 : 1 this.getCurrentRepoDataset(this.repolink, this.cloudbrainType) } @@ -4083,6 +4071,25 @@ function initVueDataset() { uploadNpu() { this.type = 1 }, + sortAble(dom) { + const params = new URLSearchParams(location.search) + if (params.toString() === '') { + location.href = `${location.href}?sort=${dom}Asc` + } + else if (!params.get('sort')) { + location.href = `${location.href}&sort=${dom}Asc` + } + else if (params.get('sort') === `${dom}Desc` || params.get('sort').indexOf(`${dom}`) === -1) { + params.delete('sort') + let asc = params.toString() + `&sort=${dom}Asc` + location.search = asc + } + else { + params.delete('sort') + let desc = params.toString() + `&sort=${dom}Desc` + location.search = desc + } + }, setPrivate(uuid, privateFlag, index) { const params = { _csrf: csrf, file: uuid, is_private: privateFlag } this.$axios.post('/attachments/private', this.qs.stringify(params)).then((res) => { diff --git a/web_src/less/openi.less b/web_src/less/openi.less index de2a3fe8c..dc02d65bc 100644 --- a/web_src/less/openi.less +++ b/web_src/less/openi.less @@ -1055,3 +1055,33 @@ display: block; float: left !important; margin: 0px 5px 0px 0px !important; } + + +.row .caret-wrapper { + display: inline-flex; + flex-direction: column; + align-items: center; + height: 34px; + width: 24px; + vertical-align: middle; + cursor: pointer; + position: relative; + } + +.row .sort-caret-up { + position: absolute; + top: 5px; + color: #c0c4cc; + font-size: 18px; + } + +.row .sort-caret-down { + position: absolute; + bottom: 3px; + color: #c0c4cc; + font-size: 18px; + } + +.row .active-sort { + color: #409eff !important; + } \ No newline at end of file