lint login and upload

This commit is contained in:
Mario Romano
2016-05-12 19:35:41 +01:00
parent 6654563469
commit 6b99e49498
22 changed files with 642 additions and 672 deletions

View File

@@ -34,63 +34,63 @@ declare let __moduleName: string;
* @returns {UploadDragAreaComponent} .
*/
@Component({
selector: 'alfresco-upload-drag-area',
moduleId: __moduleName,
directives: [FileDraggableDirective, FileUploadingDialogComponent],
templateUrl: './upload-drag-area.component.html',
styleUrls: ['./upload-drag-area.component.css']
selector: 'alfresco-upload-drag-area',
moduleId: __moduleName,
directives: [FileDraggableDirective, FileUploadingDialogComponent],
templateUrl: './upload-drag-area.component.html',
styleUrls: ['./upload-drag-area.component.css']
})
export class UploadDragAreaComponent {
private _uploaderService: UploadService;
private _uploaderService: UploadService;
@ViewChild('fileUploadingDialog')
fileUploadingDialogComponent: FileUploadingDialogComponent;
@ViewChild('fileUploadingDialog')
fileUploadingDialogComponent: FileUploadingDialogComponent;
@Input()
showUploadDialog: boolean = true;
@Input()
showUploadDialog: boolean = true;
filesUploadingList: FileModel [] = [];
filesUploadingList: FileModel [] = [];
@Input()
uploaddirectory: string = '';
@Input()
uploaddirectory: string = '';
constructor(public el: ElementRef) {
console.log('UploadComponent constructor', el);
constructor(public el: ElementRef) {
console.log('UploadComponent constructor', el);
this._uploaderService = new UploadService({
url: 'http://192.168.99.100:8080/alfresco/service/api/upload',
withCredentials: true,
authToken: btoa('admin:admin'),
authTokenPrefix: 'Basic',
fieldName: 'filedata',
formFields: {
siteid: 'swsdp',
containerid: 'documentLibrary'
}
});
}
/**
* Method called when files are dropped in the drag area.
*
* @param {File[]} files - files dropped in the drag area.
*/
onFilesDropped(files: File[]): void {
if (files.length) {
this._uploaderService.addToQueue(files);
this._uploaderService.uploadFilesInTheQueue(this.uploaddirectory);
this.filesUploadingList = this._uploaderService.getQueue();
if (this.showUploadDialog) {
this._showDialog();
}
this._uploaderService = new UploadService({
url: 'http://192.168.99.100:8080/alfresco/service/api/upload',
withCredentials: true,
authToken: btoa('admin:admin'),
authTokenPrefix: 'Basic',
fieldName: 'filedata',
formFields: {
siteid: 'swsdp',
containerid: 'documentLibrary'
}
});
}
}
/**
* Show the upload dialog.
*/
private _showDialog(): void {
this.fileUploadingDialogComponent.showDialog();
}
/**
* Method called when files are dropped in the drag area.
*
* @param {File[]} files - files dropped in the drag area.
*/
onFilesDropped(files: File[]): void {
if (files.length) {
this._uploaderService.addToQueue(files);
this._uploaderService.uploadFilesInTheQueue(this.uploaddirectory);
this.filesUploadingList = this._uploaderService.getQueue();
if (this.showUploadDialog) {
this._showDialog();
}
}
}
/**
* Show the upload dialog.
*/
private _showDialog(): void {
this.fileUploadingDialogComponent.showDialog();
}
}