| @@ -2836,6 +2836,8 @@ uploading = Uploading | |||||
| upload_complete = Uploading complete | upload_complete = Uploading complete | ||||
| failed = Upload Failed | failed = Upload Failed | ||||
| enable_minio_support = Enable minio support to use the dataset service | enable_minio_support = Enable minio support to use the dataset service | ||||
| max_file_tooltips= Upload a maximum of ? files at a time, each file does not exceed ? MB. | |||||
| max_size-tooltips= You can only upload a maximum of ? files at a time. The upload limit has been reached, please do not add more files. | |||||
| [notification] | [notification] | ||||
| notifications = Notifications | notifications = Notifications | ||||
| @@ -2842,6 +2842,8 @@ uploading=正在上传 | |||||
| upload_complete=上传完成 | upload_complete=上传完成 | ||||
| failed=上传失败 | failed=上传失败 | ||||
| enable_minio_support=启用minio支持以使用数据集服务 | enable_minio_support=启用minio支持以使用数据集服务 | ||||
| max_file_tooltips=单次最多上传?个文件,每个文件不超过? MB。 | |||||
| max_size-tooltips=一次最多只能上传?个文件, 上传已达到上限,请勿再添加文件。 | |||||
| [notification] | [notification] | ||||
| notifications=通知 | notifications=通知 | ||||
| @@ -27,10 +27,10 @@ | |||||
| </div> | </div> | ||||
| <div class="field"> | <div class="field"> | ||||
| <div class="files"></div> | <div class="files"></div> | ||||
| <div class="ui dropzone" id="dropzone" data-upload-url="{{.RepoLink}}/upload-file" data-remove-url="{{.RepoLink}}/upload-remove" data-csrf="{{.CsrfToken}}" data-accepts="{{.UploadAllowedTypes}}" data-max-file="{{.UploadMaxFiles}}" data-max-size="{{.UploadMaxSize}}" data-default-message="{{.i18n.Tr "dropzone.default_message"}}" data-invalid-input-type="{{.i18n.Tr "dropzone.invalid_input_type"}}" data-file-too-big="{{.i18n.Tr "dropzone.file_too_big"}}" data-remove-file="{{.i18n.Tr "dropzone.remove_file"}}"><div class="maxfilesize ui red message" style="display: none;margin: 2.5rem;"></div></div> | |||||
| <div class="ui dropzone" id="dropzone" data-upload-url="{{.RepoLink}}/upload-file" data-remove-url="{{.RepoLink}}/upload-remove" data-csrf="{{.CsrfToken}}" data-accepts="{{.UploadAllowedTypes}}" data-max-file="{{.UploadMaxFiles}}" data-max-size="{{.UploadMaxSize}}" data-default-message="{{.i18n.Tr "dropzone.default_message"}}" data-invalid-input-type="{{.i18n.Tr "dropzone.invalid_input_type"}}" data-file-too-big="{{.i18n.Tr "dropzone.file_too_big"}}" data-remove-file="{{.i18n.Tr "dropzone.remove_file"}}" data-max-file-tooltips="{{.i18n.Tr "dropzone.max_file_tooltips"}}" data-max-size-tooltips="{{.i18n.Tr "dropzone.max_size_tooltips"}}"><div class="maxfilesize ui red message" style="display: none;margin: 2.5rem;"></div></div> | |||||
| </div> | </div> | ||||
| {{template "repo/editor/commit_form" .}} | {{template "repo/editor/commit_form" .}} | ||||
| </form> | </form> | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| {{template "base/footer" .}} | |||||
| {{template "base/footer" .}} | |||||
| @@ -2751,9 +2751,23 @@ $(document).ready(async () => { | |||||
| $('td[data-href]').click(function () { | $('td[data-href]').click(function () { | ||||
| window.location = $(this).data('href'); | window.location = $(this).data('href'); | ||||
| }); | }); | ||||
| // 在String原型对象上添加format方法 | |||||
| String.prototype.format = function(){ | |||||
| let str = this; | |||||
| if(arguments.length == 0){ | |||||
| return str; | |||||
| }else{ | |||||
| Object.keys(arguments).forEach((item,index)=>{ | |||||
| str = str.replace(/\?/,arguments[item]) | |||||
| }) | |||||
| return str | |||||
| } | |||||
| } | |||||
| // Dropzone | // Dropzone | ||||
| const $dropzone = $('#dropzone'); | const $dropzone = $('#dropzone'); | ||||
| let maxFileTooltips=$dropzone.data('max-file-tooltips').format($dropzone.data('max-file'),$dropzone.data('max-size')) | |||||
| let maxSizeTooltips=$dropzone.data('max-size-tooltips').format($dropzone.data('max-file')) | |||||
| if ($dropzone.length > 0) { | if ($dropzone.length > 0) { | ||||
| const filenameDict = {}; | const filenameDict = {}; | ||||
| @@ -2769,7 +2783,6 @@ $(document).ready(async () => { | |||||
| dictInvalidFileType: $dropzone.data('invalid-input-type'), | dictInvalidFileType: $dropzone.data('invalid-input-type'), | ||||
| dictFileTooBig: $dropzone.data('file-too-big'), | dictFileTooBig: $dropzone.data('file-too-big'), | ||||
| dictRemoveFile: $dropzone.data('remove-file'), | dictRemoveFile: $dropzone.data('remove-file'), | ||||
| dictMaxFilesExceeded:'上次超过限制', | |||||
| init() { | init() { | ||||
| this.on('success', (file, data) => { | this.on('success', (file, data) => { | ||||
| filenameDict[file.name] = data.uuid; | filenameDict[file.name] = data.uuid; | ||||
| @@ -2790,17 +2803,18 @@ $(document).ready(async () => { | |||||
| } | } | ||||
| }); | }); | ||||
| this.on('addedfile',(file)=>{ | this.on('addedfile',(file)=>{ | ||||
| console.log("addfile",file,filenameDict,this.files.length) | |||||
| if(file.size/(1000*1000)>3){ | if(file.size/(1000*1000)>3){ | ||||
| this.removeFile(file) | this.removeFile(file) | ||||
| $('.maxfilesize.ui.red.message').text('单次最多上传XX个文件,每个文件不超过XXM。') | |||||
| $('.maxfilesize.ui.red.message').text(maxFileTooltips) | |||||
| $('.maxfilesize.ui.red.message').css('display','block') | $('.maxfilesize.ui.red.message').css('display','block') | ||||
| }else{ | |||||
| $('.maxfilesize.ui.red.message').css('display','none') | |||||
| } | } | ||||
| }); | }); | ||||
| this.on('maxfilesexceeded',(file)=>{ | this.on('maxfilesexceeded',(file)=>{ | ||||
| this.removeFile(file) | this.removeFile(file) | ||||
| $('.maxfilesize.ui.red.message').text('一次最多只能上传 5 个文件, 上传已达到上限,请勿再添加文件。') | |||||
| $('.maxfilesize.ui.red.message').text(maxSizeTooltips) | |||||
| $('.maxfilesize.ui.red.message').css('display','block') | $('.maxfilesize.ui.red.message').css('display','block') | ||||
| }) | }) | ||||