diff --git a/src/app/components/favorites/favorites.component.html b/src/app/components/favorites/favorites.component.html index b2598f77d..9fa63e224 100644 --- a/src/app/components/favorites/favorites.component.html +++ b/src/app/components/favorites/favorites.component.html @@ -28,6 +28,7 @@ color="primary" *ngIf="showEditOption(documentList.selection)" title="{{ 'APP.ACTIONS.EDIT' | translate }}" + (error)="openSnackMessage($event)" [adf-edit-folder]="documentList.selection[0]?.entry"> create diff --git a/src/app/components/favorites/favorites.component.spec.ts b/src/app/components/favorites/favorites.component.spec.ts index 8a1ea4d25..47cdb3583 100644 --- a/src/app/components/favorites/favorites.component.spec.ts +++ b/src/app/components/favorites/favorites.component.spec.ts @@ -57,6 +57,7 @@ describe('Favorites Routed Component', () => { let alfrescoContentService: ContentService; let contentService: ContentManagementService; let preferenceService: UserPreferencesService; + let notificationService: NotificationService; let router: Router; let page; let node; @@ -132,6 +133,7 @@ describe('Favorites Routed Component', () => { component = fixture.componentInstance; nodesApi = TestBed.get(NodesApiService); + notificationService = TestBed.get(NotificationService); alfrescoApi = TestBed.get(AlfrescoApiService); alfrescoApi.reset(); alfrescoContentService = TestBed.get(ContentService); @@ -325,4 +327,16 @@ describe('Favorites Routed Component', () => { expect(preferenceService.set).toHaveBeenCalledWith('prefix.sorting.direction', 'desc'); }); }); + + describe('openSnackMessage', () => { + it('should call notification service', () => { + const message = 'notification message'; + + spyOn(notificationService, 'openSnackMessage'); + + component.openSnackMessage(message); + + expect(notificationService.openSnackMessage).toHaveBeenCalledWith(message, 4000); + }); + }); }); diff --git a/src/app/components/favorites/favorites.component.ts b/src/app/components/favorites/favorites.component.ts index 013fd933a..a1c999a15 100644 --- a/src/app/components/favorites/favorites.component.ts +++ b/src/app/components/favorites/favorites.component.ts @@ -28,7 +28,7 @@ import { Router, ActivatedRoute } from '@angular/router'; import { Subscription } from 'rxjs/Rx'; import { MinimalNodeEntryEntity, MinimalNodeEntity, PathElementEntity, PathInfo } from 'alfresco-js-api'; -import { ContentService, NodesApiService, UserPreferencesService } from '@alfresco/adf-core'; +import { ContentService, NodesApiService, UserPreferencesService, NotificationService } from '@alfresco/adf-core'; import { DocumentListComponent } from '@alfresco/adf-content-services'; import { ContentManagementService } from '../../common/services/content-management.service'; @@ -52,6 +52,7 @@ export class FavoritesComponent extends PageComponent implements OnInit, OnDestr private nodesApi: NodesApiService, private contentService: ContentService, private content: ContentManagementService, + private notificationService: NotificationService, public permission: NodePermissionService, preferences: UserPreferencesService) { super(preferences); @@ -124,6 +125,13 @@ export class FavoritesComponent extends PageComponent implements OnInit, OnDestr this.preferences.set(`${this.prefix}.sorting.direction`, event.detail.direction || 'desc'); } + openSnackMessage(event: any) { + this.notificationService.openSnackMessage( + event, + 4000 + ); + } + private get prefix() { return this.route.snapshot.data.preferencePrefix; } diff --git a/src/app/components/files/files.component.html b/src/app/components/files/files.component.html index 0fd832342..847c96e54 100644 --- a/src/app/components/files/files.component.html +++ b/src/app/components/files/files.component.html @@ -30,6 +30,7 @@ mat-icon-button *ngIf="canEditFolder(documentList.selection)" title="{{ 'APP.ACTIONS.EDIT' | translate }}" + (error)="openSnackMessage($event)" [adf-edit-folder]="documentList.selection[0]?.entry"> create diff --git a/src/app/components/files/files.component.spec.ts b/src/app/components/files/files.component.spec.ts index 1794c0b78..e2b888065 100644 --- a/src/app/components/files/files.component.spec.ts +++ b/src/app/components/files/files.component.spec.ts @@ -63,6 +63,7 @@ describe('FilesComponent', () => { let browsingFilesService: BrowsingFilesService; let nodeActionsService: NodeActionsService; let preferenceService: UserPreferencesService; + let notificationService: NotificationService; beforeEach(async(() => { TestBed.configureTestingModule({ @@ -121,6 +122,7 @@ describe('FilesComponent', () => { router = TestBed.get(Router); alfrescoContentService = TestBed.get(ContentService); browsingFilesService = TestBed.get(BrowsingFilesService); + notificationService = TestBed.get(NotificationService); nodeActionsService = TestBed.get(NodeActionsService); preferenceService = TestBed.get(UserPreferencesService); }); @@ -531,4 +533,16 @@ describe('FilesComponent', () => { expect(preferenceService.set).toHaveBeenCalledWith('prefix.sorting.direction', 'desc'); }); }); + + describe('openSnackMessage', () => { + it('should call notification service', () => { + const message = 'notification message'; + + spyOn(notificationService, 'openSnackMessage'); + + component.openSnackMessage(message); + + expect(notificationService.openSnackMessage).toHaveBeenCalledWith(message, 4000); + }); + }); }); diff --git a/src/app/components/files/files.component.ts b/src/app/components/files/files.component.ts index 5869ed5a7..2486fd1ca 100644 --- a/src/app/components/files/files.component.ts +++ b/src/app/components/files/files.component.ts @@ -29,7 +29,7 @@ import { Router, ActivatedRoute, Params } from '@angular/router'; import { MinimalNodeEntity, MinimalNodeEntryEntity, PathElementEntity, NodePaging, PathElement } from 'alfresco-js-api'; import { UploadService, FileUploadEvent, NodesApiService, - ContentService, AlfrescoApiService, UserPreferencesService + ContentService, AlfrescoApiService, UserPreferencesService, NotificationService } from '@alfresco/adf-core'; import { BrowsingFilesService } from '../../common/services/browsing-files.service'; @@ -62,6 +62,7 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy { private browsingFilesService: BrowsingFilesService, private contentService: ContentService, private apiService: AlfrescoApiService, + private notificationService: NotificationService, public permission: NodePermissionService, preferences: UserPreferencesService) { super(preferences); @@ -307,6 +308,13 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy { this.preferences.set(`${this.prefix}.sorting.direction`, event.detail.direction || 'desc'); } + openSnackMessage(event: any) { + this.notificationService.openSnackMessage( + event, + 4000 + ); + } + private get prefix() { return this.route.snapshot.data.preferencePrefix; }