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', path: 'stats',
component: StatsComponent,canActivate: [FreeGuard],resolve: { envSpecific: EnvironmentSpecificResolver } component: StatsComponent,
canActivate: [FreeGuard],
resolve: { envSpecific: EnvironmentSpecificResolver }
}, },
{ path: '**',pathMatch: 'full',component: DashboardComponent } { path: '**',pathMatch: 'full',component: DashboardComponent }

View File

@ -1,3 +1,4 @@
<!--
<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>
@ -7,19 +8,20 @@
<div> <div>
<div class="contentPanel"> <div class="contentPanel">
<div *ngIf="errorMessage" class="uk-alert-danger uk-alert">{{ errorMessage }}</div> <div *ngIf="errorMessage" class="uk-alert-danger uk-alert">{{ errorMessage }}</div>
<div *ngIf="loadingMessage" class="whiteFilm"> <div *ngIf="loadingMessage" class="loading-big">
<span>{{ loadingMessage }}</span> <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>
<div class="page-controls"> <div class="page-controls">
<div class=" filters "> <div class="filters">
<div class="show-options uk-float-right"> <div class="show-options uk-float-right">
<button class="uk-button" type="button"> Bulk Actions</button> <button class="uk-button" type="button"> Bulk Actions</button>
<div uk-dropdown="mode: click"> <div uk-dropdown="mode: click">
<ul class="uk-nav uk-dropdown-nav"> <ul class="uk-nav uk-dropdown-nav">
<li><a (click)="togglePages(true, getSelectedPages())"><i></i> Activate </a></li> <li><a><i></i> Activate </a></li>
<li><a (click)="togglePages(false, getSelectedPages())"><i></i> Deactivate </a></li> <li><a><i></i> Deactivate </a></li>
<li><a (click)="confirmDeleteSelectedPages()"><i></i> Delete </a></li> <li><a><i></i> Delete </a></li>
</ul> </ul>
</div> </div>
</div> </div>
@ -34,13 +36,13 @@
<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" (change)="filterByCommunity($event)"> <select class="uk-select uk-width-medium" &lt;!&ndash;(change)="filterByCommunity($event)"&ndash;&gt;>
<!--option value="">-- none selected --</option--> &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>
<table class="uk-table uk-table-striped"> &lt;!&ndash; <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>
@ -54,7 +56,8 @@
<th *ngIf="pageWithDivIds && pageWithDivIds.length > 0">Class Help Contents</th> <th *ngIf="pageWithDivIds && pageWithDivIds.length > 0">Class Help Contents</th>
</tr> </tr>
</thead> </thead>
<tbody > <tbody *ngIf="checkboxes">
&lt;!&ndash;
<tr *ngFor="let check of checkboxes; let i=index"> <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">
@ -96,12 +99,13 @@
<span *ngIf="!pageWithDivIds.includes(check.page._id)">-</span> <span *ngIf="!pageWithDivIds.includes(check.page._id)">-</span>
</td> </td>
</tr> </tr>
&ndash;&gt;
</tbody> </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 class="uk-alert-warning" uk-alert>No pages found</div>
</div> </div>&ndash;&gt;
</div> </div>
</div> </div>
</div> </div>
@ -109,4 +113,4 @@
</div> </div>
</div> </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 {CommunityStatistics} from "../../domain/statistics-classes";
import {ActivatedRoute} from "@angular/router"; import {ActivatedRoute} from "@angular/router";
import {EnvProperties} from "../../openaireLibrary/utils/properties/env-properties"; import {EnvProperties} from "../../openaireLibrary/utils/properties/env-properties";
import { Community } from '../../domain/community';
@Component({ @Component({
selector: 'stats', selector: 'stats',
@ -10,20 +11,30 @@ import {EnvProperties} from "../../openaireLibrary/utils/properties/env-properti
}) })
export class StatsComponent implements OnInit { export class StatsComponent implements OnInit {
stats: CommunityStatistics; errorMessage: string;
loadingMessage: string;
communities: Community[] = [];
selectedCommunityPid: string;
stats: CommunityStatistics = null;
tableNames: string[] = []; tableNames: string[] = [];
properties:EnvProperties = null; public properties: EnvProperties = null;
constructor(private contentService: HelpContentService, constructor(private contentService: HelpContentService,
private route: ActivatedRoute) {} private route: ActivatedRoute) {}
ngOnInit() { ngOnInit() {
this.route.data console.log(`TRYING TO LOAD COMMUNITIES !!!`);
/* this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => { .subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific; this.properties = data.envSpecific;
this.getStatistics(); this.getCommunities();
}); },
error => console.log(`E R R O R!!`)
);*/
this.getCommunities();
} }
getStatistics() { 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)}`);
}
);
}
} }