|
|
@ -13,6 +13,7 @@ import {File} from "../../../../../models/File";
|
|
|
|
export class FilesystemImportComponent {
|
|
|
|
export class FilesystemImportComponent {
|
|
|
|
|
|
|
|
|
|
|
|
@Output() fileImported = new EventEmitter<File>();
|
|
|
|
@Output() fileImported = new EventEmitter<File>();
|
|
|
|
|
|
|
|
@Output() importFinished = new EventEmitter<void>();
|
|
|
|
|
|
|
|
|
|
|
|
public fileCount: number = 0;
|
|
|
|
public fileCount: number = 0;
|
|
|
|
public files: FileOsMetadata[] = [];
|
|
|
|
public files: FileOsMetadata[] = [];
|
|
|
@ -40,18 +41,23 @@ export class FilesystemImportComponent {
|
|
|
|
public async import() {
|
|
|
|
public async import() {
|
|
|
|
this.importing = true;
|
|
|
|
this.importing = true;
|
|
|
|
|
|
|
|
|
|
|
|
this.importingProgress = 0;
|
|
|
|
this.importingProgress = 0;
|
|
|
|
for (const file of this.files) {
|
|
|
|
let count = 0;
|
|
|
|
try {
|
|
|
|
|
|
|
|
const resultFile = await this.importService.addLocalFile(file, this.importOptions);
|
|
|
|
for (const file of this.files) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
const resultFile = await this.importService.addLocalFile(file,
|
|
|
|
|
|
|
|
this.importOptions);
|
|
|
|
this.fileImported.emit(resultFile);
|
|
|
|
this.fileImported.emit(resultFile);
|
|
|
|
} catch (err) {
|
|
|
|
} catch (err) {
|
|
|
|
console.log(err);
|
|
|
|
console.log(err);
|
|
|
|
this.errorBroker.showError(err);
|
|
|
|
this.errorBroker.showError(err);
|
|
|
|
}
|
|
|
|
|
|
|
|
this.importingProgress++;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
count++;
|
|
|
|
|
|
|
|
this.importingProgress = (count / this.fileCount) * 100;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.importing = false;
|
|
|
|
this.importing = false;
|
|
|
|
|
|
|
|
this.importFinished.emit();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|