Related Dataproviders Tab added in Dataprovider's landing page | Metrics Tab added in all landing pages | incomplete login folder added

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@44882 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2016-12-08 16:28:39 +00:00
parent c0e4e1818d
commit 80dda369cb
33 changed files with 784 additions and 75 deletions

View File

@ -14,6 +14,7 @@ import {DepoditModule} from './deposit/deposit.module';
import {LandingModule} from './landingPages/landing.module';
import {SharedComponentsModule} from './sharedComponents/sharedComponents.module'; //navbar
import {UtilsModule} from './utils/utils.module';
import {LoginModule} from './login/login.module';
import {TestModule} from './test/test.module';
import { HomeModule } from './home/home.module';
import { ErrorModule } from './error/error.module';
@ -35,6 +36,7 @@ import {ServicesModule} from './services/services.module';
SharedComponentsModule,
UtilsModule,
ServicesModule,
LoginModule,
TestModule,
HomeModule,
AppRoutingModule,

View File

@ -38,7 +38,8 @@
[resultsBy] = "dataProviderInfo.resultsBy"
[tabs]="dataProviderInfo.tabs"
[statistics]="dataProviderInfo.statistics"
[organizations]="dataProviderInfo.organizations">
[organizations]="dataProviderInfo.organizations"
[_dataproviderService]="_dataproviderService">
</tabs>
</div>

View File

@ -14,7 +14,7 @@ import{TabsComponent} from './tabs.component';
export class DataProviderComponent {
private start ;private end ;
constructor (private _publicationService: DataProviderService, private route: ActivatedRoute) {
constructor (private _dataproviderService: DataProviderService, private route: ActivatedRoute) {
this.start = new Date().getTime();
}
@ -74,7 +74,7 @@ export class DataProviderComponent {
this.warningMessage="No valid datasource id";
console.info("novalid");
}else{
this._publicationService.getPublicationInfo(this.datasourceId).subscribe(
this._dataproviderService.getDataproviderInfo(this.datasourceId).subscribe(
data => {
this.dataProviderInfo = data;
console.info(this.dataProviderInfo.resultsBy);

View File

@ -0,0 +1,58 @@
import {Component, Input} from '@angular/core';
import { SearchPublicationsComponent } from '../../searchPages/simple/searchPublications.component';
import {SearchResultComponent} from '../../searchPages/searchUtils/searchResult.component';
import {OpenaireProperties} from '../../utils/properties/openaireProperties';
@Component({
selector: 'relatedDatasourcesTab',
template: `
<div *ngIf="searchPublicationsComponent.results.length == 0" class = "alert alert-info " >
There are no related dataproviders
</div>
<div *ngIf="searchPublicationsComponent.results.length > 0">
<p>
The results below are discovered through our pilot algorithms.
<a href="mailto:">Let us know how we are doing!</a>
</p>
<table class="table table-striped">
<thead>
<tr>
<th class="text-center">Name</th>
<th class="text-center">Aggregation Number</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let item of searchPublicationsComponent.results">
<td class="text-center">
<a href="{{item.url}}" target="_blank">
{{item.name}}
</a>
</td>
<td class="text-center">
{{item.count}}
</td>
</tr>
</tbody>
</table>
</div>
`
})
export class RelatedDatasourcesTabComponent {
@Input() paramsForSearchLink: string = "";
@Input() searchPublicationsComponent : SearchPublicationsComponent;
private linkToSearchPublications = "";
constructor () {}
ngOnInit() {
//this.linkToSearchPublications = OpenaireProperties.getLinkToSearchPublications()+this.paramsForSearchLink;
}
ngOnDestroy() {}
}

View File

@ -82,6 +82,12 @@ import { SearchDataprovidersService } from '../../services/searchDataproviders.s
<organizationsTab *ngIf="tabs[0].content=='organizationsTab'">
[organizations]="organizations"
</organizationsTab>
<relatedDatasourcesTab *ngIf="tabs[0].content=='relatedDatasourcesTab'"
[searchPublicationsComponent]="searchPublicationsComponentAggregators">
</relatedDatasourcesTab>
<div *ngIf="tabs[0].content=='metricsTab'" class="well">
<b>Views: </b>{{metrics}}
</div>
</div>
<div *ngFor="let tab of tabs; let i=index" id="{{tab.content}}" class="tab-pane fade panel-body">
@ -105,6 +111,12 @@ import { SearchDataprovidersService } from '../../services/searchDataproviders.s
<organizationsTab *ngIf="i>0 && tab.content=='organizationsTab'"
[organizations]="organizations">
</organizationsTab>
<relatedDatasourcesTab *ngIf="i>0 && tab.content=='relatedDatasourcesTab'"
[searchPublicationsComponent]="searchPublicationsComponentAggregators">
</relatedDatasourcesTab>
<div *ngIf="i>0 && tab.content=='metricsTab'" class="well">
<b>Views: </b>{{metrics}}
</div>
</div>
</div>
`
@ -122,17 +134,23 @@ export class TabsComponent {
//@Input() datasources;
@Input() organizations: {"name": string, "url": string}[];
@Input() _dataproviderService;
public metrics: string;
public paramsForSearchLink: string = "";
public reloadPublications: boolean = true;
public reloadDatasets: boolean = true;
public reloadProjects: boolean = true;
public reloadDataproviders: boolean = true;
public reloadRelatedDatasources: boolean = true;
public searchPublicationsComponent : SearchPublicationsComponent;
public searchDatasetsComponent: SearchDatasetsComponent;
public searchProjectsComponent: SearchProjectsComponent;
public searchDataprovidersComponent: SearchDataprovidersComponent;
public searchPublicationsComponentAggregators: SearchPublicationsComponent;
constructor (private route: ActivatedRoute,
private _searchPublicationsService: SearchPublicationsService,
@ -143,6 +161,7 @@ export class TabsComponent {
this.searchDatasetsComponent = new SearchDatasetsComponent(this.route, this._searchDatasetsService);
this.searchProjectsComponent = new SearchProjectsComponent(this.route, this._searchProjectsService);
this.searchDataprovidersComponent = new SearchDataprovidersComponent(this.route, this._searchDataprovidersService);
this.searchPublicationsComponentAggregators = new SearchPublicationsComponent(this.route, this._searchPublicationsService);
}
ngOnInit() {
@ -170,8 +189,10 @@ export class TabsComponent {
} else if(content=='projectsTab') {
this.countProjects(page, size);
} else if(content=='datasourcesTab') {
this.countDataproviders(page, size);
}
this.countDatasources(page, size);
}// else if(content=='relatedDatasourcesTab') {
// this.countRelatedDatasources(page, size);
//}
}
}
@ -183,10 +204,27 @@ export class TabsComponent {
} else if(content=='projectsTab') {
this.searchProjects(page, size);
} else if(content=='datasourcesTab') {
this.searchDataproviders(page, size);
this.searchDatasources(page, size);
} else if(content=='relatedDatasourcesTab') {
this.searchRelatedDatasources(1, 0);
} else if(content=='metricsTab') {
this.getMetrics();
}
}
private getMetrics() {
console.info("getDatasourceMetrics: component");
this._dataproviderService.getMetrics(this.id).subscribe(
data => {
this.metrics = data;
},
err => {
console.error(err);
console.info("error");
}
);
}
private searchPublications(page: number, size: number) {
if(this.reloadPublications) {
this.searchPublicationsComponent.getResultsForDataproviders(this.id, this.resultsBy, page, size);
@ -220,14 +258,26 @@ export class TabsComponent {
this.searchProjectsComponent.getResultsForDataproviders(this.id, page, size);
}
private searchDataproviders(page: number, size: number) {
private searchDatasources(page: number, size: number) {
if(this.reloadDataproviders) {
this.searchDataprovidersComponent.getResultsForDataproviders(this.id, page, size);
}
this.reloadDataproviders = false;
}
private countDataproviders(page: number, size: number) {
private countDatasources(page: number, size: number) {
this.searchDataprovidersComponent.getResultsForDataproviders(this.id, page, size);
}
private searchRelatedDatasources(page: number, size: number) {
if(this.reloadRelatedDatasources) {
this.searchPublicationsComponentAggregators.getAggregatorResults(this.id, page, size);
}
this.reloadRelatedDatasources = false;
}
private countRelatedDatasources(page: number, size: number) {
//searchPublicationsComponentAggregator
this.searchPublicationsComponentAggregators.getAggregatorResults(this.id, page, size);
}
}

View File

@ -59,6 +59,12 @@
</span>
</a>
</li>
<li role="presentation" (click)="getMetrics()">
<a data-toggle="tab" href="#metricsTab">
Metrics
</a>
</li>
</ul>
<div class="tab-content">
@ -88,6 +94,40 @@
<tabTable [info]="datasetInfo.similarResearchResults"></tabTable>
</div>
</div>
<div id="metricsTab" class="tab-pane fade panel-body">
<dl *ngIf="metrics != undefined" class="dl-horizontal well">
<dt>TotalDownloads: </dt>
<dd>{{metrics.totalDownloads}}</dd>
<dt>TotalViews: </dt>
<dd>{{metrics.totalViews}}</dd>
</dl>
<table *ngIf="metrics != undefined && metrics.infos.size > 0"
class="table table-striped">
<thead>
<tr>
<th class="text-center">ID</th>
<th class="text-center">Number Of Downloads</th>
<th class="text-center">Number Of Views</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let key of metrics.infos.keys()">
<td class="text-center">
<a href="{{metrics.infos.get(key).url}}" target="_blank">
{{key}}
</a>
</td>
<td class="text-center">
{{metrics.infos.get(key).numOfDownloads}}
</td>
<td class="text-center">
{{metrics.infos.get(key).numOfViews}}
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>

View File

@ -2,8 +2,9 @@ import {Component, ViewChild} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {DatasetService} from '../../services/dataset.service';
import {DatasetInfo} from '../../utils/entities/datasetInfo';
import {Metrics} from '../../utils/entities/metrics';
import {ActivatedRoute} from '@angular/router';
import { OpenaireProperties} from '../../utils/properties/openaireProperties'
import {OpenaireProperties} from '../../utils/properties/openaireProperties'
import {InlineClaimContextComponent} from '../../claimPages/inlineClaims/inlineClaimContext.component';
import {InlineClaimProjectComponent} from '../../claimPages/inlineClaims/inlineClaimProject.component';
import {InlineClaimResultComponent} from '../../claimPages/inlineClaims/inlineClaimResult.component';
@ -30,6 +31,7 @@ export class DatasetComponent {
}
public datasetInfo: DatasetInfo;
private metrics: Metrics;
private showStyle: boolean = false;
private showAllReferences: boolean = false;
@ -72,6 +74,21 @@ export class DatasetComponent {
}
getMetrics() {
console.info("getDatasetMetrics: component");
this._datasetService.getMetrics(this.datasetId).subscribe(
data => {
this.metrics = data;
},
err => {
console.error(err);
console.info("error");
this.errorMessage = 'No dataset metrics found';
}
);
}
/********** Methods for Inline Claim of project / dataset ******/
toggleClaimProject(){
this.inlineClaimProject.toggle();

View File

@ -22,6 +22,7 @@ import {StatisticsTabComponent} from './dataProvider/statisticsTab.component';
import {ProjectsTabComponent} from './dataProvider/projectsTab.component';
import {DatasourcesTabComponent} from './dataProvider/datasourcesTab.component';
import {OrganizationsTabComponent} from './dataProvider/organizationsTab.component';
import {RelatedDatasourcesTabComponent} from './dataProvider/relatedDatasourcesTab.component';
import {TabsComponent} from './dataProvider/tabs.component';
@ -46,7 +47,7 @@ import { LandingRoutingModule } from './landing-routing.module';
],
declarations: [
TabPagingComponent, TabTableComponent, ShowTitleComponent, ShowAuthorsComponent,ShowIdentifiersComponent,ShowSubjectsComponent,
PublicationsTabComponent, DatasetsTabComponent, StatisticsTabComponent, ProjectsTabComponent, DatasourcesTabComponent, OrganizationsTabComponent, TabsComponent,
PublicationsTabComponent, DatasetsTabComponent, StatisticsTabComponent, ProjectsTabComponent, DatasourcesTabComponent, OrganizationsTabComponent, RelatedDatasourcesTabComponent, TabsComponent,
DataProviderComponent, PersonComponent, ProjectComponent, PublicationComponent, OrganizationComponent, DatasetComponent,
],
providers:[

View File

@ -45,6 +45,11 @@
</span>
</a>
</li>
<li role="presentation" (click)="getMetrics()">
<a data-toggle="tab" href="#metricsTab">
Metrics
</a>
</li>
</ul>
<div class="tab-content">
@ -122,6 +127,11 @@
<search-result [(results)]="searchDataprovidersComponent.results" [(status)]= "searchDataprovidersComponent.status"></search-result>
</div>
</div>
<div id="metricsTab" class="tab-pane fade panel-body">
<div class="well">
<b>Views: </b>{{metrics}}
</div>
</div>
</div>
</div>

View File

@ -21,8 +21,9 @@ import {ExportCSVComponent} from '../../utils/exportCSV.component';
export class OrganizationComponent {
organizationInfo: OrganizationInfo;
private metrics: string;
private organizationId: string;
private projectsNum : number = 0;
private projectsNum: number = 0;
private fundersSet: Set<string>;
private emptyFundersSet: boolean = true;
public warningMessage = "";
@ -90,7 +91,6 @@ export class OrganizationComponent {
this._organizationService.getOrganizationInfo(this.organizationId).subscribe(
data => {
this.organizationInfo = data;
let projectsNum = 0;
@ -111,6 +111,21 @@ export class OrganizationComponent {
);
}
private getMetrics() {
console.info("getOrganizationMetrics: component");
this._organizationService.getMetrics(this.organizationId).subscribe(
data => {
this.metrics = data;
},
err => {
console.error(err);
console.info("error");
this.errorMessage = 'No organization metrics found';
}
);
}
private handleClick(funder: string) {
if(this.emptyFundersSet) {
this.fundersSet.clear();

View File

@ -80,6 +80,11 @@
Statistics
</a>
</li>
<li role="presentation" (click)="getMetrics()">
<a data-toggle="tab" href="#metricsTab">
Metrics
</a>
</li>
</ul>
<div class="tab-content">
@ -127,6 +132,11 @@
</p>
</div>
</div>
<div id="metricsTab" class="tab-pane fade panel-body">
<div class="well">
<b>Views: </b>{{metrics}}
</div>
</div>
</div>
</div>
@ -149,12 +159,12 @@
<li class="list-group-item">
<a data-toggle="tab" href="">
View EC progress report (HTML)
View {{projectInfo.funder}} progress report (HTML)
</a>
</li>
<li class="list-group-item">
<export
[linkname]="'Download EC progress report (CSV)'"
[linkname]="'Download '+ projectInfo.funder +' progress report (CSV)'"
[filename]="'publications.csv'">
</export>
</li>

View File

@ -22,6 +22,7 @@ export class ProjectComponent{
private projectId : string ;
public projectInfo: ProjectInfo;
private metrics: string;
private project ;
@ -122,6 +123,21 @@ export class ProjectComponent{
);
}
getMetrics() {
console.info("getProjectMetrics: component");
this._projectService.getMetrics(this.projectId).subscribe(
data => {
this.metrics = data;
},
err => {
console.error(err);
console.info("error");
this.errorMessage = 'No project metrics found';
}
);
}
/*
********* Methods for Inline Claim of results *****
*/

View File

@ -97,6 +97,11 @@
<span class="badge">{{publicationInfo.software.length}}</span>
</a>
</li>
<li role="presentation" (click)="getMetrics()">
<a data-toggle="tab" href="#metricsTab">
Metrics
</a>
</li>
</ul>
<div class="tab-content">
@ -219,6 +224,40 @@
</tbody>
</table>
</div>
<div id="metricsTab" class="tab-pane fade panel-body">
<dl *ngIf="metrics != undefined" class="dl-horizontal well">
<dt>TotalDownloads: </dt>
<dd>{{metrics.totalDownloads}}</dd>
<dt>TotalViews: </dt>
<dd>{{metrics.totalViews}}</dd>
</dl>
<table *ngIf="metrics != undefined && metrics.infos.size > 0"
class="table table-striped">
<thead>
<tr>
<th class="text-center">ID</th>
<th class="text-center">Number Of Downloads</th>
<th class="text-center">Number Of Views</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let key of metrics.infos.keys()">
<td class="text-center">
<a href="{{metrics.infos.get(key).url}}" target="_blank">
{{key}}
</a>
</td>
<td class="text-center">
{{metrics.infos.get(key).numOfDownloads}}
</td>
<td class="text-center">
{{metrics.infos.get(key).numOfViews}}
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-3" *ngIf="publicationInfo != null">

View File

@ -2,6 +2,7 @@ import {Component, ViewChild} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {PublicationService} from '../../services/publication.service';
import {PublicationInfo} from '../../utils/entities/publicationInfo';
import {Metrics} from '../../utils/entities/metrics';
import {ActivatedRoute} from '@angular/router';
import {OpenaireProperties} from '../../utils/properties/openaireProperties';
import {InlineClaimContextComponent} from '../../claimPages/inlineClaims/inlineClaimContext.component';
@ -38,9 +39,8 @@ export class PublicationComponent {
console.log('ngOnInit:Execution time: ' + time);
});
}
ngAfterContentInit() {
this.end = new Date().getTime();
var time = this.end - this.start;
@ -58,9 +58,10 @@ ngAfterViewChecked() {
ngOnDestroy() {
this.sub.unsubscribe();
}
sub: any;
sub: any;getPublicationView
articleId: string;
public publicationInfo: PublicationInfo;
private metrics: Metrics;
public showAllReferences: boolean = false;
public showAllRelResData: boolean = false;
@ -118,6 +119,21 @@ ngAfterViewChecked() {
}
}
getMetrics() {
console.info("getPublicationMetrics: component");
this._publicationService.getMetrics(this.articleId).subscribe(
data => {
this.metrics = data;
},
err => {
console.error(err);
console.info("error");
this.errorMessage = 'No publication metrics found';
}
);
}
/*
********* Methods for Inline Claim of project / publication *****
*/

View File

@ -0,0 +1,14 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { LoginComponent } from './login.component';
@NgModule({
imports: [
RouterModule.forChild([
{ path: 'login', component: LoginComponent }
])
]
})
export class LoginRoutingModule { }

View File

@ -0,0 +1,100 @@
// import { Component } from '@angular/core';
// import { Router } from '@angular/router';
// import { Http } from '@angular/http';
// // import { contentHeaders } from '../../common/headers';
//
// // const styles = require('./login.css');
// // const template = require('./login.html');
//
// @Component({
// selector: 'login',
// template: template,
// styles: [ styles ]
// })
// export class Login {
// constructor(public router: Router, public http: Http) {
// }
//
// login(event, username, password) {
// event.preventDefault();
// let body = JSON.stringify({ username, password });
// localStorage.setItem('id_token',"test");
// // this.http.post('http://localhost:3001/sessions/create', body, { headers: contentHeaders })
// // .subscribe(
// // response => {
// // localStorage.setItem('id_token', response.json().id_token);
// // this.router.navigate(['home']);
// // },
// // error => {
// // alert(error.text());
// // console.log(error.text());
// // }
// // );
// }
//
// signup(event) {
// event.preventDefault();
// this.router.navigate(['signup']);
// }
// }
import {Component, ElementRef, Input} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {LoginService} from '../services/login.service';
@Component({
selector: 'login',
template: `
<div class="container" >
<div>
Welcome in Login
</div>
<div class="panel-body">
<!--div class="row">
<div class="input-group">
<input [(ngModel)]="email" name="email" type="email">
<label for="email">Email</label>
</div>
</div>
<div class="row">
<div class="input-group">
<input [(ngModel)]="password" type="password">
<label for="password">Password</label>
</div>
</div>
<form class = "search-form">
<div class="input-group">
<input type="text" class="form-control" placeholder="Type keywords..." aria-describedby="sizing-addon2" [(ngModel)]="keyword" name="keyword" >
</div>
</form-->
<button (click)="login()"
type="submit">Login Button
</button>
</div>
</div>
`
})
export class LoginComponent {
@Input() email: string = "sba";
@Input() password: string = "12345678";
constructor( private _loginService: LoginService ) {}
login() {
this._loginService.authenticate(this.email, this.password).subscribe(
data => {
console.info(data);
},
err => {
console.error(err);
}
);
}
}

View File

@ -0,0 +1,33 @@
import { NgModule} from '@angular/core';
//import { CommonModule } from '@angular/common';
//import { FormsModule } from '@angular/forms';
//import {UtilsModule} from '../utils/utils.module';
//import {ClaimModule} from '../claimPages/claim.module';
import {ServicesModule} from '../services/services.module';
//import {SearchModule} from '../searchPages/search.module';
import {LoginComponent} from './login.component';
import {LoginRoutingModule} from './login-routing.module';
@NgModule({
imports: [
//CommonModule, FormsModule,
//UtilsModule,
//ClaimModule,
ServicesModule,
LoginRoutingModule
],
declarations: [
LoginComponent
],
providers:[
],
exports: [
LoginComponent
]
})
export class LoginModule { }

View File

@ -1,39 +0,0 @@
// import { Component } from '@angular/core';
// import { Router } from '@angular/router';
// import { Http } from '@angular/http';
// // import { contentHeaders } from '../../common/headers';
//
// // const styles = require('./login.css');
// // const template = require('./login.html');
//
// @Component({
// selector: 'login',
// template: template,
// styles: [ styles ]
// })
// export class Login {
// constructor(public router: Router, public http: Http) {
// }
//
// login(event, username, password) {
// event.preventDefault();
// let body = JSON.stringify({ username, password });
// localStorage.setItem('id_token',"test");
// // this.http.post('http://localhost:3001/sessions/create', body, { headers: contentHeaders })
// // .subscribe(
// // response => {
// // localStorage.setItem('id_token', response.json().id_token);
// // this.router.navigate(['home']);
// // },
// // error => {
// // alert(error.text());
// // console.log(error.text());
// // }
// // );
// }
//
// signup(event) {
// event.preventDefault();
// this.router.navigate(['signup']);
// }
// }

View File

@ -220,7 +220,28 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number
);
}
public getAggregatorResults(id:string, page: number, size: number){
this.subResults = this._searchPublicationsService.searchAggregators('&fq=collectedfromdatasourceid exact "'+id+'"',"&refine=true&fields=resulthostingdatasourceid" , page, size).subscribe(
data => {
this.results = data;
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
}
},
err => {
console.error(err);
//TODO check erros (service not available, bad request)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
}
);
}
public queryChanged($event) {
var parameters = $event.value;

View File

@ -15,7 +15,7 @@ export class DataProviderService {
dataProviderInfo: DataProviderInfo;
getPublicationInfo (id: string):any {
getDataproviderInfo (id: string):any {
console.info("getDataProviderInfo in service");
let url = OpenaireProperties.getSearchAPIURLLast() + 'datasources/' +id +"?format=json";
let key = url;
@ -39,6 +39,22 @@ export class DataProviderService {
}
getMetrics (id: string):any {
console.info("getDataproviderMetrics in service");
//let url = OpenaireProperties. getSearchAPIURLLast() + 'publications/' +id+"?format=json";
let url = OpenaireProperties.getMetricsAPIURL()+"datasources/"+id+"/clicks";
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key));
}
return this.http.get(url)
.map(res => <any> res.json())
.map(res => res['views'])
.do(res => {
this._cache.set(key, res);
});
}
private handleError (error: Response) {
// in a real world app, we may send the error to some remote logging infrastructure
// instead of just logging it to the console
@ -85,6 +101,12 @@ export class DataProviderService {
}
this.dataProviderInfo.tabs.push({"name": "Organizations", "content": "organizationsTab"});
if(this.dataProviderInfo.tabsInTypes.relatedDatasourcesTab.has(data[1].classid)) {
this.dataProviderInfo.tabs.push({"name": "Related Data Providers", "content": "relatedDatasourcesTab"});
}
this.dataProviderInfo.tabs.push({"name": "Metrics", "content": "metricsTab"});
if(this.dataProviderInfo.resultTypes.collectedFrom.has(data[1].classid)) {
this.dataProviderInfo.resultsBy = "collectedFrom";
} else if(this.dataProviderInfo.resultTypes.hostedBy.has(data[1].classid)) {

View File

@ -2,6 +2,7 @@ import {Injectable} from '@angular/core';
import {Http, Response} from '@angular/http';
import {Observable} from 'rxjs/Observable';
import {DatasetInfo} from '../utils/entities/datasetInfo';
import {Metrics} from '../utils/entities/metrics';
import {OpenaireProperties} from '../utils/properties/openaireProperties';
import 'rxjs/add/observable/of';
import 'rxjs/add/operator/do';
@ -14,6 +15,7 @@ export class DatasetService {
constructor(private http: Http, public _cache: CacheService) {}
datasetInfo: DatasetInfo;
metrics: Metrics;
getDatasetInfo (id: string):any {
console.info("getDatasetInfo in service");
@ -46,6 +48,22 @@ export class DatasetService {
}
getMetrics (id: string):any {
console.info("getDatasetViews in service");
//let url = OpenaireProperties. getSearchAPIURLLast() + 'publications/' +id+"?format=json";
let url = OpenaireProperties.getMetricsAPIURL()+"results/"+id+"/clicks";
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key));
}
return this.http.get(url)
.map(res => <any> res.json())
.map(res => this.parseMetrics(res["downloads"], res["views"], res["total_downloads"], res["total_views"]))
.do(res => {
this._cache.set(key, res);
});
}
private handleError (error: Response) {
// in a real world app, we may send the error to some remote logging infrastructure
// instead of just logging it to the console
@ -53,6 +71,50 @@ export class DatasetService {
return Observable.throw(error || 'Server error');
}
parseMetrics(downloads: string, views: string, totalDownloads: any, totalViews: any): any {
this.metrics = new Metrics();
this.metrics.totalDownloads = totalDownloads;
this.metrics.totalViews = totalViews;
this.metrics.infos = new Map<string, {"url": string, "numOfDownloads": string, "numOfViews": string}>();
for(let i=0; i<downloads.length; i++) {
let id: string = downloads[i]['datasource_id'];
if(this.metrics.infos.has(id)) {
this.metrics.infos.get(id).numOfDownloads = downloads[i]['value'];
} else {
let info;//: {"url": string, "numOfDownloads": string, "numOfViews": string};
info = {};
info.url = OpenaireProperties.getsearchLinkToDataProvider()+id;
info.numOfDownloads = downloads[i]['value'];
info.numOfViews = "0";
this.metrics.infos.set(id, info);
}
}
for(let i=0; i<views.length; i++) {
let id: string = views[i]['datasource_id'];
if(this.metrics.infos.has(id)) {
this.metrics.infos.get(id).numOfViews = views[i]['value'];
} else {
let info;//: {"url": string, "numOfDownloads": string, "numOfViews": string};
info = {};
info.url = OpenaireProperties.getsearchLinkToDataProvider()+id;
info.numOfDownloads = "0";
info.numOfViews = views[i]['value'];
this.metrics.infos.set(id, info);
}
}
return this.metrics;
}
parseDatasetInfo (data: any):any {
this.datasetInfo = new DatasetInfo();

View File

@ -0,0 +1,30 @@
import {Injectable} from '@angular/core';
import {Http, Response} from '@angular/http';
import {Observable} from 'rxjs/Observable';
import 'rxjs/add/observable/of';
import 'rxjs/add/operator/do';
import 'rxjs/add/operator/share';
import { CacheService } from '../shared/cache.service';
import {PersonInfo} from '../utils/entities/personInfo';
import {OpenaireProperties} from '../utils/properties/openaireProperties'
@Injectable()
export class LoginService {
constructor(private http: Http, public _cache: CacheService) {}
authenticate (email: string, password: string):any {
let url = OpenaireProperties.getLoginAPIURL()+email+"&password="+password;
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key));
}
return this.http.get(url)
.map(res => <any> res.json())
.do(res => {
this._cache.set(key, res);
});
}
}

View File

@ -37,6 +37,22 @@ export class OrganizationService {
}
getMetrics (id: string):any {
console.info("getOrganizationMetrics in service");
//let url = OpenaireProperties. getSearchAPIURLLast() + 'publications/' +id+"?format=json";
let url = OpenaireProperties.getMetricsAPIURL()+"organizations/"+id+"/clicks";
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key));
}
return this.http.get(url)
.map(res => <any> res.json())
.map(res => res['views'])
.do(res => {
this._cache.set(key, res);
});
}
private handleError (error: Response) {
// in a real world app, we may send the error to some remote logging infrastructure
// instead of just logging it to the console

View File

@ -34,6 +34,23 @@ export class ProjectService {
});
}
getMetrics (id: string):any {
console.info("getProjectsMetrics in service");
//let url = OpenaireProperties. getSearchAPIURLLast() + 'publications/' +id+"?format=json";
let url = OpenaireProperties.getMetricsAPIURL()+"projects/"+id+"/clicks";
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key));
}
return this.http.get(url)
.map(res => <any> res.json())
.map(res => res['views'])
.do(res => {
this._cache.set(key, res);
});
}
/*
get project strtDate and endDate
*/

View File

@ -2,6 +2,7 @@ import {Injectable} from '@angular/core';
import {Http, Response} from '@angular/http';
import {Observable} from 'rxjs/Observable';
import {PublicationInfo} from '../utils/entities/publicationInfo';
import {Metrics} from '../utils/entities/metrics';
import {OpenaireProperties} from '../utils/properties/openaireProperties';
import 'rxjs/add/observable/of';
import 'rxjs/add/operator/do';
@ -13,6 +14,7 @@ export class PublicationService {
constructor(private http: Http, public _cache: CacheService) {}
publicationInfo: PublicationInfo;
metrics: Metrics;
getPublicationInfo (id: string):any {
console.info("getPublicationInfo in service");
@ -43,6 +45,22 @@ export class PublicationService {
});
}
getMetrics (id: string):any {
console.info("getPublicationViews in service");
//let url = OpenaireProperties. getSearchAPIURLLast() + 'publications/' +id+"?format=json";
let url = OpenaireProperties.getMetricsAPIURL()+"results/"+id+"/clicks";
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key));
}
return this.http.get(url)
.map(res => <any> res.json())
.map(res => this.parseMetrics(res["downloads"], res["views"], res["total_downloads"], res["total_views"]))
.do(res => {
this._cache.set(key, res);
});
}
private handleError (error: Response) {
// in a real world app, we may send the error to some remote logging infrastructure
// instead of just logging it to the console
@ -50,6 +68,50 @@ export class PublicationService {
return Observable.throw(error || 'Server error');
}
parseMetrics(downloads: string, views: string, totalDownloads: any, totalViews: any): any {
this.metrics = new Metrics();
this.metrics.totalDownloads = totalDownloads;
this.metrics.totalViews = totalViews;
this.metrics.infos = new Map<string, {"url": string, "numOfDownloads": string, "numOfViews": string}>();
for(let i=0; i<downloads.length; i++) {
let id: string = downloads[i]['datasource_id'];
if(this.metrics.infos.has(id)) {
this.metrics.infos.get(id).numOfDownloads = downloads[i]['value'];
} else {
let info;//: {"url": string, "numOfDownloads": string, "numOfViews": string};
info = {};
info.url = OpenaireProperties.getsearchLinkToDataProvider()+id;
info.numOfDownloads = downloads[i]['value'];
info.numOfViews = "0";
this.metrics.infos.set(id, info);
}
}
for(let i=0; i<views.length; i++) {
let id: string = views[i]['datasource_id'];
if(this.metrics.infos.has(id)) {
this.metrics.infos.get(id).numOfViews = views[i]['value'];
} else {
let info;//: {"url": string, "numOfDownloads": string, "numOfViews": string};
info = {};
info.url = OpenaireProperties.getsearchLinkToDataProvider()+id;
info.numOfDownloads = "0";
info.numOfViews = views[i]['value'];
this.metrics.infos.set(id, info);
}
}
return this.metrics;
}
parsePublicationInfo (data: any):any {
this.publicationInfo = new PublicationInfo();

View File

@ -261,17 +261,23 @@ export class SearchDataprovidersService {
result['type'] = this.getDataproviderType(resData);
if(resData.hasOwnProperty('accessinfopackage')) {
let OAIPMHURL: string;
if(Array.isArray(resData['accessinfopackage'])) {
OAIPMHURL = resData['accessinfopackage'][0];
} else {
OAIPMHURL = resData['accessinfopackage'];
}
let typeid: string = resData['datasourcetype'].classid;
console.info(typeid);
if(typeid != "entityregistry" && typeid != "entityregistry::projects" && typeid != "entityregistry::repositories") {
if(OAIPMHURL != '' && OAIPMHURL != 'unknown') {
result['OAIPMHURL'] = OAIPMHURL;
if(resData.hasOwnProperty('accessinfopackage')) {
let OAIPMHURL: string;
if(Array.isArray(resData['accessinfopackage'])) {
OAIPMHURL = resData['accessinfopackage'][0];
} else {
OAIPMHURL = resData['accessinfopackage'];
}
if(OAIPMHURL != '' && OAIPMHURL != 'unknown') {
result['OAIPMHURL'] = OAIPMHURL;
}
}
result['compatibility'] = this.getDataproviderCompatibility(resData);
}
result['websiteURL'] = resData.websiteurl;
@ -280,10 +286,7 @@ export class SearchDataprovidersService {
result['organizations'] = res[1];
result['countries'] = res[0];
result['compatibility'] = this.getDataproviderCompatibility(resData)
results.push(result);
}
return results;

View File

@ -15,6 +15,7 @@ export class SearchPublicationsService {
private sizeOfDescription: number = 497;
constructor(private http: Http, public _cache: CacheService) {}
searchPublications (params: string, refineParams:string, page: number, size: number, refineFields:string[] ):any {
let link = OpenaireProperties.getSearchAPIURLLast()+"publications";
@ -35,13 +36,39 @@ export class SearchPublicationsService {
return this.http.get(url)
.map(res => <any> res.json())
//.do(res => console.info(res))
.do(res => console.info(res))
.map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "publication")])
.do(res => {
this._cache.set(key, res);
});
}
searchAggregators (params: string, refineParams:string, page: number, size: number ):any {
let link = OpenaireProperties.getSearchAPIURLLast()+"publications";
let url = link+"?"+"&format=json&";
if(params!= null && params != '' ) {
url += params;
}
if(refineParams!= null && refineParams != '' ) {
url += refineParams;
}
url += "&page="+(page-1)+"&size="+size;
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key));
}
return this.http.get(url)
.map(res => <any> res.json())
.map(res => this.parseRefineResults(res['refineResults']))
.do(res => {
this._cache.set(key, res);
});
}
searchPublicationsByDois (DOIs: string[], refineParams:string, page: number, size: number, refineFields:string[] ):any {
let link = OpenaireProperties.getSearchAPIURLLast()+"publications";
@ -351,6 +378,26 @@ export class SearchPublicationsService {
return results;
}
parseRefineResults(data: any): any {
var results:any = [];
if(data.hasOwnProperty("resulthostingdatasourceid")) {
let length = Array.isArray(data['resulthostingdatasourceid']) ? data['resulthostingdatasourceid'].length : 1;
for(let i=0; i<length; i++) {
let datasource = Array.isArray(data['resulthostingdatasourceid']) ? data['resulthostingdatasourceid'][i] : data['resulthostingdatasourceid'];
let result: {"name": string, "id": string, "url":string, "count": number} = {"name": "", "id": "", "url": "", "count": 0};
result['name'] = datasource.name;
result['id'] = datasource.id;
result['url'] = OpenaireProperties.getsearchLinkToDataProvider()+result['id'];
result['count'] = datasource.count;
results.push(result);
}
}
return results;
}
numOfEntityPublications(id: string, entity: string):any {
//OpenaireProperties.getSearchAPIURLLast()

View File

@ -27,6 +27,8 @@ import {EntitiesSearchService} from './entitySearch.service';
import {ISVocabulariesService} from './ISVocabularies.service';
import {RefineFieldResultsService} from './refineFieldResults.service'
import {LoginService} from './login.service';
@NgModule({
imports: [
@ -42,7 +44,8 @@ import {RefineFieldResultsService} from './refineFieldResults.service'
SearchProjectsService, SearchDatasetsService, SearchOrganizationsService,
SearchPeopleService, ISVocabulariesService,
RefineFieldResultsService,
EntitiesSearchService
EntitiesSearchService,
LoginService
],
exports: [
]

View File

@ -36,14 +36,39 @@ export class DataProviderInfo {
"pubsrepository::journal",
"pubsrepository::unknown",
"pubsrepository::thematic",
"pubscatalogue::unknown"
"pubscatalogue::unknown",
]),
// "organizationsTab": new Set<string>(
// [ "entityregistry::projects",
// "entityregistry::repositories"
// ]),
"projectsTab": new Set<string>(["entityregistry::projects"]),
"datasourcesTab": new Set<string>(["entityregistry::repositories"])
"datasourcesTab": new Set<string>(["entityregistry::repositories"]),
"relatedDatasourcesTab": new Set<string>(
[ "aggregator::pubsrepository::unknown",
"aggregator::pubsrepository::journals",
"aggregator::pubsrepository::institutional",
"aggregator::datarepository"
])/*,
"metricsTab": new Set<string>(
[ "aggregator::datarepository",
"aggregator::pubsrepository::institutional",
"aggregator::pubsrepository::unknown",
"aggregator::pubsrepository::journals",
"crissystem",
"datarepository::unknown",
"pubsrepository::institutional",
"pubsrepository::journal",
"pubsrepository::unknown",
"pubsrepository::thematic",
"pubscatalogue::unknown",
"infospace",
"scholarcomminfra",
"entityregistry",
"entityregistry::projects",
"entityregistry::repositories"
])*/
};
resultsBy: string;

View File

@ -11,7 +11,8 @@ import {ProjectInfo} from './projectInfo';
import {Publication} from './publication';
import {PublicationInfo} from './publicationInfo';
import {SearchResult} from './searchResult';
import { DataProviderInfo } from './dataProviderInfo';
import {DataProviderInfo} from './dataProviderInfo';
import {Metrics} from './metrics';
import {ClaimResult, ClaimProject, ClaimContext} from './claimEntities.class';

View File

@ -0,0 +1,5 @@
export class Metrics {
totalDownloads: string;
totalViews: string;
infos: Map<string, {"url": string, "numOfDownloads": string, "numOfViews": string}>;
}

View File

@ -27,6 +27,10 @@ export class OpenaireProperties {
// Services - APIs
private static metricsAPIURL = "http://vatopedi.di.uoa.gr:8080/stats/";
private static loginAPIURL = "http://mpagasas.di.uoa.gr:8080/uoa-user-management-1.0.0-SNAPSHOT/api/users/authenticate?username=";
// public claimsAPIURL = "http://rudie.di.uoa.gr:8080/dnet-openaire-connector-service-1.0.0-SNAPSHOT/rest/claimsService/"
private static claimsAPIURL = "http://scoobydoo.di.uoa.gr:8181/dnet-openaire-connector-service-1.0.0-SNAPSHOT/rest/claimsService/";
@ -118,6 +122,14 @@ export class OpenaireProperties {
// return this.searchAPIURL;
// }
// Services - APIs' getters
public static getMetricsAPIURL(): string {
return this.metricsAPIURL;
}
public static getLoginAPIURL(): string {
return this.loginAPIURL;
}
public static getSearchAPIURLLast():string{
return this.searchAPIURLLAst;
}

View File

@ -16,7 +16,7 @@ export const routes: string[] = [
'search/find/people','search/find/publications','search/find/projects','search/find/datasets','search/find/dataproviders','search/find/organizations',
'search/advanced/people','search/advanced/publications','search/advanced/projects','search/advanced/datasets','search/advanced/dataproviders','search/advanced/organizations',
'deposit-publications','deposit-datasets','deposit-publications-result','deposit-datasets-result',
'search/data-providers','search/entity-registries',
'search/data-providers','search/entity-registries', 'login',
'test',
'error'