diff --git a/app/pages/stats/stats.component.html b/app/pages/stats/stats.component.html
index d3fba38..cc585f6 100644
--- a/app/pages/stats/stats.component.html
+++ b/app/pages/stats/stats.component.html
@@ -1,4 +1,3 @@
-
Name |
- State |
- Type |
- Related Entities |
- Route |
- Actions |
- Page Help Contents |
- 0">Class Help Contents |
+ Show in statistics page |
+ Show in dashboard |
-
-<!–
-
-
+ |
+
+
+ {{ name }}
|
- {{check.page.name}}
- |
-
- |
-
- {{check.page.type}}
- |
-
- |
- {{check.page.route}}
- |
-
-
- |
-
- add page contents
- |
- 0" class="uk-text-center">
- add class contents
- -
|
-–>
- –>
-
-<!–
+
+
@@ -113,4 +85,4 @@
--->
+
diff --git a/app/pages/stats/stats.component.ts b/app/pages/stats/stats.component.ts
index 5d49447..f435e9c 100644
--- a/app/pages/stats/stats.component.ts
+++ b/app/pages/stats/stats.component.ts
@@ -26,47 +26,68 @@ export class StatsComponent implements OnInit {
private route: ActivatedRoute) {}
ngOnInit() {
- console.log(`TRYING TO LOAD COMMUNITIES !!!`);
-/* this.route.data
+ this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.getCommunities();
- },
- error => console.log(`E R R O R!!`)
- );*/
- this.getCommunities();
+ },
+ error => console.log(`E R R O R!!`)
+ );
}
- getStatistics() {
- this.contentService.getStatistics('egi',this.properties.adminToolsAPIURL).subscribe(
- stats => this.stats = stats,
+ getCommunities() {
+ this.loadingMessage = 'Retrieving communities';
+ this.contentService.getCommunities(this.properties.adminToolsAPIURL).subscribe(
+ /* this.contentService.getCommunities('http://duffy.di.uoa.gr:8080/uoa-admin-tools/').subscribe(*/
+ comms => {
+ this.communities = comms;
+ },
error => {
+ this.loadingMessage = '';
+ this.errorMessage = 'Failed to retrieve information on your communities!';
console.log(error);
},
() => {
- console.log(`I got something! My pid is ${this.stats.pid}`);
- console.log(`my table names are:`);
+ console.log(`I have communities`);
+ this.loadingMessage = '';
+ this.selectedCommunityPid = this.communities[0].pid;
+ this.getStatistics();
+ }
+ );
+ }
+
+ getStatistics() {
+ this.loadingMessage = 'Retrieving statistics tables';
+ this.errorMessage = '';
+ this.stats = null;
+ this.tableNames = [];
+ this.contentService.getStatistics(this.selectedCommunityPid,this.properties.adminToolsAPIURL).subscribe(
+ stats => this.stats = stats,
+ error => {
+ this.loadingMessage = '';
+ this.errorMessage = 'Failed to retrieve statistics tables for the chosen community!';
+ console.log(error);
+ },
+ () => {
+ console.log(`I have statistics!`);
+ this.loadingMessage = '';
for (let key in this.stats.statistics){
this.tableNames.push(key);
- console.log(key);
}
}
);
}
- getCommunities() {
- this.contentService.getCommunities(this.properties.adminToolsAPIURL).subscribe(
-/* this.contentService.getCommunities('http://duffy.di.uoa.gr:8080/uoa-admin-tools/').subscribe(*/
- comms => {
- this.communities = comms;
- this.selectedCommunityPid = this.communities[0].pid;
- },
- error => {
- console.log(error);
- },
- () => {
- console.log(`I got ${JSON.stringify(this.communities)}`);
- }
- );
+ getStatsOfCommunity(pid: string) {
+ this.selectedCommunityPid = pid;
+ this.getStatistics();
+ }
+
+ toggleShow(name: string) {
+ this.stats.statistics[name].show = !this.stats.statistics[name].show;
+ }
+
+ toggleShowInDashboard(name: string) {
+ this.stats.statistics[name].showInDashboard = !this.stats.statistics[name].showInDashboard;
}
}