clean all the events that start wit on prefix (#2536)

This commit is contained in:
Eugenio Romano
2017-10-25 09:35:38 +01:00
committed by Maurizio Vitale
parent b2414781d4
commit ded3847762
169 changed files with 705 additions and 749 deletions

View File

@@ -69,7 +69,7 @@
"@types/hammerjs": "2.0.35",
"@types/jasmine": "2.5.35",
"@types/node": "6.0.45",
"adf-tslint-rules": "0.0.3",
"adf-tslint-rules": "0.0.4",
"angular2-template-loader": "0.6.2",
"autoprefixer": "6.5.4",
"codelyzer": "3.1.2",

View File

@@ -173,7 +173,7 @@ describe('UploadButtonComponent', () => {
it('should call uploadFile with the default root folder', () => {
component.rootFolderId = '-root-';
component.currentFolderPath = '/root-fake-/sites-fake/folder-fake';
component.onSuccess = null;
component.success = null;
spyOn(component, 'getFolderNode').and.returnValue(Observable.of(fakeFolderNodeWithPermission));
@@ -189,7 +189,7 @@ describe('UploadButtonComponent', () => {
it('should call uploadFile with a custom root folder', () => {
component.currentFolderPath = '/root-fake-/sites-fake/folder-fake';
component.rootFolderId = '-my-';
component.onSuccess = null;
component.success = null;
spyOn(component, 'getFolderNode').and.returnValue(Observable.of(fakeFolderNodeWithPermission));
component.ngOnChanges({ rootFolderId: new SimpleChange(null, component.rootFolderId, true) });
@@ -212,13 +212,13 @@ describe('UploadButtonComponent', () => {
component.ngOnChanges({ rootFolderId: new SimpleChange(null, component.rootFolderId, true) });
fixture.detectChanges();
component.onSuccess.subscribe(e => {
component.success.subscribe(e => {
expect(e.value).toEqual('File uploaded');
done();
});
spyOn(component, 'uploadFiles').and.callFake(() => {
component.onSuccess.emit({
component.success.emit({
value: 'File uploaded'
});
});

View File

@@ -79,10 +79,10 @@ export class UploadButtonComponent implements OnInit, OnChanges, NodePermissionS
rootFolderId: string = '-root-';
@Output()
onSuccess = new EventEmitter();
success = new EventEmitter();
@Output()
onError = new EventEmitter();
error = new EventEmitter();
@Output()
createFolder = new EventEmitter();
@@ -162,7 +162,7 @@ export class UploadButtonComponent implements OnInit, OnChanges, NodePermissionS
if (latestFilesAdded.length > 0) {
this.uploadService.addToQueue(...latestFilesAdded);
this.uploadService.uploadFilesInTheQueue(this.onSuccess);
this.uploadService.uploadFilesInTheQueue(this.success);
if (this.showNotificationBar) {
this.showUndoNotificationBar(latestFilesAdded);
}
@@ -222,7 +222,7 @@ export class UploadButtonComponent implements OnInit, OnChanges, NodePermissionS
if (this.rootFolderId) {
this.getFolderNode(this.rootFolderId).subscribe(
res => this.permissionValue.next(this.hasCreatePermission(res)),
error => this.onError.emit(error)
error => this.error.emit(error)
);
}
}

View File

@@ -1,7 +1,7 @@
<div [file-draggable]="isDroppable()" id="UploadBorder" class="upload-border"
(onFilesDropped)="onFilesDropped($event)"
(onFilesEntityDropped)="onFilesEntityDropped($event)"
(onFolderEntityDropped)="onFolderEntityDropped($event)"
(filesDropped)="onFilesDropped($event)"
(filesEntityDropped)="onFilesEntityDropped($event)"
(folderEntityDropped)="onFolderEntityDropped($event)"
(upload-files)="onUploadFiles($event)"
dropzone="" webkitdropzone="*" #droparea>
<ng-content></ng-content>

View File

@@ -190,7 +190,7 @@ describe('UploadDragAreaComponent', () => {
it('should upload the list of files dropped', (done) => {
component.currentFolderPath = '/root-fake-/sites-fake/folder-fake';
component.onSuccess = null;
component.success = null;
component.showNotificationBar = false;
uploadService.uploadFilesInTheQueue = jasmine.createSpy('uploadFilesInTheQueue');
@@ -208,7 +208,7 @@ describe('UploadDragAreaComponent', () => {
it('should show the loading messages in the notification bar when the files are dropped', () => {
component.currentFolderPath = '/root-fake-/sites-fake/folder-fake';
component.onSuccess = null;
component.success = null;
component.showNotificationBar = true;
uploadService.uploadFilesInTheQueue = jasmine.createSpy('uploadFilesInTheQueue');
component.showUndoNotificationBar = jasmine.createSpy('_showUndoNotificationBar');
@@ -224,7 +224,7 @@ describe('UploadDragAreaComponent', () => {
it('should upload a file when dropped', () => {
component.currentFolderPath = '/root-fake-/sites-fake/document-library-fake';
component.onSuccess = null;
component.success = null;
fixture.detectChanges();
spyOn(uploadService, 'uploadFilesInTheQueue');
@@ -247,7 +247,7 @@ describe('UploadDragAreaComponent', () => {
it('should upload a file with a custom root folder ID when dropped', () => {
component.currentFolderPath = '/root-fake-/sites-fake/document-library-fake';
component.rootFolderId = '-my-';
component.onSuccess = null;
component.success = null;
fixture.detectChanges();
spyOn(uploadService, 'uploadFilesInTheQueue');
@@ -285,7 +285,7 @@ describe('UploadDragAreaComponent', () => {
fixture.detectChanges();
spyOn(uploadService, 'uploadFilesInTheQueue').and.returnValue(Promise.resolve(fakeItem));
component.onSuccess.subscribe((val) => {
component.success.subscribe((val) => {
expect(val).not.toBeNull();
});
@@ -302,7 +302,7 @@ describe('UploadDragAreaComponent', () => {
it('should show notification bar when a file is dropped', () => {
component.currentFolderPath = '/root-fake-/sites-fake/document-library-fake';
component.rootFolderId = '-my-';
component.onSuccess = null;
component.success = null;
fixture.detectChanges();
spyOn(uploadService, 'uploadFilesInTheQueue');

View File

@@ -73,7 +73,7 @@ export class UploadDragAreaComponent implements NodePermissionSubject {
parentId: string;
@Output()
onSuccess = new EventEmitter();
success = new EventEmitter();
constructor(private uploadService: UploadService,
private translateService: AlfrescoTranslationService,
@@ -93,7 +93,7 @@ export class UploadDragAreaComponent implements NodePermissionSubject {
parentId: this.parentId || this.rootFolderId
}));
this.uploadService.addToQueue(...fileModels);
this.uploadService.uploadFilesInTheQueue(this.onSuccess);
this.uploadService.uploadFilesInTheQueue(this.success);
let latestFilesAdded = this.uploadService.getQueue();
if (this.showNotificationBar) {
this.showUndoNotificationBar(latestFilesAdded);
@@ -115,7 +115,7 @@ export class UploadDragAreaComponent implements NodePermissionSubject {
path: item.fullPath.replace(item.name, '')
});
this.uploadService.addToQueue(fileModel);
this.uploadService.uploadFilesInTheQueue(this.onSuccess);
this.uploadService.uploadFilesInTheQueue(this.success);
});
if (this.showNotificationBar) {
this.showUndoNotificationBar(item);
@@ -144,7 +144,7 @@ export class UploadDragAreaComponent implements NodePermissionSubject {
let latestFilesAdded = this.uploadService.getQueue();
this.showUndoNotificationBar(latestFilesAdded);
}
this.uploadService.uploadFilesInTheQueue(this.onSuccess);
this.uploadService.uploadFilesInTheQueue(this.success);
});
}
}
@@ -213,7 +213,7 @@ export class UploadDragAreaComponent implements NodePermissionSubject {
private uploadFiles(files: FileModel[]): void {
if (files.length) {
this.uploadService.addToQueue(...files);
this.uploadService.uploadFilesInTheQueue(this.onSuccess);
this.uploadService.uploadFilesInTheQueue(this.success);
let latestFilesAdded = this.uploadService.getQueue();
if (this.showNotificationBar) {
this.showUndoNotificationBar(latestFilesAdded);

View File

@@ -29,13 +29,13 @@ export class FileDraggableDirective implements OnInit, OnDestroy {
enabled: boolean = true;
@Output()
onFilesDropped: EventEmitter<File[]> = new EventEmitter<File[]>();
filesDropped: EventEmitter<File[]> = new EventEmitter<File[]>();
@Output()
onFilesEntityDropped: EventEmitter<any> = new EventEmitter();
filesEntityDropped: EventEmitter<any> = new EventEmitter();
@Output()
onFolderEntityDropped: EventEmitter<any> = new EventEmitter();
folderEntityDropped: EventEmitter<any> = new EventEmitter();
private cssClassName: string = 'file-draggable__input-focus';
private element: HTMLElement;
@@ -75,20 +75,20 @@ export class FileDraggableDirective implements OnInit, OnDestroy {
let item = items[i].webkitGetAsEntry();
if (item) {
if (item.isFile) {
this.onFilesEntityDropped.emit(item);
this.filesEntityDropped.emit(item);
} else if (item.isDirectory) {
this.onFolderEntityDropped.emit(item);
this.folderEntityDropped.emit(item);
}
}
} else {
let files = FileUtils.toFileArray(event.dataTransfer.files);
this.onFilesDropped.emit(files);
this.filesDropped.emit(files);
}
}
} else {
// safari or FF
let files = FileUtils.toFileArray(event.dataTransfer.files);
this.onFilesDropped.emit(files);
this.filesDropped.emit(files);
}
this.element.classList.remove(this.cssClassName);

View File

@@ -152,6 +152,7 @@
"templates-use-public": true,
"invoke-injectable": true,
"adf-file-name": true,
"adf-class-name": true
}
"adf-class-name": true,
"adf-prefix-name": true
}
}