diff --git a/landingPages/dataProvider/dataProvider.component.html b/landingPages/dataProvider/dataProvider.component.html index 219fdb78..e933441d 100644 --- a/landingPages/dataProvider/dataProvider.component.html +++ b/landingPages/dataProvider/dataProvider.component.html @@ -842,15 +842,15 @@ -
+
+ + +
+
-
- - -
diff --git a/landingPages/dataProvider/dataProvider.component.ts b/landingPages/dataProvider/dataProvider.component.ts index 0d9cc2d7..7b358153 100644 --- a/landingPages/dataProvider/dataProvider.component.ts +++ b/landingPages/dataProvider/dataProvider.component.ts @@ -68,8 +68,12 @@ export class DataProviderComponent { public metricsClicked: boolean; public viewsFrameUrl: string; public downloadsFrameUrl: string; - public totalViews: number; - public totalDownloads: number; + /** @deprecated*/ + public totalViews: number = null; + /** @deprecated*/ + public totalDownloads: number = null; + public hasViews: boolean = false; + public hasDownloads: boolean = false; // public pageViews: number; // Statistics tab variables @@ -408,9 +412,21 @@ export class DataProviderComponent { this.showLoading = false; + this.hasViews = false; + this.hasDownloads = false; + // ensure that if the API call to index does not have metrics, we get them from old metrics service call if(this.dataProviderInfo && !this.dataProviderInfo.measure) { this.getMetrics(); + } else if(this.dataProviderInfo && this.dataProviderInfo.measure && this.dataProviderInfo.measure.counts) { + this.dataProviderInfo.measure.counts.forEach(measure => { + if(measure.name == "views" && measure.value > 0) { + this.hasViews = true; + } + if(measure.name == "downloads" && measure.value > 0) { + this.hasDownloads = true; + } + }); } this.cdr.detectChanges(); @@ -719,10 +735,16 @@ export class DataProviderComponent { obs = zip(this.metricsService.getMetricsNumber(this.datasourceId, "usagestats.views.repository.local", this.properties), this.metricsService.getMetricsNumber(this.datasourceId, "usagestats.downloads.repository.local", this.properties)); this.sub = obs.subscribe(data => { - if(data[0] && data[1] && data[0] > 0 && data[1] > 0) { + if((data[0] && data[0] > 0) || (data[1] && data[1] > 0)) { this.dataProviderInfo.measure = {counts: []}; - this.dataProviderInfo.measure.counts.push({name: 'views', order: 0, icon: 'visibility', value: data[0]}); - this.dataProviderInfo.measure.counts.push({name: 'downloads', order: 1, icon: 'downloads', value: data[1]}); + if(data[0] && data[0] > 0) { + this.dataProviderInfo.measure.counts.push({name: 'views', order: 0, icon: 'visibility', value: data[0]}); + this.hasViews = true; + } + if(data[1] && data[1] > 0) { + this.dataProviderInfo.measure.counts.push({name: 'downloads', order: 1, icon: 'downloads', value: data[1]}); + this.hasDownloads = true; + } this.cdr.detectChanges(); } }); diff --git a/landingPages/project/project.component.html b/landingPages/project/project.component.html index 4add8ba6..b449f4a4 100644 --- a/landingPages/project/project.component.html +++ b/landingPages/project/project.component.html @@ -906,15 +906,15 @@
-
+
+ + +
+
-
- - -
diff --git a/landingPages/project/project.component.ts b/landingPages/project/project.component.ts index c420a552..cf46334d 100644 --- a/landingPages/project/project.component.ts +++ b/landingPages/project/project.component.ts @@ -55,8 +55,12 @@ export class ProjectComponent { public metricsClicked: boolean; public viewsFrameUrl: string; public downloadsFrameUrl: string; - public totalViews: number; - public totalDownloads: number; + /** @deprecated*/ + public totalViews: number = null; + /** @deprecated*/ + public totalDownloads: number = null; + public hasViews: boolean = false; + public hasDownloads: boolean = false; // public pageViews: number; // Statistics tab variables @@ -534,9 +538,21 @@ export class ProjectComponent { endDate: this.projectInfo.endDate }; + this.hasViews = false; + this.hasDownloads = false; + // ensure that if the API call to index does not have metrics, we get them from old metrics service call if(this.projectInfo && !this.projectInfo.measure) { this.getMetrics(); + } else if(this.projectInfo && this.projectInfo.measure && this.projectInfo.measure.counts) { + this.projectInfo.measure.counts.forEach(measure => { + if(measure.name == "views" && measure.value > 0) { + this.hasViews = true; + } + if(measure.name == "downloads" && measure.value > 0) { + this.hasDownloads = true; + } + }) } //old // this.viewsFrameUrl = this.properties.framesAPIURL + '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":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'; @@ -603,10 +619,17 @@ export class ProjectComponent { obs = zip(this.metricsService.getMetricsNumber(this.projectId, "usagestats.projects.views", this.properties), this.metricsService.getMetricsNumber(this.projectId, "usagestats.projects.downloads", this.properties)); this.sub = obs.subscribe(data => { - if(data[0] && data[1] && data[0] > 0 && data[1] > 0) { + if((data[0] && data[0] > 0) || (data[1] && data[1] > 0)) { this.projectInfo.measure = {counts: []}; - this.projectInfo.measure.counts.push({name: 'views', order: 0, icon: 'visibility', value: data[0]}); - this.projectInfo.measure.counts.push({name: 'downloads', order: 1, icon: 'downloads', value: data[1]}); + if(data[0] && data[0] > 0) { + this.projectInfo.measure.counts.push({name: 'views', order: 0, icon: 'visibility', value: data[0]}); + this.hasViews = true; + } + if(data[1] && data[1] > 0) { + this.projectInfo.measure.counts.push({name: 'downloads', order: 1, icon: 'downloads', value: data[1]}); + this.hasDownloads = true; + } + this.cdr.detectChanges(); } // this.totalViews = data[0]; diff --git a/landingPages/result/resultLanding.component.html b/landingPages/result/resultLanding.component.html index a36c131f..fa2d442c 100644 --- a/landingPages/result/resultLanding.component.html +++ b/landingPages/result/resultLanding.component.html @@ -1178,15 +1178,15 @@
-
- -
-
+
+
+ +
diff --git a/landingPages/result/resultLanding.component.ts b/landingPages/result/resultLanding.component.ts index 4c3f1c9b..a44acc1d 100644 --- a/landingPages/result/resultLanding.component.ts +++ b/landingPages/result/resultLanding.component.ts @@ -79,8 +79,12 @@ export class ResultLandingComponent { public hasAltMetrics: boolean = false; public viewsFrameUrl: string; public downloadsFrameUrl: string; + /** @deprecated*/ public totalViews: number = null; + /** @deprecated*/ public totalDownloads: number = null; + public hasViews: boolean = false; + public hasDownloads: boolean = false; public pageViews: number = null; public bipFrameUrl: string; @@ -502,7 +506,7 @@ export class ResultLandingComponent { this.viewsFrameUrl = this.properties.statisticsFrameNewAPIURL + 'chart?json=' + encodeURIComponent('{"library":"HighCharts","chartDescription":{"queries":[{"name":"Monthly views","type":"column","query":{"name":"usagestats.results.views.monthly", "parameters":["' + this.id + '"], "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.results.downloads.monthly", "parameters":["' + this.id + '"], "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.bipFrameUrl = this.properties.bipFrameAPIURL + this.id; + this.bipFrameUrl = this.properties.bipFrameAPIURL + this.id + (properties.environment == "beta" ? "&src=beta" : ""); let pid:Identifier = Identifier.getPIDFromIdentifiers(this.resultLandingInfo.identifiers); if (this.type == "result") { // no type was specified - update URL based this.resultLandingInfo.resultType this.updateUrlWithType(pid); @@ -559,6 +563,19 @@ export class ResultLandingComponent { this.relatedClassSelected = ""; this.filteredRelatedResults = this.resultLandingInfo.relatedResults; + this.hasViews = false; + this.hasDownloads = false; + if(this.resultLandingInfo.measure && this.resultLandingInfo.measure.counts) { + this.resultLandingInfo.measure.counts.forEach(measure => { + if(measure.name == "views" && measure.value > 0) { + this.hasViews = true; + } + if(measure.name == "downloads" && measure.value > 0) { + this.hasDownloads = true; + } + }) + } + this.showLoading = false; this.setActiveTab(); diff --git a/orcid/orcid-work.component.ts b/orcid/orcid-work.component.ts index 37919822..591b9604 100644 --- a/orcid/orcid-work.component.ts +++ b/orcid/orcid-work.component.ts @@ -21,38 +21,38 @@ declare var UIkit: any; - + - + Claim - - + - + Remove - @@ -143,7 +143,7 @@ declare var UIkit: any; - Add to ORCID + Claim @@ -154,7 +154,7 @@ declare var UIkit: any; - Delete from ORCID + Remove diff --git a/searchPages/searchUtils/newSearchPage.component.html b/searchPages/searchUtils/newSearchPage.component.html index acca3a2f..728deb98 100644 --- a/searchPages/searchUtils/newSearchPage.component.html +++ b/searchPages/searchUtils/newSearchPage.component.html @@ -166,10 +166,13 @@
-
+
@@ -235,7 +238,7 @@
- +
diff --git a/searchPages/searchUtils/newSearchPage.component.ts b/searchPages/searchUtils/newSearchPage.component.ts index c2a4ae31..10e975a0 100644 --- a/searchPages/searchUtils/newSearchPage.component.ts +++ b/searchPages/searchUtils/newSearchPage.component.ts @@ -1724,4 +1724,8 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges { public getFilterById(filterId: string): Filter { return this.filters.find(filter => filter.filterId == filterId); } + + detectChanges() { + this.cdr.detectChanges(); + } } diff --git a/sharedComponents/navigationBar.component.html b/sharedComponents/navigationBar.component.html index 0822d168..df1d6e1e 100644 --- a/sharedComponents/navigationBar.component.html +++ b/sharedComponents/navigationBar.component.html @@ -170,7 +170,7 @@ -
diff --git a/utils/staticAutoComplete/ISVocabularies.service.ts b/utils/staticAutoComplete/ISVocabularies.service.ts index e635b8ec..8a1b5457 100644 --- a/utils/staticAutoComplete/ISVocabularies.service.ts +++ b/utils/staticAutoComplete/ISVocabularies.service.ts @@ -122,12 +122,12 @@ export class ISVocabulariesService { getFos(properties: EnvProperties): Observable { let url = "/assets/common-assets/vocabulary/fos.json"; - return this.http.get((properties.useLongCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url) + return this.http.get(url); } getSDGs(properties: EnvProperties): Observable { let url = "/assets/common-assets/vocabulary/sdg.json"; - return this.http.get((properties.useLongCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url) + return this.http.get(url); } parseSDGs(data: any): AutoCompleteValue[] {