continued working on stats

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-admin-portal/trunk@51085 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
myrto.koukouli 2018-03-08 05:53:22 +00:00
parent e9482c8ed5
commit ba808effb4
3 changed files with 53 additions and 20 deletions

View File

@ -104,7 +104,9 @@ const appRoutes: Routes = [
{
path: 'stats',
component: StatsComponent,canActivate: [FreeGuard],resolve: { envSpecific: EnvironmentSpecificResolver }
component: StatsComponent,
canActivate: [FreeGuard],
resolve: { envSpecific: EnvironmentSpecificResolver }
},
{ path: '**',pathMatch: 'full',component: DashboardComponent }

View File

@ -1,3 +1,4 @@
<!--
<div id="stats" class="uk-container">
<div class="menubar ">
<div class="page-title uk-article-title">Statistics</div>
@ -7,19 +8,20 @@
<div>
<div class="contentPanel">
<div *ngIf="errorMessage" class="uk-alert-danger uk-alert">{{ errorMessage }}</div>
<div *ngIf="loadingMessage" class="whiteFilm">
<span>{{ loadingMessage }}</span>
<div *ngIf="loadingMessage" class="loading-big">
<div class="loader-big" style="text-align: center; padding-top: 170px; color: rgb(47, 64, 80); font-weight: bold;">{{ loadingMessage }}</div>
<div class="whiteFilm"></div>
</div>
<div class="page-controls">
<div class=" filters ">
<div class="filters">
<div class="show-options uk-float-right">
<button class="uk-button" type="button"> Bulk Actions</button>
<div uk-dropdown="mode: click">
<ul class="uk-nav uk-dropdown-nav">
<li><a (click)="togglePages(true, getSelectedPages())"><i></i> Activate </a></li>
<li><a (click)="togglePages(false, getSelectedPages())"><i></i> Deactivate </a></li>
<li><a (click)="confirmDeleteSelectedPages()"><i></i> Delete </a></li>
<li><a><i></i> Activate </a></li>
<li><a><i></i> Deactivate </a></li>
<li><a><i></i> Delete </a></li>
</ul>
</div>
</div>
@ -34,13 +36,13 @@
<div class="filters marginBottom20">
<div class="links form-group form-inline">
<span>Filter by community:</span>
<select class="uk-select uk-width-medium" (change)="filterByCommunity($event)">
<!--option value="">-- none selected --</option-->
<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>
</div>
</div>
<table class="uk-table uk-table-striped">
&lt;!&ndash; <table class="uk-table uk-table-striped">
<thead>
<tr>
<th><input id="allPageCheckbox" type="checkbox" (change)="toggleCheckBoxes($event)"></th>
@ -54,7 +56,8 @@
<th *ngIf="pageWithDivIds && pageWithDivIds.length > 0">Class Help Contents</th>
</tr>
</thead>
<tbody >
<tbody *ngIf="checkboxes">
&lt;!&ndash;
<tr *ngFor="let check of checkboxes; let i=index">
<td><input id="{{check.page._id}}" class="checkBox" type="checkbox"
name="pagescb[]" value="{{check.page._id}}" [(ngModel)]="check.checked">
@ -96,12 +99,13 @@
<span *ngIf="!pageWithDivIds.includes(check.page._id)">-</span>
</td>
</tr>
&ndash;&gt;
</tbody>
</table>
</table>&ndash;&gt;
<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>
</div>&ndash;&gt;
</div>
</div>
</div>
@ -109,4 +113,4 @@
</div>
</div>
</div>
</div>
</div>-->

View File

@ -3,6 +3,7 @@ import {HelpContentService} from "../../services/help-content.service";
import {CommunityStatistics} from "../../domain/statistics-classes";
import {ActivatedRoute} from "@angular/router";
import {EnvProperties} from "../../openaireLibrary/utils/properties/env-properties";
import { Community } from '../../domain/community';
@Component({
selector: 'stats',
@ -10,20 +11,30 @@ import {EnvProperties} from "../../openaireLibrary/utils/properties/env-properti
})
export class StatsComponent implements OnInit {
stats: CommunityStatistics;
errorMessage: string;
loadingMessage: string;
communities: Community[] = [];
selectedCommunityPid: string;
stats: CommunityStatistics = null;
tableNames: string[] = [];
properties:EnvProperties = null;
public properties: EnvProperties = null;
constructor(private contentService: HelpContentService,
private route: ActivatedRoute) {}
ngOnInit() {
this.route.data
console.log(`TRYING TO LOAD COMMUNITIES !!!`);
/* this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.getStatistics();
});
this.getCommunities();
},
error => console.log(`E R R O R!!`)
);*/
this.getCommunities();
}
getStatistics() {
@ -42,4 +53,20 @@ export class StatsComponent implements OnInit {
}
);
}
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)}`);
}
);
}
}