Browse Source

Merge pull request 'fix-55' (#56) from fix-55 into develop

Reviewed-by: berry <senluowanxiangt@gmail.com>
master
berry 4 years ago
parent
commit
c29cc4456b
19 changed files with 176 additions and 142 deletions
  1. +3
    -0
      modules/templates/helper.go
  2. +8
    -1
      options/locale/locale_en-US.ini
  3. +9
    -2
      options/locale/locale_zh-CN.ini
  4. +8
    -7
      routers/repo/dir.go
  5. +2
    -2
      routers/routes/routes.go
  6. +2
    -2
      templates/explore/navbar.tmpl
  7. +1
    -1
      templates/repo/cloudbrain/index.tmpl
  8. +3
    -3
      templates/repo/cloudbrain/new.tmpl
  9. +3
    -3
      templates/repo/datasets/dataset_list.tmpl
  10. +24
    -17
      templates/repo/datasets/dirs/dir_list.tmpl
  11. +7
    -11
      templates/repo/datasets/dirs/index.tmpl
  12. +1
    -0
      templates/repo/datasets/index.tmpl
  13. +2
    -2
      templates/repo/header.tmpl
  14. +1
    -1
      templates/repo/settings/options.tmpl
  15. +1
    -1
      templates/repo/view_list.tmpl
  16. +1
    -1
      templates/user/profile.tmpl
  17. +51
    -33
      web_src/js/components/MinioUploader.vue
  18. +4
    -1
      web_src/less/_dataset.less
  19. +45
    -54
      web_src/less/_repository.less

+ 3
- 0
modules/templates/helper.go View File

@@ -307,6 +307,9 @@ func NewFuncMap() []template.FuncMap {
"tasks": tasks, "tasks": tasks,
"categories": categories, "categories": categories,
"licenses": licenses, "licenses": licenses,
"DatasetPathJoin": func(arr []string, index int, seq string) string {
return strings.Join(arr[0:index+1], seq)
},
}} }}
} }




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

@@ -647,6 +647,7 @@ private = private
public = public public = public
back = back back = back
copy_url=copy download url copy_url=copy download url
directory=check directory of the datasets
visibility = visibility visibility = visibility
visibility_description = Only the owner or the organization members if they have rights, will be able to see it. visibility_description = Only the owner or the organization members if they have rights, will be able to see it.
visibility_helper = Make Dataset Private visibility_helper = Make Dataset Private
@@ -752,6 +753,10 @@ unit_disabled = The site administrator has disabled this repository section.
language_other = Other language_other = Other
datasets = Datasets datasets = Datasets
datasets.desc = Enable Dataset datasets.desc = Enable Dataset
cloudbrain=cloudbrain
cloudbrain.new=New cloudbrain
cloudbrain.desc=cloudbrain
cloudbrain.cancel=Cancel


template.items = Template Items template.items = Template Items
template.git_content = Git Content (Default Branch) template.git_content = Git Content (Default Branch)
@@ -1420,7 +1425,8 @@ settings.use_external_wiki = Use External Wiki
settings.external_wiki_url = External Wiki URL settings.external_wiki_url = External Wiki URL
settings.external_wiki_url_error = The external wiki URL is not a valid URL. settings.external_wiki_url_error = The external wiki URL is not a valid URL.
settings.external_wiki_url_desc = Visitors are redirected to the external wiki URL when clicking the wiki tab. settings.external_wiki_url_desc = Visitors are redirected to the external wiki URL when clicking the wiki tab.
settings.dataset_desc= Enable Repository Dataset
settings.dataset_desc = Enable Repository Dataset
settings.cloudbrain_desc = Enable Cloudbarin
settings.issues_desc = Enable Repository Issue Tracker settings.issues_desc = Enable Repository Issue Tracker
settings.use_internal_issue_tracker = Use Built-In Issue Tracker settings.use_internal_issue_tracker = Use Built-In Issue Tracker
settings.use_external_issue_tracker = Use External Issue Tracker settings.use_external_issue_tracker = Use External Issue Tracker
@@ -2434,6 +2440,7 @@ md5_computing = MD5 computing
loading_file = Loading loading_file = Loading
uploading = Uploading uploading = Uploading
upload_complete = Uploading complete upload_complete = Uploading complete
falied = Upload Failed
enable_minio_support = Enable minio support to use the dataset service enable_minio_support = Enable minio support to use the dataset service


[notification] [notification]


+ 9
- 2
options/locale/locale_zh-CN.ini View File

@@ -648,6 +648,7 @@ public=公有
dir=目录 dir=目录
back=返回 back=返回
copy_url=复制下载链接 copy_url=复制下载链接
directory=查看数据集目录结构
visibility=可见性 visibility=可见性
visibility_description=只有组织所有人或拥有权利的组织成员才能看到。 visibility_description=只有组织所有人或拥有权利的组织成员才能看到。
visibility_helper=将数据集设为私有 visibility_helper=将数据集设为私有
@@ -751,8 +752,12 @@ pick_reaction=选择你的表情
reactions_more=再加载 %d reactions_more=再加载 %d
unit_disabled=站点管理员已禁用此项目单元。 unit_disabled=站点管理员已禁用此项目单元。
language_other=其它 language_other=其它
datasets = 数据集
datasets.desc = 数据集功能
datasets=数据集
datasets.desc=数据集功能
cloudbrain=云脑
cloudbrain.new=新建任务
cloudbrain.desc=云脑功能
cloudbrain.cancel=取消


template.items=模板选项 template.items=模板选项
template.git_content=Git数据(默认分支) template.git_content=Git数据(默认分支)
@@ -1423,6 +1428,7 @@ settings.external_wiki_url=外部 Wiki 链接
settings.external_wiki_url_error=外部百科链接无效 settings.external_wiki_url_error=外部百科链接无效
settings.external_wiki_url_desc=当点击工单标签时,访问者将被重定向到外部工单系统的URL。 settings.external_wiki_url_desc=当点击工单标签时,访问者将被重定向到外部工单系统的URL。
settings.dataset_desc=启用数据集 settings.dataset_desc=启用数据集
settings.cloudbrain_desc = 启用云脑
settings.issues_desc=启用工单系统 settings.issues_desc=启用工单系统
settings.use_internal_issue_tracker=使用内置的轻量级工单管理系统 settings.use_internal_issue_tracker=使用内置的轻量级工单管理系统
settings.use_external_issue_tracker=使用外部的工单管理系统 settings.use_external_issue_tracker=使用外部的工单管理系统
@@ -2436,6 +2442,7 @@ md5_computing=计算MD5
loading_file=加载文件 loading_file=加载文件
uploading=正在上传 uploading=正在上传
upload_complete=上传完成 upload_complete=上传完成
failed=上传失败
enable_minio_support=启用minio支持以使用数据集服务 enable_minio_support=启用minio支持以使用数据集服务


[notification] [notification]


+ 8
- 7
routers/repo/dir.go View File

@@ -29,6 +29,7 @@ type FileInfo struct {
func DirIndex(ctx *context.Context) { func DirIndex(ctx *context.Context) {
uuid := ctx.Params("uuid") uuid := ctx.Params("uuid")
parentDir := ctx.Query("parentDir") parentDir := ctx.Query("parentDir")
dirArray := strings.Split(parentDir, "/")


if parentDir == "" { if parentDir == "" {
attachment, err := models.GetAttachmentByUUID(uuid) attachment, err := models.GetAttachmentByUUID(uuid)
@@ -41,15 +42,13 @@ func DirIndex(ctx *context.Context) {
log.Error("The file is not zip file, can not query the dir") log.Error("The file is not zip file, can not query the dir")
ctx.ServerError("The file is not zip file, can not query the dir", errors.New("The file is not zip file, can not query the dir")) ctx.ServerError("The file is not zip file, can not query the dir", errors.New("The file is not zip file, can not query the dir"))
return return
} else {
if attachment.DecompressState != models.DecompressStateDone {
log.Error("The file has not been decompressed completely now")
ctx.ServerError("The file has not been decompressed completely now", errors.New("The file has not been decompressed completely now"))
return
}
} else if attachment.DecompressState != models.DecompressStateDone {
log.Error("The file has not been decompressed completely now")
ctx.ServerError("The file has not been decompressed completely now", errors.New("The file has not been decompressed completely now"))
return
} }


ctx.Data["Title"] = attachment.Name
// ctx.Data["OriginName"] = attachment.Name
} }


files, err := ioutil.ReadDir(setting.Attachment.Minio.RealPath + setting.Attachment.Minio.Bucket + "/" + setting.Attachment.Minio.BasePath + files, err := ioutil.ReadDir(setting.Attachment.Minio.RealPath + setting.Attachment.Minio.Bucket + "/" + setting.Attachment.Minio.BasePath +
@@ -87,7 +86,9 @@ func DirIndex(ctx *context.Context) {
i++ i++
} }


ctx.Data["Path"] = dirArray
ctx.Data["Dirs"] = fileInfos ctx.Data["Dirs"] = fileInfos
ctx.Data["PageIsDataset"] = true


ctx.HTML(200, tplDirIndex) ctx.HTML(200, tplDirIndex)
} }

+ 2
- 2
routers/routes/routes.go View File

@@ -880,8 +880,8 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Get("", reqRepoDatasetReader, repo.DatasetIndex) m.Get("", reqRepoDatasetReader, repo.DatasetIndex)
m.Post("", reqRepoDatasetWriter, bindIgnErr(auth.EditDatasetForm{}), repo.EditDatasetPost) m.Post("", reqRepoDatasetWriter, bindIgnErr(auth.EditDatasetForm{}), repo.EditDatasetPost)


m.Group("/dirs/:uuid", func() {
m.Get("", reqRepoDatasetReader, repo.DirIndex)
m.Group("/dirs", func() {
m.Get("/:uuid", reqRepoDatasetReader, repo.DirIndex)
}) })
}, context.RepoRef()) }, context.RepoRef())




+ 2
- 2
templates/explore/navbar.tmpl View File

@@ -4,7 +4,7 @@
{{svg "octicon-repo" 16}} {{.i18n.Tr "explore.repos"}} {{svg "octicon-repo" 16}} {{.i18n.Tr "explore.repos"}}
</a> </a>
<a class="{{if .PageIsDatasets}}active{{end}} item" href="{{AppSubUrl}}/explore/datasets"> <a class="{{if .PageIsDatasets}}active{{end}} item" href="{{AppSubUrl}}/explore/datasets">
{{svg "octicon-file-submodule" 16}} {{.i18n.Tr "datasets"}}
{{svg "octicon-inbox" 16}} {{.i18n.Tr "datasets"}}
</a> </a>
{{/* <a class="{{if .PageIsExploreUsers}}active{{end}} item" href="{{AppSubUrl}}/explore/users"> {{/* <a class="{{if .PageIsExploreUsers}}active{{end}} item" href="{{AppSubUrl}}/explore/users">
{{svg "octicon-person" 16}} {{.i18n.Tr "explore.users"}} {{svg "octicon-person" 16}} {{.i18n.Tr "explore.users"}}
@@ -28,7 +28,7 @@
{{svg "octicon-repo" 16}} {{.i18n.Tr "explore.repos"}} {{svg "octicon-repo" 16}} {{.i18n.Tr "explore.repos"}}
</a> </a>
<a class="{{if .PageIsDatasets}}active{{end}} item" href="{{AppSubUrl}}/explore/datasets"> <a class="{{if .PageIsDatasets}}active{{end}} item" href="{{AppSubUrl}}/explore/datasets">
{{svg "octicon-file-submodule" 16}} {{.i18n.Tr "datasets"}}
{{svg "octicon-inbox" 16}} {{.i18n.Tr "datasets"}}
</a> </a>
{{/* <a class="{{if .PageIsExploreUsers}}active{{end}} item" href="{{AppSubUrl}}/explore/users"> {{/* <a class="{{if .PageIsExploreUsers}}active{{end}} item" href="{{AppSubUrl}}/explore/users">
{{svg "octicon-person" 16}} {{.i18n.Tr "explore.users"}} {{svg "octicon-person" 16}} {{.i18n.Tr "explore.users"}}


+ 1
- 1
templates/repo/cloudbrain/index.tmpl View File

@@ -4,7 +4,7 @@
<div class="ui container"> <div class="ui container">
<div class="ui three column stackable grid"> <div class="ui three column stackable grid">
<div class="column"> <div class="column">
<h2>{{.i18n.Tr "cloudbrain"}}</h2>
<h2>{{.i18n.Tr "repo.cloudbrain"}}</h2>
</div> </div>
<div class="column"> <div class="column">
</div> </div>


+ 3
- 3
templates/repo/cloudbrain/new.tmpl View File

@@ -1,13 +1,13 @@
{{template "base/head" .}} {{template "base/head" .}}
<div class="repository new repo"> <div class="repository new repo">
{{template "repo/header" .}}
{{template "repo/header" .}}
<div class="ui middle very relaxed page grid"> <div class="ui middle very relaxed page grid">
<div class="column"> <div class="column">
{{template "base/alert" .}} {{template "base/alert" .}}
<form class="ui form" action="{{.Link}}" method="post"> <form class="ui form" action="{{.Link}}" method="post">
{{.CsrfTokenHtml}} {{.CsrfTokenHtml}}
<h3 class="ui top attached header"> <h3 class="ui top attached header">
New Cloudbrain task
{{.i18n.Tr "repo.cloudbrain.new"}}
</h3> </h3>
<div class="ui attached segment"> <div class="ui attached segment">
<br> <br>
@@ -27,7 +27,7 @@
<div class="inline field"> <div class="inline field">
<label></label> <label></label>
<button class="ui green button"> <button class="ui green button">
Create Cloudbrain
{{.i18n.Tr "repo.cloudbrain.new"}}
</button> </button>
<a class="ui button" href="/">Cancel</a> <a class="ui button" href="/">Cancel</a>
</div> </div>


+ 3
- 3
templates/repo/datasets/dataset_list.tmpl View File

@@ -2,7 +2,7 @@
{{range .Attachments}} {{range .Attachments}}
<div class="ui grid item" id="{{.UUID}}"> <div class="ui grid item" id="{{.UUID}}">
<div class="row"> <div class="row">
<div class="{{if $.Permission.CanWrite $.UnitTypeDatasets}}six{{else}}ten{{end}} wide column">
<div class="{{if $.Permission.CanWrite $.UnitTypeDatasets}}five{{else}}nine{{end}} wide column">
<a class="title" href="{{.DownloadURL}}"> <a class="title" href="{{.DownloadURL}}">
<span class="fitted">{{svg "octicon-cloud-download" 16}}</span> {{.Name}} <span class="fitted">{{svg "octicon-cloud-download" 16}}</span> {{.Name}}
</a> </a>
@@ -18,8 +18,8 @@
<span class="ui text center clipboard" data-clipboard-text="{{.DownloadURL}}" data-tooltip='{{$.i18n.Tr "dataset.copy_url"}}' data-clipboard-action="copy">{{svg "octicon-file" 16}}</span> <span class="ui text center clipboard" data-clipboard-text="{{.DownloadURL}}" data-tooltip='{{$.i18n.Tr "dataset.copy_url"}}' data-clipboard-action="copy">{{svg "octicon-file" 16}}</span>
</div> </div>


<div class="two wide column" style="{{if ne .DecompressState 1}}visibility: hidden{{end}}">
<a class="ui button mini" href="datasets/dirs/{{.UUID}}" data-uuid={{.UUID}} data-dataset-dir data-dir-url="{{AppSubUrl}}/attachments/dir" data-csrf="{{$.CsrfToken}}">{{$.i18n.Tr "dataset.dir"}}</a>
<div class="wide column one" style="{{if ne .DecompressState 1}}display:none{{end}}">
<a class="ui text center" href="datasets/dirs/{{.UUID}}" data-tooltip='{{$.i18n.Tr "dataset.directory"}}'>{{svg "octicon-file-directory" 16}}</a>
</div> </div>


{{if $.Permission.CanWrite $.UnitTypeDatasets}} {{if $.Permission.CanWrite $.UnitTypeDatasets}}


+ 24
- 17
templates/repo/datasets/dirs/dir_list.tmpl View File

@@ -1,20 +1,27 @@
{{if .Dirs}} {{if .Dirs}}
{{range .Dirs}}
<div class="ui grid item">
<div class="row">
<div class="six wide column">
<a class="title" href="{{if .IsDir}}{{$.RepoLink}}/datasets/dirs/{{.UUID}}?parentDir={{.ParenDir}}{{end}}">
<span class="fitted">{{if .IsDir}} {{svg "octicon-file-directory" 16}}{{else}}{{svg "octicon-file" 16}}{{end}}</span> {{.FileName}}
</a>
</div>
<div class="two wide column">
{{.Size | FileSize}}
</div>
<div class="six wide column">
<span>{{.ModTime}}</span>
</div>
<table id="repo-files-table" class="ui single line table">
<tbody>
{{range .Dirs}}
<tr>
<td class="name four wide">
<span class="truncate">
<span class="octicon octicon-file-directory"></span>
<a class="title" href="{{if .IsDir}}{{$.RepoLink}}/datasets/dirs/{{.UUID}}?parentDir={{.ParenDir}}{{end}}">
<span class="fitted">{{if .IsDir}} {{svg "octicon-file-directory" 16}}{{else}}{{svg "octicon-file" 16}}{{end}}</span> {{.FileName}}
</a>
</span>
</td>
<td class="message nine wide">
<span class="truncate has-emoji">
{{.Size | FileSize}}
</span>
</td>
<td class="text right age three wide">
<span class="time-since poping up">{{.ModTime}}</span>
</td>
</tr>
{{end}}
</tbody>
</table>


</div>
</div>
{{end}}
{{end}} {{end}}

+ 7
- 11
templates/repo/datasets/dirs/index.tmpl View File

@@ -1,26 +1,22 @@
{{template "base/head" .}} {{template "base/head" .}}

<div class="repository dataset dir-list view"> <div class="repository dataset dir-list view">
{{template "repo/header" .}}
<form class="ui container"> <form class="ui container">
<div class="ui stackable grid {{if .Error}}hide{{end}}" id="dir-content"> <div class="ui stackable grid {{if .Error}}hide{{end}}" id="dir-content">
<div class="row"> <div class="row">
<div class="column sixteen wide"> <div class="column sixteen wide">
<h2>{{.Title}}</h2>
<p>
{{ range $index, $item := .Path }}
<a href='{{$.Link}}/?parentDir={{if gt $index 0}}{{DatasetPathJoin $.Path $index "/"}}{{else}}{{$item}}{{end}}'>{{ $item }}</a>/
{{ end }}
</p>
</div> </div>
</div> </div>
</div> </div>


<div class="ui divider"></div>
<div class="ui grid"> <div class="ui grid">
<div class="row"> <div class="row">
<div class="ui twelve wide column">
<div class="ui sixteen wide column">
<div class="ui two column stackable grid">
<div class="column">
<h2>{{.i18n.Tr "dataset.dir"}}</h2>
</div>
</div>
</div>
<div class="ui sixteen wide column">
<div class="dir list"> <div class="dir list">
{{template "repo/datasets/dirs/dir_list" .}} {{template "repo/datasets/dirs/dir_list" .}}
</div> </div>


+ 1
- 0
templates/repo/datasets/index.tmpl View File

@@ -92,6 +92,7 @@
data-loading-file='{{.i18n.Tr "dropzone.loading_file"}}' data-loading-file='{{.i18n.Tr "dropzone.loading_file"}}'
data-upload-complete='{{.i18n.Tr "dropzone.upload_complete"}}' data-upload-complete='{{.i18n.Tr "dropzone.upload_complete"}}'
data-uploading='{{.i18n.Tr "dropzone.uploading"}}' data-uploading='{{.i18n.Tr "dropzone.uploading"}}'
data-failed='{{.i18n.Tr "dropzone.failed"}}'
> >
</div> </div>
{{if eq .StoreType "minio"}} {{if eq .StoreType "minio"}}


+ 2
- 2
templates/repo/header.tmpl View File

@@ -99,7 +99,7 @@


{{if .Permission.CanRead $.UnitTypeDatasets}} {{if .Permission.CanRead $.UnitTypeDatasets}}
<a class="{{if .PageIsDataset}}active{{end}} item" href="{{.RepoLink}}/datasets"> <a class="{{if .PageIsDataset}}active{{end}} item" href="{{.RepoLink}}/datasets">
{{svg "octicon-file-submodule" 16}} {{.i18n.Tr "datasets"}}
{{svg "octicon-inbox" 16}} {{.i18n.Tr "datasets"}}
</a> </a>
{{end}} {{end}}


@@ -141,7 +141,7 @@


{{if .Permission.CanRead $.UnitTypeCloudBrain}} {{if .Permission.CanRead $.UnitTypeCloudBrain}}
<a class="{{if .PageIsCloudBrain}}active{{end}} item" href="{{.RepoLink}}/cloudbrain"> <a class="{{if .PageIsCloudBrain}}active{{end}} item" href="{{.RepoLink}}/cloudbrain">
{{svg "octicon-file-submodule" 16}} {{.i18n.Tr "cloudbrains"}}
{{svg "octicon-server" 16}} {{.i18n.Tr "repo.cloudbrain"}}
</a> </a>
{{end}} {{end}}




+ 1
- 1
templates/repo/settings/options.tmpl View File

@@ -143,7 +143,7 @@


{{$isDatasetEnabled := .Repository.UnitEnabled $.UnitTypeDatasets }} {{$isDatasetEnabled := .Repository.UnitEnabled $.UnitTypeDatasets }}
<div class="inline field"> <div class="inline field">
<label>{{.i18n.Tr "repo.dataset"}}</label>
<label>{{.i18n.Tr "repo.datasets"}}</label>
<div class="ui checkbox"> <div class="ui checkbox">
<input class="enable-system" name="enable_dataset" type="checkbox" {{if $isDatasetEnabled}}checked{{end}}> <input class="enable-system" name="enable_dataset" type="checkbox" {{if $isDatasetEnabled}}checked{{end}}>
<label>{{.i18n.Tr "repo.settings.dataset_desc"}}</label> <label>{{.i18n.Tr "repo.settings.dataset_desc"}}</label>


+ 1
- 1
templates/repo/view_list.tmpl View File

@@ -63,7 +63,7 @@
{{if $entry.IsSubModule}} {{if $entry.IsSubModule}}
<td> <td>
<span class="truncate"> <span class="truncate">
{{svg "octicon-file-submodule" 16}}
{{svg "octicon-inbox" 16}}
{{$refURL := $commit.RefURL AppUrl $.Repository.FullName}} {{$refURL := $commit.RefURL AppUrl $.Repository.FullName}}
{{if $refURL}} {{if $refURL}}
<a href="{{$refURL}}">{{$entry.Name}}</a> @ <a href="{{$refURL}}/commit/{{$commit.RefID}}">{{ShortSha $commit.RefID}}</a> <a href="{{$refURL}}">{{$entry.Name}}</a> @ <a href="{{$refURL}}/commit/{{$commit.RefID}}">{{ShortSha $commit.RefID}}</a>


+ 1
- 1
templates/user/profile.tmpl View File

@@ -87,7 +87,7 @@
{{svg "octicon-repo" 16}} {{.i18n.Tr "user.repositories"}} {{svg "octicon-repo" 16}} {{.i18n.Tr "user.repositories"}}
</a> </a>
<a class='{{if eq .TabName "datasets"}}active{{end}} item' href="{{.Owner.HomeLink}}?tab=datasets"> <a class='{{if eq .TabName "datasets"}}active{{end}} item' href="{{.Owner.HomeLink}}?tab=datasets">
{{svg "octicon-file-submodule" 16}} {{.i18n.Tr "user.datasets"}}
{{svg "octicon-inbox" 16}} {{.i18n.Tr "user.datasets"}}
</a> </a>
<a class='{{if eq .TabName "activity"}}active{{end}} item' href="{{.Owner.HomeLink}}?tab=activity"> <a class='{{if eq .TabName "activity"}}active{{end}} item' href="{{.Owner.HomeLink}}?tab=activity">
{{svg "octicon-rss" 16}} {{.i18n.Tr "user.activity"}} {{svg "octicon-rss" 16}} {{.i18n.Tr "user.activity"}}


+ 51
- 33
web_src/js/components/MinioUploader.vue View File

@@ -37,6 +37,10 @@ export default {
}, },


async mounted() { async mounted() {
this.dropzoneParams = $('div#minioUploader-params');
this.file_status_text = this.dropzoneParams.data('file-status');
this.status = this.dropzoneParams.data('file-init-status');

let previewTemplate = ''; let previewTemplate = '';
previewTemplate += '<div class="dz-preview dz-file-preview">\n '; previewTemplate += '<div class="dz-preview dz-file-preview">\n ';
previewTemplate += ' <div class="dz-details">\n '; previewTemplate += ' <div class="dz-details">\n ';
@@ -61,9 +65,6 @@ export default {
previewTemplate += ' </div>\n'; previewTemplate += ' </div>\n';
previewTemplate += '</div>'; previewTemplate += '</div>';


this.dropzoneParams = $('div#minioUploader-params');
this.file_status_text = this.dropzoneParams.data('file-status');
this.status = this.dropzoneParams.data('file-init-status');
const $dropzone = $('div#dataset'); const $dropzone = $('div#dataset');
console.log('createDropzone'); console.log('createDropzone');
const dropzoneUploader = await createDropzone($dropzone[0], { const dropzoneUploader = await createDropzone($dropzone[0], {
@@ -111,6 +112,12 @@ export default {
this.dropzoneUploader.emit('success', file); this.dropzoneUploader.emit('success', file);
this.dropzoneUploader.emit('complete', file); this.dropzoneUploader.emit('complete', file);
}, },
emitDropzoneFailed(file) {
this.status = this.dropzoneParams.data('falied');
file.status = 'error';
this.dropzoneUploader.emit('error', file);
// this.dropzoneUploader.emit('complete', file);
},
onFileAdded(file) { onFileAdded(file) {
file.datasetId = document file.datasetId = document
.getElementById('datasetId') .getElementById('datasetId')
@@ -188,33 +195,38 @@ export default {


async computeMD5Success(md5edFile) { async computeMD5Success(md5edFile) {
const file = await this.getSuccessChunks(md5edFile); const file = await this.getSuccessChunks(md5edFile);
if (file.uploadID == '' || file.uuid == '') {
try {
if (file.uploadID == '' || file.uuid == '') {
// 未上传过 // 未上传过
await this.newMultiUpload(file);
if (file.uploadID != '' && file.uuid != '') {
file.chunks = '';
this.multipartUpload(file);
} else {
await this.newMultiUpload(file);
if (file.uploadID != '' && file.uuid != '') {
file.chunks = '';
this.multipartUpload(file);
} else {
// 失败如何处理 // 失败如何处理
return;
}
return; return;
} }
return;
}


if (file.uploaded == '1') {
if (file.uploaded == '1') {
// 已上传成功 // 已上传成功
// 秒传 // 秒传
if (file.attachID == '0') {
if (file.attachID == '0') {
// 删除数据集记录,未删除文件 // 删除数据集记录,未删除文件
await addAttachment(file);
}
console.log('文件已上传完成');
this.progress = 100;
this.status = this.dropzoneParams.data('upload-complete');
this.finishUpload(file);
} else {
await addAttachment(file);
}
console.log('文件已上传完成');
this.progress = 100;
this.status = this.dropzoneParams.data('upload-complete');
this.finishUpload(file);
} else {
// 断点续传 // 断点续传
this.multipartUpload(file);
this.multipartUpload(file);
}
} catch (error) {
this.emitDropzoneFailed(file);
console.log(error);
} }


async function addAttachment(file) { async function addAttachment(file) {
@@ -247,6 +259,7 @@ export default {
file.attachID = response.data.attachID; file.attachID = response.data.attachID;
return file; return file;
} catch (error) { } catch (error) {
this.emitDropzoneFailed(file);
console.log('getSuccessChunks catch: ', error); console.log('getSuccessChunks catch: ', error);
return null; return null;
} }
@@ -323,24 +336,29 @@ export default {
); );
} }
async function uploadChunk(e) { async function uploadChunk(e) {
if (!checkSuccessChunks()) {
const start = currentChunk * chunkSize;
const partSize =
try {
if (!checkSuccessChunks()) {
const start = currentChunk * chunkSize;
const partSize =
start + chunkSize >= file.size ? file.size - start : chunkSize; start + chunkSize >= file.size ? file.size - start : chunkSize;
// 获取分片上传url
await getUploadChunkUrl(currentChunk, partSize);
if (urls[currentChunk] != '') {
// 获取分片上传url
await getUploadChunkUrl(currentChunk, partSize);
if (urls[currentChunk] != '') {
// 上传到minio // 上传到minio
await uploadMinio(urls[currentChunk], e);
if (etags[currentChunk] != '') {
await uploadMinio(urls[currentChunk], e);
if (etags[currentChunk] != '') {
// 更新数据库:分片上传结果 // 更新数据库:分片上传结果
await updateChunk(currentChunk);
await updateChunk(currentChunk);
} else {
console.log("上传到minio uploadChunk etags[currentChunk] == ''");// TODO
}
} else { } else {
console.log("上传到minio uploadChunk etags[currentChunk] == ''");// TODO
console.log("uploadChunk urls[currentChunk] != ''");// TODO
} }
} else {
console.log("uploadChunk urls[currentChunk] != ''");// TODO
} }
} catch (error) {
this.emitDropzoneFailed(file);
console.log(error);
} }
} }




+ 4
- 1
web_src/less/_dataset.less View File

@@ -51,7 +51,10 @@
} }
} }
.dz-preview .dz-error-message { .dz-preview .dz-error-message {
top: 30px;
background: none;
}
.dz-preview .dz-error-message::after {
border: none !important;
} }
} }
.upload-info { .upload-info {


+ 45
- 54
web_src/less/_repository.less View File

@@ -1,6 +1,5 @@
.repository { .repository {

padding-top: 15px;
// padding-top: 15px;


.repo-header { .repo-header {
.ui.compact.menu { .ui.compact.menu {
@@ -154,7 +153,7 @@
&.labels { &.labels {
.label-filter .menu .info { .label-filter .menu .info {
display: inline-block; display: inline-block;
padding: .5rem .25rem;
padding: 0.5rem 0.25rem;
border-bottom: 1px solid #cccccc; border-bottom: 1px solid #cccccc;
font-size: 12px; font-size: 12px;
width: 100%; width: 100%;
@@ -171,7 +170,7 @@
} }


.text { .text {
margin-left: .9em;
margin-left: 0.9em;
} }


.menu { .menu {
@@ -227,7 +226,7 @@
padding: 0 5px; padding: 0 5px;


&:first-child { &:first-child {
border-radius: .28571429rem 0 0 .28571429rem;
border-radius: 0.28571429rem 0 0 0.28571429rem;
} }
} }


@@ -259,7 +258,6 @@
} }


.repo-path { .repo-path {

.section, .section,
.divider { .divider {
display: inline; display: inline;
@@ -377,11 +375,11 @@
} }


.small.icon { .small.icon {
font-size: .75em;
font-size: 0.75em;
} }


.tiny.icon { .tiny.icon {
font-size: .5em;
font-size: 0.5em;
} }


.file-actions { .file-actions {
@@ -464,7 +462,7 @@


input { input {
vertical-align: middle; vertical-align: middle;
box-shadow: rgba(0, 0, 0, .0745098) 0 1px 2px inset;
box-shadow: rgba(0, 0, 0, 0.0745098) 0 1px 2px inset;
width: inherit; width: inherit;
padding: 7px 8px; padding: 7px 8px;
margin-right: 5px; margin-right: 5px;
@@ -504,8 +502,8 @@
display: inline-block; display: inline-block;
padding: 3px 6px; padding: 3px 6px;
font: 12px @monospaced-fonts, monospace; font: 12px @monospaced-fonts, monospace;
color: rgba(0, 0, 0, .65);
background-color: rgba(209, 227, 237, .45);
color: rgba(0, 0, 0, 0.65);
background-color: rgba(209, 227, 237, 0.45);
border-radius: 3px; border-radius: 3px;
} }


@@ -582,7 +580,6 @@
overflow-x: auto; overflow-x: auto;
} }
} }

} }
} }


@@ -596,7 +593,7 @@
margin-bottom: 5px; margin-bottom: 5px;


.ui.input { .ui.input {
font-size: .5em;
font-size: 0.5em;
vertical-align: top; vertical-align: top;
width: 50%; width: 50%;
min-width: 600px; min-width: 600px;
@@ -660,7 +657,6 @@
} }


.review-item { .review-item {

.avatar, .avatar,
.type-icon { .type-icon {
float: none; float: none;
@@ -675,7 +671,7 @@
} }


.text { .text {
margin: .3em 0 .5em .5em;
margin: 0.3em 0 0.5em 0.5em;
} }


.type-icon { .type-icon {
@@ -684,7 +680,7 @@
} }


.divider { .divider {
margin: .5rem 0;
margin: 0.5rem 0;
} }


.review-content { .review-content {
@@ -696,7 +692,7 @@
.comment-list { .comment-list {
&:not(.prevent-before-timeline):before { &:not(.prevent-before-timeline):before {
display: block; display: block;
content: "";
content: '';
position: absolute; position: absolute;
margin-top: 12px; margin-top: 12px;
margin-bottom: 14px; margin-bottom: 14px;
@@ -714,9 +710,10 @@
margin-left: 40px; margin-left: 40px;
padding-left: 16px; padding-left: 16px;


&:before { //ciara
&:before {
//ciara
display: block; display: block;
content: "";
content: '';
position: absolute; position: absolute;
margin-top: 12px; margin-top: 12px;
margin-bottom: 14px; margin-bottom: 14px;
@@ -810,13 +807,12 @@
} }


.comment { .comment {

.tag { .tag {
color: #767676; color: #767676;
margin-top: 3px; margin-top: 3px;
padding: 2px 5px; padding: 2px 5px;
font-size: 12px; font-size: 12px;
border: 1px solid rgba(0, 0, 0, .1);
border: 1px solid rgba(0, 0, 0, 0.1);
border-radius: 3px; border-radius: 3px;
&.review { &.review {
margin-left: 5px; margin-left: 5px;
@@ -888,10 +884,10 @@
} }


.actions a { .actions a {
color: rgba(0, 0, 0, .4);
color: rgba(0, 0, 0, 0.4);


&:hover { &:hover {
color: rgba(0, 0, 0, .8);
color: rgba(0, 0, 0, 0.8);
} }
} }
} }
@@ -998,7 +994,8 @@
padding-left: 15px; padding-left: 15px;


& > .svg:not(.issue-symbol) { & > .svg:not(.issue-symbol) {
text-shadow: -2px 0 #fff, 0 2px #fff, 2px 0 #fff, 0 -2px #fff;
text-shadow: -2px 0 #fff, 0 2px #fff, 2px 0 #fff,
0 -2px #fff;
} }


& > .svg.issue-symbol { & > .svg.issue-symbol {
@@ -1037,7 +1034,7 @@
} }


.detail { .detail {
font-size: .9rem;
font-size: 0.9rem;
margin-top: 5px; margin-top: 5px;
margin-left: 35px; margin-left: 35px;


@@ -1134,9 +1131,8 @@
} }


.orglabel { .orglabel {
opacity: .7;
opacity: 0.7;
} }

} }


.milestone.list { .milestone.list {
@@ -1315,7 +1311,7 @@
} }


&.ui.basic.striped.table tbody tr:nth-child(2n) { &.ui.basic.striped.table tbody tr:nth-child(2n) {
background-color: rgba(0, 0, 0, .02) !important;
background-color: rgba(0, 0, 0, 0.02) !important;
} }
} }


@@ -1434,7 +1430,7 @@


> div:after { > div:after {
clear: both; clear: both;
content: "";
content: '';
display: block; display: block;
} }


@@ -1590,14 +1586,12 @@
} }


.code-diff-split { .code-diff-split {

table, table,
tbody { tbody {
width: 100%; width: 100%;
} }


tbody tr { tbody tr {

// light gray for empty lines before / after commit // light gray for empty lines before / after commit
&.add-code td:nth-child(1), &.add-code td:nth-child(1),
&.add-code td:nth-child(2), &.add-code td:nth-child(2),
@@ -1650,7 +1644,6 @@
} }


.diff-stats { .diff-stats {

clear: both; clear: both;
margin-bottom: 5px; margin-bottom: 5px;
max-height: 400px; max-height: 400px;
@@ -1697,7 +1690,7 @@
} }


.clone.button:first-child { .clone.button:first-child {
border-radius: .28571429rem 0 0 .28571429rem;
border-radius: 0.28571429rem 0 0 0.28571429rem;
} }


.ui.action.small.input { .ui.action.small.input {
@@ -1825,7 +1818,6 @@
} }


.field { .field {

button, button,
input { input {
@media only screen and (max-width: 438px) { @media only screen and (max-width: 438px) {
@@ -2158,7 +2150,7 @@
} }


&.active { &.active {
background: rgba(0, 0, 0, .05);
background: rgba(0, 0, 0, 0.05);
} }
} }
} }
@@ -2172,12 +2164,12 @@
min-width: 15em; min-width: 15em;


> .header { > .header {
margin: .75rem 0 .5rem;
margin: 0.75rem 0 0.5rem;
} }


> .item { > .item {
float: left; float: left;
padding: .5rem .5rem !important;
padding: 0.5rem 0.5rem !important;
font-size: 1.5em; font-size: 1.5em;
width: 45px; width: 45px;
left: 13px; left: 13px;
@@ -2206,7 +2198,7 @@


&.disabled { &.disabled {
cursor: default; cursor: default;
opacity: .5;
opacity: 0.5;
} }
} }


@@ -2221,7 +2213,7 @@


.select-reaction { .select-reaction {
float: left; float: left;
padding: .6em;
padding: 0.6em;
line-height: 21px; line-height: 21px;


&:not(.active) a { &:not(.active) a {
@@ -2462,11 +2454,11 @@
border-radius: 4px; border-radius: 4px;


.dz-button { .dz-button {
color: rgba(0, 0, 0, .6);
color: rgba(0, 0, 0, 0.6);
} }


&:hover .dz-button { &:hover .dz-button {
color: rgba(0, 0, 0, .8);
color: rgba(0, 0, 0, 0.8);
} }


.dz-error-message { .dz-error-message {
@@ -2481,7 +2473,7 @@


> .header, > .header,
.segment { .segment {
box-shadow: 0 1px 2px 0 rgba(34, 36, 38, .15);
box-shadow: 0 1px 2px 0 rgba(34, 36, 38, 0.15);
} }
} }


@@ -2503,7 +2495,7 @@


> .svg + .content { > .svg + .content {
display: table-cell; display: table-cell;
padding: 0 0 0 .5em;
padding: 0 0 0 0.5em;
vertical-align: top; vertical-align: top;
} }


@@ -2590,13 +2582,12 @@
} }


#avatar-arrow { #avatar-arrow {

&:before, &:before,
&:after { &:after {
right: 100%; right: 100%;
top: 20px; top: 20px;
border: solid transparent; border: solid transparent;
content: " ";
content: ' ';
height: 0; height: 0;
width: 0; width: 0;
position: absolute; position: absolute;
@@ -2642,7 +2633,7 @@
display: table-cell; display: table-cell;


&.tiny { &.tiny {
height: .5em;
height: 0.5em;
} }
} }
} }
@@ -2799,18 +2790,18 @@ tbody.commit-list {
} }


.repo-buttons .disabled-repo-button .label { .repo-buttons .disabled-repo-button .label {
opacity: .5;
opacity: 0.5;
} }


.repo-buttons .disabled-repo-button a.button { .repo-buttons .disabled-repo-button a.button {
opacity: .5;
opacity: 0.5;
cursor: not-allowed; cursor: not-allowed;
} }


.repo-buttons .disabled-repo-button a.button:hover { .repo-buttons .disabled-repo-button a.button:hover {
background: none !important; background: none !important;
color: rgba(0, 0, 0, .6) !important;
box-shadow: 0 0 0 1px rgba(34, 36, 38, .15) inset !important;
color: rgba(0, 0, 0, 0.6) !important;
box-shadow: 0 0 0 1px rgba(34, 36, 38, 0.15) inset !important;
} }


.repo-buttons .ui.labeled.button > .label { .repo-buttons .ui.labeled.button > .label {
@@ -2857,12 +2848,12 @@ td.blob-excerpt {
margin-top: 1em; margin-top: 1em;
} }


.diff-file-box[data-folded="true"] .diff-file-body {
.diff-file-box[data-folded='true'] .diff-file-body {
display: none; display: none;
} }


.diff-file-box[data-folded="true"] .diff-file-header {
border-radius: .28571429rem !important;
.diff-file-box[data-folded='true'] .diff-file-header {
border-radius: 0.28571429rem !important;
} }


/* prevent page shaking on language bar click */ /* prevent page shaking on language bar click */
@@ -2872,7 +2863,7 @@ td.blob-excerpt {
} }


.ui.form .right .ui.button { .ui.form .right .ui.button {
margin-left: .25em;
margin-left: 0.25em;
margin-right: 0; margin-right: 0;
} }




Loading…
Cancel
Save