[ADF-2682][ADF-2714][ADF-2719] fix issues folder navigation and messages releated (#3196)

* [ADF-2687] No message is displayed when deleting a folder from content action
[ADF-2714] Not able to download a version of a file
[ADF-2682] Number of page doesn't change when navigating to another folder
Expand lock documentation

* fix test init
This commit is contained in:
Eugenio Romano 2018-04-16 14:02:44 +01:00 committed by GitHub
parent 8a0af2c5e4
commit 62f91b567c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 28 additions and 14 deletions

View File

@ -27,6 +27,7 @@ import { MatSnackBar } from '@angular/material';
export class VersionManagerDialogAdapterComponent {
public contentEntry: MinimalNodeEntryEntity;
showComments = true;
allowDownload = true;
@ -35,7 +36,7 @@ export class VersionManagerDialogAdapterComponent {
private containingDialog?: MatDialogRef<VersionManagerDialogAdapterComponent>) {
this.contentEntry = data.contentEntry;
this.showComments = data.hasOwnProperty('showComments') ? data.showComments : this.showComments;
this.allowDownload = data.hasOwnProperty('allowDownload') ? data.enableDownload : this.allowDownload;
this.allowDownload = data.hasOwnProperty('allowDownload') ? data.allowDownload : this.allowDownload;
}
uploadError(errorMessage: string) {

View File

@ -8,6 +8,12 @@ Last reviewed: 2018-04-10
Locks a node.
When the directive is clicked a dialog is shown and you can lock or unlock a file (folder cannot be locked)
there are two types of lock: indefinite lock and time lock.
If the time is not selected the user will lock the file it until will not unlock it
When a file is locked it can be locked and unlocked by default only by the user that creates the lock but you can also allow the other file owners to modify it
![adf-lock](../docassets/images/lock-directive.png)
## Basic Usage
```html

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

View File

@ -63,8 +63,8 @@ describe('ContentAction', () => {
beforeEach(() => {
contentService = TestBed.get(ContentService);
nodeActionsService = new NodeActionsService(null, null, null);
documentActions = new DocumentActionsService(nodeActionsService, null, null);
folderActions = new FolderActionsService(nodeActionsService, null, contentService);
documentActions = new DocumentActionsService(nodeActionsService, null, null, null);
folderActions = new FolderActionsService(nodeActionsService, null, contentService, null);
documentList = (TestBed.createComponent(DocumentListComponent).componentInstance as DocumentListComponent);
actionList = new ContentActionListComponent(documentList);

View File

@ -465,7 +465,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
}
updateFolderData(node: MinimalNodeEntity): void {
this.folderNode = null;
this.resetNewFolderPagination();
this.currentFolderId = node.entry.id;
this.reload();
this.folderChange.emit(new NodeEntryEvent(node.entry));

View File

@ -118,7 +118,7 @@ export class DocumentActionsService {
);
}
private deleteNode(node: any, target?: any, permission?: string): Observable<any> {
private deleteNode(node: MinimalNodeEntity, target?: any, permission?: string): Observable<any> {
let handlerObservable;
if (this.canExecuteAction(node)) {

View File

@ -16,7 +16,7 @@
*/
import { TestBed } from '@angular/core/testing';
import { AlfrescoApiServiceMock, AppConfigService, StorageService, ContentService } from '@alfresco/adf-core';
import { AlfrescoApiServiceMock, AppConfigService, StorageService, ContentService, TranslationMock } from '@alfresco/adf-core';
import { Observable } from 'rxjs/Observable';
import { FileNode, FolderNode } from '../../mock';
import { ContentActionHandler } from '../models/content-action.model';
@ -35,7 +35,7 @@ describe('FolderActionsService', () => {
let contentService = new ContentService(null, null, null, null);
let alfrescoApiService = new AlfrescoApiServiceMock(new AppConfigService(null), new StorageService());
documentListService = new DocumentListService(null, contentService, alfrescoApiService, null, null);
service = new FolderActionsService(null, documentListService, contentService);
service = new FolderActionsService(null, documentListService, contentService, new TranslationMock());
});
it('should register custom action handler', () => {

View File

@ -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';
@ -37,7 +37,8 @@ export class FolderActionsService {
constructor(private nodeActionsService: NodeActionsService,
private documentListService: DocumentListService,
private contentService: ContentService) {
private contentService: ContentService,
private translation: TranslationService) {
this.setupActionHandlers();
}
@ -113,18 +114,24 @@ export class FolderActionsService {
);
}
private deleteNode(obj: any, target?: any, permission?: string): Observable<any> {
private deleteNode(node: MinimalNodeEntity, target?: any, permission?: string): Observable<any> {
let handlerObservable: Observable<any>;
if (this.canExecuteAction(obj)) {
if (this.contentService.hasPermission(obj.entry, permission)) {
handlerObservable = this.documentListService.deleteNode(obj.entry.id);
if (this.canExecuteAction(node)) {
if (this.contentService.hasPermission(node.entry, permission)) {
handlerObservable = this.documentListService.deleteNode(node.entry.id);
handlerObservable.subscribe(() => {
if (target && typeof target.reload === 'function') {
target.reload();
}
this.success.next(obj.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: 'folder', action: 'delete', permission: permission}));