1 |
51830
|
myrto.kouk
|
import {Component, Input, OnInit} from "@angular/core";
|
2 |
|
|
import {AuthenticationService} from "../../services/authentication.service";
|
3 |
|
|
import {BrokerService} from "../../services/broker.service";
|
4 |
|
|
import {loadingRepoMessage, loadingUserRepoInfoEmpty, reposRetrievalError} from "../../domain/shared-messages";
|
5 |
50041
|
myrto.kouk
|
|
6 |
|
|
@Component ({
|
7 |
|
|
selector: 'app-content-events',
|
8 |
|
|
templateUrl: 'content-events.component.html'
|
9 |
|
|
})
|
10 |
|
|
|
11 |
|
|
export class ContentEventsComponent implements OnInit {
|
12 |
51830
|
myrto.kouk
|
datasourcesOfUser = [];
|
13 |
|
|
tilesView: boolean;
|
14 |
|
|
errorMessage: string;
|
15 |
|
|
noDatasourcesMessage: string;
|
16 |
|
|
loadingMessage: string;
|
17 |
50041
|
myrto.kouk
|
|
18 |
51830
|
myrto.kouk
|
@Input() parent: string = '';
|
19 |
50041
|
myrto.kouk
|
|
20 |
51830
|
myrto.kouk
|
constructor(private authService: AuthenticationService,
|
21 |
|
|
private brokerService: BrokerService) {}
|
22 |
|
|
|
23 |
|
|
ngOnInit() {
|
24 |
|
|
this.tilesView = true;
|
25 |
|
|
this.getDatasourcesOfUser();
|
26 |
|
|
}
|
27 |
|
|
|
28 |
|
|
|
29 |
|
|
getDatasourcesOfUser() {
|
30 |
|
|
this.loadingMessage = loadingRepoMessage;
|
31 |
|
|
this.brokerService.getDatasourcesOfUser(this.authService.getUserEmail()).subscribe(
|
32 |
|
|
res => {
|
33 |
|
|
this.datasourcesOfUser = res['datasourcesOfUser'];
|
34 |
|
|
},
|
35 |
|
|
error => {
|
36 |
|
|
console.log(error);
|
37 |
|
|
this.loadingMessage = '';
|
38 |
|
|
this.errorMessage = reposRetrievalError;
|
39 |
|
|
},
|
40 |
|
|
() => {
|
41 |
|
|
this.loadingMessage = '';
|
42 |
|
|
if (!this.datasourcesOfUser.length) {
|
43 |
|
|
this.noDatasourcesMessage = loadingUserRepoInfoEmpty;
|
44 |
|
|
/*} else {
|
45 |
|
|
this.datasourcesOfUser.forEach(
|
46 |
|
|
d => {
|
47 |
|
|
console.log( d['first']['value'],' -> ',d['first']['size'] );
|
48 |
|
|
}
|
49 |
|
|
);*/
|
50 |
|
|
}
|
51 |
|
|
}
|
52 |
|
|
);
|
53 |
|
|
}
|
54 |
|
|
|
55 |
|
|
toggleTiles(){
|
56 |
|
|
this.tilesView = !this.tilesView;
|
57 |
|
|
}
|
58 |
|
|
|
59 |
50041
|
myrto.kouk
|
}
|