mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[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:
@@ -17,7 +17,7 @@
|
||||
|
||||
/* tslint:disable:no-input-rename */
|
||||
|
||||
import { Directive, HostListener, Input } from '@angular/core';
|
||||
import { Directive, HostListener, Input, Output, EventEmitter } from '@angular/core';
|
||||
import { MatDialog, MatDialogConfig } from '@angular/material';
|
||||
import { MinimalNodeEntryEntity } from 'alfresco-js-api';
|
||||
import { FolderDialogComponent } from '../dialogs/folder.dialog';
|
||||
@@ -35,6 +35,10 @@ export class FolderCreateDirective {
|
||||
@Input('adf-create-folder')
|
||||
parentNodeId: string = DEFAULT_FOLDER_PARENT_ID;
|
||||
|
||||
/** Emitted when the 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();
|
||||
@@ -60,6 +64,10 @@ export class FolderCreateDirective {
|
||||
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.folderCreate.next(node);
|
||||
|
Reference in New Issue
Block a user