diff --git a/demo-shell/src/app/components/files/version-manager-dialog-adapter.component.ts b/demo-shell/src/app/components/files/version-manager-dialog-adapter.component.ts index cebe38b5f5..87d5112399 100644 --- a/demo-shell/src/app/components/files/version-manager-dialog-adapter.component.ts +++ b/demo-shell/src/app/components/files/version-manager-dialog-adapter.component.ts @@ -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) { 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) { diff --git a/docs/content-services/node-lock.directive.md b/docs/content-services/node-lock.directive.md index 0078a2aee9..b080d93986 100644 --- a/docs/content-services/node-lock.directive.md +++ b/docs/content-services/node-lock.directive.md @@ -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 diff --git a/docs/docassets/images/lock-directive.png b/docs/docassets/images/lock-directive.png new file mode 100644 index 0000000000..13422efcc1 Binary files /dev/null and b/docs/docassets/images/lock-directive.png differ diff --git a/lib/content-services/document-list/components/content-action/content-action.component.spec.ts b/lib/content-services/document-list/components/content-action/content-action.component.spec.ts index ce852b780c..0649d99ce5 100644 --- a/lib/content-services/document-list/components/content-action/content-action.component.spec.ts +++ b/lib/content-services/document-list/components/content-action/content-action.component.spec.ts @@ -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); diff --git a/lib/content-services/document-list/components/document-list.component.ts b/lib/content-services/document-list/components/document-list.component.ts index a1030e94b6..3f427567d0 100644 --- a/lib/content-services/document-list/components/document-list.component.ts +++ b/lib/content-services/document-list/components/document-list.component.ts @@ -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)); diff --git a/lib/content-services/document-list/services/document-actions.service.ts b/lib/content-services/document-list/services/document-actions.service.ts index e26c3c2dba..246341aacd 100644 --- a/lib/content-services/document-list/services/document-actions.service.ts +++ b/lib/content-services/document-list/services/document-actions.service.ts @@ -118,7 +118,7 @@ export class DocumentActionsService { ); } - private deleteNode(node: any, target?: any, permission?: string): Observable { + private deleteNode(node: MinimalNodeEntity, target?: any, permission?: string): Observable { let handlerObservable; if (this.canExecuteAction(node)) { diff --git a/lib/content-services/document-list/services/folder-actions.service.spec.ts b/lib/content-services/document-list/services/folder-actions.service.spec.ts index 1da4f00355..1fe37e36c9 100644 --- a/lib/content-services/document-list/services/folder-actions.service.spec.ts +++ b/lib/content-services/document-list/services/folder-actions.service.spec.ts @@ -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', () => { diff --git a/lib/content-services/document-list/services/folder-actions.service.ts b/lib/content-services/document-list/services/folder-actions.service.ts index c3de1d8286..6203a776ec 100644 --- a/lib/content-services/document-list/services/folder-actions.service.ts +++ b/lib/content-services/document-list/services/folder-actions.service.ts @@ -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 { + private deleteNode(node: MinimalNodeEntity, target?: any, permission?: string): Observable { let handlerObservable: Observable; - 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}));