Bug fixed in metrics service (metrics info cached before parsed) | Open Graph metatags added in person landing page | baseLink for openaire starting page added in properties file

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@47421 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2017-05-31 14:29:57 +00:00
parent b3ab493532
commit 10e9fb8fdc
5 changed files with 42 additions and 16 deletions

View File

@ -1,6 +1,6 @@
import {Component, ElementRef} from '@angular/core'; import {Component, ElementRef} from '@angular/core';
import {Observable} from 'rxjs/Observable'; import {Observable} from 'rxjs/Observable';
import { ActivatedRoute, Route} from '@angular/router'; import { ActivatedRoute, Route, Router} from '@angular/router';
import {PersonService} from './person.service'; import {PersonService} from './person.service';
import { PersonInfo } from '../../utils/entities/personInfo'; import { PersonInfo } from '../../utils/entities/personInfo';
@ -38,13 +38,16 @@ export class PersonComponent {
private _personService: PersonService, private _personService: PersonService,
private route: ActivatedRoute, private route: ActivatedRoute,
private _searchPublicationsService: SearchPublicationsService, private _searchPublicationsService: SearchPublicationsService,
private _searchDatasetsService: SearchDatasetsService, private _meta: Meta) { private _searchDatasetsService: SearchDatasetsService,
private _router: Router,
private _meta: Meta) {
this.fetchPublications = new FetchPublications( this._searchPublicationsService); this.fetchPublications = new FetchPublications( this._searchPublicationsService);
this.fetchDatasets = new FetchDatasets( this._searchDatasetsService); this.fetchDatasets = new FetchDatasets( this._searchDatasetsService);
// this.scrollUp = this._route.events.subscribe((path) => { // this.scrollUp = this._route.events.subscribe((path) => {
// element.nativeElement.scrollIntoView(); // element.nativeElement.scrollIntoView();
// }); // });
this.updateUrl(OpenaireProperties.getBaseLink()+this._router.url);
} }
ngOnInit() { ngOnInit() {
@ -150,12 +153,15 @@ export class PersonComponent {
} }
updateDescription(description:string){ updateDescription(description:string){
this._meta.updateMeta("description", description); this._meta.updateMeta("description", description);
this._meta.updateMeta("og:description", description); this._meta.updateProperty("og:description", description);
} }
updateTitle(title:string){ updateTitle(title:string){
var _suffix ="| OpenAIRE"; var _suffix ="| OpenAIRE";
var _title = ((title.length> 50 ) ?title.substring(0,50):title) + _suffix; var _title = ((title.length> 50 ) ?title.substring(0,50):title) + _suffix;
this._meta.setTitle(_title ); this._meta.setTitle(_title );
this._meta.updateMeta("og:title",_title); this._meta.updateProperty("og:title",_title);
}
updateUrl(url:string){
this._meta.updateProperty("og:url", url);
} }
} }

View File

@ -66,12 +66,12 @@ import {SearchFilterModalComponent} from './searchFilterModal.component';
[type]="entityType" [urlParam]="urlParam" [type]="entityType" [urlParam]="urlParam"
[showLoading]="true"> [showLoading]="true">
</search-result> </search-result>
<table-view *ngIf="tableView" <!--table-view *ngIf="tableView"
[results]="results" [results]="results"
[status]=searchUtils.status [status]=searchUtils.status
[type]="entityType" [urlParam]="urlParam" [type]="entityType" [urlParam]="urlParam"
[showLoading]="true"> [showLoading]="true">
</table-view> </table-view-->
</div> </div>
@ -89,12 +89,12 @@ import {SearchFilterModalComponent} from './searchFilterModal.component';
[type]="entityType" [urlParam]="urlParam" [type]="entityType" [urlParam]="urlParam"
[showLoading]="true"> [showLoading]="true">
</search-result> </search-result>
<table-view *ngIf="tableView" <!--table-view *ngIf="tableView"
[results]="results" [results]="results"
[status]=searchUtils.status [status]=searchUtils.status
[type]="entityType" [urlParam]="urlParam" [type]="entityType" [urlParam]="urlParam"
[showLoading]="true"> [showLoading]="true">
</table-view> </table-view-->
</div> </div>
</div> </div>
</div> </div>

View File

@ -17,16 +17,18 @@ export class MetricsService {
let url = OpenaireProperties.getMetricsAPIURL()+entity+"/"+id+"/clicks"; let url = OpenaireProperties.getMetricsAPIURL()+entity+"/"+id+"/clicks";
let key = url; let key = url;
if (this._cache.has(key)) { if (this._cache.has(key)) {
return Observable.of(this._cache.get(key)); return Observable.of(this._cache.get(key))
.map(res => this.parseMetrics(res["downloads"], res["views"], res["total_downloads"], res["total_views"],
res["total_openaire_views"], res["total_openaire_downloads"], res["pageviews"]));
} }
return this.http.get(url) return this.http.get(url)
.map(res => <any> res.json()) .map(res => <any> res.json())
.map(res => this.parseMetrics(res["downloads"], res["views"], res["total_downloads"], res["total_views"],
res["total_openaire_views"], res["total_openaire_downloads"], res["pageviews"]))
.do(res => { .do(res => {
this._cache.set(key, res); this._cache.set(key, res);
}); })
.map(res => this.parseMetrics(res["downloads"], res["views"], res["total_downloads"], res["total_views"],
res["total_openaire_views"], res["total_openaire_downloads"], res["pageviews"]));
} }

View File

@ -1,5 +1,9 @@
export class OpenaireProperties { export class OpenaireProperties {
private static productionMode:boolean = false; private static productionMode:boolean = false;
//base url
private static baseLink = "http://demo.openaire.eu";
//landing Pages //landing Pages
private static baseSearchLink="/"; private static baseSearchLink="/";
private static searchLinkToPublication = "search/publication?articleId="; private static searchLinkToPublication = "search/publication?articleId=";
@ -79,6 +83,11 @@ export class OpenaireProperties {
private static uploadService = "http://scoobydoo.di.uoa.gr:8000/upload"; private static uploadService = "http://scoobydoo.di.uoa.gr:8000/upload";
private static vocabulariesAPI ="https://beta.services.openaire.eu/provision/mvc/vocabularies/"; private static vocabulariesAPI ="https://beta.services.openaire.eu/provision/mvc/vocabularies/";
public static getBaseLink():string{
return this.baseLink;
}
//landing Pages' getters //landing Pages' getters
public static getsearchLinkToPublication():string{ public static getsearchLinkToPublication():string{
return this.baseSearchLink + this.searchLinkToPublication; return this.baseSearchLink + this.searchLinkToPublication;

View File

@ -7,10 +7,19 @@
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<base href="/" /> <base href="/" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="description" content="open access, research, scientific publication, European Commission, EC, FP7, ERC, Horizon 2020, H2020, search, projects "> <meta name="description" content="open access, research, scientific publication, European Commission, EC, FP7, ERC, Horizon 2020, H2020, search, projects "/>
<meta property="og:description" content="open access, research, scientific publication, European Commission, EC, FP7, ERC, Horizon 2020, H2020, search, projects "> <meta property="og:description" content="open access, research, scientific publication, European Commission, EC, FP7, ERC, Horizon 2020, H2020, search, projects "/>
<meta property="og:title" content="Search OpenAIRE"> <meta property="og:title" content="Search OpenAIRE"/>
<meta name="og:image" content="assets/newlogo.png">
<meta property="og:type" content="website"/>
<meta property="og:url" content="http://demo.openaire.eu"/>
<meta property="og:site_name" content="OpenAIRE"/>
<!--meta property="og:image" content="http://duffy.di.uoa.gr:3000/assets/newlogo_200_200.png"/>
<meta property="og:image:type" content="image/png" />
<meta property="og:image:width" content="200" />
<meta property="og:image:height" content="200" /-->
<link href="assets/favicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon" /> <link href="assets/favicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon" />
<title>Search OpenAIRE</title> <title>Search OpenAIRE</title>
<!-- <script src="assets/jquery/jquery.min.js" type="text/javascript"></script> --> <!-- <script src="assets/jquery/jquery.min.js" type="text/javascript"></script> -->