reintroduce numbersComponent in homepage, update submodules

This commit is contained in:
Alex Martzios 2022-11-08 14:32:44 +02:00
parent 4b6a383154
commit a9733427e8
5 changed files with 38 additions and 123 deletions

View File

@ -14,18 +14,7 @@
<h1 class="uk-h2 uk-width-1-2@m" uk-scrollspy-class> <h1 class="uk-h2 uk-width-1-2@m" uk-scrollspy-class>
Discover open linked research<span class="uk-text-primary">.</span> Discover open linked research<span class="uk-text-primary">.</span>
</h1> </h1>
<div *ngIf="showContentWithNumbers" class="uk-margin-top" style="max-width: 600px;" uk-scrollspy-class> <numbers #numbersComponent [defaultInit]="false" (results)="numbers = $event"></numbers>
<div>
A comprehensive and open dataset of research information covering
<span class="uk-text-bold">{{numbers.publicationsSize.number|number}}<span class="uk-text-lowercase">{{numbers.publicationsSize.size}}</span> {{openaireEntities.PUBLICATIONS.toLowerCase()}}</span>,
<span class="uk-text-bold">{{numbers.datasetsSize.number|number}}<span class="uk-text-lowercase">{{numbers.datasetsSize.size}}</span> {{openaireEntities.DATASETS.toLowerCase()}}</span>,
<span class="uk-text-bold">{{numbers.softwareSize.number|number}}<span class="uk-text-lowercase">{{numbers.softwareSize.size}}</span> {{openaireEntities.SOFTWARE.toLowerCase()}}</span> items, from
<span class="uk-text-bold">{{numbers.datasourcesSize.number|number}}<span class="uk-text-lowercase">{{numbers.datasourcesSize.size}}</span> {{openaireEntities.DATASOURCES.toLowerCase()}}</span>, linked to
<span class="uk-text-bold">{{numbers.projectsSize.number|number}}<span class="uk-text-lowercase">{{numbers.projectsSize.size}}</span> grants</span> and
<span class="uk-text-bold">{{numbers.organizationsSize.number|number}}<span class="uk-text-lowercase">{{numbers.organizationsSize.size}}</span> {{openaireEntities.ORGANIZATIONS.toLowerCase()}}</span>.
</div>
<div class="uk-text-primary">All linked together through citations and semantics.</div>
</div>
<div [class.uk-invisible]="disableSelect" class="uk-margin-medium-top uk-width-3-4@xl"> <div [class.uk-invisible]="disableSelect" class="uk-margin-medium-top uk-width-3-4@xl">
<advanced-search-input #advanced (searchEmitter)="goTo(true)"> <advanced-search-input #advanced (searchEmitter)="goTo(true)">
<entities-selection [simpleView]="true" currentEntity="all" [selectedEntity]="selectedEntity" <entities-selection [simpleView]="true" currentEntity="all" [selectedEntity]="selectedEntity"
@ -80,13 +69,13 @@
<li *ngFor="let range of createRange(logos[type].length) let j=index" <li *ngFor="let range of createRange(logos[type].length) let j=index"
class="uk-width-1-1 home-logo"> class="uk-width-1-1 home-logo">
<h1 class="uk-text-center uk-margin-large-bottom uk-text-primary uk-h4"> <h1 class="uk-text-center uk-margin-large-bottom uk-text-primary uk-h4">
<span *ngIf="type=='publication' && showPublications && numbers?.publicationsSize"> <span *ngIf="type=='publication' && numbersComponent.showPublications && numbers?.publicationsSize">
<span <span
class="uk-text-bold">{{numbers.publicationsSize.number|number}}{{numbers.publicationsSize.size}} class="uk-text-bold">{{numbers.publicationsSize.number|number}}{{numbers.publicationsSize.size}}
{{openaireEntities.PUBLICATIONS}}</span><span> deduplicated</span> {{openaireEntities.PUBLICATIONS}}</span><span> deduplicated</span>
</span> </span>
<span <span
*ngIf="type=='dataset' && showDatasets && (numbers?.datasetsLinkedSize || numbers?.datasetsSize)"> *ngIf="type=='dataset' && numbersComponent.showDatasets && (numbers?.datasetsLinkedSize || numbers?.datasetsSize)">
<span *ngIf="numbers?.datasetsLinkedSize"> <span *ngIf="numbers?.datasetsLinkedSize">
<span <span
class="uk-text-bold">{{numbers.datasetsLinkedSize.number|number}}{{numbers.datasetsLinkedSize.size}} class="uk-text-bold">{{numbers.datasetsLinkedSize.number|number}}{{numbers.datasetsLinkedSize.size}}
@ -96,7 +85,7 @@
{{openaireEntities.DATASETS}}</span> {{openaireEntities.DATASETS}}</span>
</span> </span>
<span <span
*ngIf="type=='software' && showSoftware && (numbers?.softwareSize || numbers?.softwareLinkedSize)"> *ngIf="type=='software' && numbersComponent.showSoftware && (numbers?.softwareSize || numbers?.softwareLinkedSize)">
<span *ngIf="numbers?.softwareLinkedSize"> <span *ngIf="numbers?.softwareLinkedSize">
<span <span
class="uk-text-bol ">{{numbers.softwareLinkedSize.number|number}}{{numbers.softwareLinkedSize.size}} class="uk-text-bol ">{{numbers.softwareLinkedSize.number|number}}{{numbers.softwareLinkedSize.size}}
@ -108,7 +97,7 @@
<span *ngIf="type=='persistent'"> <span *ngIf="type=='persistent'">
<span>Persistent identifiers and registries</span> <span>Persistent identifiers and registries</span>
</span> </span>
<span *ngIf="type=='funder' && showProjects && numbers?.fundersSize && numbers?.projectsSize"> <span *ngIf="type=='funder' && numbersComponent.showProjects && numbers?.fundersSize && numbers?.projectsSize">
<span <span
class="uk-text-bold">{{numbers.fundersSize.number|number}}{{numbers.fundersSize.size}} class="uk-text-bold">{{numbers.fundersSize.number|number}}{{numbers.fundersSize.size}}
funders</span><span> and</span> funders</span><span> and</span>

View File

@ -9,28 +9,21 @@ import {
ViewChild, ViewChild,
ViewChildren ViewChildren
} from '@angular/core'; } from '@angular/core';
import {of, Subscriber, zip} from 'rxjs'; import {Subscriber} from 'rxjs';
import {ActivatedRoute, Router} from '@angular/router'; import {Router} from '@angular/router';
import {Location} from '@angular/common';
import {Meta, Title} from '@angular/platform-browser'; import {Meta, Title} from '@angular/platform-browser';
import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service'; import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service';
import {SearchDataprovidersService} from '../openaireLibrary/services/searchDataproviders.service';
import {SearchProjectsService} from '../openaireLibrary/services/searchProjects.service';
import {SearchOrganizationsService} from '../openaireLibrary/services/searchOrganizations.service';
import {RefineFieldResultsService} from '../openaireLibrary/services/refineFieldResults.service';
import {OpenaireEntities, SearchFields} from '../openaireLibrary/utils/properties/searchFields'; import {OpenaireEntities, SearchFields} from '../openaireLibrary/utils/properties/searchFields';
import {RouterHelper} from '../openaireLibrary/utils/routerHelper.class'; import {RouterHelper} from '../openaireLibrary/utils/routerHelper.class';
import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties'; import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties';
import {ErrorCodes} from '../openaireLibrary/utils/properties/errorCodes'; import {ErrorCodes} from '../openaireLibrary/utils/properties/errorCodes';
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service'; import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
import {SEOService} from '../openaireLibrary/sharedComponents/SEO/SEO.service'; import {SEOService} from '../openaireLibrary/sharedComponents/SEO/SEO.service';
import {SearchResearchResultsService} from "../openaireLibrary/services/searchResearchResults.service";
import {HelperService} from "../openaireLibrary/utils/helper/helper.service"; import {HelperService} from "../openaireLibrary/utils/helper/helper.service";
import {Filter} from "../openaireLibrary/searchPages/searchUtils/searchHelperClasses.class"; import {Filter} from "../openaireLibrary/searchPages/searchUtils/searchHelperClasses.class";
import {properties} from "../../environments/environment"; import {properties} from "../../environments/environment";
import {Numbers, NumbersComponent} from "../openaireLibrary/sharedComponents/numbers/numbers.component"; import {Numbers, NumbersComponent} from "../openaireLibrary/sharedComponents/numbers/numbers.component";
import {StringUtils} from "../openaireLibrary/utils/string-utils.class"; import {StringUtils} from "../openaireLibrary/utils/string-utils.class";
import {NumberUtils} from '../openaireLibrary/utils/number-utils.class';
import {QuickContactService} from '../openaireLibrary/sharedComponents/quick-contact/quick-contact.service'; import {QuickContactService} from '../openaireLibrary/sharedComponents/quick-contact/quick-contact.service';
@Component({ @Component({
@ -93,7 +86,6 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit {
"logo-dryad.png" "logo-dryad.png"
] ]
], ],
//"other": [],
"persistent": [ "persistent": [
[ [
"logo-re3data.png", "logo-re3data.png",
@ -120,29 +112,19 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit {
] ]
] ]
}; };
public pageTitle = "OpenAIRE"; public pageTitle = "OpenAIRE";
public keyword: string = ""; public keyword: string = "";
public searchFields: SearchFields = new SearchFields(); public searchFields: SearchFields = new SearchFields();
public errorCodes: ErrorCodes = new ErrorCodes(); public errorCodes: ErrorCodes = new ErrorCodes();
public routerHelper: RouterHelper = new RouterHelper(); public routerHelper: RouterHelper = new RouterHelper();
public numbers: Numbers = {}; public numbers: Numbers = {};
showPublications: boolean = false; public properties: EnvProperties = properties;
showDatasets: boolean = false;
showSoftware: boolean = false;
showOrp: boolean = false;
showProjects: boolean = false;
showDataProviders: boolean = false;
showOrganizations: boolean = false;
properties: EnvProperties = properties;
public openaireEntities = OpenaireEntities; public openaireEntities = OpenaireEntities;
public readMore: boolean = false; public readMore: boolean = false;
public showQuickContact: boolean; public showQuickContact: boolean;
@ViewChild('contact') contact: ElementRef; @ViewChild('contact') contact: ElementRef;
subscriptions: any[] = []; subscriptions: any[] = [];
@ViewChildren('scrolling_element') elements: QueryList<ElementRef>; @ViewChildren('scrolling_element') elements: QueryList<ElementRef>;
resultsQuickFilter: { filter: Filter, selected: boolean, filterId: string, value: string } = { resultsQuickFilter: { filter: Filter, selected: boolean, filterId: string, value: string } = {
filter: null, filter: null,
selected: true, selected: true,
@ -173,27 +155,13 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit {
{value: "lcsh:Chemistry", label: "Chemistry"}, {value: "lcsh:Chemistry", label: "Chemistry"},
{value: "lcsh:Engineering (General). Civil engineering (General)", label: "Civil engineering"}, {value: "lcsh:Engineering (General). Civil engineering (General)", label: "Civil engineering"},
{value: "lcsh:Technology", label: "Technology"}, {value: "lcsh:Technology", label: "Technology"},
/* "Mathematics::Combinatorics",
"lcsh:Medicine",
"lcsh:Science",
"lcsh:Biology (General)",
"lcsh:Chemistry",
"lcsh:Engineering (General). Civil engineering (General)",
"lcsh:Technology"*/
]; ];
stringUtils = new StringUtils(); stringUtils = new StringUtils();
disableSelect: boolean = true; disableSelect: boolean = true;
constructor( constructor(
private route: ActivatedRoute,
private _router: Router, private _router: Router,
private searchResearchResultsService: SearchResearchResultsService, private _piwikService: PiwikService,
private searchDataprovidersService: SearchDataprovidersService,
private searchProjectsService: SearchProjectsService,
private searchOrganizationsService: SearchOrganizationsService,
private refineFieldResultsService: RefineFieldResultsService,
private location: Location, private _piwikService: PiwikService,
private config: ConfigurationService, private _meta: Meta, private _title: Title, private seoService: SEOService, private config: ConfigurationService, private _meta: Meta, private _title: Title, private seoService: SEOService,
private helper: HelperService, private helper: HelperService,
private cdr: ChangeDetectorRef, private cdr: ChangeDetectorRef,
@ -248,21 +216,31 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit {
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
this.subscriptions.push(this._piwikService.trackView(this.properties, "OpenAIRE").subscribe()); this.subscriptions.push(this._piwikService.trackView(this.properties, "OpenAIRE").subscribe());
} }
//this.config.getCommunityInformation(this.properties, this.properties.adminToolsCommunity ).subscribe(data => { if(this.numbersComponent) {
this.numbersComponent.showPublications = false;
this.numbersComponent.showDatasets = false;
this.numbersComponent.showSoftware = false;
this.numbersComponent.showOrp = false;
this.numbersComponent.showProjects = false;
this.numbersComponent.showDataProviders = false;
this.numbersComponent.showOrganizations = false;
}
this.subscriptions.push(this.config.communityInformationState.subscribe(data => { this.subscriptions.push(this.config.communityInformationState.subscribe(data => {
if (data) { if(data) {
var showEntity = {}; var showEntity = {};
for (var i = 0; i < data['entities'].length; i++) { for (var i = 0; i < data['entities'].length; i++) {
showEntity["" + data['entities'][i]["pid"] + ""] = data['entities'][i]["isEnabled"]; showEntity["" + data['entities'][i]["pid"] + ""] = data['entities'][i]["isEnabled"];
} }
this.showPublications = !!showEntity["publication"]; if(this.numbersComponent) {
this.showDatasets = !!showEntity["dataset"]; this.numbersComponent.showPublications = !!showEntity["publication"];
this.showSoftware = !!showEntity["software"]; this.numbersComponent.showDatasets = !!showEntity["dataset"];
this.showOrp = !!showEntity["orp"]; this.numbersComponent.showSoftware = !!showEntity["software"];
this.showProjects = !!showEntity["project"]; this.numbersComponent.showOrp = !!showEntity["orp"];
this.showDataProviders = !!showEntity["datasource"]; this.numbersComponent.showProjects = !!showEntity["project"];
this.showOrganizations = !!showEntity["organization"]; this.numbersComponent.showDataProviders = !!showEntity["datasource"];
if (this.showPublications) { this.numbersComponent.showOrganizations = !!showEntity["organization"];
}
if(this.numbersComponent && this.numbersComponent.showPublications) {
this.resultTypes.values.push({ this.resultTypes.values.push({
name: this.openaireEntities.PUBLICATIONS, name: this.openaireEntities.PUBLICATIONS,
id: "publications", id: "publications",
@ -270,7 +248,7 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit {
number: 0 number: 0
}); });
} }
if (this.showDatasets) { if(this.numbersComponent && this.numbersComponent.showDatasets) {
this.resultTypes.values.push({ this.resultTypes.values.push({
name: this.openaireEntities.DATASETS, name: this.openaireEntities.DATASETS,
id: "datasets", id: "datasets",
@ -278,7 +256,7 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit {
number: 0 number: 0
}); });
} }
if (this.showSoftware) { if(this.numbersComponent && this.numbersComponent.showSoftware) {
this.resultTypes.values.push({ this.resultTypes.values.push({
name: this.openaireEntities.SOFTWARE, name: this.openaireEntities.SOFTWARE,
id: "software", id: "software",
@ -286,10 +264,12 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit {
number: 0 number: 0
}); });
} }
if (this.showOrp) { if(this.numbersComponent && this.numbersComponent.showOrp) {
this.resultTypes.values.push({name: this.openaireEntities.OTHER, id: "other", selected: false, number: 0}); this.resultTypes.values.push({name: this.openaireEntities.OTHER, id: "other", selected: false, number: 0});
} }
this.init(this.showDatasets, this.showSoftware, this.showPublications, this.showDatasets, this.showSoftware, this.showOrp, this.showProjects, this.showDataProviders, this.showOrganizations); if(this.numbersComponent) {
this.numbersComponent.init(this.numbersComponent.showDatasets, this.numbersComponent.showSoftware, this.numbersComponent.showPublications, this.numbersComponent.showDatasets, this.numbersComponent.showSoftware, this.numbersComponent.showOrp, this.numbersComponent.showProjects, this.numbersComponent.showDataProviders, this.numbersComponent.showOrganizations);
}
} }
}, },
error => { error => {
@ -400,62 +380,8 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit {
return {'f0': 'resultsubject', 'fv0': '"' + (param) + '"', size: 50}; return {'f0': 'resultsubject', 'fv0': '"' + (param) + '"', size: 50};
} }
init(getDatasetsLinked = false, getSoftwareLinked = false, getPublications = true, getDatasets = true,
getSoftware = true, getOther = true, getProjects = true, getDataProviders = true, getOrganizations = true, refineValue: string = null) {
this.subscriptions.push(zip(
(getPublications) ? this.searchResearchResultsService.numOfSearchResults('publication', '', this.properties, null) : of(0),
(getDatasets) ? this.searchResearchResultsService.numOfSearchResults('dataset', '', this.properties, null) : of(0),
(getDatasetsLinked) ? this.searchResearchResultsService.numOfSearchResultsLinkedToPub("dataset", this.properties) : of(0),
(getSoftware) ? this.searchResearchResultsService.numOfSearchResults('software', '', this.properties, null) : of(0),
(getSoftwareLinked) ? this.searchResearchResultsService.numOfSearchResultsLinkedToPub("software", this.properties) : of(0),
(getOther) ? this.searchResearchResultsService.numOfSearchResults('other', '', this.properties, null) : of(0),
(getProjects) ? this.refineFieldResultsService.getRefineFieldsResultsByEntityName(['funder'], 'project', this.properties, null) : of(0),
(getDataProviders) ? this.searchDataprovidersService.numOfSearchDataproviders('', this.properties, null) : of(0),
(getOrganizations) ? this.searchOrganizationsService.numOfSearchOrganizations2('', this.properties, null) : of(0)
).subscribe((data: any[]) => {
if (data[0] && data[0] > 0) {
this.numbers.publicationsSize = NumberUtils.roundNumber(data[0]);
}
if (data[1] && data[1] > 0) {
this.numbers.datasetsSize = NumberUtils.roundNumber(data[1]);
}
if (data[2] && data[2] > 0) {
this.numbers.datasetsLinkedSize = NumberUtils.roundNumber(data[2]);
}
if (data[3] && data[3] > 0) {
this.numbers.softwareSize = NumberUtils.roundNumber(data[3]);
}
if (data[4] && data[4] > 0) {
this.numbers.softwareLinkedSize = NumberUtils.roundNumber(data[4]);
}
if (data[5] && data[5] > 0) {
this.numbers.otherSize = NumberUtils.roundNumber(data[5]);
}
if (data[6][0] && data[6][0] > 0) {
this.numbers.projectsSize = NumberUtils.roundNumber(data[6][0]);
}
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);
}
if (data[7] && data[7] > 0) {
this.numbers.datasourcesSize = NumberUtils.roundNumber(data[7]);
}
if (data[8] && data[8] > 0) {
this.numbers.organizationsSize = NumberUtils.roundNumber(data[8]);
}
}, err => {
this.handleError('Error getting numbers', err);
}));
}
disableSelectChange(event: boolean) { disableSelectChange(event: boolean) {
this.disableSelect = event; this.disableSelect = event;
this.cdr.detectChanges(); this.cdr.detectChanges();
} }
public get showContentWithNumbers() {
if (this.numbers && this.numbers.publicationsSize && this.numbers.datasetsSize && this.numbers.softwareSize && this.numbers.datasourcesSize && this.numbers.projectsSize && this.numbers.organizationsSize) {
return true;
}
}
} }

@ -1 +1 @@
Subproject commit 97c350dfeccad759ce37b04e50306e80a4ad2f15 Subproject commit a2fea9e32331de06ab2192e3e638662531b9f42f

@ -1 +1 @@
Subproject commit 3ec9d00bc4b794ae782b163a1a17886bd83534f4 Subproject commit 06e1889730e456e86f728a31410bf550d16ac7d6

@ -1 +1 @@
Subproject commit 67483e8b95c23aa8dcb2d1203e1fe89a4d7f033f Subproject commit e3e2a6ec11055f4d4352d0749bb1b484ddd711ae