|
|
@ -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[] = [];
|
|
|
@ -41,17 +42,22 @@ export class FilesystemImportComponent {
|
|
|
|
this.importing = true;
|
|
|
|
this.importing = true;
|
|
|
|
|
|
|
|
|
|
|
|
this.importingProgress = 0;
|
|
|
|
this.importingProgress = 0;
|
|
|
|
|
|
|
|
let count = 0;
|
|
|
|
|
|
|
|
|
|
|
|
for (const file of this.files) {
|
|
|
|
for (const file of this.files) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
const resultFile = await this.importService.addLocalFile(file, this.importOptions);
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|