created stats component and classes and imported statistics from api

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-admin-portal/trunk@51044 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
myrto.koukouli 2018-03-05 16:10:19 +00:00
parent 3b6274e0e1
commit 094c3e9be8
7 changed files with 62 additions and 2 deletions

View File

@ -51,6 +51,7 @@ import { AdminLoginGuard} from './openaireLibrary/login/adminLoginGuard.guard';
import { EnvironmentSpecificResolver} from './openaireLibrary/utils/properties/environmentSpecificResolver';
import { EnvironmentSpecificService} from './openaireLibrary/utils/properties/environment-specific.service';
import{ClaimsAdminModule} from './openaireLibrary/claims/claimsAdmin/claimsAdmin.module';
import {StatsComponent} from "./pages/stats/stats.component";
//, , ErrorModule CookieLawModule
@NgModule({
imports: [
@ -94,7 +95,8 @@ import{ClaimsAdminModule} from './openaireLibrary/claims/claimsAdmin/claimsAdmin
NewDivHelpContentComponent,
EditDivHelpContentComponent,
DivContentFormComponent,
ClaimsComponent
ClaimsComponent,
StatsComponent
],
providers: [
FAQService,

View File

@ -23,6 +23,7 @@ import { AdminLoginGuard} from './openaireLibrary/login/adminLoginGuard.guard';
import { EnvironmentSpecificResolver} from './openaireLibrary/utils/properties/environmentSpecificResolver';
import { EnvironmentSpecificService} from './openaireLibrary/utils/properties/environment-specific.service';
import{ClaimsAdminComponent} from './openaireLibrary/claims/claimsAdmin/claimsAdmin.component';
import {StatsComponent} from "./pages/stats/stats.component";
@ -95,6 +96,10 @@ const appRoutes: Routes = [
path: 'claims',
component: ClaimsComponent,canActivate: [FreeGuard],resolve: { envSpecific: EnvironmentSpecificResolver }
},
{
path: 'stats',
component: StatsComponent,canActivate: [FreeGuard],resolve: { envSpecific: EnvironmentSpecificResolver }
},
{ path: '**',pathMatch: 'full',component: DashboardComponent }
];

View File

@ -54,7 +54,8 @@
</h3>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
<p>
<a href="http://scoobydoo.di.uoa.gr/connect/stats.html" class="uk-button uk-button-text">Select statistics &amp; charts</a>
<a href="http://scoobydoo.di.uoa.gr/connect/stats.html" class="uk-button uk-button-text">Select statistics &amp; charts</a><br>
<a routerLink="/stats" class="uk-button uk-button-text">New statistics page-under construction</a>
</p>
</div>

View File

@ -0,0 +1,9 @@
export class StatTableOptions {
show: boolean;
showInDashboard: boolean;
}
export class CommunityStatistics {
pid: string;
statistics: Map<string,StatTableOptions>;
}

View File

@ -0,0 +1 @@
<div>Waiting for stats page!</div>

View File

@ -0,0 +1,35 @@
import {Component, OnInit} from "@angular/core";
import {HelpContentService} from "../../services/help-content.service";
import {CommunityStatistics} from "../../domain/statistics-classes";
@Component({
selector: 'stats',
templateUrl: 'stats.component.html'
})
export class StatsComponent implements OnInit {
stats: CommunityStatistics;
tableNames: string[] = [];
constructor(private contentService: HelpContentService) {}
ngOnInit() {
this.getStatistics();
}
getStatistics() {
this.contentService.getStatistics('egi').subscribe(
stats => this.stats = stats,
error => console.log(error),
() => {
console.log(`I got something! My pid is ${this.stats.pid}`);
console.log(`my table names are:`);
for (let key in this.stats.statistics){
this.tableNames.push(key);
console.log(key);
}
}
);
}
}

View File

@ -10,6 +10,7 @@ import { Community } from "../domain/community";
import { Entity } from "../domain/entity";
import { DivId } from "../domain/divId";
import { DivHelpContent } from "../domain/div-help-content";
import {CommunityStatistics} from "../domain/statistics-classes";
@Injectable()
export class HelpContentService {
@ -389,4 +390,10 @@ export class HelpContentService {
return this.http.get('https://beta.services.openaire.eu/search/v2/api/datasources?format=json').map(res => <any> res.json()).map(res => res.results).do(res => {console.log(res)}).catch(this.handleError);
}
getStatistics(community_pid: string) {
return this.http.get(this._helpContentUrl + 'statistics/'+community_pid)
.map(res => <CommunityStatistics> res.json())
.catch(this.handleError);
}
}