diff --git a/landingPages/dataProvider/dataProvider.component.html b/landingPages/dataProvider/dataProvider.component.html
index d4260c31..5f3841b1 100644
--- a/landingPages/dataProvider/dataProvider.component.html
+++ b/landingPages/dataProvider/dataProvider.component.html
@@ -75,7 +75,7 @@
-
+
{
@@ -163,7 +163,7 @@ export class DataProviderComponent {
}
}));
}
-
+
public initializeValues() {
this._numberOfTabs = 0;
this.tabsAreInitialized = false;
@@ -184,19 +184,19 @@ export class DataProviderComponent {
this.statsClicked = false;
this.metricsClicked = false;
}
-
+
private getPageContents() {
this.subscriptions.push(this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.pageContents = contents;
}));
}
-
+
private getDivContents() {
this.subscriptions.push(this.helper.getDivHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.divContents = contents;
}));
}
-
+
ngOnDestroy() {
this.subscriptions.forEach(subscription => {
if (subscription instanceof Subscriber) {
@@ -210,14 +210,14 @@ export class DataProviderComponent {
this.fetchDataproviders.clearSubscriptions();
this.fetchProjects.clearSubscriptions();
}
-
+
private getDataProviderInfo(id: string) {
this.warningMessage = '';
this.errorMessage = "";
this.showLoading = true;
-
+
this.dataProviderInfo = null;
-
+
this.showTabs = false;
if (this.datasourceId == null || this.datasourceId == '') {
this.showLoading = false;
@@ -242,9 +242,9 @@ export class DataProviderComponent {
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
this.subscriptions.push(this._piwikService.trackView(this.properties, this.dataProviderInfo.title.name, this.piwikSiteId).subscribe());
}
-
+
this.showLoading = false;
-
+
// if (this.dataProviderInfo.tabs != undefined && this.dataProviderInfo.tabs.length > 0) {
// this.activeTab = this.dataProviderInfo.tabs[0].name;
// }
@@ -267,7 +267,7 @@ export class DataProviderComponent {
));
}
}
-
+
private getDataProviderAggregationStatus(originalId: string) {
this.subscriptions.push(this._dataproviderService.getDataproviderAggregationStatus(originalId, this.properties).subscribe(
data => {
@@ -293,12 +293,12 @@ export class DataProviderComponent {
}
))
}
-
+
private updateDescription(description: string) {
this._meta.updateTag({content: description.substring(0, 160)}, "name='description'");
this._meta.updateTag({content: description.substring(0, 160)}, "property='og:description'");
}
-
+
private updateTitle(title: string) {
var _prefix = "";
// if(this.communityId) {
@@ -308,13 +308,13 @@ export class DataProviderComponent {
this._title.setTitle(title);
this._meta.updateTag({content: title}, "property='og:title'");
}
-
+
private updateUrl(url: string) {
this._meta.updateTag({content: url}, "property='og:url'");
}
-
+
private initTabs() {
-
+
//if (this.dataProviderInfo.tabs != undefined && this.dataProviderInfo.tabs.length > 0) {
this.reloadPublications = true;
this.reloadDatasets = true;
@@ -324,22 +324,22 @@ export class DataProviderComponent {
this.reloadDataproviders = true;
this.reloadRelatedDatasources = true;
this.statsClicked = false;
-
+
//this.search(this.dataProviderInfo.tabs[0].content, 1, 10);
this.count(1, 0);
-
+
this.metricsClicked = false;
//old
- this.viewsFrameUrl = this.properties.framesAPIURL + 'merge.php?com=query&data=[{"query":"dtsrcRepoViews","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":200,"sort":"xaxis","xStyle":{"r":-30,"s":"6","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[]}]&info_types=["column"]&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 = this.properties.framesAPIURL + 'merge.php?com=query&data=[{"query":"dtsrcRepoDownloads","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":200,"sort":"xaxis","xStyle":{"r":-30,"s":"6","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[]}]&info_types=["column"]&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 = this.properties.framesAPIURL + 'merge.php?com=query&data=[{"query":"dtsrcRepoViews","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":200,"sort":"xaxis","xStyle":{"r":-30,"s":"6","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[]}]&info_types=["column"]&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 = this.properties.framesAPIURL + 'merge.php?com=query&data=[{"query":"dtsrcRepoDownloads","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":200,"sort":"xaxis","xStyle":{"r":-30,"s":"6","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[]}]&info_types=["column"]&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';
//new
- // this.viewsFrameUrl = this.properties.statisticsFrameNewAPIURL + 'chart?json=' + encodeURIComponent('{"library":"HighCharts","chartDescription":{"queries":[{"name":"Monthly views","type":"line","query":{"name":"usagestats.views.monthly", "parameters":["' + this.datasourceId + '"], "profile":"OpenAIRE All-inclusive" }}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"Monthly views"},"subtitle":{},"yAxis":{"title":{"text":""}},"xAxis":{"title":{}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":false},"credits":{"href":null,"enabled":true,"text":""}}}');
- // this.downloadsFrameUrl = this.properties.statisticsFrameNewAPIURL + 'chart?json=' +
- // encodeURIComponent('{"library":"HighCharts","chartDescription":{"queries":[{"name":"Monthly downloads","type":"column","query":{"name":"usagestats.downloads.monthly", "parameters":["' + this.datasourceId + '"], "profile":"OpenAIRE All-inclusive" }}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"Monthly downloads"},"subtitle":{},"yAxis":{"title":{"text":""}},"xAxis":{"title":{}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":false},"credits":{"href":null,"enabled":true,"text":""}}}');
+ this.viewsFrameUrl = this.properties.statisticsFrameNewAPIURL + 'chart?json=' + encodeURIComponent('{"library":"HighCharts","chartDescription":{"queries":[{"name":"Monthly views","type":"column","query":{"name":"usagestats.views.monthly", "parameters":["' + this.datasourceId + '"], "profile":"OpenAIRE All-inclusive" }}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"Monthly views"},"subtitle":{},"yAxis":{"title":{"text":""}},"xAxis":{"title":{}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":false},"credits":{"href":null,"enabled":true,"text":""}}}');
+ this.downloadsFrameUrl = this.properties.statisticsFrameNewAPIURL + 'chart?json=' +
+ encodeURIComponent('{"library":"HighCharts","chartDescription":{"queries":[{"name":"Monthly downloads","type":"column","query":{"name":"usagestats.downloads.monthly", "parameters":["' + this.datasourceId + '"], "profile":"OpenAIRE All-inclusive" }}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"Monthly downloads"},"subtitle":{},"yAxis":{"title":{"text":""}},"xAxis":{"title":{}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":false},"credits":{"href":null,"enabled":true,"text":""}}}');
this.fetchAggregatorsResults = new FetchResearchResults(this._searchResearchResultsService);
}
-
+
public getParamsForSearchLink(type: string = "") {
if (type) {
@@ -348,7 +348,7 @@ export class DataProviderComponent {
return this.routerHelper.createQueryParams(['f0', 'fv0', 'f1', 'fv1'], ["collectedfromdatasourceid", this.datasourceId, "resulthostingdatasourceid,or", this.datasourceId]);
}
}
-
+
private count(page: number, size: number) {
this.countPublications(page, size);
@@ -359,7 +359,7 @@ export class DataProviderComponent {
this.countDatasources(page, size);
}
-
+
public search(content: string, page: number, size: number) {
if (content == 'publicationsTab') {
this.searchPublications(page, size);
@@ -381,7 +381,7 @@ export class DataProviderComponent {
this.statsClicked = !this.statsClicked;
}
}
-
+
private searchPublications(page: number, size: number) {
if (this.reloadPublications &&
(this.fetchPublications.searchUtils.status == this.errorCodes.LOADING ||
@@ -392,11 +392,11 @@ export class DataProviderComponent {
}
this.reloadPublications = false;
}
-
+
private countPublications(page: number, size: number) {
this.fetchPublications.getResultsForDataproviders("publication", this.datasourceId, this.dataProviderInfo.resultsBy, page, size, this.properties);
}
-
+
private searchDatasets(page: number, size: number) {
if (this.reloadDatasets &&
(this.fetchDatasets.searchUtils.status == this.errorCodes.LOADING ||
@@ -407,11 +407,11 @@ export class DataProviderComponent {
}
this.reloadDatasets = false;
}
-
+
private countDatasets(page: number, size: number) {
this.fetchDatasets.getResultsForDataproviders("dataset", this.datasourceId, this.dataProviderInfo.resultsBy, page, size, this.properties);
}
-
+
private searchSoftware(page: number, size: number) {
if (this.reloadSoftware &&
(this.fetchSoftware.searchUtils.status == this.errorCodes.LOADING ||
@@ -422,11 +422,11 @@ export class DataProviderComponent {
}
this.reloadSoftware = false;
}
-
+
private countSoftware(page: number, size: number) {
this.fetchSoftware.getResultsForDataproviders("software", this.datasourceId, this.dataProviderInfo.resultsBy, page, size, this.properties);
}
-
+
private searchOrps(page: number, size: number) {
if (this.reloadOrps &&
(this.fetchOrps.searchUtils.status == this.errorCodes.LOADING ||
@@ -437,11 +437,11 @@ export class DataProviderComponent {
}
this.reloadOrps = false;
}
-
+
private countOrps(page: number, size: number) {
this.fetchOrps.getResultsForDataproviders("other", this.datasourceId, this.dataProviderInfo.resultsBy, page, size, this.properties);
}
-
+
private searchProjects(page: number, size: number) {
if (this.reloadProjects &&
(this.fetchProjects.searchUtils.status == this.errorCodes.LOADING ||
@@ -452,11 +452,11 @@ export class DataProviderComponent {
}
this.reloadProjects = false;
}
-
+
private countProjects(page: number, size: number) {
this.fetchProjects.getResultsForDataproviders(this.datasourceId, page, size, this.properties);
}
-
+
private searchDatasources(page: number, size: number) {
if (this.reloadDataproviders &&
(this.fetchDataproviders.searchUtils.status == this.errorCodes.LOADING ||
@@ -467,14 +467,14 @@ export class DataProviderComponent {
}
this.reloadDataproviders = false;
}
-
+
private countDatasources(page: number, size: number) {
this.fetchDataproviders.getResultsForDataproviders(this.datasourceId, page, size, this.properties);
}
-
+
private searchRelatedDatasources(page: number, size: number) {
// Currently no counting is done for this tab. Following condition is always false
-
+
// if (this.reloadRelatedDatasources &&
// (this.fetchAggregatorsPublications.searchUtils.status == this.errorCodes.LOADING ||
// this.fetchAggregatorsPublications.searchUtils.status == this.errorCodes.DONE)
@@ -519,16 +519,16 @@ export class DataProviderComponent {
this.loadingRelatedDatasources = false;
}
));
-
+
this.fetchAggregatorsResults.getAggregatorResults("results", this.datasourceId, page, size, this.properties);
} else {
this.loadingRelatedDatasources = false;
}
-
-
+
+
this.reloadRelatedDatasources = false;
}
-
+
private countRelatedDatasources(page: number, size: number) {
this.fetchAggregatorsResults.getAggregatorResults("results", this.datasourceId, page, size, this.properties);
}
@@ -538,11 +538,11 @@ export class DataProviderComponent {
this.totalDownloads = $event.totalDownloads;
this.pageViews = $event.pageViews;
}
-
+
public get hasMetrics(): boolean {
return !(this.totalViews && this.totalDownloads && this.pageViews) || this.totalViews > 0 || this.totalDownloads > 0 || this.pageViews > 0;
}
-
+
public openStatistics() {
this.statsClicked = true;
this.statisticsModal.cancelButton = false;
@@ -550,7 +550,7 @@ export class DataProviderComponent {
this.statisticsModal.alertTitle = "Statistics of";
this.statisticsModal.open();
}
-
+
public openRelatedDatasources() {
this.searchRelatedDatasources(1, 0);
this.relatedDatasourcesModal.cancelButton = false;
@@ -558,19 +558,19 @@ export class DataProviderComponent {
this.relatedDatasourcesModal.alertTitle = "Related content providers of";
this.relatedDatasourcesModal.open();
}
-
+
public scroll() {
HelperFunctions.scroll();
}
-
+
public removeUnknown(array: string[]): string[] {
return array.filter(value => value.toLowerCase() !== 'unknown');
}
-
+
private handleError(message: string, error) {
console.error("Content Provider Landing Page: " + message, error);
}
-
+
private getEntityName(entityType: string, plural: boolean, full: boolean): string {
if (entityType == "publication") {
return "publication" + (plural ? "s" : "");
@@ -586,11 +586,11 @@ export class DataProviderComponent {
return entityType + (plural ? "s" : "");
}
}
-
+
public getResultPreview(result: SearchResult, type: string): ResultPreview {
return ResultPreview.searchResultConvert(result, type);
}
-
+
public onSelectActiveTab(activeTabId) {
if (this.activeTab != "activaTabId") { // tab really changed
if (activeTabId == 'summary') {
@@ -622,7 +622,7 @@ export class DataProviderComponent {
}
}
}
-
+
public get hasAggregationStatusInfo(): boolean {
// return (!!this.dataProviderInfo.aggregationStatus &&
// ((!!this.dataProviderInfo.aggregationStatus.fulltexts && parseInt(this.dataProviderInfo.aggregationStatus.fulltexts) != -1)
@@ -641,7 +641,7 @@ export class DataProviderComponent {
!!this.dataProviderInfo.journal['start_page'] || !!this.dataProviderInfo.journal['end_page']));
//return true;
}
-
+
public get hasPrimaryInfo(): boolean {
return !!this.dataProviderInfo && (
!!this.dataProviderInfo.description ||
@@ -650,7 +650,7 @@ export class DataProviderComponent {
!!this.dataProviderInfo.countries ||
(!!this.dataProviderInfo.subjects && this.dataProviderInfo.subjects.length > 0));
}
-
+
public get hasSecondaryInfo(): boolean {
return !!this.dataProviderInfo && (
(!!this.dataProviderInfo.organizations && this.dataProviderInfo.organizations.length > 0)
diff --git a/landingPages/landing-utils/metrics/metrics.component.ts b/landingPages/landing-utils/metrics/metrics.component.ts
index b0a77a8c..d19835ab 100644
--- a/landingPages/landing-utils/metrics/metrics.component.ts
+++ b/landingPages/landing-utils/metrics/metrics.component.ts
@@ -3,7 +3,7 @@ import {Metrics} from '../../../utils/entities/metrics';
import {MetricsService} from '../../../services/metrics.service';
import {ErrorCodes} from '../../../utils/properties/errorCodes';
-import {Subscription} from 'rxjs';
+import {Subscription, zip} from 'rxjs';
import {EnvProperties} from '../../../utils/properties/env-properties';
import {animate, state, style, transition, trigger} from "@angular/animations";
@@ -78,16 +78,16 @@ import {animate, state, style, transition, trigger} from "@angular/animations";
-
+
0 && viewsFrameUrl"
[height]="200"
- [url]=viewsFrameUrl>
+ [url]=viewsFrameUrl [addClass]="false">
-
+
0 && downloadsFrameUrl"
[height]="200"
- [url]=downloadsFrameUrl>
+ [url]=downloadsFrameUrl [addClass]="false">
@@ -195,20 +195,19 @@ export class MetricsComponent {
@Input() open = false;
@Input() viewsFrameUrl: string;
@Input() downloadsFrameUrl: string;
-
+
public metrics: Metrics;
public errorCodes: ErrorCodes;
private sub: Subscription;
private timeouts: any[] = [];
- public metricsClicked: boolean = false;
+ public metricsClicked: boolean = true;
public status: number;
public state: number = -1;
-
constructor(private metricsService: MetricsService, private cdr: ChangeDetectorRef) {
}
-
+
ngOnInit() {
this.errorCodes = new ErrorCodes();
if (typeof document !== 'undefined') {
@@ -216,45 +215,99 @@ export class MetricsComponent {
this.getMetrics();
}
}
-
+
ngOnDestroy() {
if(this.sub) {
this.sub.unsubscribe();
}
}
-
+
public get total(): number {
return +this.pageViews + +this.metrics.totalViews + +this.metrics.totalDownloads;
}
-
+
private getMetrics() {
- this.sub = this.metricsService.getMetrics(this.id, this.entityType, this.properties).subscribe(
- data => {
- this.metrics = data;
- this.cdr.detectChanges();
- this.status = this.errorCodes.DONE;
- this.metricsResults.emit({
- totalViews: this.metrics.totalViews,
- totalDownloads: this.metrics.totalDownloads,
- pageViews: this.metrics.pageViews
- });
- },
- err => {
- if (err.status == '404') {
- this.status = this.errorCodes.NOT_FOUND;
- } else if (err.status == '500') {
- this.status = this.errorCodes.ERROR;
- } else {
- this.status = this.errorCodes.NOT_AVAILABLE;
+ //queries from old API - replaced with queries to the stats tool
+ /* this.sub = this.metricsService.getMetrics(this.id, this.entityType, this.properties).subscribe(
+ data => {
+ this.metrics = data;
+ this.cdr.detectChanges();
+ this.status = this.errorCodes.DONE;
+ this.metricsResults.emit({
+ totalViews: this.metrics.totalViews,
+ totalDownloads: this.metrics.totalDownloads,
+ pageViews: this.metrics.pageViews
+ });
+ },
+ err => {
+ if (err.status == '404') {
+ this.status = this.errorCodes.NOT_FOUND;
+ } else if (err.status == '500') {
+ this.status = this.errorCodes.ERROR;
+ } else {
+ this.status = this.errorCodes.NOT_AVAILABLE;
+ }
+ this.metricsResults.emit({
+ totalViews: 0,
+ totalDownloads: 0
+ });
}
- this.metricsResults.emit({
- totalViews: 0,
- totalDownloads: 0
- });
+ );*/
+ let obs;
+ if (this.entityType == "results") {
+ obs = zip(this.metricsService.getMetricsNumber(this.id, "usagestats.results.views", this.properties),
+ this.metricsService.getMetricsNumber(this.id, "usagestats.results.downloads", this.properties),
+ this.metricsService.getMetricsNumber(this.id, "usagestats.results.views.openaire", this.properties),
+ this.metricsService.getMetricsNumbersByRepository(this.id, "usagestats.results.viewsdownloads.repository", this.properties)
+
+ );
+
+ } else if (this.entityType == "projects") {
+ obs = zip(this.metricsService.getMetricsNumber(this.id, "usagestats.projects.views", this.properties),
+ this.metricsService.getMetricsNumber(this.id, "usagestats.projects.downloads", this.properties),
+ this.metricsService.getMetricsNumber(this.id, "usagestats.projects.views.openaire", this.properties));
+
+ } else if (this.entityType == "datasources") {
+ obs = zip(this.metricsService.getMetricsNumber(this.id, "usagestats.views.repository.local", this.properties),
+ this.metricsService.getMetricsNumber(this.id, "usagestats.downloads.repository.local", this.properties),
+ this.metricsService.getMetricsNumber(this.id, "usagestats.views.openaire", this.properties),
+ // this.metricsService.getMetricsNumber(this.id, "usagestats.downloads.repository.openaire", this.properties)
+ );
+
}
- );
+
+ this.sub = obs.subscribe(
+ data => {
+ this.metrics = new Metrics();
+ this.metrics.infos = new Map();
+ this.metrics.totalViews = data[0] ? data[0] : 0;
+ this.metrics.totalDownloads = data[1] ? data[1] : 0;
+ this.metrics.pageViews = data[2] ? data[2] : 0;
+ this.metrics.infos = data[3] ? data[3] : 0;
+ this.cdr.detectChanges();
+ this.status = this.errorCodes.DONE;
+ this.metricsResults.emit({
+ totalViews: this.metrics.totalViews,
+ totalDownloads: this.metrics.totalDownloads,
+ pageViews: this.metrics.pageViews
+ });
+ },
+ err => {
+ if (err.status == '404') {
+ this.status = this.errorCodes.NOT_FOUND;
+ } else if (err.status == '500') {
+ this.status = this.errorCodes.ERROR;
+ } else {
+ this.status = this.errorCodes.NOT_AVAILABLE;
+ }
+ this.metricsResults.emit({
+ totalViews: 0,
+ totalDownloads: 0
+ });
+ }
+ );
}
-
+
public close(event) {
if(event.value && this.state !== -1) {
this.timeouts.forEach(timeout => {
@@ -264,8 +317,8 @@ export class MetricsComponent {
this.timeouts = [];
}
}
-
-
+
+
public toggle(event) {
this.metricsClicked = true;
@@ -293,7 +346,7 @@ export class MetricsComponent {
}
this.cdr.detectChanges();
}
-
+
public getKeys(map) {
return Array.from(map.keys());
}
diff --git a/landingPages/project/project.component.html b/landingPages/project/project.component.html
index 54603a57..bf064e92 100644
--- a/landingPages/project/project.component.html
+++ b/landingPages/project/project.component.html
@@ -399,7 +399,7 @@
-
+
0 || this.totalDownloads > 0||this.pageViews > 0;
}
@@ -709,7 +709,7 @@ export class ProjectComponent {
private openLoading() {
this.closeDownloadReportModal();
-
+
if (this.loading) {
this.loading.open();
}
@@ -769,7 +769,7 @@ export class ProjectComponent {
public getResultPreview(result: SearchResult, type: string): ResultPreview {
return ResultPreview.searchResultConvert(result, type);
}
-
+
public scroll() {
HelperFunctions.scroll();
}
diff --git a/landingPages/result/resultLanding.component.html b/landingPages/result/resultLanding.component.html
index 27120d73..463d0052 100644
--- a/landingPages/result/resultLanding.component.html
+++ b/landingPages/result/resultLanding.component.html
@@ -125,7 +125,7 @@
-
+
{
return this.http.get(url + doi).pipe(map(res => !!(res)));
}
-
+ getMetricsNumber (id: string, table: string, properties:EnvProperties):any {
+
+ let url =properties.statisticsFrameNewAPIURL + 'raw?json=' + encodeURIComponent('{"series":[{"query":{"name":"' + table + '", "parameters":["' + id + '"], "profile":"OpenAIRE All-inclusive"}}],"verbose":true}');
+
+ return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
+ .pipe(map(res => this.parseMetricsNumber(res)));
+ }
+ parseMetricsNumber(res){
+ try{
+ return +res["datasets"]["0"]["series"]["result"]["0"]["row"]["0"];
+ }catch(e){
+ return null;
+ }
+
+ }
+ getMetricsNumbersByRepository (id: string, table: string, properties:EnvProperties):any {
+
+ let url =properties.statisticsFrameNewAPIURL + 'raw?json=' + encodeURIComponent('{"series":[{"query":{"name":"' + table + '", "parameters":["' + id + '","' + id + '","' + id + '"], "profile":"OpenAIRE All-inclusive"}}],"verbose":true}');
+
+ return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
+ .pipe(map(res => this.parseMetricsNumbersByRepository(res,properties)));
+ }
+ parseMetricsNumbersByRepository(res,properties){
+ let map = new Map();
+ try{
+
+ let results = res["datasets"]["0"]["series"]["result"];
+ for(let i=0; i 0) {
+ map.set(id, info);
+ }
+ }
+ }
+ }catch(e){
+ console.error(e)
+ }
+ console.log(map)
+ return map;
+
+ }
getMetrics (id: string, entityType: string, properties:EnvProperties):any {
let url = properties.metricsAPIURL+entityType+"/"+id+"/clicks";
let key = url;
diff --git a/utils/iframe.component.ts b/utils/iframe.component.ts
index e76ddade..26e22b8d 100644
--- a/utils/iframe.component.ts
+++ b/utils/iframe.component.ts
@@ -4,10 +4,10 @@ import { SafeResourceUrl, DomSanitizer } from '@angular/platform-browser';
@Component({
selector: 'i-frame',
template: `
-
+
-
+
`
@@ -18,8 +18,9 @@ export class IFrameComponent {
@Input() width: number;
@Input() height: number;
@Input() unit: string = 'px';
+ @Input() addClass: boolean= true;
public style: any;
-
+
constructor(private sanitizer: DomSanitizer) {
}
ngOnInit() {