[ADF-523] Fix delete operation in the search component (#2020)

* Search delete permission notification fix

* Support content deletion inside search results

* Forgotten broken test fix.

* Update alfresco-document-list READDME.md

* Update alfresco-document-list READDME.md II

* Adding TOC to README.md

* Build fix

* Fix the build for now and ever!
This commit is contained in:
Popovics András
2017-07-06 09:45:03 +01:00
committed by Eugenio Romano
parent ee871ba578
commit 843afdbcc6
14 changed files with 214 additions and 46 deletions

View File

@@ -19,7 +19,7 @@ import { Injectable } from '@angular/core';
import { ContentActionHandler } from '../models/content-action.model';
import { PermissionModel } from '../models/permissions.model';
import { DocumentListService } from './document-list.service';
import { Subject } from 'rxjs/Rx';
import { Subject, Observable } from 'rxjs/Rx';
@Injectable()
export class FolderActionsService {
@@ -71,16 +71,21 @@ export class FolderActionsService {
window.alert('standard folder action 2');
}
private deleteNode(obj: any, target?: any, permission?: string) {
private deleteNode(obj: any, target?: any, permission?: string): Observable<any> {
let handlerObservale: Observable<any>;
if (this.canExecuteAction(obj)) {
if (this.hasPermission(obj.entry, permission)) {
this.documentListService.deleteNode(obj.entry.id).subscribe(() => {
handlerObservale = this.documentListService.deleteNode(obj.entry.id);
handlerObservale.subscribe(() => {
if (target && typeof target.reload === 'function') {
target.reload();
}
});
return handlerObservale;
} else {
this.permissionEvent.next(new PermissionModel({type: 'folder', action: 'delete', permission: permission}));
return Observable.throw(new Error('No permission to delete'));
}
}
}