diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini
index 8df65bd2a..3e49cb21a 100755
--- a/options/locale/locale_zh-CN.ini
+++ b/options/locale/locale_zh-CN.ini
@@ -756,7 +756,8 @@ cloudbrain.commit_image=提交
balance=余额
balance.total_view=余额总览
balance.available=可用余额:
-balance.disable=不可用余额:
+cloudbrain1=云脑1
+cloudbrain2=云脑2
template.items=模板选项
template.git_content=Git数据(默认分支)
diff --git a/package-lock.json b/package-lock.json
index 42d6926af..00eeeea26 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1922,9 +1922,9 @@
"axios": {
"version": "0.21.1",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz",
- "integrity": "sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==",
+ "integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==",
"requires": {
- "follow-redirects": "1.5.10"
+ "follow-redirects": "^1.10.0"
}
},
"babel-loader": {
@@ -3409,6 +3409,11 @@
"assert-plus": "^1.0.0"
}
},
+ "date-format": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npm.taobao.org/date-format/download/date-format-3.0.0.tgz",
+ "integrity": "sha1-64eANlx9KxURB4+0keZHl4DzrZU="
+ },
"dateformat": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/dateformat/-/dateformat-2.2.0.tgz",
@@ -4020,6 +4025,15 @@
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ="
},
+ "esdk-obs-nodejs": {
+ "version": "3.20.11",
+ "resolved": "https://registry.npm.taobao.org/esdk-obs-nodejs/download/esdk-obs-nodejs-3.20.11.tgz?cache=0&sync_timestamp=1610351636380&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fesdk-obs-nodejs%2Fdownload%2Fesdk-obs-nodejs-3.20.11.tgz",
+ "integrity": "sha1-/bMuzu3qoT+xLgmCcgg8yM6MIsE=",
+ "requires": {
+ "log4js": "^6.3.0",
+ "xml2js": "^0.4.23"
+ }
+ },
"eslint": {
"version": "6.8.0",
"resolved": "https://registry.npm.taobao.org/eslint/download/eslint-6.8.0.tgz",
@@ -5195,8 +5209,7 @@
"flatted": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.2.tgz",
- "integrity": "sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==",
- "dev": true
+ "integrity": "sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA=="
},
"flatten": {
"version": "1.0.3",
@@ -5367,6 +5380,16 @@
"readable-stream": "^2.0.0"
}
},
+ "fs-extra": {
+ "version": "8.1.0",
+ "resolved": "https://registry.npm.taobao.org/fs-extra/download/fs-extra-8.1.0.tgz?cache=0&sync_timestamp=1611075469998&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ffs-extra%2Fdownload%2Ffs-extra-8.1.0.tgz",
+ "integrity": "sha1-SdQ8RaiM2Wd2aMt74bRu/bjS4cA=",
+ "requires": {
+ "graceful-fs": "^4.2.0",
+ "jsonfile": "^4.0.0",
+ "universalify": "^0.1.0"
+ }
+ },
"fs-minipass": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz",
@@ -7700,6 +7723,14 @@
"minimist": "^1.2.5"
}
},
+ "jsonfile": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npm.taobao.org/jsonfile/download/jsonfile-4.0.0.tgz?cache=0&sync_timestamp=1604161797011&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fjsonfile%2Fdownload%2Fjsonfile-4.0.0.tgz",
+ "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=",
+ "requires": {
+ "graceful-fs": "^4.1.6"
+ }
+ },
"jsprim": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz",
@@ -8184,6 +8215,18 @@
"chalk": "^2.4.2"
}
},
+ "log4js": {
+ "version": "6.3.0",
+ "resolved": "https://registry.npm.taobao.org/log4js/download/log4js-6.3.0.tgz",
+ "integrity": "sha1-EN+vu0NDUaPjAnegC5h5RG9xW8s=",
+ "requires": {
+ "date-format": "^3.0.0",
+ "debug": "^4.1.1",
+ "flatted": "^2.0.1",
+ "rfdc": "^1.1.4",
+ "streamroller": "^2.2.4"
+ }
+ },
"longest": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz",
@@ -11821,6 +11864,11 @@
"resolved": "https://registry.npmjs.org/rework-visit/-/rework-visit-1.0.0.tgz",
"integrity": "sha1-mUWygD8hni96ygCtuLyfZA+ELJo="
},
+ "rfdc": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npm.taobao.org/rfdc/download/rfdc-1.2.0.tgz?cache=0&sync_timestamp=1610744108114&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Frfdc%2Fdownload%2Frfdc-1.2.0.tgz",
+ "integrity": "sha1-npiUJY9I8oS0PDFDxoBwpPNzuUk="
+ },
"rgb-regex": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/rgb-regex/-/rgb-regex-1.0.1.tgz",
@@ -12428,6 +12476,23 @@
"resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.1.tgz",
"integrity": "sha512-AiisoFqQ0vbGcZgQPY1cdP2I76glaVA/RauYR4G4thNFgkTqr90yXTo4LYX60Jl+sIlPNHHdGSwo01AvbKUSVQ=="
},
+ "streamroller": {
+ "version": "2.2.4",
+ "resolved": "https://registry.npm.taobao.org/streamroller/download/streamroller-2.2.4.tgz",
+ "integrity": "sha1-wZjO1C25QIamGTYIGHzoCl8rDlM=",
+ "requires": {
+ "date-format": "^2.1.0",
+ "debug": "^4.1.1",
+ "fs-extra": "^8.1.0"
+ },
+ "dependencies": {
+ "date-format": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npm.taobao.org/date-format/download/date-format-2.1.0.tgz",
+ "integrity": "sha1-MdW16iEc9f12TNOLr50DPffhJc8="
+ }
+ }
+ },
"strict-uri-encode": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz",
@@ -13983,6 +14048,11 @@
"os-name": "^3.1.0"
}
},
+ "universalify": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npm.taobao.org/universalify/download/universalify-0.1.2.tgz?cache=0&sync_timestamp=1603179967633&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Funiversalify%2Fdownload%2Funiversalify-0.1.2.tgz",
+ "integrity": "sha1-tkb2m+OULavOzJ1mOcgNwQXvqmY="
+ },
"unquote": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/unquote/-/unquote-1.1.1.tgz",
@@ -15035,6 +15105,20 @@
"repeat-string": "^1.5.2"
}
},
+ "xml2js": {
+ "version": "0.4.23",
+ "resolved": "https://registry.npm.taobao.org/xml2js/download/xml2js-0.4.23.tgz?cache=0&sync_timestamp=1599054229598&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fxml2js%2Fdownload%2Fxml2js-0.4.23.tgz",
+ "integrity": "sha1-oMaVFnUkIesqx1juTUzPWIQ+rGY=",
+ "requires": {
+ "sax": ">=0.6.0",
+ "xmlbuilder": "~11.0.0"
+ }
+ },
+ "xmlbuilder": {
+ "version": "11.0.1",
+ "resolved": "https://registry.npm.taobao.org/xmlbuilder/download/xmlbuilder-11.0.1.tgz",
+ "integrity": "sha1-vpuuHIoEbnazESdyY0fQrXACvrM="
+ },
"xtend": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
diff --git a/package.json b/package.json
index 77e28bd06..26654ef8d 100644
--- a/package.json
+++ b/package.json
@@ -19,6 +19,7 @@
"cssnano": "4.1.10",
"domino": "2.1.5",
"dropzone": "5.7.2",
+ "esdk-obs-nodejs": "3.20.11",
"fast-glob": "3.2.2",
"file-loader": "6.0.0",
"fomantic-ui": "2.8.4",
diff --git a/templates/repo/cloudbrain/index.tmpl b/templates/repo/cloudbrain/index.tmpl
index 778c70e50..e2197e3b8 100755
--- a/templates/repo/cloudbrain/index.tmpl
+++ b/templates/repo/cloudbrain/index.tmpl
@@ -198,7 +198,7 @@
-
{{.i18n.Tr "repo.cloudbrain"}}
+ {{.i18n.Tr "repo.cloudbrain1"}}
diff --git a/templates/repo/datasets/index.tmpl b/templates/repo/datasets/index.tmpl
index 2da6ca8bf..c8588ef80 100755
--- a/templates/repo/datasets/index.tmpl
+++ b/templates/repo/datasets/index.tmpl
@@ -50,6 +50,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/web_src/js/components/MinioUploader.vue b/web_src/js/components/MinioUploader.vue
index 85e47506d..7d7875b7b 100755
--- a/web_src/js/components/MinioUploader.vue
+++ b/web_src/js/components/MinioUploader.vue
@@ -134,325 +134,326 @@ export default {
// }, 1000);
},
- computeMD5(file) {
- this.resetStatus();
- const blobSlice =
- File.prototype.slice ||
- File.prototype.mozSlice ||
- File.prototype.webkitSlice,
- chunkSize = 1024 * 1024 * 64,
- chunks = Math.ceil(file.size / chunkSize),
- spark = new SparkMD5.ArrayBuffer(),
- fileReader = new FileReader();
- let currentChunk = 0;
-
- const time = new Date().getTime();
- // console.log('计算MD5...')
- this.status = this.dropzoneParams.data('md5-computing');
- file.totalChunkCounts = chunks;
- loadNext();
-
- fileReader.onload = (e) => {
- fileLoaded.call(this, e);
- };
- fileReader.onerror = (err) => {
- console.warn('oops, something went wrong.', err);
- file.cancel();
- };
-
- function fileLoaded(e) {
- spark.append(e.target.result); // Append array buffer
- currentChunk++;
- if (currentChunk < chunks) {
- // console.log(`第${currentChunk}分片解析完成, 开始第${currentChunk +1}/${chunks}分片解析`);
- this.status = `${this.dropzoneParams.data('loading-file')} ${(
- (currentChunk / chunks) *
- 100
- ).toFixed(2)}% (${currentChunk}/${chunks})`;
- this.updateProgress(file, ((currentChunk / chunks) * 100).toFixed(2));
- loadNext();
- return;
- }
-
- const md5 = spark.end();
- console.log(
- `MD5计算完成:${file.name} \nMD5:${md5} \n分片:${chunks} 大小:${
- file.size
- } 用时:${(new Date().getTime() - time) / 1000} s`
- );
- spark.destroy(); // 释放缓存
- file.uniqueIdentifier = md5; // 将文件md5赋值给文件唯一标识
- file.cmd5 = false; // 取消计算md5状态
- this.computeMD5Success(file);
- }
-
- function loadNext() {
- const start = currentChunk * chunkSize;
- const end =
- start + chunkSize >= file.size ? file.size : start + chunkSize;
- fileReader.readAsArrayBuffer(blobSlice.call(file, start, end));
- }
- },
-
- async computeMD5Success(md5edFile) {
- const file = await this.getSuccessChunks(md5edFile);
- try {
- if (file.uploadID == '' || file.uuid == '') {
- // 未上传过
- await this.newMultiUpload(file);
- if (file.uploadID != '' && file.uuid != '') {
- file.chunks = '';
- this.multipartUpload(file);
- } else {
- // 失败如何处理
- return;
- }
- return;
- }
-
- if (file.uploaded == '1') {
- // 已上传成功
- // 秒传
- if (file.attachID == '0') {
- // 删除数据集记录,未删除文件
- await addAttachment(file);
- }
- //不同数据集上传同一个文件
- if (file.datasetID != '') {
- if (Number(file.datasetID) != file.datasetId) {
- var info = "该文件已上传,对应数据集(" + file.datasetName + ")-文件(" + file.realName + ")";
- window.alert(info);
- window.location.reload();
- }
- }
- console.log('文件已上传完成');
- this.progress = 100;
- this.status = this.dropzoneParams.data('upload-complete');
- this.finishUpload(file);
- } else {
- // 断点续传
- this.multipartUpload(file);
- }
- } catch (error) {
- this.emitDropzoneFailed(file);
- console.log(error);
- }
-
- async function addAttachment(file) {
- return await axios.post(
- '/attachments/add',
- qs.stringify({
- uuid: file.uuid,
- file_name: file.name,
- size: file.size,
- dataset_id: file.datasetId,
- _csrf: csrf
- })
- );
- }
- },
-
- async getSuccessChunks(file) {
- const params = {
- params: {
- md5: file.uniqueIdentifier,
- type: cloud_brain_type,
- _csrf: csrf
- }
- };
- try {
- const response = await axios.get('/attachments/get_chunks', params);
- file.uploadID = response.data.uploadID;
- file.uuid = response.data.uuid;
- file.uploaded = response.data.uploaded;
- file.chunks = response.data.chunks;
- file.attachID = response.data.attachID;
- file.datasetID = response.data.datasetID;
- file.datasetName = response.data.datasetName;
- file.realName = response.data.fileName;
- return file;
- } catch (error) {
- this.emitDropzoneFailed(file);
- console.log('getSuccessChunks catch: ', error);
- return null;
- }
- },
-
- async newMultiUpload(file) {
- const res = await axios.get('/attachments/new_multipart', {
- params: {
- totalChunkCounts: file.totalChunkCounts,
- md5: file.uniqueIdentifier,
- size: file.size,
- fileType: file.type,
- type: cloud_brain_type,
- _csrf: csrf
- }
- });
- file.uploadID = res.data.uploadID;
- file.uuid = res.data.uuid;
- },
-
- multipartUpload(file) {
- const blobSlice =
- File.prototype.slice ||
- File.prototype.mozSlice ||
- File.prototype.webkitSlice,
- chunkSize = 1024 * 1024 * 64,
- chunks = Math.ceil(file.size / chunkSize),
- fileReader = new FileReader(),
- time = new Date().getTime();
- let currentChunk = 0;
-
- function loadNext() {
- const start = currentChunk * chunkSize;
- const end =
- start + chunkSize >= file.size ? file.size : start + chunkSize;
- fileReader.readAsArrayBuffer(blobSlice.call(file, start, end));
- }
-
- function checkSuccessChunks() {
- const index = successChunks.indexOf((currentChunk + 1).toString());
- if (index == -1) {
- return false;
- }
- return true;
- }
-
- async function getUploadChunkUrl(currentChunk, partSize) {
- const res = await axios.get('/attachments/get_multipart_url', {
- params: {
- uuid: file.uuid,
- uploadID: file.uploadID,
- size: partSize,
- chunkNumber: currentChunk + 1,
- type: cloud_brain_type,
- _csrf: csrf
- }
- });
- urls[currentChunk] = res.data.url;
- }
-
- async function uploadMinio(url, e) {
- const res = await axios.put(url, e.target.result);
- etags[currentChunk] = res.headers.etag;
- }
-
- async function updateChunk(currentChunk) {
- await axios.post(
- '/attachments/update_chunk',
- qs.stringify({
- uuid: file.uuid,
- chunkNumber: currentChunk + 1,
- etag: etags[currentChunk],
- _csrf: csrf
- })
- );
- }
-
- async function uploadPart(currentChunk, partSize, e) {
- console.log(e);
- let params = new FormData();
- params.append("uuid", file.uuid);
- params.append("uploadId", file.uploadID);
- params.append("size", partSize);
- params.append("chunkNumber", currentChunk + 1);
- params.append("file", e.target.file);
- params.append("_csrf", csrf);
- return await axios.post('/attachments/upload_part',
- params,
- {headers: {'Content-Type': 'multipart/form-data'}}
- );
- }
-
- async function uploadChunk(e) {
- try {
- if (!checkSuccessChunks()) {
- const start = currentChunk * chunkSize;
- const partSize =
- start + chunkSize >= file.size ? file.size - start : chunkSize;
- await uploadPart(currentChunk, partSize, e);
-
- // 获取分片上传url
- // await getUploadChunkUrl(currentChunk, partSize);
- // if (urls[currentChunk] != '') {
- // // 上传到minio
- // await uploadMinio(urls[currentChunk], e);
- // if (etags[currentChunk] != '') {
- // // 更新数据库:分片上传结果
- // //await updateChunk(currentChunk);
- // } else {
- // console.log("上传到minio uploadChunk etags[currentChunk] == ''");// TODO
- // }
- // } else {
- // console.log("uploadChunk urls[currentChunk] != ''");// TODO
- // }
-
- }
- } catch (error) {
- console.log(error);
- this.emitDropzoneFailed(file);
- }
- }
-
- async function completeUpload() {
- return await axios.post(
- '/attachments/complete_multipart',
- qs.stringify({
- uuid: file.uuid,
- uploadID: file.uploadID,
- file_name: file.name,
- size: file.size,
- dataset_id: file.datasetId,
- type: cloud_brain_type,
- _csrf: csrf
- })
- );
- }
-
- const successChunks = [];
- let successParts = [];
- successParts = file.chunks.split(',');
- for (let i = 0; i < successParts.length; i++) {
- successChunks[i] = successParts[i].split('-')[0];
- }
- const urls = []; // TODO const ?
- const etags = [];
- console.log('上传分片...');
- this.status = this.dropzoneParams.data('uploading');
- loadNext();
- fileReader.onload = async (e) => {
- await uploadChunk(e);
- fileReader.abort();
- currentChunk++;
- if (currentChunk < chunks) {
- console.log(
- `第${currentChunk}个分片上传完成, 开始第${currentChunk +
- 1}/${chunks}个分片上传`
- );
- this.progress = Math.ceil((currentChunk / chunks) * 100);
- this.updateProgress(file, ((currentChunk / chunks) * 100).toFixed(2));
- this.status = `${this.dropzoneParams.data('uploading')} ${(
- (currentChunk / chunks) *
- 100
- ).toFixed(2)}%`;
- await loadNext();
- } else {
- await completeUpload();
- console.log(
- `文件上传完成:${file.name} \n分片:${chunks} 大小:${
- file.size
- } 用时:${(new Date().getTime() - time) / 1000} s`
- );
- this.progress = 100;
- this.status = this.dropzoneParams.data('upload-complete');
- this.finishUpload(file);
- }
- };
- }
- }
-};
-
+// computeMD5(file) {
+// this.resetStatus();
+// const blobSlice =
+// File.prototype.slice ||
+// File.prototype.mozSlice ||
+// File.prototype.webkitSlice,
+// chunkSize = 1024 * 1024 * 64,
+// chunks = Math.ceil(file.size / chunkSize),
+// spark = new SparkMD5.ArrayBuffer(),
+// fileReader = new FileReader();
+// let currentChunk = 0;
+
+// const time = new Date().getTime();
+// // console.log('计算MD5...')
+// this.status = this.dropzoneParams.data('md5-computing');
+// file.totalChunkCounts = chunks;
+// loadNext();
+
+// fileReader.onload = (e) => {
+// fileLoaded.call(this, e);
+// };
+// fileReader.onerror = (err) => {
+// console.warn('oops, something went wrong.', err);
+// file.cancel();
+// };
+
+// function fileLoaded(e) {
+// spark.append(e.target.result); // Append array buffer
+// currentChunk++;
+// if (currentChunk < chunks) {
+// // console.log(`第${currentChunk}分片解析完成, 开始第${currentChunk +1}/${chunks}分片解析`);
+// this.status = `${this.dropzoneParams.data('loading-file')} ${(
+// (currentChunk / chunks) *
+// 100
+// ).toFixed(2)}% (${currentChunk}/${chunks})`;
+// this.updateProgress(file, ((currentChunk / chunks) * 100).toFixed(2));
+// loadNext();
+// return;
+// }
+
+// const md5 = spark.end();
+// console.log(
+// `MD5计算完成:${file.name} \nMD5:${md5} \n分片:${chunks} 大小:${
+// file.size
+// } 用时:${(new Date().getTime() - time) / 1000} s`
+// );
+// spark.destroy(); // 释放缓存
+// file.uniqueIdentifier = md5; // 将文件md5赋值给文件唯一标识
+// file.cmd5 = false; // 取消计算md5状态
+// this.computeMD5Success(file);
+// }
+
+// function loadNext() {
+// const start = currentChunk * chunkSize;
+// const end =
+// start + chunkSize >= file.size ? file.size : start + chunkSize;
+// fileReader.readAsArrayBuffer(blobSlice.call(file, start, end));
+// }
+// },
+
+// async computeMD5Success(md5edFile) {
+// const file = await this.getSuccessChunks(md5edFile);
+// try {
+// if (file.uploadID == '' || file.uuid == '') {
+// // 未上传过
+// await this.newMultiUpload(file);
+// if (file.uploadID != '' && file.uuid != '') {
+// file.chunks = '';
+// this.multipartUpload(file);
+// } else {
+// // 失败如何处理
+// return;
+// }
+// return;
+// }
+
+// if (file.uploaded == '1') {
+// // 已上传成功
+// // 秒传
+// if (file.attachID == '0') {
+// // 删除数据集记录,未删除文件
+// await addAttachment(file);
+// }
+// //不同数据集上传同一个文件
+// if (file.datasetID != '') {
+// if (Number(file.datasetID) != file.datasetId) {
+// var info = "该文件已上传,对应数据集(" + file.datasetName + ")-文件(" + file.realName + ")";
+// window.alert(info);
+// window.location.reload();
+// }
+// }
+// console.log('文件已上传完成');
+// this.progress = 100;
+// this.status = this.dropzoneParams.data('upload-complete');
+// this.finishUpload(file);
+// } else {
+// // 断点续传
+// this.multipartUpload(file);
+// }
+// } catch (error) {
+// this.emitDropzoneFailed(file);
+// console.log(error);
+// }
+
+// async function addAttachment(file) {
+// return await axios.post(
+// '/attachments/add',
+// qs.stringify({
+// uuid: file.uuid,
+// file_name: file.name,
+// size: file.size,
+// dataset_id: file.datasetId,
+// _csrf: csrf
+// })
+// );
+// }
+// },
+
+// async getSuccessChunks(file) {
+// const params = {
+// params: {
+// md5: file.uniqueIdentifier,
+// type: cloud_brain_type,
+// _csrf: csrf
+// }
+// };
+// try {
+// const response = await axios.get('/attachments/get_chunks', params);
+// file.uploadID = response.data.uploadID;
+// file.uuid = response.data.uuid;
+// file.uploaded = response.data.uploaded;
+// file.chunks = response.data.chunks;
+// file.attachID = response.data.attachID;
+// file.datasetID = response.data.datasetID;
+// file.datasetName = response.data.datasetName;
+// file.realName = response.data.fileName;
+// return file;
+// } catch (error) {
+// this.emitDropzoneFailed(file);
+// console.log('getSuccessChunks catch: ', error);
+// return null;
+// }
+// },
+
+// async newMultiUpload(file) {
+// const res = await axios.get('/attachments/new_multipart', {
+// params: {
+// totalChunkCounts: file.totalChunkCounts,
+// md5: file.uniqueIdentifier,
+// size: file.size,
+// fileType: file.type,
+// type: cloud_brain_type,
+// _csrf: csrf
+// }
+// });
+// console.log("dsnjs", res)
+// file.uploadID = res.data.uploadID;
+// file.uuid = res.data.uuid;
+// },
+
+// multipartUpload(file) {
+// const blobSlice =
+// File.prototype.slice ||
+// File.prototype.mozSlice ||
+// File.prototype.webkitSlice,
+// chunkSize = 1024 * 1024 * 64,
+// chunks = Math.ceil(file.size / chunkSize),
+// fileReader = new FileReader(),
+// time = new Date().getTime();
+// let currentChunk = 0;
+
+// function loadNext() {
+// const start = currentChunk * chunkSize;
+// const end =
+// start + chunkSize >= file.size ? file.size : start + chunkSize;
+// fileReader.readAsArrayBuffer(blobSlice.call(file, start, end));
+// }
+
+// function checkSuccessChunks() {
+// const index = successChunks.indexOf((currentChunk + 1).toString());
+// if (index == -1) {
+// return false;
+// }
+// return true;
+// }
+
+// // async function getUploadChunkUrl(currentChunk, partSize) {
+// // const res = await axios.get('/attachments/get_multipart_url', {
+// // params: {
+// // uuid: file.uuid,
+// // uploadID: file.uploadID,
+// // size: partSize,
+// // chunkNumber: currentChunk + 1,
+// // type: cloud_brain_type,
+// // _csrf: csrf
+// // }
+// // });
+// // urls[currentChunk] = res.data.url;
+// // }
+
+// // async function uploadMinio(url, e) {
+// // const res = await axios.put(url, e.target.result);
+// // etags[currentChunk] = res.headers.etag;
+// // }
+
+// // async function updateChunk(currentChunk) {
+// // await axios.post(
+// // '/attachments/update_chunk',
+// // qs.stringify({
+// // uuid: file.uuid,
+// // chunkNumber: currentChunk + 1,
+// // etag: etags[currentChunk],
+// // _csrf: csrf
+// // })
+// // );
+// // }
+
+// async function uploadPart(currentChunk, partSize, e) {
+// console.log(e);
+// let params = new FormData();
+// params.append("uuid", file.uuid);
+// params.append("uploadId", file.uploadID);
+// params.append("size", partSize);
+// params.append("chunkNumber", currentChunk + 1);
+// params.append("file", e.target.file);
+// params.append("_csrf", csrf);
+// return await axios.post('/attachments/upload_part',
+// params,
+// {headers: {'Content-Type': 'multipart/form-data'}}
+// );
+// }
+
+// async function uploadChunk(e) {
+// try {
+// if (!checkSuccessChunks()) {
+// const start = currentChunk * chunkSize;
+// const partSize =
+// start + chunkSize >= file.size ? file.size - start : chunkSize;
+// await uploadPart(currentChunk, partSize, e);
+
+// // 获取分片上传url
+// // await getUploadChunkUrl(currentChunk, partSize);
+// // if (urls[currentChunk] != '') {
+// // // 上传到minio
+// // await uploadMinio(urls[currentChunk], e);
+// // if (etags[currentChunk] != '') {
+// // // 更新数据库:分片上传结果
+// // //await updateChunk(currentChunk);
+// // } else {
+// // console.log("上传到minio uploadChunk etags[currentChunk] == ''");// TODO
+// // }
+// // } else {
+// // console.log("uploadChunk urls[currentChunk] != ''");// TODO
+// // }
+
+// }
+// } catch (error) {
+// console.log(error);
+// this.emitDropzoneFailed(file);
+// }
+// }
+
+// async function completeUpload() {
+// return await axios.post(
+// '/attachments/complete_multipart',
+// qs.stringify({
+// uuid: file.uuid,
+// uploadID: file.uploadID,
+// file_name: file.name,
+// size: file.size,
+// dataset_id: file.datasetId,
+// type: cloud_brain_type,
+// _csrf: csrf
+// })
+// );
+// }
+
+// const successChunks = [];
+// let successParts = [];
+// successParts = file.chunks.split(',');
+// for (let i = 0; i < successParts.length; i++) {
+// successChunks[i] = successParts[i].split('-')[0];
+// }
+// const urls = []; // TODO const ?
+// const etags = [];
+// console.log('上传分片...');
+// this.status = this.dropzoneParams.data('uploading');
+// loadNext();
+// fileReader.onload = async (e) => {
+// await uploadChunk(e);
+// fileReader.abort();
+// currentChunk++;
+// if (currentChunk < chunks) {
+// console.log(
+// `第${currentChunk}个分片上传完成, 开始第${currentChunk +
+// 1}/${chunks}个分片上传`
+// );
+// this.progress = Math.ceil((currentChunk / chunks) * 100);
+// this.updateProgress(file, ((currentChunk / chunks) * 100).toFixed(2));
+// this.status = `${this.dropzoneParams.data('uploading')} ${(
+// (currentChunk / chunks) *
+// 100
+// ).toFixed(2)}%`;
+// await loadNext();
+// } else {
+// await completeUpload();
+// console.log(
+// `文件上传完成:${file.name} \n分片:${chunks} 大小:${
+// file.size
+// } 用时:${(new Date().getTime() - time) / 1000} s`
+// );
+// this.progress = 100;
+// this.status = this.dropzoneParams.data('upload-complete');
+// this.finishUpload(file);
+// }
+// };
+// }
+// }
+// };
+//