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 class="menubar ">
<div class="page-title uk-article-title">Statistics</div>
@ -29,83 +28,56 @@
</div>
<div>
<div class="gwt-HTML">
<div>
<div class="row users-list">
<div class="col-md-12">
<div class="filters marginBottom20">
<div class="links form-group form-inline">
<span>Filter by community:</span>
<select class="uk-select uk-width-medium" &lt;!&ndash;(change)="filterByCommunity($event)"&ndash;&gt;>
&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>
<select class="uk-select uk-width-medium" #selectPid (change)="getStatsOfCommunity(selectPid.value)">
<option *ngFor="let community of communities" value="{{ community.pid }}">{{ community.name }} </option>
</select>
</div>
</div>
&lt;!&ndash; <table class="uk-table uk-table-striped">
<table class="uk-table uk-table-striped">
<thead>
<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>State</th>
<th *ngIf="!pagesType">Type</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>
<th>Show in statistics page</th>
<th>Show in dashboard</th>
</tr>
</thead>
<tbody *ngIf="checkboxes">
&lt;!&ndash;
<tr *ngFor="let check of checkboxes; let i=index">
<td><input id="{{check.page._id}}" class="checkBox" type="checkbox"
<tbody *ngIf="stats">
<tr *ngFor="let name of tableNames">
<!--<td><input id="{{check.page._id}}" class="checkBox" type="checkbox"
name="pagescb[]" value="{{check.page._id}}" [(ngModel)]="check.checked">
</td>-->
<td>
<div class="name">{{ name }}</div>
</td>
<td>
<div class="name" href="#">{{check.page.name}}</div>
</td>
<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 *ngIf="stats.statistics[name].show" class="activated" >
<input (click)="toggleShow(name)" class="deactivate" src="imgs/check-icon.png" title="Disable" width="20" type="image" height="20">
</div>
<div *ngIf="!check.page.isEnabled" class="deactivated" >
<input (click)="togglePages(true,[check.page._id])" 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 *ngIf="!stats.statistics[name].show" class="deactivated" >
<input (click)="toggleShow(name)" class="deactivate" src="imgs/x-icon.png" title="Enable" width="20" type="image" height="20">
</div>
</td>
<td>
<div class="route" href="#">{{check.page.route}}</div>
</td>
<td>
<div class="actions" href="#">
<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 *ngIf="stats.statistics[name].showInDashboard" class="activated" >
<input (click)="toggleShowInDashboard(name)" class="deactivate" src="imgs/check-icon.png" title="Disable" width="20" type="image" height="20">
</div>
<div *ngIf="!stats.statistics[name].showInDashboard" class="deactivated" >
<input (click)="toggleShowInDashboard(name)" class="deactivate" src="imgs/x-icon.png" title="Enable" width="20" type="image" height="20">
</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>
</tr>
&ndash;&gt;
</tbody>
</table>&ndash;&gt;
&lt;!&ndash; <div *ngIf="checkboxes.length==0" class="col-md-12">
</table>
<!-- <div *ngIf="checkboxes.length==0" class="col-md-12">
<div class="uk-alert-warning" uk-alert>No pages found</div>
</div>&ndash;&gt;
</div>-->
</div>
</div>
</div>
@ -113,4 +85,4 @@
</div>
</div>
</div>
</div>-->
</div>

View File

@ -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;
}
}