mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-12 17:04:46 +00:00
edit folder error notification (#296)
This commit is contained in:
parent
4f48ed9361
commit
b47fc2cb3f
@ -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">
|
||||
<mat-icon>create</mat-icon>
|
||||
</button>
|
||||
|
@ -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);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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">
|
||||
<mat-icon>create</mat-icon>
|
||||
</button>
|
||||
|
@ -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);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user