|
|
|
@ -16,6 +16,8 @@ import { DropzoneComponent , DropzoneDirective,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import { CompleterService } from '../typescripts/pro';
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'app-book',
|
|
|
|
|
templateUrl: './book.component.html',
|
|
|
|
@ -47,6 +49,23 @@ export class BookComponent implements OnInit, OnDestroy {
|
|
|
|
|
// config: DropzoneConfigInterface;
|
|
|
|
|
//myDropzone: Dropzone;
|
|
|
|
|
droptestt:any;
|
|
|
|
|
allItems: any;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
searchStr: String;
|
|
|
|
|
dataService: any;
|
|
|
|
|
|
|
|
|
|
protected searchData = [
|
|
|
|
|
{ color: 'red'},
|
|
|
|
|
{ color: 'green'},
|
|
|
|
|
{ color: 'blue'},
|
|
|
|
|
{ color: 'cyan'},
|
|
|
|
|
{ color: 'magenta'},
|
|
|
|
|
{ color: 'yellow'},
|
|
|
|
|
{ color: 'black'},
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public type: string = 'component';
|
|
|
|
|
|
|
|
|
@ -64,12 +83,26 @@ export class BookComponent implements OnInit, OnDestroy {
|
|
|
|
|
@ViewChild(DropzoneDirective) directiveRef?: DropzoneDirective;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
constructor(private http: HttpClient, private router: Router, private route: ActivatedRoute, public sanitizer: DomSanitizer) {
|
|
|
|
|
constructor(private completerService: CompleterService, private http: HttpClient, private router: Router, private route: ActivatedRoute, public sanitizer: DomSanitizer) {
|
|
|
|
|
this.httpOptions = {
|
|
|
|
|
headers: new HttpHeaders({ 'Authorization': localStorage.getItem('jwtToken'), 'Access-Control-Allow-Origin' : '*'}),
|
|
|
|
|
pathFolder: ''
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
this.http.get('/api/getCurrentUser', this.httpOptions).subscribe(user => {
|
|
|
|
|
this.currentUser = user;
|
|
|
|
|
this.openFolder('Home');
|
|
|
|
|
}, err => {
|
|
|
|
|
if (err.status === 401) {
|
|
|
|
|
this.router.navigate(['Home']);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
this.isClickCreateFolder = false;
|
|
|
|
|
this.fileChooseName = 'None';
|
|
|
|
|
this.filesToUpload = [];
|
|
|
|
|
this.test = '';
|
|
|
|
|
this.sizeFile = 0;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
sendMessage() {
|
|
|
|
|
console.log('caca');
|
|
|
|
@ -131,19 +164,7 @@ export class BookComponent implements OnInit, OnDestroy {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
|
this.httpOptions = {
|
|
|
|
|
headers: new HttpHeaders({ 'Authorization': localStorage.getItem('jwtToken'), 'Access-Control-Allow-Origin' : '*'}),
|
|
|
|
|
pathFolder: ''
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
this.http.get('/api/getCurrentUser', this.httpOptions).subscribe(user => {
|
|
|
|
|
this.currentUser = user;
|
|
|
|
|
this.openFolder('Home');
|
|
|
|
|
}, err => {
|
|
|
|
|
if (err.status === 401) {
|
|
|
|
|
this.router.navigate(['login']);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
deleteFile(fileToDelete) {
|
|
|
|
@ -186,6 +207,12 @@ export class BookComponent implements OnInit, OnDestroy {
|
|
|
|
|
this.http.post('/api/getFileAppList', {owner: this.currentUser.username.toString()}).subscribe(files => {
|
|
|
|
|
if (files) {
|
|
|
|
|
this.allUserAppFile = files;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.allItems = (this.allUserAppFolder.concat(this.allUserAppFile));
|
|
|
|
|
this.dataService = this.completerService.local(this.allItems, 'name', 'path');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (let f of this.allUserAppFile){
|
|
|
|
|
console.log(f.name);
|
|
|
|
|
//f.fileTab = this.getfiles(f);
|
|
|
|
@ -246,6 +273,7 @@ export class BookComponent implements OnInit, OnDestroy {
|
|
|
|
|
console.log(this.currentUser.username.toString());
|
|
|
|
|
|
|
|
|
|
this.setAllUserAppFolder.emit(this.currentUser.username.toString());
|
|
|
|
|
|
|
|
|
|
this.getAllUserAppFiles();
|
|
|
|
|
} else {
|
|
|
|
|
this.allUserAppFolder = [];
|
|
|
|
@ -285,6 +313,12 @@ export class BookComponent implements OnInit, OnDestroy {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
openFolder(path: String) {
|
|
|
|
|
|
|
|
|
|
if(this.searchStr !== undefined ? path === 'searchStr' : false){
|
|
|
|
|
path = this.searchStr;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.httpOptions.pathFolder = path;
|
|
|
|
|
|
|
|
|
|
this.isClickCreateFolder = false;
|
|
|
|
@ -292,6 +326,7 @@ export class BookComponent implements OnInit, OnDestroy {
|
|
|
|
|
this.http.post('/api/getMainFolder', {path: path, owner: this.currentUser.username.toString()}).subscribe(folder => {
|
|
|
|
|
if (folder) {
|
|
|
|
|
this.mainFolder = folder;
|
|
|
|
|
console.log('folder : ' + folder);
|
|
|
|
|
this.getfolders();
|
|
|
|
|
this.getAllUserAppFolder();
|
|
|
|
|
this.getfiles();
|
|
|
|
|