diff --git a/portal-2/src/app/app-routing.module.ts b/portal-2/src/app/app-routing.module.ts index 782e7927..617677d5 100644 --- a/portal-2/src/app/app-routing.module.ts +++ b/portal-2/src/app/app-routing.module.ts @@ -115,6 +115,12 @@ export function getClaimsAdminModule() { return System.import('./claims/claimsAdmin/claimsAdmin.module' + (process.env.AOT ? '.ngfactory' : '')) .then(mod => mod[(process.env.AOT ? 'ClaimsAdminModuleNgFactory' : 'ClaimsAdminModule')]); } + +export function getClaimsByTokenModule() { + return System.import('./claims/claimsByToken/claimsByToken.module' + (process.env.AOT ? '.ngfactory' : '')) + .then(mod => mod[(process.env.AOT ? 'ClaimsByTokenModuleNgFactory' : 'ClaimsByTokenModule')]); +} + export function getLinkingModule() { return System.import('./claims/linking/linkingGeneric.module' + (process.env.AOT ? '.ngfactory' : '')) .then(mod => mod[(process.env.AOT ? 'LinkingGenericModuleNgFactory' : 'LinkingGenericModule')]); @@ -162,6 +168,7 @@ export function getUserModule() { { path: 'claims', loadChildren: getClaimsAdminModule }, { path: 'participate/claim', loadChildren: getLinkingModule }, { path: 'participate/direct-claim', loadChildren: getDirectLinkingModule }, + { path: 'claims-project-manager', loadChildren: getClaimsByTokenModule }, { path: 'user-info', loadChildren: getUserModule }, ]) diff --git a/portal-2/src/app/claims/claimsByToken/claimsByToken-routing.module.ts b/portal-2/src/app/claims/claimsByToken/claimsByToken-routing.module.ts new file mode 100644 index 00000000..9c0f4180 --- /dev/null +++ b/portal-2/src/app/claims/claimsByToken/claimsByToken-routing.module.ts @@ -0,0 +1,14 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; +import { LoginGuard} from'../../login/loginGuard.guard'; +import { ClaimsByTokenComponent } from './claimsByToken.component'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: ClaimsByTokenComponent, canActivate: [LoginGuard]} + + ]) + ] +}) +export class ClaimsByTokenRoutingModule { } diff --git a/portal-2/src/app/claims/claimsByToken/claimsByToken.component.ts b/portal-2/src/app/claims/claimsByToken/claimsByToken.component.ts new file mode 100644 index 00000000..3e0d3ba9 --- /dev/null +++ b/portal-2/src/app/claims/claimsByToken/claimsByToken.component.ts @@ -0,0 +1,271 @@ +import {Component, ViewChild, Input} from '@angular/core'; +import {Location} from '@angular/common'; +import {Observable} from 'rxjs/Observable'; +import {ActivatedRoute, Router, Params} from '@angular/router'; +import {ClaimsByTokenService} from './claimsByToken.service'; + +import {ModalSelect} from '../../utils/modal/selectModal.component'; +import {ModalLoading} from '../../utils/modal/loading.component'; + +import {Session} from '../../login/utils/helper.class'; + +@Component({ + selector: 'claims-project-manager', + template: ` + + + + + +
+
+ + +

Oops! Your email does not give you the authority to view claims for the selected project. Please contact the administrators.

+
+
+ +
+

Pending Claims

+ +
+
No pending claims found.
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Research ResultLink toClaimed byClaimed DateTrueFalse
{{claim.userMail}}{{claim.date}}
+ + +

Already Curated Claims

+ +
+
No curated claims found.
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
Research ResultLink toClaimed byClaimed DateCurated byCuration DateTrueFalse
{{claim.userMail}}{{claim.date}}{{claim.curatedBy}}{{claim.curationDate}}
+ + +
*Note that claims you did not approved or disapproved are considered as right (but not curated)
+ + + + +
+ `, + +}) +export class ClaimsByTokenComponent { + public token: string = ""; + public sub: any; + private claims:any = []; + public pending_claims: any = []; + public curated_claims: any = []; + public selectedRight: Set; + public selectedWrong: Set; + public editable: Set; + public contact_person: string[] = ["Konstantina", "Argiro", "Katerina"]; + + // when 'empty' show form to fill email, when 'valid' show proper claims, when 'invalid' show no matched entry-wanna retry + public accessStatus: string;// = "empty"; + + @ViewChild (ModalSelect) selectModal : ModalSelect; + @ViewChild (ModalLoading) loading : ModalLoading ; + + constructor ( private route: ActivatedRoute, private _router:Router, private claimsByTokenService: ClaimsByTokenService ) { + + } + ngOnInit() { + this.sub = this.route.queryParams.subscribe(params => { + this.token = params['token']; + this.selectedRight = new Set(); + this.selectedWrong = new Set(); + this.editable = new Set(); + //this.openSelect(); + //this.setMessageSelect("Please select your identity:"); + //this.setOptionsSelect(this.contact_person); + this.validateJWTandToken(); + } + ); + } + + validateJWTandToken() { + var user_token=Session.getUserJwt(); + if(this.token) { + this.claimsByTokenService.getClaims(this.token, user_token).subscribe( + data => { + this.closeLoading(); + this.accessStatus = "valid"; + //console.info(data); + this.claims = data.data; + for(let claim of this.claims) { + if(claim.curatedBy) { + this.curated_claims.push(claim); + } else { + this.pending_claims.push(claim); + } + } + }, + err => { + this.accessStatus = "invalid"; + console.log(err); + } + ); + } else { + this.accessStatus = "invalid"; + } + } + + selectApprove(id:string, event) { + var value = event.currentTarget.checked; + if(value){ + this.selectedRight.add(id); + this.selectedWrong.delete(id); + console.info(this.selectedRight); + }else{ + this.selectedRight.delete(id); + console.info(this.selectedRight); + } + } + + selectDisapprove(id:string,event) { + var value = event.currentTarget.checked; + if(value){ + this.selectedWrong.add(id); + this.selectedRight.delete(id); + }else{ + this.selectedWrong.delete(id); + } + } + + isSelectedRight(id:string) { + return this.selectedRight.has(id); + } + + isSelectedWrong(id:string) { + return this.selectedWrong.has(id); + } + + isRight(claim: any) { + //claim.approved = true; + if(this.isSelectedRight(claim.id)) { + return true; + } else if(claim.approved == true && !this.isSelectedWrong(claim.id)) { + return true; + } + + return false; + } + + isWrong(claim: any) { + if(this.isSelectedWrong(claim.id)) { + return true; + } else if(claim.approved == false && !this.isSelectedRight(claim.id)) { + return true; + } + + return false; + } + + saveChanges() { + console.info("Changes Saved!"); + /* + this.claimsByTokenService.updateClaimsCuration(this.token, this.selectedRight, this.selectedWrong).subscribe( + data => { + console.info(data); + }, + err => { + console.log(err); + } + ); + */ + } + + public closeLoading(){ + if(this.loading){ + this.loading.close(); + } + } + + curatorSelected(selected: string) { + console.info("selected curator: "+selected); + } + + public openSelect(){ + if(this.selectModal){ + this.selectModal.open(); + } + } + + public setMessageSelect(message: string){ + if(this.selectModal){ + this.selectModal.message = message; + } + } + + public setOptionsSelect(options: string[]){ + if(this.selectModal){ + this.selectModal.options = options; + } + } +} diff --git a/portal-2/src/app/claims/claimsByToken/claimsByToken.module.ts b/portal-2/src/app/claims/claimsByToken/claimsByToken.module.ts new file mode 100644 index 00000000..f8895afe --- /dev/null +++ b/portal-2/src/app/claims/claimsByToken/claimsByToken.module.ts @@ -0,0 +1,34 @@ +import { NgModule } from '@angular/core'; + +import { SharedModule } from '../../shared/shared.module'; +import { ClaimsByTokenComponent } from './claimsByToken.component'; +import { ClaimsByTokenService } from './claimsByToken.service'; +import { ClaimsByTokenRoutingModule } from './claimsByToken-routing.module'; +import {ClaimEntityFormatterModule} from '../claim-utils/entityFormatter/claimEntityFormatter.module'; +// import{ClaimServiceModule} from '../claim-utils/service/claimsService.module'; +//import {DisplayClaimsModule} from '../claim-utils/displayClaims/displayClaims.module'; +import {SelectModalModule} from '../../utils/modal/selectModal.module'; +import {LoadingModalModule} from '../../utils/modal/loadingModal.module'; + +import {LoginGuard} from'../../login/loginGuard.guard'; + +@NgModule({ + imports: [ + SharedModule, + ClaimsByTokenRoutingModule, + ClaimEntityFormatterModule, + SelectModalModule, + LoadingModalModule + // ClaimServiceModule, + //DisplayClaimsModule + + ], + providers:[ + ClaimsByTokenService, + LoginGuard + ], + declarations: [ + ClaimsByTokenComponent + ] +}) +export class ClaimsByTokenModule { } diff --git a/portal-2/src/app/claims/claimsByToken/claimsByToken.service.ts b/portal-2/src/app/claims/claimsByToken/claimsByToken.service.ts new file mode 100644 index 00000000..cab2fe27 --- /dev/null +++ b/portal-2/src/app/claims/claimsByToken/claimsByToken.service.ts @@ -0,0 +1,73 @@ +import {Injectable} from '@angular/core'; +import {Http, Response} from '@angular/http'; +import {Jsonp, URLSearchParams,ResponseOptions, RequestOptions, Headers} from '@angular/http'; +import {Observable} from 'rxjs/Observable'; +import {OpenaireProperties} from '../../utils/properties/openaireProperties'; +import 'rxjs/add/operator/do'; +import { CacheService } from '../../shared/cache.service'; +@Injectable() +export class ClaimsByTokenService { + + constructor(private http: Http, public _cache: CacheService) {} + + getClaims(token: string, user_token: string):any { + console.info("getClaims in service"); + + let url = OpenaireProperties.getClaimsAPIURL()+"projects/corda__h2020::94c962e736df90a5075a7f660ba3d7f6/claims" + +"?&token="+user_token; +console.info(url); + let key = url; + if (this._cache.has(key)) { + return Observable.of(this._cache.get(key)); + } + return this.http.get(url) + //.map(res => res.text()) + .map(request => request.json()) + .do(res => { + this._cache.set(key, res); + }); + } + + +/* + getClaims(email: string, token: string, user_token: string):any { + let url = OpenaireProperties.getClaimsAPIURL(); // What else? + let body = JSON.stringify( {"email": email, "token": token} ); + console.warn('Json body: : '+body); + let headers = new Headers({ 'Content-Type': 'application/json' }); + let options = new RequestOptions({ headers: headers }); + return this.http.post(url, body, options) + .map(res => res.json()) + .do(request => console.info("Insert Response:"+request.status) ) + .catch(this.handleError); + } +*/ + + updateClaimsCuration(token: string, selectedRight: Set, selectedWrong: Set) { + let url = OpenaireProperties.getClaimsAPIURL(); // What else? + let claimsCurationInfo: any = []; + for(let selected in selectedRight) { + let claimCurationInfo: any = {"claim_id": selected, "approved": true, "token": token}; + claimsCurationInfo.add(claimCurationInfo); + } + for(let selected in selectedWrong) { + let claimCurationInfo: any = {"claim_id": selected, "approved": false, "token": token}; + claimsCurationInfo.add(claimCurationInfo); + } + let body = JSON.stringify( claimsCurationInfo ); + console.warn('Json body: : '+body); + let headers = new Headers({ 'Content-Type': 'application/json' }); + let options = new RequestOptions({ headers: headers }); + return this.http.post(url, body, options) + .map(res => res.json()) + .do(request => console.info("Insert Response:"+request.status) ) + .catch(this.handleError); + } + + 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 + console.log(error); + return Observable.throw(error || 'Server error'); + } +} diff --git a/portal-2/src/app/landingPages/dataProvider/dataProvider.component.html b/portal-2/src/app/landingPages/dataProvider/dataProvider.component.html index ed69400d..3690d8c6 100644 --- a/portal-2/src/app/landingPages/dataProvider/dataProvider.component.html +++ b/portal-2/src/app/landingPages/dataProvider/dataProvider.component.html @@ -131,8 +131,8 @@
- + @@ -157,6 +157,12 @@ + +
  • +
    +
    Page Views: {{pageViews}}
    +
    +
  • diff --git a/portal-2/src/app/landingPages/dataProvider/dataProvider.component.ts b/portal-2/src/app/landingPages/dataProvider/dataProvider.component.ts index 3fb49dc9..624b26c3 100644 --- a/portal-2/src/app/landingPages/dataProvider/dataProvider.component.ts +++ b/portal-2/src/app/landingPages/dataProvider/dataProvider.component.ts @@ -50,6 +50,7 @@ public reloadRelatedDatasources: boolean = true; private downloadsFrameUrl: string; private totalViews: number; private totalDownloads: number; + private pageViews: number; public statsClicked: boolean = false; private docsTimelineUrl: string; @@ -151,8 +152,15 @@ public reloadRelatedDatasources: boolean = true; this.count(1, 0); this.metricsClicked = false; - this.viewsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"dtsrcOpenAIRETimeline", "dtsrcName":"'+this.datasourceId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"OpenAIRE","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]},{"query":"dtsrcRepoTimeline", "dtsrcName":"'+this.datasourceId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":[""],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column","column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true'; + + this.viewsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"dtsrcRepoViews","dtsrcName":"'+this.datasourceId+'","table":"","fields":[{"fld":"sum","agg":"sum","type":"chart","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[]}]&info_types=["spline"]&stacking=&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; + /*this.viewsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"dtsrcOpenAIRETimeline", "dtsrcName":"'+this.datasourceId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"OpenAIRE","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]},{"query":"dtsrcRepoTimeline", "dtsrcName":"'+this.datasourceId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":[""],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column","column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true'; + */ + + this.downloadsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"dtsrcRepoDownloads","dtsrcName":"'+this.datasourceId+'","table":"","fields":[{"fld":"sum","agg":"sum","type":"chart","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[]}]&info_types=["spline"]&stacking=&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; + /* this.downloadsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"dtsrcDownloadsTimeline","dtsrcName":"'+this.datasourceId+'","table":"","fields":[{"fld":"sum","agg":"sum","type":"chart","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[]}]&info_types=["spline"]&stacking=&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true'; + */ this.docsTimelineUrl ='https://beta.openaire.eu/stats/chart.php?com=query&persistent=false&data={"query":"dtsrcYear","dtsrcName":"'+this.datasourceId+'","table": "result", "fields": [{"fld": "number", "agg": "count", "type": "line", "yaxis":1, "c":true}], "xaxis":{"name": "year", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Documents"], "in": [{"f":0, "text": "Yearly"}], "filters": [{"name":"year","max":"2016","min":"1997"},{"name": "result_datasources-datasource-name", "values":[""], "to": "-1"}],"having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": "Year"}&w=600&h=250'; this.docsTypesUrl = 'https://beta.openaire.eu/stats/chart.php?com=query&persistent=false&data={"query":"dtsrcPubs","dtsrcName":"'+this.datasourceId+'", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "pie", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Documents"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [""], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=600&h=250'; @@ -284,5 +292,6 @@ public reloadRelatedDatasources: boolean = true; public metricsResults($event) { this.totalViews = $event.totalViews; this.totalDownloads = $event.totalDownloads; + this.pageViews = $event.pageViews; } } diff --git a/portal-2/src/app/landingPages/dataset/dataset.component.html b/portal-2/src/app/landingPages/dataset/dataset.component.html index c87bef25..9f6d0ff2 100644 --- a/portal-2/src/app/landingPages/dataset/dataset.component.html +++ b/portal-2/src/app/landingPages/dataset/dataset.component.html @@ -101,7 +101,7 @@
  • -
  • + +
  • +
    +
    Page Views: {{pageViews}}
    +
    +
  • diff --git a/portal-2/src/app/landingPages/dataset/dataset.component.ts b/portal-2/src/app/landingPages/dataset/dataset.component.ts index b154c6d7..e4f309cb 100644 --- a/portal-2/src/app/landingPages/dataset/dataset.component.ts +++ b/portal-2/src/app/landingPages/dataset/dataset.component.ts @@ -32,6 +32,7 @@ export class DatasetComponent { private downloadsFrameUrl: string; private totalViews: number; private totalDownloads: number; + private pageViews: number; public relatedResearchResultsNum: number = 0; @@ -60,10 +61,14 @@ export class DatasetComponent { } this.metricsClicked = false; - //this.viewsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"resOpenAIRETimeline", "resTitle":"'+this.datasetId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"OpenAIRE","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]},{"query":"resRepoTimeline", "resTitle":"'+this.datasetId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":[""],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column","column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true'; - this.viewsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"resViewsTimeline", "resTitle":"'+this.datasetId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; - this.downloadsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"resRepoDownloadTimeline", "resTitle":"'+this.datasetId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true'; + this.viewsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"resRepoViews", "resTitle":"'+this.datasetId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; + /*this.viewsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"resViewsTimeline", "resTitle":"'+this.datasetId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; + */ + + this.downloadsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"resRepoDownloads", "resTitle":"'+this.datasetId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; + /*this.downloadsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"resRepoDownloadTimeline", "resTitle":"'+this.datasetId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true'; + */ if (typeof document !== 'undefined') { this.element.nativeElement.scrollIntoView(); } @@ -111,6 +116,7 @@ export class DatasetComponent { public metricsResults($event) { this.totalViews = $event.totalViews; this.totalDownloads = $event.totalDownloads; + this.pageViews = $event.pageViews; } updateDescription(description:string){ this._meta.updateMeta("description", description); diff --git a/portal-2/src/app/landingPages/metrics.component.ts b/portal-2/src/app/landingPages/metrics.component.ts index c7389abb..b3332a63 100644 --- a/portal-2/src/app/landingPages/metrics.component.ts +++ b/portal-2/src/app/landingPages/metrics.component.ts @@ -47,9 +47,15 @@ import {ErrorCodes} from '../utils/properties/openaireProperties'; {{metrics.totalViews}} + + ( {{metrics.totalOpenaireViews}} from OpenAIRE ) + {{metrics.totalDownloads}} + + ( {{metrics.totalOpenaireDownloads}} from OpenAIRE ) + @@ -73,9 +79,15 @@ import {ErrorCodes} from '../utils/properties/openaireProperties'; {{metrics.infos.get(key).numOfViews}} + + ( {{metrics.infos.get(key).openaireViews}} from OpenAIRE ) + {{metrics.infos.get(key).numOfDownloads}} + + ( {{metrics.infos.get(key).openaireDownloads}} from OpenAIRE ) + @@ -115,8 +127,8 @@ export class MetricsComponent { this.status = this.errorCodes.DONE; this.metricsResults.emit({ totalViews: this.metrics.totalViews, - totalDownloads: this.metrics.totalDownloads - + totalDownloads: this.metrics.totalDownloads, + pageViews: this.metrics.pageViews }); }, err => { diff --git a/portal-2/src/app/landingPages/project/project.component.html b/portal-2/src/app/landingPages/project/project.component.html index e3b1afee..f565856d 100644 --- a/portal-2/src/app/landingPages/project/project.component.html +++ b/portal-2/src/app/landingPages/project/project.component.html @@ -160,7 +160,7 @@
  • - @@ -243,6 +243,12 @@ Deposit Publications
  • + +
  • +
    +
    Page Views: {{pageViews}}
    +
    +
  • diff --git a/portal-2/src/app/landingPages/project/project.component.ts b/portal-2/src/app/landingPages/project/project.component.ts index 0e078236..d0237bb8 100644 --- a/portal-2/src/app/landingPages/project/project.component.ts +++ b/portal-2/src/app/landingPages/project/project.component.ts @@ -31,6 +31,7 @@ export class ProjectComponent{ public downloadsFrameUrl: string; private totalViews: number; private totalDownloads: number; + private pageViews: number; public statsClicked: boolean; public chartScientificResultsUrl: string; public chartAccessModeUrl: string; @@ -178,8 +179,15 @@ export class ProjectComponent{ this.updateDescription("project, funding, open access, publications, datasets, "+this.projectName+ ","+this.projectInfo.funder); this.project= { funderId: "", funderName: this.projectInfo.funder, projectId: this.projectId, projectName: this.projectInfo.title, projectAcronym: this.projectInfo.acronym, startDate: this.projectInfo.startDate, endDate: this.projectInfo.endDate }; - this.viewsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"projViewsTimeline","projTitle":"'+this.projectId+'","table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[]}]&info_types=["spline"]&stacking=&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true'; + this.viewsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"projRepoViews","projTitle":"'+this.projectId+'","table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[]}]&info_types=["spline"]&stacking=&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; + /*this.viewsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"projViewsTimeline","projTitle":"'+this.projectId+'","table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[]}]&info_types=["spline"]&stacking=&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true'; + */ + + this.downloadsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"projRepoDownloads","projTitle":"'+this.projectId+'","table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[]}]&info_types=["spline"]&stacking=&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; + /* this.downloadsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"projDownloadsTimeline","projTitle":"'+this.projectId+'","table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[]}]&info_types=["spline"]&stacking=&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true'; + */ + //stats tab charts this.chartScientificResultsUrl='https://beta.openaire.eu/stats/chart.php?com=query&persistent=false&data={"query":"projScient","projTitle":"'+this.projectId+'", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "spline", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Publications"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [" "], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=600&h=250'; this.chartAccessModeUrl='https://beta.openaire.eu/stats/chart.php?com=query&persistent=false&data={"query":"projOA","projTitle":"'+this.projectId+'", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "pie", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Publications"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [" "], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=600&h=250'; @@ -245,6 +253,7 @@ export class ProjectComponent{ public metricsResults($event) { this.totalViews = $event.totalViews; this.totalDownloads = $event.totalDownloads; + this.pageViews = $event.pageViews; } updateDescription(description:string){ this._meta.updateMeta("description", description); diff --git a/portal-2/src/app/landingPages/publication/publication.component.html b/portal-2/src/app/landingPages/publication/publication.component.html index 229b982c..603632ee 100644 --- a/portal-2/src/app/landingPages/publication/publication.component.html +++ b/portal-2/src/app/landingPages/publication/publication.component.html @@ -313,7 +313,7 @@
  • - @@ -342,7 +342,6 @@
  • -
  • Download from
    @@ -542,6 +541,12 @@
  • + +
  • +
    +
    Page Views: {{pageViews}}
    +
    +
  • diff --git a/portal-2/src/app/landingPages/publication/publication.component.ts b/portal-2/src/app/landingPages/publication/publication.component.ts index 7bc147dc..3d0c933e 100644 --- a/portal-2/src/app/landingPages/publication/publication.component.ts +++ b/portal-2/src/app/landingPages/publication/publication.component.ts @@ -30,6 +30,7 @@ export class PublicationComponent { private downloadsFrameUrl: string; private totalViews: number; private totalDownloads: number; + private pageViews: number; public showAllReferences: boolean = false; public showAllRelResData: boolean = false; @@ -71,10 +72,14 @@ export class PublicationComponent { this.warningMessage="No valid publication id"; } this.metricsClicked = false; - //this.viewsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"resOpenAIRETimeline", "resTitle":"'+this.articleId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"OpenAIRE","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]},{"query":"resRepoTimeline", "resTitle":"'+this.articleId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":[""],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column","column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true'; - this.viewsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"resViewsTimeline", "resTitle":"'+this.articleId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; - this.downloadsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"resRepoDownloadTimeline", "resTitle":"'+this.articleId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true'; + this.viewsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"resRepoViews", "resTitle":"'+this.articleId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; + /*this.viewsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"resViewsTimeline", "resTitle":"'+this.articleId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; + */ + + this.downloadsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"resRepoDownloads", "resTitle":"'+this.articleId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; + /*this.downloadsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"resRepoDownloadTimeline", "resTitle":"'+this.articleId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true'; + */ if (typeof document !== 'undefined') { this.element.nativeElement.scrollIntoView(); } @@ -143,6 +148,7 @@ export class PublicationComponent { public metricsResults($event) { this.totalViews = $event.totalViews; this.totalDownloads = $event.totalDownloads; + this.pageViews = $event.pageViews; } public buildTooltip(item: { "id": string, "acronym": string, "title": string, diff --git a/portal-2/src/app/searchPages/searchUtils/searchResult.component.ts b/portal-2/src/app/searchPages/searchUtils/searchResult.component.ts index 23d86034..15f8b3ed 100644 --- a/portal-2/src/app/searchPages/searchUtils/searchResult.component.ts +++ b/portal-2/src/app/searchPages/searchUtils/searchResult.component.ts @@ -17,7 +17,8 @@ import {RouterHelper} from '../../utils/routerHelper.class'; - + +

    diff --git a/portal-2/src/app/services/metrics.service.ts b/portal-2/src/app/services/metrics.service.ts index 57c74316..aa3019af 100644 --- a/portal-2/src/app/services/metrics.service.ts +++ b/portal-2/src/app/services/metrics.service.ts @@ -12,35 +12,41 @@ export class MetricsService { constructor(private http: Http, public _cache: CacheService) {} getMetrics (id: string, entity: string):any { - console.info("getPublicationViews in service"); + console.info("getMetrics in service"); //let url = OpenaireProperties. getSearchAPIURLLast() + 'publications/' +id+"?format=json"; let url = OpenaireProperties.getMetricsAPIURL()+entity+"/"+id+"/clicks"; let key = url; if (this._cache.has(key)) { return Observable.of(this._cache.get(key)); } + return this.http.get(url) .map(res => res.json()) - .map(res => this.parseMetrics(res["downloads"], res["views"], res["total_downloads"], res["total_views"])) + .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 => { this._cache.set(key, res); }); } - parseMetrics(downloads: string, views: string, totalDownloads: any, totalViews: any): any { - + parseMetrics(downloads: any, views: any, totalDownloads: string, totalViews: string, + totalOpenaireViews: string, totalOpenaireDownloads: string, pageViews: string): any { this.metrics = new Metrics(); this.metrics.totalDownloads = totalDownloads; this.metrics.totalViews = totalViews; + this.metrics.totalOpenaireViews = totalOpenaireViews; + this.metrics.totalOpenaireDownloads = totalOpenaireDownloads; + this.metrics.pageViews = pageViews; - this.metrics.infos = new Map(); + this.metrics.infos = new Map(); for(let i=0; i; + totalOpenaireViews: string; + totalOpenaireDownloads: string; + pageViews: string; + infos: Map; } diff --git a/portal-2/src/app/utils/modal/selectModal.component.ts b/portal-2/src/app/utils/modal/selectModal.component.ts new file mode 100644 index 00000000..ce1e3b7f --- /dev/null +++ b/portal-2/src/app/utils/modal/selectModal.component.ts @@ -0,0 +1,79 @@ +import {Component, ViewEncapsulation, ComponentRef, ElementRef, Input, EventEmitter, Output} from '@angular/core'; + +@Component({ + selector: 'modal-select', + template: ` +
    +
    + +
    + + `, + encapsulation: ViewEncapsulation.None, +}) +/** + * API to an open alert window. + */ +export class ModalSelect{ + +@Input() public message:string ="Loading"; +@Input() public options:string[] = []; + +public selected: string; + + /** + * if the value is true alert will be visible or else it will be hidden. + */ + public isOpen:boolean=false; + /** + * Emitted when a ok button was clicked + * or when Ok method is called. + */ + @Output() public alertOutput:EventEmitter = new EventEmitter(); + constructor( public _elementRef: ElementRef){} + /** + * Opens a alert window creating backdrop. + */ + open(){ + this.isOpen= true; + } + + close(){ + this.isOpen = false; + if(!this.selected) { + this.selected = this.options[0]; + } + this.alertOutput.emit(this.selected); + } + +} diff --git a/portal-2/src/app/utils/modal/selectModal.module.ts b/portal-2/src/app/utils/modal/selectModal.module.ts new file mode 100644 index 00000000..971a7dd7 --- /dev/null +++ b/portal-2/src/app/utils/modal/selectModal.module.ts @@ -0,0 +1,19 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; + + import {ModalSelect} from './selectModal.component'; +import {ModalModule} from './modal.module'; + +//helpers + +@NgModule({ + imports: [ CommonModule, FormsModule,ModalModule ], + declarations: [ + ModalSelect + ], + exports: [ + ModalSelect + ] +}) +export class SelectModalModule { } diff --git a/portal-2/src/app/utils/properties/openaireProperties.ts b/portal-2/src/app/utils/properties/openaireProperties.ts index 429864c6..12318676 100644 --- a/portal-2/src/app/utils/properties/openaireProperties.ts +++ b/portal-2/src/app/utils/properties/openaireProperties.ts @@ -28,7 +28,7 @@ export class OpenaireProperties { //http://rudie.di.uoa.gr:6081/dnet-functionality-services-2.0.0-SNAPSHOT // Services - APIs - private static metricsAPIURL = "http://vatopedi.di.uoa.gr:8080/stats/"; + private static metricsAPIURL = "http://vatopedi.di.uoa.gr:8080/usagestats/"; private static framesAPIURL = "http://vatopedi.di.uoa.gr/stats2/"; private static loginAPIURL = "http://mpagasas.di.uoa.gr:8080/uoa-user-management-1.0.0-SNAPSHOT/api/users/authenticates"; diff --git a/portal-2/src/server.routes.ts b/portal-2/src/server.routes.ts index 9b08ec01..141d8f4a 100644 --- a/portal-2/src/server.routes.ts +++ b/portal-2/src/server.routes.ts @@ -16,7 +16,7 @@ export const routes: string[] = [ 'search/advanced/people','search/advanced/publications','search/advanced/projects','search/advanced/datasets','search/advanced/dataproviders','search/advanced/organizations', 'participate/deposit-publications','participate/deposit-datasets','participate/deposit-publications-result','participate/deposit-datasets-result', 'search/data-providers','search/entity-registries', 'project-report', - 'claims','myclaims','participate/claim', 'participate/direct-claim', + 'claims','myclaims','participate/claim', 'participate/direct-claim', 'claims-project-manager', 'test', 'user-info', '**','error'