mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-2645] move the service use in the upload in the right place (#3189)
[ADF-2645] move the service use in the upload in the right place [ADF-2687] No message is displayed when deleting a file/folder from content action [ADF-2714] [demo shell] Not able to download a version of a file * add spaces tslint fix
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { ContentService } from '@alfresco/adf-core';
|
||||
import { ContentService, TranslationService } from '@alfresco/adf-core';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { MinimalNodeEntity } from 'alfresco-js-api';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
@@ -38,6 +38,7 @@ export class DocumentActionsService {
|
||||
|
||||
constructor(private nodeActionsService: NodeActionsService,
|
||||
private contentNodeDialogService: ContentNodeDialogService,
|
||||
private translation: TranslationService,
|
||||
private documentListService?: DocumentListService,
|
||||
private contentService?: ContentService) {
|
||||
this.setupActionHandlers();
|
||||
@@ -111,7 +112,7 @@ export class DocumentActionsService {
|
||||
private prepareHandlers(actionObservable, type: string, action: string, target?: any, permission?: string): void {
|
||||
actionObservable.subscribe(
|
||||
(fileOperationMessage) => {
|
||||
this.success.next(fileOperationMessage);
|
||||
this.success.next(fileOperationMessage);
|
||||
},
|
||||
this.error.next.bind(this.error)
|
||||
);
|
||||
@@ -124,11 +125,19 @@ export class DocumentActionsService {
|
||||
if (this.contentService.hasPermission(node.entry, permission)) {
|
||||
handlerObservable = this.documentListService.deleteNode(node.entry.id);
|
||||
handlerObservable.subscribe(() => {
|
||||
this.success.next(node.entry.id);
|
||||
let message = this.translation.instant('CORE.DELETE_NODE.SINGULAR', { name: node.entry.name });
|
||||
this.success.next(message);
|
||||
}, () => {
|
||||
let message = this.translation.instant('CORE.DELETE_NODE.ERROR_SINGULAR', { name: node.entry.name });
|
||||
this.error.next(message);
|
||||
});
|
||||
return handlerObservable;
|
||||
} else {
|
||||
this.permissionEvent.next(new PermissionModel({type: 'content', action: 'delete', permission: permission}));
|
||||
this.permissionEvent.next(new PermissionModel({
|
||||
type: 'content',
|
||||
action: 'delete',
|
||||
permission: permission
|
||||
}));
|
||||
return Observable.throw(new Error('No permission to delete'));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user