mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
lint login and upload
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user