|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core';
|
|
|
|
|
import { Component, OnInit, OnDestroy, ViewChild, Output, EventEmitter } from '@angular/core';
|
|
|
|
|
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
|
|
|
|
import { Router, ActivatedRoute } from '@angular/router';
|
|
|
|
|
import { Observable } from 'rxjs/Observable';
|
|
|
|
@ -10,7 +10,7 @@ import * as formData from 'form-data';
|
|
|
|
|
import {forEach} from '@angular/router/src/utils/collection';
|
|
|
|
|
import {type} from 'os';
|
|
|
|
|
import { DomSanitizer } from '@angular/platform-browser';
|
|
|
|
|
//import { Dropzone } from 'dropzone';
|
|
|
|
|
// import { Dropzone } from 'dropzone';
|
|
|
|
|
import { DropzoneComponent , DropzoneDirective,
|
|
|
|
|
DropzoneConfigInterface } from 'ngx-dropzone-wrapper';
|
|
|
|
|
|
|
|
|
@ -22,6 +22,11 @@ import { DropzoneComponent , DropzoneDirective,
|
|
|
|
|
styleUrls: ['./book.component.css']
|
|
|
|
|
})
|
|
|
|
|
export class BookComponent implements OnInit, OnDestroy {
|
|
|
|
|
@Output() setAllUserAppFolder = new EventEmitter<String>();
|
|
|
|
|
|
|
|
|
|
message: string = 'Hola Mundo!';
|
|
|
|
|
|
|
|
|
|
@Output() messageEvent = new EventEmitter<string>();
|
|
|
|
|
currentUser: any;
|
|
|
|
|
allUserFile: any;
|
|
|
|
|
allUserFolder: any;
|
|
|
|
@ -63,7 +68,10 @@ export class BookComponent implements OnInit, OnDestroy {
|
|
|
|
|
this.filesToUpload = [];
|
|
|
|
|
this.test = '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sendMessage() {
|
|
|
|
|
console.log('caca');
|
|
|
|
|
this.messageEvent.emit('caca')
|
|
|
|
|
}
|
|
|
|
|
public toggleType(): void {
|
|
|
|
|
this.type = (this.type === 'component') ? 'directive' : 'component';
|
|
|
|
|
}
|
|
|
|
@ -204,9 +212,14 @@ export class BookComponent implements OnInit, OnDestroy {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
getAllUserAppFolder(){
|
|
|
|
|
this.message = 'caca';
|
|
|
|
|
this.sendMessage();
|
|
|
|
|
this.http.post('/api/getFolderAppList', {owner: this.currentUser.username.toString()}).subscribe(folders => {
|
|
|
|
|
if (folders) {
|
|
|
|
|
this.allUserAppFolder = folders;
|
|
|
|
|
console.log('yuuuuuuuuuu' + this.currentUser.username.toString());
|
|
|
|
|
|
|
|
|
|
this.setAllUserAppFolder.emit(this.currentUser.username.toString());
|
|
|
|
|
} else {
|
|
|
|
|
this.allUserAppFolder = [];
|
|
|
|
|
}
|
|
|
|
@ -297,6 +310,9 @@ export class BookComponent implements OnInit, OnDestroy {
|
|
|
|
|
this.http.post('api/uploadFileMongo', { name: this.fileChooseName.toString(), path: this.mainFolder.path.toString(), type: this.filesToUpload[0].type.toString(), taille: this.filesToUpload[0].size.toString(), idUser: this.currentUser._id.toString(), owner: this.currentUser.username.toString(), lastDate: Date.now().toString(), url: ''}).subscribe(resp => {
|
|
|
|
|
me.saveURLFileMongo(resp);
|
|
|
|
|
var mee = this;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
////////
|
|
|
|
|
me.makeFileRequest('http://localhost:3000/api/upload', [], this.filesToUpload, resp).then((result) => {
|
|
|
|
|
mee.getfiles();
|
|
|
|
|
mee.filesToUpload = null;
|
|
|
|
|