[ASD-2483] Validate folder name on change (#3088)

* notify service refactoring
get translate eliminitation in favor of instant
add error event where necessary
fix config problem during test

* fix delete notify test

* remove fdescribe

* fix core test

* errors

* fix types
This commit is contained in:
Eugenio Romano
2018-03-21 16:55:52 +00:00
committed by GitHub
parent de0fdd9ab4
commit 2951374cc0
25 changed files with 357 additions and 260 deletions

View File

@@ -15,8 +15,8 @@
* limitations under the License.
*/
import { FileModel, FileUploadStatus, NodesApiService, NotificationService, TranslationService, UploadService } from '@alfresco/adf-core';
import { Component, ContentChild, Input, TemplateRef } from '@angular/core';
import { FileModel, FileUploadStatus, NodesApiService, TranslationService, UploadService } from '@alfresco/adf-core';
import { Component, ContentChild, Input, Output, TemplateRef, EventEmitter } from '@angular/core';
import { Observable } from 'rxjs/Observable';
@Component({
@@ -34,10 +34,13 @@ export class FileUploadingListComponent {
@Input()
files: FileModel[] = [];
/** Emitted when a file in the list has an error. */
@Output()
error: EventEmitter<any> = new EventEmitter();
constructor(
private uploadService: UploadService,
private nodesApi: NodesApiService,
private notificationService: NotificationService,
private translateService: TranslationService) {
}
@@ -130,24 +133,23 @@ export class FileUploadingListComponent {
}
private notifyError(...files: FileModel[]) {
let translateSubscription = null;
let messageError: string = null;
if (files.length === 1) {
translateSubscription = this.translateService
.get(
messageError = this.translateService
.instant(
'FILE_UPLOAD.MESSAGES.REMOVE_FILE_ERROR',
{ fileName: files[0].name}
);
} else {
translateSubscription = this.translateService
.get(
messageError = this.translateService
.instant(
'FILE_UPLOAD.MESSAGES.REMOVE_FILES_ERROR',
{ total: files.length }
);
}
translateSubscription
.subscribe(message => this.notificationService.openSnackMessage(message, 4000));
this.error.emit(messageError);
}
private getUploadingFiles() {