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
This commit is contained in:
myrto.koukouli 2018-03-08 17:00:58 +00:00
parent ba808effb4
commit bb21acb9f4
2 changed files with 73 additions and 80 deletions

View File

@ -1,4 +1,3 @@
<!--
<div id="stats" class="uk-container"> <div id="stats" class="uk-container">
<div class="menubar "> <div class="menubar ">
<div class="page-title uk-article-title">Statistics</div> <div class="page-title uk-article-title">Statistics</div>
@ -29,83 +28,56 @@
</div> </div>
<div> <div>
<div class="gwt-HTML"> <div>
<div class="row users-list"> <div class="row users-list">
<div class="col-md-12"> <div class="col-md-12">
<div class="filters marginBottom20"> <div class="filters marginBottom20">
<div class="links form-group form-inline"> <div class="links form-group form-inline">
<span>Filter by community:</span> <span>Filter by community:</span>
<select class="uk-select uk-width-medium" &lt;!&ndash;(change)="filterByCommunity($event)"&ndash;&gt;> <select class="uk-select uk-width-medium" #selectPid (change)="getStatsOfCommunity(selectPid.value)">
&lt;!&ndash;option value="">&#45;&#45; none selected &#45;&#45;</option&ndash;&gt; <option *ngFor="let community of communities" value="{{ community.pid }}">{{ community.name }} </option>
<option *ngFor="let community of communities" value="{{community.pid}}">{{community.name}}</option>
</select> </select>
</div> </div>
</div> </div>
&lt;!&ndash; <table class="uk-table uk-table-striped"> <table class="uk-table uk-table-striped">
<thead> <thead>
<tr> <tr>
<th><input id="allPageCheckbox" type="checkbox" (change)="toggleCheckBoxes($event)"></th> <!-- <th><input id="allPageCheckbox" type="checkbox" (change)="toggleCheckBoxes($event)"></th>-->
<th>Name</th> <th>Name</th>
<th>State</th> <th>Show in statistics page</th>
<th *ngIf="!pagesType">Type</th> <th>Show in dashboard</th>
<th>Related Entities</th>
<th>Route</th>
<th>Actions</th>
<th>Page Help Contents</th>
<th *ngIf="pageWithDivIds && pageWithDivIds.length > 0">Class Help Contents</th>
</tr> </tr>
</thead> </thead>
<tbody *ngIf="checkboxes"> <tbody *ngIf="stats">
&lt;!&ndash; <tr *ngFor="let name of tableNames">
<tr *ngFor="let check of checkboxes; let i=index"> <!--<td><input id="{{check.page._id}}" class="checkBox" type="checkbox"
<td><input id="{{check.page._id}}" class="checkBox" type="checkbox"
name="pagescb[]" value="{{check.page._id}}" [(ngModel)]="check.checked"> name="pagescb[]" value="{{check.page._id}}" [(ngModel)]="check.checked">
</td>-->
<td>
<div class="name">{{ name }}</div>
</td> </td>
<td> <td>
<div class="name" href="#">{{check.page.name}}</div> <div *ngIf="stats.statistics[name].show" class="activated" >
</td> <input (click)="toggleShow(name)" class="deactivate" src="imgs/check-icon.png" title="Disable" width="20" type="image" height="20">
<td>
<div *ngIf="check.page.isEnabled" class="activated" >
<input (click)="togglePages(false,[check.page._id])" class="deactivate" src="imgs/check-icon.png" title="Disable" width="20" type="image" height="20">
</div> </div>
<div *ngIf="!check.page.isEnabled" class="deactivated" > <div *ngIf="!stats.statistics[name].show" class="deactivated" >
<input (click)="togglePages(true,[check.page._id])" class="deactivate" src="imgs/x-icon.png" title="Enable" width="20" type="image" height="20"> <input (click)="toggleShow(name)" class="deactivate" src="imgs/x-icon.png" title="Enable" width="20" type="image" height="20">
</div>
</td>
<td *ngIf="!pagesType">
<div class="type" href="#">{{check.page.type}}</div>
</td>
<td>
<div class="entities" href="#">
<span *ngFor="let entity of check.page.entities let i=index">{{entity.name}}<span *ngIf="i<(check.page.entities.length-1)">, </span></span>
</div> </div>
</td> </td>
<td> <td>
<div class="route" href="#">{{check.page.route}}</div> <div *ngIf="stats.statistics[name].showInDashboard" class="activated" >
</td> <input (click)="toggleShowInDashboard(name)" class="deactivate" src="imgs/check-icon.png" title="Disable" width="20" type="image" height="20">
</div>
<td> <div *ngIf="!stats.statistics[name].showInDashboard" class="deactivated" >
<div class="actions" href="#"> <input (click)="toggleShowInDashboard(name)" class="deactivate" src="imgs/x-icon.png" title="Enable" width="20" type="image" height="20">
<input title="Edit" src="imgs/icn_edit.png" class="edit" type="image" (click)="editPage(i)">
<input title="Delete" src="imgs/icn_trash.png" class="delete" type="image" (click)="confirmDeletePage(check.page._id)">
</div> </div>
</td>
<td>
<a class="helpContents" [queryParams]="{community: selectedCommunityPid, page: check.page._id}" routerLink="/pageContents">add page contents</a>
</td>
<td *ngIf="pageWithDivIds && pageWithDivIds.length > 0" class="uk-text-center">
<a *ngIf="pageWithDivIds.includes(check.page._id)" class="classHelpContents" [queryParams]="{community: selectedCommunityPid, page: check.page._id}" routerLink="/classContents">add class contents</a>
<span *ngIf="!pageWithDivIds.includes(check.page._id)">-</span>
</td> </td>
</tr> </tr>
&ndash;&gt;
</tbody> </tbody>
</table>&ndash;&gt; </table>
<!-- <div *ngIf="checkboxes.length==0" class="col-md-12">
&lt;!&ndash; <div *ngIf="checkboxes.length==0" class="col-md-12">
<div class="uk-alert-warning" uk-alert>No pages found</div> <div class="uk-alert-warning" uk-alert>No pages found</div>
</div>&ndash;&gt; </div>-->
</div> </div>
</div> </div>
</div> </div>
@ -113,4 +85,4 @@
</div> </div>
</div> </div>
</div> </div>
</div>--> </div>

View File

@ -26,47 +26,68 @@ export class StatsComponent implements OnInit {
private route: ActivatedRoute) {} private route: ActivatedRoute) {}
ngOnInit() { ngOnInit() {
console.log(`TRYING TO LOAD COMMUNITIES !!!`); this.route.data
/* this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => { .subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific; this.properties = data.envSpecific;
this.getCommunities(); this.getCommunities();
}, },
error => console.log(`E R R O R!!`) error => console.log(`E R R O R!!`)
);*/ );
this.getCommunities();
} }
getStatistics() { getCommunities() {
this.contentService.getStatistics('egi',this.properties.adminToolsAPIURL).subscribe( this.loadingMessage = 'Retrieving communities';
stats => this.stats = stats, 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 => { error => {
this.loadingMessage = '';
this.errorMessage = 'Failed to retrieve information on your communities!';
console.log(error); console.log(error);
}, },
() => { () => {
console.log(`I got something! My pid is ${this.stats.pid}`); console.log(`I have communities`);
console.log(`my table names are:`); 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){ for (let key in this.stats.statistics){
this.tableNames.push(key); this.tableNames.push(key);
console.log(key);
} }
} }
); );
} }
getCommunities() { getStatsOfCommunity(pid: string) {
this.contentService.getCommunities(this.properties.adminToolsAPIURL).subscribe( this.selectedCommunityPid = pid;
/* this.contentService.getCommunities('http://duffy.di.uoa.gr:8080/uoa-admin-tools/').subscribe(*/ this.getStatistics();
comms => { }
this.communities = comms;
this.selectedCommunityPid = this.communities[0].pid; toggleShow(name: string) {
}, this.stats.statistics[name].show = !this.stats.statistics[name].show;
error => { }
console.log(error);
}, toggleShowInDashboard(name: string) {
() => { this.stats.statistics[name].showInDashboard = !this.stats.statistics[name].showInDashboard;
console.log(`I got ${JSON.stringify(this.communities)}`);
}
);
} }
} }