mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[ADF-4410] Upload dialog - remove delete action of version upload (#4618)
* undo remove node version implementation * clean up style * version upload row style * upload version row cells * update tests * fix aria label
This commit is contained in:
committed by
Eugenio Romano
parent
7826eea946
commit
cc53d96698
@@ -19,7 +19,6 @@ import {
|
||||
FileModel,
|
||||
FileUploadStatus,
|
||||
NodesApiService,
|
||||
AlfrescoApiService,
|
||||
TranslationService,
|
||||
UploadService
|
||||
} from '@alfresco/adf-core';
|
||||
@@ -31,7 +30,7 @@ import {
|
||||
TemplateRef,
|
||||
EventEmitter
|
||||
} from '@angular/core';
|
||||
import { Observable, forkJoin, of, from } from 'rxjs';
|
||||
import { Observable, forkJoin, of } from 'rxjs';
|
||||
import { map, catchError } from 'rxjs/operators';
|
||||
|
||||
@Component({
|
||||
@@ -53,7 +52,6 @@ export class FileUploadingListComponent {
|
||||
error: EventEmitter<any> = new EventEmitter();
|
||||
|
||||
constructor(
|
||||
private alfrescoApiService: AlfrescoApiService,
|
||||
private uploadService: UploadService,
|
||||
private nodesApi: NodesApiService,
|
||||
private translateService: TranslationService
|
||||
@@ -78,23 +76,14 @@ export class FileUploadingListComponent {
|
||||
* @memberOf FileUploadingListComponent
|
||||
*/
|
||||
removeFile(file: FileModel): void {
|
||||
if (file.options && file.options.newVersion) {
|
||||
this.deleteNodeVersion(file).subscribe(() => {
|
||||
if (file.status === FileUploadStatus.Error) {
|
||||
this.notifyError(file);
|
||||
}
|
||||
this.uploadService.cancelUpload(file);
|
||||
});
|
||||
} else {
|
||||
this.deleteNode(file).subscribe(() => {
|
||||
if (file.status === FileUploadStatus.Error) {
|
||||
this.notifyError(file);
|
||||
}
|
||||
this.deleteNode(file).subscribe(() => {
|
||||
if (file.status === FileUploadStatus.Error) {
|
||||
this.notifyError(file);
|
||||
}
|
||||
|
||||
this.cancelNodeVersionInstances(file);
|
||||
this.uploadService.cancelUpload(file);
|
||||
});
|
||||
}
|
||||
this.cancelNodeVersionInstances(file);
|
||||
this.uploadService.cancelUpload(file);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -168,24 +157,6 @@ export class FileUploadingListComponent {
|
||||
);
|
||||
}
|
||||
|
||||
private deleteNodeVersion(file: FileModel): Observable<FileModel> {
|
||||
return from(
|
||||
this.alfrescoApiService.versionsApi.deleteVersion(
|
||||
file.data.entry.id,
|
||||
file.data.entry.properties['cm:versionLabel']
|
||||
)
|
||||
).pipe(
|
||||
map(() => {
|
||||
file.status = FileUploadStatus.Deleted;
|
||||
return file;
|
||||
}),
|
||||
catchError(() => {
|
||||
file.status = FileUploadStatus.Error;
|
||||
return of(file);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
private cancelNodeVersionInstances(file) {
|
||||
this.files
|
||||
.filter(
|
||||
|
Reference in New Issue
Block a user