reintroduce numbersComponent in homepage, update submodules

angular-14
Alex Martzios 1 year ago
parent 4b6a383154
commit a9733427e8

@ -14,18 +14,7 @@
<h1 class="uk-h2 uk-width-1-2@m" uk-scrollspy-class>
Discover open linked research<span class="uk-text-primary">.</span>
</h1>
<div *ngIf="showContentWithNumbers" class="uk-margin-top" style="max-width: 600px;" uk-scrollspy-class>
<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>
<numbers #numbersComponent [defaultInit]="false" (results)="numbers = $event"></numbers>
<div [class.uk-invisible]="disableSelect" class="uk-margin-medium-top uk-width-3-4@xl">
<advanced-search-input #advanced (searchEmitter)="goTo(true)">
<entities-selection [simpleView]="true" currentEntity="all" [selectedEntity]="selectedEntity"
@ -80,13 +69,13 @@
<li *ngFor="let range of createRange(logos[type].length) let j=index"
class="uk-width-1-1 home-logo">
<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
class="uk-text-bold">{{numbers.publicationsSize.number|number}}{{numbers.publicationsSize.size}}
{{openaireEntities.PUBLICATIONS}}</span><span> deduplicated</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
class="uk-text-bold">{{numbers.datasetsLinkedSize.number|number}}{{numbers.datasetsLinkedSize.size}}
@ -96,7 +85,7 @@
{{openaireEntities.DATASETS}}</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
class="uk-text-bol ">{{numbers.softwareLinkedSize.number|number}}{{numbers.softwareLinkedSize.size}}
@ -108,7 +97,7 @@
<span *ngIf="type=='persistent'">
<span>Persistent identifiers and registries</span>
</span>
<span *ngIf="type=='funder' && showProjects && numbers?.fundersSize && numbers?.projectsSize">
<span *ngIf="type=='funder' && numbersComponent.showProjects && numbers?.fundersSize && numbers?.projectsSize">
<span
class="uk-text-bold">{{numbers.fundersSize.number|number}}{{numbers.fundersSize.size}}
funders</span><span> and</span>

@ -9,28 +9,21 @@ import {
ViewChild,
ViewChildren
} from '@angular/core';
import {of, Subscriber, zip} from 'rxjs';
import {ActivatedRoute, Router} from '@angular/router';
import {Location} from '@angular/common';
import {Subscriber} from 'rxjs';
import {Router} from '@angular/router';
import {Meta, Title} from '@angular/platform-browser';
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 {RouterHelper} from '../openaireLibrary/utils/routerHelper.class';
import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties';
import {ErrorCodes} from '../openaireLibrary/utils/properties/errorCodes';
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.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 {Filter} from "../openaireLibrary/searchPages/searchUtils/searchHelperClasses.class";
import {properties} from "../../environments/environment";
import {Numbers, NumbersComponent} from "../openaireLibrary/sharedComponents/numbers/numbers.component";
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';
@Component({
@ -93,7 +86,6 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit {
"logo-dryad.png"
]
],
//"other": [],
"persistent": [
[
"logo-re3data.png",
@ -120,29 +112,19 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit {
]
]
};
public pageTitle = "OpenAIRE";
public keyword: string = "";
public searchFields: SearchFields = new SearchFields();
public errorCodes: ErrorCodes = new ErrorCodes();
public routerHelper: RouterHelper = new RouterHelper();
public numbers: Numbers = {};
showPublications: boolean = false;
showDatasets: boolean = false;
showSoftware: boolean = false;
showOrp: boolean = false;
showProjects: boolean = false;
showDataProviders: boolean = false;
showOrganizations: boolean = false;
properties: EnvProperties = properties;
public properties: EnvProperties = properties;
public openaireEntities = OpenaireEntities;
public readMore: boolean = false;
public showQuickContact: boolean;
@ViewChild('contact') contact: ElementRef;
subscriptions: any[] = [];
@ViewChildren('scrolling_element') elements: QueryList<ElementRef>;
resultsQuickFilter: { filter: Filter, selected: boolean, filterId: string, value: string } = {
filter: null,
selected: true,
@ -173,27 +155,13 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit {
{value: "lcsh:Chemistry", label: "Chemistry"},
{value: "lcsh:Engineering (General). Civil engineering (General)", label: "Civil engineering"},
{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();
disableSelect: boolean = true;
constructor(
private route: ActivatedRoute,
private _router: Router,
private searchResearchResultsService: SearchResearchResultsService,
private searchDataprovidersService: SearchDataprovidersService,
private searchProjectsService: SearchProjectsService,
private searchOrganizationsService: SearchOrganizationsService,
private refineFieldResultsService: RefineFieldResultsService,
private location: Location, private _piwikService: PiwikService,
private _piwikService: PiwikService,
private config: ConfigurationService, private _meta: Meta, private _title: Title, private seoService: SEOService,
private helper: HelperService,
private cdr: ChangeDetectorRef,
@ -248,21 +216,31 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit {
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
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 => {
if (data) {
if(data) {
var showEntity = {};
for (var i = 0; i < data['entities'].length; i++) {
showEntity["" + data['entities'][i]["pid"] + ""] = data['entities'][i]["isEnabled"];
}
this.showPublications = !!showEntity["publication"];
this.showDatasets = !!showEntity["dataset"];
this.showSoftware = !!showEntity["software"];
this.showOrp = !!showEntity["orp"];
this.showProjects = !!showEntity["project"];
this.showDataProviders = !!showEntity["datasource"];
this.showOrganizations = !!showEntity["organization"];
if (this.showPublications) {
if(this.numbersComponent) {
this.numbersComponent.showPublications = !!showEntity["publication"];
this.numbersComponent.showDatasets = !!showEntity["dataset"];
this.numbersComponent.showSoftware = !!showEntity["software"];
this.numbersComponent.showOrp = !!showEntity["orp"];
this.numbersComponent.showProjects = !!showEntity["project"];
this.numbersComponent.showDataProviders = !!showEntity["datasource"];
this.numbersComponent.showOrganizations = !!showEntity["organization"];
}
if(this.numbersComponent && this.numbersComponent.showPublications) {
this.resultTypes.values.push({
name: this.openaireEntities.PUBLICATIONS,
id: "publications",
@ -270,7 +248,7 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit {
number: 0
});
}
if (this.showDatasets) {
if(this.numbersComponent && this.numbersComponent.showDatasets) {
this.resultTypes.values.push({
name: this.openaireEntities.DATASETS,
id: "datasets",
@ -278,7 +256,7 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit {
number: 0
});
}
if (this.showSoftware) {
if(this.numbersComponent && this.numbersComponent.showSoftware) {
this.resultTypes.values.push({
name: this.openaireEntities.SOFTWARE,
id: "software",
@ -286,10 +264,12 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit {
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.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 => {
@ -400,62 +380,8 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit {
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) {
this.disableSelect = event;
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
Loading…
Cancel
Save