From bb21acb9f4bf49eebbb73e88afaaeda68d82da73 Mon Sep 17 00:00:00 2001 From: "myrto.koukouli" Date: Thu, 8 Mar 2018 17:00:58 +0000 Subject: [PATCH] created temporary table with stat-tables names git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-admin-portal/trunk@51099 d315682c-612b-4755-9ff5-7f18f6832af3 --- app/pages/stats/stats.component.html | 80 +++++++++------------------- app/pages/stats/stats.component.ts | 73 ++++++++++++++++--------- 2 files changed, 73 insertions(+), 80 deletions(-) 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 - Class Help Contents + Show in statistics page + Show in dashboard - -<!– - - + + + +
{{ name }}
-
{{check.page.name}}
- - -
- +
+
-
- -
- - -
{{check.page.type}}
- - -
- {{entity.name}}, +
+
-
{{check.page.route}}
- - - -
- - +
+ +
+
+
- - - add page contents - - - 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; } }