fix things
This commit is contained in:
parent
e7c051ac53
commit
21aab14380
|
@ -32,7 +32,6 @@ import {
|
||||||
import { ComlinkWorker } from 'utils/comlink';
|
import { ComlinkWorker } from 'utils/comlink';
|
||||||
import { getFileType } from './readFileService';
|
import { getFileType } from './readFileService';
|
||||||
import { FILE_TYPE } from 'constants/file';
|
import { FILE_TYPE } from 'constants/file';
|
||||||
import { title } from 'process';
|
|
||||||
import uploadService from './uploadService';
|
import uploadService from './uploadService';
|
||||||
|
|
||||||
const MAX_CONCURRENT_UPLOADS = 4;
|
const MAX_CONCURRENT_UPLOADS = 4;
|
||||||
|
@ -95,6 +94,9 @@ class UploadManager {
|
||||||
if (mediaFiles.length) {
|
if (mediaFiles.length) {
|
||||||
UIService.setUploadStage(UPLOAD_STAGES.START);
|
UIService.setUploadStage(UPLOAD_STAGES.START);
|
||||||
await this.extractMetadataFromFiles(mediaFiles);
|
await this.extractMetadataFromFiles(mediaFiles);
|
||||||
|
uploadService.setMetadataAndFileTypeInfoMap(
|
||||||
|
this.metadataAndFileTypeInfoMap
|
||||||
|
);
|
||||||
await this.uploadMediaFiles(mediaFiles);
|
await this.uploadMediaFiles(mediaFiles);
|
||||||
}
|
}
|
||||||
UIService.setUploadStage(UPLOAD_STAGES.FINISH);
|
UIService.setUploadStage(UPLOAD_STAGES.FINISH);
|
||||||
|
@ -155,10 +157,15 @@ class UploadManager {
|
||||||
)) || null;
|
)) || null;
|
||||||
return { fileTypeInfo, metadata };
|
return { fileTypeInfo, metadata };
|
||||||
})();
|
})();
|
||||||
|
|
||||||
this.metadataAndFileTypeInfoMap.set(
|
this.metadataAndFileTypeInfoMap.set(
|
||||||
getMetadataMapKey(collectionID, title),
|
getMetadataMapKey(collectionID, file.name),
|
||||||
{ ...{ fileTypeInfo, metadata } }
|
{
|
||||||
|
fileTypeInfo: { ...fileTypeInfo },
|
||||||
|
metadata: { ...metadata },
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
console.log(this.metadataAndFileTypeInfoMap.keys());
|
||||||
UIService.increaseFileUploaded();
|
UIService.increaseFileUploaded();
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
@ -23,12 +23,20 @@ import {
|
||||||
UploadURL,
|
UploadURL,
|
||||||
MetadataAndFileTypeInfoMap,
|
MetadataAndFileTypeInfoMap,
|
||||||
ParsedMetadataJSONMap,
|
ParsedMetadataJSONMap,
|
||||||
|
ParsedMetadataJSON,
|
||||||
|
MetadataAndFileTypeInfo,
|
||||||
} from 'types/upload';
|
} from 'types/upload';
|
||||||
|
|
||||||
class UploadService {
|
class UploadService {
|
||||||
private uploadURLs: UploadURL[] = [];
|
private uploadURLs: UploadURL[] = [];
|
||||||
private parsedMetadataJSONMap: ParsedMetadataJSONMap;
|
private parsedMetadataJSONMap: ParsedMetadataJSONMap = new Map<
|
||||||
private metadataAndFileTypeInfoMap: MetadataAndFileTypeInfoMap;
|
string,
|
||||||
|
ParsedMetadataJSON
|
||||||
|
>();
|
||||||
|
private metadataAndFileTypeInfoMap: MetadataAndFileTypeInfoMap = new Map<
|
||||||
|
string,
|
||||||
|
MetadataAndFileTypeInfo
|
||||||
|
>();
|
||||||
private pendingUploadCount: number = 0;
|
private pendingUploadCount: number = 0;
|
||||||
|
|
||||||
async setFileCount(fileCount: number) {
|
async setFileCount(fileCount: number) {
|
||||||
|
@ -101,7 +109,8 @@ class UploadService {
|
||||||
}
|
}
|
||||||
|
|
||||||
getFileMetadataAndFileTypeInfo(key: string) {
|
getFileMetadataAndFileTypeInfo(key: string) {
|
||||||
return this.getFileMetadataAndFileTypeInfo(key);
|
console.log(this.metadataAndFileTypeInfoMap, key);
|
||||||
|
return this.metadataAndFileTypeInfoMap.get(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
async encryptFile(
|
async encryptFile(
|
||||||
|
|
Loading…
Reference in a new issue