RED-4467: Don't show overwrite files dialog on empty dossiers

This commit is contained in:
Adina Țeudan 2022-07-01 22:07:39 +03:00
parent aafa0690cd
commit ccd86a1dfd

View File

@ -11,6 +11,7 @@ import { FilesMapService } from '@services/files/files-map.service';
import { switchMap, tap, throttleTime } from 'rxjs/operators'; import { switchMap, tap, throttleTime } from 'rxjs/operators';
import { FilesService } from '@services/files/files.service'; import { FilesService } from '@services/files/files.service';
import { UploadDownloadDialogService } from './upload-download-dialog.service'; import { UploadDownloadDialogService } from './upload-download-dialog.service';
import { ActiveDossiersService } from '@services/dossiers/active-dossiers.service';
export interface ActiveUpload { export interface ActiveUpload {
subscription: Subscription; subscription: Subscription;
@ -37,6 +38,7 @@ export class FileUploadService extends GenericService<IFileUploadResult> impleme
private readonly _configService: ConfigService, private readonly _configService: ConfigService,
private readonly _dialogService: UploadDownloadDialogService, private readonly _dialogService: UploadDownloadDialogService,
private readonly _errorMessageService: ErrorMessageService, private readonly _errorMessageService: ErrorMessageService,
private readonly _activeDossiersService: ActiveDossiersService,
protected readonly _injector: Injector, protected readonly _injector: Injector,
) { ) {
super(_injector, 'upload'); super(_injector, 'upload');
@ -76,15 +78,17 @@ export class FileUploadService extends GenericService<IFileUploadResult> impleme
let currentOption = option; let currentOption = option;
if (isZip(file)) { if (isZip(file)) {
const res = await this._dialogService.openOverwriteFileDialog(null); if (dossierFiles.length > 0) {
if (res.cancel) { const res = await this._dialogService.openOverwriteFileDialog(null);
return; if (res.cancel) {
} return;
if (res.option === OverwriteFileOptions.PARTIAL_OVERWRITE) { }
file.keepManualRedactions = true; if (res.option === OverwriteFileOptions.PARTIAL_OVERWRITE) {
} file.keepManualRedactions = true;
if (res.option === OverwriteFileOptions.SKIP) { }
files = []; if (res.option === OverwriteFileOptions.SKIP) {
files = [];
}
} }
} else if (dossierFiles.find(pf => pf.filename === file.file.name)) { } else if (dossierFiles.find(pf => pf.filename === file.file.name)) {
if (!option) { if (!option) {