diff --git a/landingPages/dataProvider/dataProvider.component.ts b/landingPages/dataProvider/dataProvider.component.ts index 6c4b8be0..baebcd09 100644 --- a/landingPages/dataProvider/dataProvider.component.ts +++ b/landingPages/dataProvider/dataProvider.component.ts @@ -394,8 +394,8 @@ export class DataProviderComponent { this.updateUrl(this.canonicalUrl); this.seoService.createLinkForCanonicalURL(this.properties.domain +this.properties.baseLink + this._router.url); if (typeof document !== 'undefined') { - this.getDataProviderAggregationStatus(this.dataProviderInfo.originalId); - // this.getCollectedFulltexts(); + // this.getDataProviderAggregationStatus(this.dataProviderInfo.originalId); + this.getCollectedFulltexts(); this.countResultsWithFundingInfo(); } else { this.aggregationStatusIsInitialized = true; @@ -454,34 +454,34 @@ export class DataProviderComponent { } } - private getDataProviderAggregationStatus(originalId: string) { - this.subscriptions.push(this._dataproviderService.getDataproviderAggregationStatus(originalId, this.properties).subscribe( - data => { - this.dataProviderInfo.aggregationStatus = data; - this.aggregationStatusIsInitialized = true; - }, - err => { - //console.log(err); - this.aggregationStatusIsInitialized = true; - this.handleError("Error getting "+this.getTypeName()+" aggregation status for id: " + this.datasourceId, err); - } - )); - } - - // private getCollectedFulltexts() { - // this.subscriptions.push(this._dataproviderService.getCollectedFulltexts(this.datasourceId).subscribe( - // (data: string) => { - // this.dataProviderInfo.aggregationStatus = {"fulltexts": data}; + // private getDataProviderAggregationStatus(originalId: string) { + // this.subscriptions.push(this._dataproviderService.getDataproviderAggregationStatus(originalId, this.properties).subscribe( + // data => { + // this.dataProviderInfo.aggregationStatus = data; // this.aggregationStatusIsInitialized = true; // }, // err => { // //console.log(err); // this.aggregationStatusIsInitialized = true; - // this.handleError("Error getting "+this.getTypeName()+" collected fulltexts for id: " + this.datasourceId, err); + // this.handleError("Error getting "+this.getTypeName()+" aggregation status for id: " + this.datasourceId, err); // } // )); // } + private getCollectedFulltexts() { + this.subscriptions.push(this._dataproviderService.getCollectedFulltexts(this.datasourceId).subscribe( + (data: string) => { + this.dataProviderInfo.aggregationStatus = {"fulltexts": data}; + this.aggregationStatusIsInitialized = true; + }, + err => { + //console.log(err); + this.aggregationStatusIsInitialized = true; + this.handleError("Error getting "+this.getTypeName()+" collected fulltexts for id: " + this.datasourceId, err); + } + )); + } + private countResultsWithFundingInfo() { this.subscriptions.push(this._searchResearchResultsService.countCollectedResultsWithFundingInfo(this.datasourceId).subscribe( fundedContent => { diff --git a/landingPages/dataProvider/dataProvider.service.ts b/landingPages/dataProvider/dataProvider.service.ts index a80645e8..e62dd935 100644 --- a/landingPages/dataProvider/dataProvider.service.ts +++ b/landingPages/dataProvider/dataProvider.service.ts @@ -83,10 +83,10 @@ export class DataProviderService { .pipe(map(res => this.parseDataproviderAggregationStatus(res))); } - // getCollectedFulltexts(datasourceId: string) { - // return this.http.get(properties.pdfStatisticsAPIURL+"/api/stats/getNumberOfPayloadsForDatasource?datasourceId="+datasourceId) - // .pipe(map(res => res)) - // } + getCollectedFulltexts(datasourceId: string) { + return this.http.get(properties.pdfStatisticsAPIURL+"/stats/getNumberOfPayloadsForDatasource?datasourceId="+datasourceId) + .pipe(map(res => res)) + } private handleError (error: HttpErrorResponse) { // in a real world app, we may send the error to some remote logging infrastructure diff --git a/landingPages/landing-utils/parsingFunctions.class.ts b/landingPages/landing-utils/parsingFunctions.class.ts index a34ba066..846de4a9 100644 --- a/landingPages/landing-utils/parsingFunctions.class.ts +++ b/landingPages/landing-utils/parsingFunctions.class.ts @@ -894,7 +894,7 @@ export class ParsingFunctions { countsPerDatasource[datasourcePosition.get(element.datasource)].views = element.count; } else { datasourcePosition.set(element.datasource, countsPerDatasource.length); - countsPerDatasource.push({"datasourceId": element.datasource, "views": element.count, "downloads": 0}) + countsPerDatasource.push({"datasourceId": element.datasource.split("||")[0], "datasourceName": element.datasource.split("||")[1], "views": element.count, "downloads": 0}) } } // measure.views = element.count; @@ -907,7 +907,7 @@ export class ParsingFunctions { countsPerDatasource[datasourcePosition.get(element.datasource)].downloads = element.count; } else { datasourcePosition.set(element.datasource, countsPerDatasource.length); - countsPerDatasource.push({"datasourceId": element.datasource, "views": 0, "downloads": element.count}) + countsPerDatasource.push({"datasourceId": element.datasource.split("||")[0], "datasourceName": element.datasource.split("||")[1], "views": 0, "downloads": element.count}) } } // measure.downloads = element.count; diff --git a/landingPages/result/resultLanding.component.html b/landingPages/result/resultLanding.component.html index ca097000..7d6a9ccd 100644 --- a/landingPages/result/resultLanding.component.html +++ b/landingPages/result/resultLanding.component.html @@ -297,13 +297,13 @@ + + - - @@ -328,14 +328,14 @@ + + +
- - -
- {{datasource.datasourceId}} + {{datasource.datasourceName}} {{datasource.views}} {{datasource.downloads}} diff --git a/landingPages/result/resultLanding.component.ts b/landingPages/result/resultLanding.component.ts index 9e1c8714..bc25c014 100644 --- a/landingPages/result/resultLanding.component.ts +++ b/landingPages/result/resultLanding.component.ts @@ -554,10 +554,6 @@ export class ResultLandingComponent { } } } - if (this.communityId && this.communityId == "enermaps" && properties.enermapsURL) { - this.enermapsId = ParsingFunctions.getEnermapsConceptId(this.resultLandingInfo.contexts); - } - this.relatedClassFilters = [{"label": "All relations", "value": ""}]; if (this.resultLandingInfo.relatedClassFilters.size > 1) { for (let relClass of this.resultLandingInfo.relatedClassFilters) { @@ -591,6 +587,9 @@ export class ResultLandingComponent { this.cdr.detectChanges(); if (contexts) { + if (this.communityId && this.communityId == "enermaps" && properties.enermapsURL) { + this.enermapsId = ParsingFunctions.getEnermapsConceptId(contexts); + } await this.promise; if(this.publicCommunities && this.publicCommunities.length > 0) { this.resultLandingInfo.contexts = contexts.filter(context => { diff --git a/monitor-admin/topic/indicators.component.less b/monitor-admin/topic/indicators.component.less deleted file mode 100644 index 627ab18a..00000000 --- a/monitor-admin/topic/indicators.component.less +++ /dev/null @@ -1,53 +0,0 @@ -@import (reference) "~src/assets/openaire-theme/less/_import-variables"; - -.number-preview { - border: @global-border-width solid @global-border; - background: transparent; - border-radius: @global-border-radius; - min-width: 100px; - min-height: 70px; -} - -.refresh-indicator { - background-color: @global-overlay-background; - border-radius: @global-border-radius; - position: absolute; - color: @global-inverse-color; - z-index: 1; -} - -.section { - padding: 60px 45px; - border-radius: @global-border-radius; - border: @global-border-width solid @global-border; - position: relative; - background: @global-inverse-color; - border-left: 5px @global-primary-background solid; - - .tools { - position: absolute; - top: 0; - left: 50%; - transform: translate(-50%, -100%); - max-width: 50px; - padding: 5px 10px; - background-image: @global-primary-gradient; - color: @global-inverse-color; - -webkit-clip-path: polygon(20% 5%, 80% 5%, 100% 100%, 0% 100%); - clip-path: polygon(20% 5%, 80% 5%, 100% 100%, 0% 100%); - display: none; - } - - &:hover { - .tools { - display: block; - - a { - color: currentColor; - &:hover { - text-decoration: none; - } - } - } - } -} diff --git a/monitor-admin/topic/indicators.component.ts b/monitor-admin/topic/indicators.component.ts index d97f5f82..18d937de 100644 --- a/monitor-admin/topic/indicators.component.ts +++ b/monitor-admin/topic/indicators.component.ts @@ -51,8 +51,7 @@ declare var UIkit; @Component({ selector: 'indicators', - templateUrl: './indicators.component.html', - styleUrls: ['indicators.component.less'] + templateUrl: './indicators.component.html' }) export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterViewInit { filesToUpload: Array; diff --git a/searchPages/searchUtils/entitiesSelection.component.ts b/searchPages/searchUtils/entitiesSelection.component.ts index 9241f78e..d4df8e7b 100644 --- a/searchPages/searchUtils/entitiesSelection.component.ts +++ b/searchPages/searchUtils/entitiesSelection.component.ts @@ -40,7 +40,7 @@ export class EntitiesSelectionComponent { /** TODO change conditions base on PortalType instead of customFilter */ ngOnInit() { - if ((this.customFilter && this.customFilter.queryFieldName == "communityId") || (['explore', 'aggregator', 'eosc'].includes(this.properties.adminToolsPortalType))) { + if ((this.customFilter && this.customFilter.queryFieldName == "communityId") || (['explore', 'aggregator', 'eosc', 'faircore4eosc'].includes(this.properties.adminToolsPortalType))) { this.subscriptions.push(this.config.portalAsObservable.subscribe(data => { if (data) { let showEntity = {}; diff --git a/searchPages/searchUtils/searchSorting.component.ts b/searchPages/searchUtils/searchSorting.component.ts index e75e3930..88afac19 100644 --- a/searchPages/searchUtils/searchSorting.component.ts +++ b/searchPages/searchUtils/searchSorting.component.ts @@ -20,8 +20,7 @@ export class SearchSortingComponent { @Input() entityType: string = ''; @Output() sortByChange = new EventEmitter(); public options: Option[]; - private generalOptions = properties.environment != "production" ? - [ + private generalOptions = [ {value: '', label: 'Relevance'}, {value: 'resultdateofacceptance,descending', label: 'Date (most recent)'}, {value: 'resultdateofacceptance,ascending', label: 'Date (least recent)'}, @@ -29,11 +28,6 @@ export class SearchSortingComponent { {value: 'popularity,descending', label: 'Popularity'}, {value: 'influence,descending', label: 'Influence'}, {value: 'impulse,descending', label: 'Impulse'} - ] : - [ - {value: '', label: 'Relevance'}, - {value: 'resultdateofacceptance,descending', label: 'Date (most recent)'}, - {value: 'resultdateofacceptance,ascending', label: 'Date (least recent)'} ]; private communityOptions = [ {value: '', label: 'Title'}, diff --git a/services/refineFieldResults.service.ts b/services/refineFieldResults.service.ts index d40819ab..f43771dd 100644 --- a/services/refineFieldResults.service.ts +++ b/services/refineFieldResults.service.ts @@ -26,11 +26,32 @@ export class RefineFieldResultsService { .pipe(map(res => [res['meta'].total, RefineResultsUtils.parse(res['refineResults'],fields, entityName)])); } - getRefineFieldResultsByFieldName(fieldName:string, entityName:string, properties:EnvProperties):any{ - let key:string="fundinglevel"; - let link = properties.searchAPIURLLAst +this.getSearchAPIURLForEntity(entityName)+"?fields="+fieldName +(fieldName.toString().indexOf(key)!=-1?('&sf='+fieldName):'')+ "&format=json"; - return this.getField(link,fieldName, properties); + getAllRefineFieldResultsByFieldName(fieldName:string, entityName:string, properties:EnvProperties, refineQuery:string=null):any{ + // let keys:string[]=["funder", "relfunder", "fundinglevel"]; + let url = properties.searchAPIURLLAst +this.getSearchAPIURLForEntity(entityName)+"?fields="+fieldName +('&sf='+fieldName)+ "&format=json"; + if(refineQuery!= null && refineQuery != '' ) { + url += refineQuery; + } + return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) + //.map(res => res.json()) + + .pipe(map(res => [res['meta'].total, RefineResultsUtils.parse(res['refineResults'],[fieldName], entityName)])); + } + + getRefineFieldResultsByFieldName(fieldName:string, entityName:string, properties:EnvProperties):any{ + let keys:string[]=["funder", "fundinglevel"]; // this covers funder, relfunder, funding stream fields and funding level fields + let link = properties.searchAPIURLLAst +this.getSearchAPIURLForEntity(entityName)+"?fields="+fieldName +(this.fieldIncludesAnyOfTheKeywords(fieldName, keys)?('&sf='+fieldName):'')+ "&format=json"; + return this.getField(link,fieldName, properties); + } + + fieldIncludesAnyOfTheKeywords(field: string, keywords: string[]) { + for(let keyword of keywords) { + if(field.toString().indexOf(keyword)!=-1) { + return true; + } + } + return false; } getField (link:string,fieldName:string, properties:EnvProperties):any{ diff --git a/sharedComponents/numbers/numbers.component.ts b/sharedComponents/numbers/numbers.component.ts index cb163c7d..bd83f769 100644 --- a/sharedComponents/numbers/numbers.component.ts +++ b/sharedComponents/numbers/numbers.component.ts @@ -18,6 +18,7 @@ export interface Numbers { softwareSize?: NumberSize; otherSize?: NumberSize; fundersSize?: NumberSize; + mergedFundersSize?: NumberSize; projectsSize?: NumberSize; datasourcesSize?: NumberSize; organizationsSize?: NumberSize; @@ -89,6 +90,9 @@ export class NumbersComponent implements OnInit, OnDestroy { this.refineValue = refineValue; } let refineParams = (this.refineValue) ? ('&fq=' + this.refineValue) : null; + + let mergedFundersSet = new Set(); + this.subs.push(zip( (getPublications) ? this.searchResearchResultsService.numOfSearchResults('publication', '', this.properties, refineParams) : this.empty, (getDatasets) ? this.searchResearchResultsService.numOfSearchResults('dataset', '', this.properties, refineParams) : this.empty, @@ -96,9 +100,10 @@ export class NumbersComponent implements OnInit, OnDestroy { (getSoftware) ? this.searchResearchResultsService.numOfSearchResults('software', '', this.properties, refineParams) : this.empty, (getSoftwareLinked) ? this.searchResearchResultsService.numOfSearchResultsLinkedToPub("software", this.properties) : this.empty, (getOther) ? this.searchResearchResultsService.numOfSearchResults('other', '', this.properties, refineParams) : this.empty, - (getProjects) ? this.refineFieldResultsService.getRefineFieldsResultsByEntityName(['funder'], 'project', this.properties, refineParams) : this.empty, + (getProjects) ? this.refineFieldResultsService.getAllRefineFieldResultsByFieldName('funder', 'project', this.properties, refineParams) : this.empty, (getDataProviders) ? this.searchDataprovidersService.numOfSearchDataproviders('', this.properties, refineParams) : this.empty, - (getOrganizations) ? this._searchOrganizationsService.numOfSearchOrganizations2('', this.properties, refineParams) : this.empty + (getOrganizations) ? this._searchOrganizationsService.numOfSearchOrganizations2('', this.properties, refineParams) : this.empty, + (getPublications && getDatasets && getSoftware && getOther) ? this.refineFieldResultsService.getAllRefineFieldResultsByFieldName('relfunder', 'result', this.properties, refineParams) : this.empty, ).subscribe((data: any[]) => { if (data[0] && data[0] > 0) { this.numbers.publicationsSize = NumberUtils.roundNumber(data[0]); @@ -123,6 +128,15 @@ export class NumbersComponent implements OnInit, OnDestroy { } if (data[6][1] && data[6][1].length > 0 && data[6][1][0].filterId == 'funder' && data[6][1][0].values) { this.numbers.fundersSize = NumberUtils.roundNumber(data[6][1][0].values.length); + + let queriedFunders = data[6][1][0].values; + queriedFunders.forEach(queriedFunder => { + if(+queriedFunder.number > 1) { + if (!mergedFundersSet.has(queriedFunder.id)) { + mergedFundersSet.add(queriedFunder.id); + } + } + }); } if (data[7] && data[7] > 0) { this.numbers.datasourcesSize = NumberUtils.roundNumber(data[7]); @@ -130,7 +144,17 @@ export class NumbersComponent implements OnInit, OnDestroy { if (data[8] && data[8] > 0) { this.numbers.organizationsSize = NumberUtils.roundNumber(data[8]); } - this.results.emit(this.numbers); + if (data[9][1] && data[9][1].length > 0 && data[9][1][0].filterId == 'relfunder' && data[9][1][0].values) { + let queriedFunders = data[9][1][0].values; + queriedFunders.forEach(queriedFunder => { + if (!mergedFundersSet.has(queriedFunder.id)) { + mergedFundersSet.add(queriedFunder.id); + } + }); + } + + this.numbers.mergedFundersSize = NumberUtils.roundNumber(mergedFundersSet.size); + this.results.emit(this.numbers); }, err => { this.handleError('Error getting numbers', err); })); diff --git a/utils/entities/resultLandingInfo.ts b/utils/entities/resultLandingInfo.ts index 8a45393b..1e2f7740 100644 --- a/utils/entities/resultLandingInfo.ts +++ b/utils/entities/resultLandingInfo.ts @@ -49,7 +49,7 @@ export interface Measure { export interface MetricPerDatasource { datasourceId: string, - // datasourceName: string, + datasourceName: string, views: number, downloads: number } diff --git a/utils/modal/alert.ts b/utils/modal/alert.ts index b6458d79..f79f0e18 100644 --- a/utils/modal/alert.ts +++ b/utils/modal/alert.ts @@ -31,15 +31,15 @@ declare var UIkit: any;