[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

@@ -17,7 +17,7 @@
/* tslint:disable:no-input-rename */
import { Directive, ElementRef, HostListener, Input } from '@angular/core';
import { Directive, ElementRef, HostListener, Input, Output, EventEmitter } from '@angular/core';
import { MatDialog, MatDialogConfig } from '@angular/material';
import { MinimalNodeEntryEntity } from 'alfresco-js-api';
@@ -35,6 +35,10 @@ export class FolderEditDirective {
@Input('adf-edit-folder')
folder: MinimalNodeEntryEntity;
/** Emitted when the edit/create folder give error for example a folder with same name already exist */
@Output()
error: EventEmitter<any> = new EventEmitter<any>();
@HostListener('click', [ '$event' ])
onClick(event) {
event.preventDefault();
@@ -63,6 +67,10 @@ export class FolderEditDirective {
const { dialogRef, dialogConfig, content } = this;
const dialogInstance = dialogRef.open(FolderDialogComponent, dialogConfig);
dialogInstance.componentInstance.error.subscribe((error) => {
this.error.emit(error);
});
dialogInstance.afterClosed().subscribe((node: MinimalNodeEntryEntity) => {
if (node) {
content.folderEdit.next(node);