mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[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:
committed by
Eugenio Romano
parent
ee871ba578
commit
843afdbcc6
@@ -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'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user