Browse Source

fix issue

tags/v1.22.4.2^2
zhoupzh 3 years ago
parent
commit
732fdeefb5
3 changed files with 15 additions and 19 deletions
  1. +4
    -3
      templates/repo/attachment/upload.tmpl
  2. +7
    -16
      web_src/js/components/MinioUploader.vue
  3. +4
    -0
      web_src/js/index.js

+ 4
- 3
templates/repo/attachment/upload.tmpl View File

@@ -13,15 +13,16 @@
<el-form label-width="140px">
{{.CsrfTokenHtml}}
<el-form-item label='{{$.i18n.Tr "dataset.dataset_available_clusters"}}:' prop="title">
<el-button :class="{active:type==0}" size="small" style="margin: 0;border-radius: 0.28571429rem 0 0 0.28571429rem;" @click="uploadGpu">CPU/GPU</el-button>
<el-button :class="{active:type==1}" size="small" style="margin: 0 0 0 -4px;border-radius: 0 0.28571429rem 0.28571429rem 0;" @click="uploadNpu">NPU</el-button>
${clusterFlag}
<el-button :class="{active:type==0}" :disabled="clusterFlag" size="small" style="margin: 0;border-radius: 0.28571429rem 0 0 0.28571429rem;" @click="uploadGpu">CPU/GPU</el-button>
<el-button :class="{active:type==1}" :disabled="clusterFlag" size="small" style="margin: 0 0 0 -4px;border-radius: 0 0.28571429rem 0.28571429rem 0;" @click="uploadNpu">NPU</el-button>
<!-- <span>请输入字母、数字、_和-,最长64个字符,且不能以中划线(-)结尾。</span> -->
</el-form-item>
<el-form-item label='{{$.i18n.Tr "dataset.file_description"}}:' prop="description">
<el-input type="textarea" :rows="3" maxlength="255" placeholder="{{$.i18n.Tr "repo.modelarts.train_job.new_place"}}" v-model="desc"></el-input>
</el-form-item>
<el-form-item label='{{$.i18n.Tr "dataset.data_upload"}}:' prop="category">
<minio-uploader :uploadtype="type" :desc="desc"></minio-uploader>
<minio-uploader :uploadtype="type" :desc="desc" @setcluster="setcluster"></minio-uploader>
</el-form-item>
<div style='display:none;'
id="minioUploader-params"


+ 7
- 16
web_src/js/components/MinioUploader.vue View File

@@ -132,40 +132,35 @@ export default {
$('.maxfilesize.ui.red.message').css('display','none')
})
dropzoneUploader.on('maxfilesexceeded', function (file) {
console.log("maxfilesexceeded")
// if (this.files[0].status !== 'success') {
// alert(this.dropzoneParams.data('waitting-uploading'));
// this.removeFile(file);
// return;
// }
dropzoneUploader.removeFile(file)
$('.maxfilesize.ui.red.message').text("单次最多上传10个文件,单个文件不超过200G")
$('.maxfilesize.ui.red.message').css('display','block')
// this.removeAllFiles();
// this.addFile(file);
});

});
this.dropzoneUploader = dropzoneUploader;
console.log(this.dropzoneUploader)
},
watch:{
allUploadLength(len){
console.log(len)
if(len===this.uploadFiles.length){
setTimeout(() => {
this.dropzoneUploader.removeAllFiles(true)
this.btnFlag = false
this.$emit('setcluster',this.btnFlag)
}, 2000);
}
}
},
methods: {
startUpload(){
this.uploadFiles = this.dropzoneUploader.getQueuedFiles()
if(this.uploadFiles.length===0){
return
}
this.resetStatus()
$('.dz-remove').remove()
$('.maxfilesize.ui.red.message').css('display','none')
this.btnFlag = true
this.uploadFiles = this.dropzoneUploader.getQueuedFiles()
this.$emit('setcluster',this.btnFlag)
this.uploadFiles.forEach(element => {
element.datasetId = document.getElementById('datasetId').getAttribute('datasetId')
this.computeMD5(element)
@@ -226,7 +221,6 @@ export default {
file.previewTemplate.querySelector(
'.dz-progress'
).style.opacity = 0
console.log()
if(this.uploadLength === this.uploadFiles.length){
setTimeout(() => {
window.location.href = this.repoPath
@@ -235,7 +229,6 @@ export default {
},

computeMD5(file) {
console.log("computeMD5-file:",file)
const blobSlice =
File.prototype.slice ||
File.prototype.mozSlice ||
@@ -269,7 +262,6 @@ export default {
(currentChunk / chunks) *
100
).toFixed(2)}% (${currentChunk}/${chunks})`;
console.log("this.status",this.status)
this.updateProgress(file, ((currentChunk / chunks) * 100).toFixed(2));
loadMd5Next();
return;
@@ -580,7 +572,6 @@ export default {
this.allUploadLength++
this.uploadError(file,info)
this.allUploadFiles.push({name:file.name,status:2,info:info})
console.log("err",err)
if(err){
return
}


+ 4
- 0
web_src/js/index.js View File

@@ -3837,6 +3837,7 @@ function initVueDataset() {
suburl: AppSubUrl,
url:'',
checked:false,
clusterFlag:false,
type:0,
desc:'',
descfile:'',
@@ -4051,6 +4052,9 @@ function initVueDataset() {
gotoAnnotate(repolink,uuid,type){
location.href = `${AppSubUrl}${repolink}/datasets/label/${uuid}?type=${type}`
},
setcluster(val){
this.clusterFlag = val
},
uploadGpu(){
this.type=0
},


Loading…
Cancel
Save