From f52ff453bd99e4f9eb12d67e4a14a45daac249c9 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Thu, 30 Mar 2017 11:10:20 +0000 Subject: [PATCH] Lazy Routing everywhere (including all tabs & navigating from one entity to another instance of the same entity) -> Problems in Dataprovider landing tabs | Hide unidentified projects from search and tab results when they are not main results (e.g. do not hide them in project tabs, but hide them in publication tabs) git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@46513 d315682c-612b-4755-9ff5-7f18f6832af3 --- .../dataProvider/dataProvider.component.ts | 18 +++- .../dataProvider/dataProvider.service.ts | 1 + .../relatedDatasourcesTab.component.ts | 26 +++--- .../dataProvider/tabs.component.ts | 87 ++++++++++++------- .../dataset/dataset.component.html | 4 +- .../landingPages/dataset/dataset.component.ts | 43 +++++---- .../organization/organization.component.html | 2 +- .../organization/organization.component.ts | 31 +++++-- .../landingPages/person/person.component.html | 8 +- .../landingPages/person/person.component.ts | 41 ++++++--- .../landingPages/project/project.component.ts | 28 +++--- .../publication/publication.component.html | 4 +- .../publication/publication.component.ts | 21 +++-- .../searchingProjectsInTab.component.ts | 26 ++++-- .../app/landingPages/tabTable.component.ts | 15 +--- .../searchUtils/searchResult.component.ts | 17 ++-- .../searchUtils/tabResult.component.ts | 35 +++----- .../simple/searchPublications.component.ts | 23 ----- .../app/services/searchDatasets.service.ts | 66 ++++++++++++-- .../services/searchOrganizations.service.ts | 17 ++-- .../services/searchPublications.service.ts | 17 ++-- .../fetchDataproviders.class.ts | 10 ++- .../fetchDatasets.class.ts | 32 +++++++ .../fetchProjects.class.ts | 5 ++ .../fetchPublications.class.ts | 32 ++----- 25 files changed, 379 insertions(+), 230 deletions(-) diff --git a/portal-2/src/app/landingPages/dataProvider/dataProvider.component.ts b/portal-2/src/app/landingPages/dataProvider/dataProvider.component.ts index 8be87f51..1eaef7ea 100644 --- a/portal-2/src/app/landingPages/dataProvider/dataProvider.component.ts +++ b/portal-2/src/app/landingPages/dataProvider/dataProvider.component.ts @@ -1,4 +1,4 @@ -import {Component, ViewChild} from '@angular/core'; +import {Component, ViewChild, ElementRef} from '@angular/core'; import {Observable} from 'rxjs/Observable'; import {DataProviderService} from './dataProvider.service'; import {DataProviderInfo} from '../../utils/entities/dataProviderInfo'; @@ -14,12 +14,18 @@ import{TabsComponent} from './tabs.component'; }) export class DataProviderComponent { - constructor (private _dataproviderService: DataProviderService, private route: ActivatedRoute, private _meta: Meta) { - this.updateTitle("Data provider"); - this.updateDescription("Data provider, search, repositories, open access"); + constructor (private element: ElementRef, + private _dataproviderService: DataProviderService, + private route: ActivatedRoute, + private _meta: Meta) { + } + ngOnInit() { this.sub = this.route.queryParams.subscribe(data => { + this.updateTitle("Data provider"); + this.updateDescription("Data provider, search, repositories, open access"); + this.datasourceId = data['datasourceId']; // console.info("Datasource id is :"+this.datasourceId); if(this.datasourceId){ @@ -28,6 +34,10 @@ export class DataProviderComponent { // console.info("Datasource id not found"); } + if (typeof document !== 'undefined') { + this.element.nativeElement.scrollIntoView(); + } + }); diff --git a/portal-2/src/app/landingPages/dataProvider/dataProvider.service.ts b/portal-2/src/app/landingPages/dataProvider/dataProvider.service.ts index b11f6006..4862f342 100644 --- a/portal-2/src/app/landingPages/dataProvider/dataProvider.service.ts +++ b/portal-2/src/app/landingPages/dataProvider/dataProvider.service.ts @@ -66,6 +66,7 @@ export class DataProviderService { if(this.dataProviderInfo.tabs == undefined) { this.dataProviderInfo.tabs = new Array<{"name": string, "content": string}>(); } + if(this.dataProviderInfo.tabsInTypes.publicationsTab.has(data[1].classid)) { this.dataProviderInfo.tabs.push({"name": "Publications", "content": "publicationsTab"}); } diff --git a/portal-2/src/app/landingPages/dataProvider/relatedDatasourcesTab.component.ts b/portal-2/src/app/landingPages/dataProvider/relatedDatasourcesTab.component.ts index 47bb5ffd..98746475 100644 --- a/portal-2/src/app/landingPages/dataProvider/relatedDatasourcesTab.component.ts +++ b/portal-2/src/app/landingPages/dataProvider/relatedDatasourcesTab.component.ts @@ -1,6 +1,7 @@ import {Component, Input} from '@angular/core'; import { FetchPublications } from '../../utils/fetchEntitiesClasses/fetchPublications.class'; +import { FetchDatasets } from '../../utils/fetchEntitiesClasses/fetchDatasets.class'; import {OpenaireProperties} from '../../utils/properties/openaireProperties'; import {RouterHelper} from '../../utils/routerHelper.class'; @@ -9,11 +10,11 @@ import {RouterHelper} from '../../utils/routerHelper.class'; selector: 'relatedDatasourcesTab', template: ` -
+
There are no related dataproviders
-
+

The results below are discovered through our pilot algorithms. Let us know how we are doing! @@ -23,22 +24,22 @@ import {RouterHelper} from '../../utils/routerHelper.class'; Data Provider Name - Number of publications/ datasets + Number of {{type}} - + - - + + {{item.name}} + routerLinkActive="router-link-active" [routerLink]="linkToSearchResults"> {{item.count}} @@ -50,9 +51,10 @@ import {RouterHelper} from '../../utils/routerHelper.class'; }) export class RelatedDatasourcesTabComponent { + @Input() type: string; @Input() dataproviderId: string; - @Input() fetchPublications : FetchPublications; - public linkToSearchPublications: string = ""; + @Input() fetchResults : any; + public linkToSearchResults: string = ""; public searchLinkToDataProvider: string = ""; public routerHelper:RouterHelper = new RouterHelper(); @@ -63,7 +65,11 @@ export class RelatedDatasourcesTabComponent { ngOnInit() { console.info("related datasources tab: init"); - this.linkToSearchPublications = OpenaireProperties.getLinkToAdvancedSearchPublications();//+"?&hostedBy=";//+ +"&ho=and&collectedFrom="+ +"&co=and"; + if(this.type == "publications") { + this.linkToSearchResults = OpenaireProperties.getLinkToAdvancedSearchPublications();//+"?&hostedBy=";//+ +"&ho=and&collectedFrom="+ +"&co=and"; + } else { + this.linkToSearchResults = OpenaireProperties.getLinkToAdvancedSearchDatasets(); + } this.searchLinkToDataProvider = OpenaireProperties.getsearchLinkToDataProvider(); /*queryParams.push("hostedBy"); queryParams.push("ho"); diff --git a/portal-2/src/app/landingPages/dataProvider/tabs.component.ts b/portal-2/src/app/landingPages/dataProvider/tabs.component.ts index f37f3c9c..f0a0c45e 100644 --- a/portal-2/src/app/landingPages/dataProvider/tabs.component.ts +++ b/portal-2/src/app/landingPages/dataProvider/tabs.component.ts @@ -95,7 +95,8 @@ import {RouterHelper} from '../../utils/routerHelper.class'; [organizations]="organizations"> + [fetchResults]="fetchResultsAggregators" + [type]="relatedDataprovidersResultsType">

@@ -185,7 +186,8 @@ import {RouterHelper} from '../../utils/routerHelper.class'; + [fetchResults]="fetchResultsAggregators" + [type]="relatedDataprovidersResultsType"> View all {{fetchPublications.searchUtils.totalResults}} results
+ type="publication" urlParam="articleId">
@@ -73,15 +71,13 @@

+ type="dataset" urlParam="datasetId">
diff --git a/portal-2/src/app/landingPages/person/person.component.ts b/portal-2/src/app/landingPages/person/person.component.ts index 3074d986..24950b3b 100644 --- a/portal-2/src/app/landingPages/person/person.component.ts +++ b/portal-2/src/app/landingPages/person/person.component.ts @@ -1,4 +1,4 @@ -import {Component} from '@angular/core'; +import {Component, ElementRef} from '@angular/core'; import {Observable} from 'rxjs/Observable'; import { ActivatedRoute } from '@angular/router'; import {PersonService} from './person.service'; @@ -33,12 +33,11 @@ export class PersonComponent { public warningMessage = ""; public errorMessage = ""; - constructor (private _personService: PersonService, + constructor (private element: ElementRef, + private _personService: PersonService, private route: ActivatedRoute, private _searchPublicationsService: SearchPublicationsService, private _searchDatasetsService: SearchDatasetsService, private _meta: Meta) { - this.updateTitle("Person"); - this.updateDescription("person, publication, research data, search, open access"); console.info('person constructor'); this.fetchPublications = new FetchPublications( this._searchPublicationsService); @@ -48,20 +47,28 @@ export class PersonComponent { ngOnInit() { console.info('person init'); this.sub = this.route.queryParams.subscribe(params => { - this.personId = params['personId']; - console.info("Id is :"+this.personId); - if(this.personId){ + this.personInfo = null; + this.updateTitle("Person"); + this.updateDescription("person, publication, research data, search, open access"); + + this.personId = params['personId']; + console.info("Id is :"+this.personId); + + if(this.personId){ this.fetchPersonInfo(); this.searchPublications(); - }else{ + }else{ this.warningMessage="No valid person id"; - } + } - }); + if (typeof document !== 'undefined') { + this.element.nativeElement.scrollIntoView(); + } + }); - this.subDatasetsCount = this.route.queryParams.subscribe(params => { + /*this.subDatasetsCount = this.route.queryParams.subscribe(params => { this._searchDatasetsService.numOfEntityDatasets(this.personId, "people/").subscribe( data => { this.fetchDatasets.searchUtils.totalResults = data; @@ -70,7 +77,7 @@ export class PersonComponent { console.log(err); } ); - }) + })*/ } private searchDatasetsInit() { @@ -96,13 +103,21 @@ export class PersonComponent { this.warningMessage = ''; this.errorMessage="" - console.info("do request"); this._personService.getPersonInfo(this.personId).subscribe( data => { this.personInfo = data; this.updateTitle(this.personInfo.fullname); this.updateDescription("person, publication, research data, search, open access, "+this.personInfo.fullname); + + this._searchDatasetsService.numOfEntityDatasets(this.personId, "people/").subscribe( + data => { + this.fetchDatasets.searchUtils.totalResults = data; + }, + err => { + console.log(err); + } + ); }, err => { diff --git a/portal-2/src/app/landingPages/project/project.component.ts b/portal-2/src/app/landingPages/project/project.component.ts index be4f3b1b..0e078236 100644 --- a/portal-2/src/app/landingPages/project/project.component.ts +++ b/portal-2/src/app/landingPages/project/project.component.ts @@ -1,4 +1,4 @@ -import {Component, ViewChild} from '@angular/core'; +import {Component, ViewChild, ElementRef} from '@angular/core'; import {Observable} from 'rxjs/Observable'; import {ActivatedRoute, Params} from '@angular/router'; import {ProjectService} from './project.service'; @@ -60,25 +60,26 @@ export class ProjectComponent{ @ViewChild (ModalLoading) loading : ModalLoading ; - constructor (private _projectService: ProjectService, - private route: ActivatedRoute, - private _searchPublicationsService: SearchPublicationsService, - private _searchDatasetsService: SearchDatasetsService, - private _reportsService: ReportsService, private _meta: Meta) { + constructor ( private element: ElementRef, + private _projectService: ProjectService, + private route: ActivatedRoute, + private _searchPublicationsService: SearchPublicationsService, + private _searchDatasetsService: SearchDatasetsService, + private _reportsService: ReportsService, private _meta: Meta) { console.info('project constructor.'); - - this.fetchPublications = new FetchPublications( this._searchPublicationsService); - this.fetchDatasets = new FetchDatasets(this._searchDatasetsService); - this.updateTitle("Project"); - this.updateDescription("project, funding, open access, publications, datasets, "); } ngOnInit() { this.sub = this.route.queryParams.subscribe(params => { - this.metricsClicked = false; this.statsClicked = false; + this.fetchPublications = new FetchPublications( this._searchPublicationsService); + this.fetchDatasets = new FetchDatasets(this._searchDatasetsService); + + this.updateTitle("Project"); + this.updateDescription("project, funding, open access, publications, datasets, "); + this.projectId = params['projectId']; console.info("Id is :"+this.projectId); if(this.projectId){ @@ -123,6 +124,9 @@ export class ProjectComponent{ this.createClipboard(); this.csvParams = "format=csv-special&page=0&type=publications&query=(((oaftype exact result) and (resulttypeid exact publication)) and (relprojectid exact "+this.projectId+"))&size="; + if (typeof document !== 'undefined') { + this.element.nativeElement.scrollIntoView(); + } }); } diff --git a/portal-2/src/app/landingPages/publication/publication.component.html b/portal-2/src/app/landingPages/publication/publication.component.html index 72b15d71..229b982c 100644 --- a/portal-2/src/app/landingPages/publication/publication.component.html +++ b/portal-2/src/app/landingPages/publication/publication.component.html @@ -174,7 +174,7 @@ Let us know how we are doing!

- +
@@ -190,7 +190,7 @@ Let us know how we are doing!

- + diff --git a/portal-2/src/app/landingPages/publication/publication.component.ts b/portal-2/src/app/landingPages/publication/publication.component.ts index 72043279..7bc147dc 100644 --- a/portal-2/src/app/landingPages/publication/publication.component.ts +++ b/portal-2/src/app/landingPages/publication/publication.component.ts @@ -1,4 +1,4 @@ -import {Component, ViewChild} from '@angular/core'; +import {Component, ViewChild, ElementRef} from '@angular/core'; import {Observable} from 'rxjs/Observable'; import {PublicationService} from './publication.service'; import {PublicationInfo} from '../../utils/entities/publicationInfo'; @@ -48,16 +48,19 @@ export class PublicationComponent { public errorMessage = ""; public routerHelper:RouterHelper = new RouterHelper(); - constructor (private _publicationService: PublicationService, + constructor ( private element: ElementRef, + private _publicationService: PublicationService, private route: ActivatedRoute, private _meta: Meta) { } ngOnInit() { this.sub = this.route.queryParams.subscribe(data => { + this.publicationInfo = null; + this.updateTitle("Publication"); + this.updateDescription("Publication, open access, collected from"); this.articleId = data['articleId']; console.info("Article id is :"+this.articleId); - this.updateTitle("Publication"); - this.updateDescription("Publication, open access, collected from"); + if(this.articleId){ this.getPublicationInfo(this.articleId); @@ -65,13 +68,16 @@ export class PublicationComponent { // switcher(UIkit); // } }else{ - console.info("Article id not found"); this.warningMessage="No valid publication id"; } this.metricsClicked = false; //this.viewsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"resOpenAIRETimeline", "resTitle":"'+this.articleId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"OpenAIRE","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]},{"query":"resRepoTimeline", "resTitle":"'+this.articleId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":[""],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column","column"]&stacking=normal&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'; this.viewsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"resViewsTimeline", "resTitle":"'+this.articleId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&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 = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"resRepoDownloadTimeline", "resTitle":"'+this.articleId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&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(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'; + + if (typeof document !== 'undefined') { + this.element.nativeElement.scrollIntoView(); + } }); } @@ -92,6 +98,7 @@ export class PublicationComponent { // this.result = {id: id, type :"dataset", source : "openaire", title: this.publicationInfo.title,url: '', result: '', accessRights: this.publicationInfo.bestlicense, embargoEndDate: ''}; this.updateTitle(this.publicationInfo.title.name); this.updateDescription("Dataset, search, repositories, open access,"+this.publicationInfo.title.name); + let bioentitiesNum = 0; if(this.publicationInfo.bioentities != undefined) { this.publicationInfo.bioentities.forEach(function (value, key, map) { @@ -146,7 +153,7 @@ export class PublicationComponent { if(item.title) { tooltipContent += "

"+item.title+"

"; } - if(item.code && item.code != "unidentified") { + if(item.code) { tooltipContent += "Project Code: "+item.code; } if(item.funderName || item.funderShortname) { @@ -166,7 +173,7 @@ export class PublicationComponent { tooltipContent += "
Funding: "+ item.funding + "
"; } - if(tooltipContent != "") { + if(tooltipContent) { tooltipContent = "
" + tooltipContent + "
"; } diff --git a/portal-2/src/app/landingPages/searchingProjectsInTab.component.ts b/portal-2/src/app/landingPages/searchingProjectsInTab.component.ts index 261fe824..5ae9f0b1 100644 --- a/portal-2/src/app/landingPages/searchingProjectsInTab.component.ts +++ b/portal-2/src/app/landingPages/searchingProjectsInTab.component.ts @@ -1,4 +1,5 @@ -import {Component, Input} from '@angular/core'; +import {Component} from '@angular/core'; +import {ActivatedRoute} from '@angular/router'; import { FetchProjects } from '../utils/fetchEntitiesClasses/fetchProjects.class'; import { SearchProjectsService } from '../services/searchProjects.service'; @@ -54,25 +55,36 @@ import {RouterHelper} from '../utils/routerHelper.class'; export class SearchingProjectsTabComponent { public fetchProjects : FetchProjects; - @Input() organizationId:string = ""; + public organizationId:string = ""; public page :number = 1; public size :number = 10; public linkToSearchProjects; private filterQuery:string = ""; + private sub: any; public routerHelper:RouterHelper = new RouterHelper(); - constructor (private _searchProjectsService: SearchProjectsService) { - this.fetchProjects = new FetchProjects(this._searchProjectsService); - + constructor (private route: ActivatedRoute, + private _searchProjectsService: SearchProjectsService) { } ngOnInit() { - this.linkToSearchProjects = OpenaireProperties.getLinkToAdvancedSearchProjects();//+"?organization="+this.organizationId+"or=and";; - this.search(true,""); + this.sub = this.route.queryParams.subscribe(params => { + this.organizationId = params['organizationId']; + + if(this.organizationId) { + this.fetchProjects = new FetchProjects(this._searchProjectsService); + + this.linkToSearchProjects = OpenaireProperties.getLinkToAdvancedSearchProjects();//+"?organization="+this.organizationId+"or=and";; + this.search(true,""); + } + }); } + ngOnDestroy() { + this.sub.unsubscribe(); + } search(refine:boolean, filterQuery:string){ var refineFields:string [] = ["funderid"]; diff --git a/portal-2/src/app/landingPages/tabTable.component.ts b/portal-2/src/app/landingPages/tabTable.component.ts index d3053d9c..b4bfe63c 100644 --- a/portal-2/src/app/landingPages/tabTable.component.ts +++ b/portal-2/src/app/landingPages/tabTable.component.ts @@ -19,17 +19,12 @@ import {OpenaireProperties} from '../utils/properties/openaireProperties'; - {{item['name']}} - - {{item['name']}} - - - @@ -37,11 +32,6 @@ import {OpenaireProperties} from '../utils/properties/openaireProperties'; {{item['name']}} - - {{item['name']}} - -

{{item['name']}}

({{item['date']}}) @@ -66,7 +56,6 @@ import {OpenaireProperties} from '../utils/properties/openaireProperties'; }) export class TabTableComponent { - @Input() from: string = "publication"; @Input() info: { "name": string, "url": string, "date": string, "trust": string}[];//Map; public routerHelper:RouterHelper = new RouterHelper(); diff --git a/portal-2/src/app/searchPages/searchUtils/searchResult.component.ts b/portal-2/src/app/searchPages/searchUtils/searchResult.component.ts index 1655a28a..23d86034 100644 --- a/portal-2/src/app/searchPages/searchUtils/searchResult.component.ts +++ b/portal-2/src/app/searchPages/searchUtils/searchResult.component.ts @@ -50,14 +50,13 @@ import {RouterHelper} from '../../utils/routerHelper.class'; Projects: - - + {{project['funderShortname']?project['funderShortname']:project['funderName']}} - | {{ project['acronym']?project['acronym']:project['title']}} ({{project.code}})

- {{project['funderShortname']?project['funderShortname']:project['funderName']}} - | {{ project['acronym']?project['acronym']:project['title']}} ({{project.code}})

{{project['funderShortname']?project['funderShortname']:project['funderName']}} | {{ project['acronym']?project['acronym']:project['title']}}({{project.code}}),
@@ -88,10 +87,10 @@ import {RouterHelper} from '../../utils/routerHelper.class'; Organizations: - + {{organization.name}} + *ngIf="!organization.id"> {{organization.name}}, @@ -120,7 +119,7 @@ import {RouterHelper} from '../../utils/routerHelper.class'; Compatibility: {{result.compatibility}} -
+
Countries: {{result.countries}}
diff --git a/portal-2/src/app/searchPages/searchUtils/tabResult.component.ts b/portal-2/src/app/searchPages/searchUtils/tabResult.component.ts index 1b82892a..5ca842ed 100644 --- a/portal-2/src/app/searchPages/searchUtils/tabResult.component.ts +++ b/portal-2/src/app/searchPages/searchUtils/tabResult.component.ts @@ -17,7 +17,7 @@ import {RouterHelper} from '../../utils/routerHelper.class'; - +

@@ -28,24 +28,12 @@ import {RouterHelper} from '../../utils/routerHelper.class'; [no title available]

- - -

-

-

- [no title available] -

-
- - {{author['name']}}; - - + {{author['name']}}; @@ -64,14 +52,13 @@ import {RouterHelper} from '../../utils/routerHelper.class'; Projects: - - + {{project['funderShortname']?project['funderShortname']:project['funderName']}} - | {{ project['acronym']?project['acronym']:project['title']}} ({{project.code}})

- {{project['funderShortname']?project['funderShortname']:project['funderName']}} - | {{ project['acronym']?project['acronym']:project['title']}} ({{project.code}})

{{project['funderShortname']?project['funderShortname']:project['funderName']}} | {{ project['acronym']?project['acronym']:project['title']}}({{project.code}}),
@@ -102,10 +89,10 @@ import {RouterHelper} from '../../utils/routerHelper.class'; Organizations: - + {{organization.name}} + *ngIf="!organization.id"> {{organization.name}}, @@ -134,7 +121,7 @@ import {RouterHelper} from '../../utils/routerHelper.class'; Compatibility: {{result.compatibility}}
-
+
Countries: {{result.countries}}
@@ -149,8 +136,6 @@ export class TabResultComponent { @Input() type: string; @Input() urlParam: string; @Input() showLoading: boolean = false; - @Input() lazy: string = "true"; - @Input() from: string = ""; public errorCodes:ErrorCodes = new ErrorCodes(); public routerHelper:RouterHelper = new RouterHelper(); diff --git a/portal-2/src/app/searchPages/simple/searchPublications.component.ts b/portal-2/src/app/searchPages/simple/searchPublications.component.ts index cb88b62e..06202a7a 100644 --- a/portal-2/src/app/searchPages/simple/searchPublications.component.ts +++ b/portal-2/src/app/searchPages/simple/searchPublications.component.ts @@ -87,29 +87,6 @@ export class SearchPublicationsComponent { } } -public getCSVResultsForEntity(entity:string, id:string): any { - let exportPublications = []; - exportPublications.push(//[exportPublications.length] = - [ - this.quote(["bli", "blo"]), - this.quote("bla"), - this.quote("bla"), - this.quote("bla"), - this.quote("bla"), - this.quote("bla"), - this.quote("bla"), - this.quote("bla"), - this.quote("bla"), - this.quote("blaaaaa") - ] - ); - return exportPublications; -} - -private quote(word: any): string { - return '"'+word+'"'; -} - public getResultsForEntity(entity:string, id:string, page: number, size: number){ var parameters = ""; diff --git a/portal-2/src/app/services/searchDatasets.service.ts b/portal-2/src/app/services/searchDatasets.service.ts index d84b2293..f83ee433 100644 --- a/portal-2/src/app/services/searchDatasets.service.ts +++ b/portal-2/src/app/services/searchDatasets.service.ts @@ -54,6 +54,33 @@ export class SearchDatasetsService { }) .map(res => this.parseResults(res)); } + + searchAggregators (id: string, params: string, refineParams:string, page: number, size: number ):any { + + let link = OpenaireProperties.getSearchAPIURLLast()+"datasets"; + + let url = link+"?"+"&format=json"; + if(params!= null && params != '' ) { + url += params; + } + if(refineParams!= null && refineParams != '' ) { + url += refineParams; + } + url += "&page="+(page-1)+"&size="+size; + + let key = url; + if (this._cache.has(key)) { + return Observable.of(this._cache.get(key)).map(res => this.parseRefineResults(id, res['refineResults'])); + } + + return this.http.get(url) + .map(res => res.json()) + .do(res => { + this._cache.set(key, res); + }) + .map(res => this.parseRefineResults(id, res['refineResults'])); + } + searchDatasetsByDois (DOIs: string[], refineParams:string, page: number, size: number, refineFields:string[] ):any { let link = OpenaireProperties.getSearchAPIURLLast()+"datasets"; let url = link+"?"; @@ -192,11 +219,18 @@ export class SearchDatasetsService { "code": "" } - result['projects'][countProjects]['id'] = - /*OpenaireProperties.getsearchLinkToProject() + */relation['to'].content; - result['projects'][countProjects]['acronym'] = relation.acronym; - result['projects'][countProjects]['title'] = relation.title; - result['projects'][countProjects]['code'] = relation.code; + if(relation.title != 'unidentified') { + result['projects'][countProjects]['id'] = + /*OpenaireProperties.getsearchLinkToProject() + */relation['to'].content; + result['projects'][countProjects]['acronym'] = relation.acronym; + result['projects'][countProjects]['title'] = relation.title; + result['projects'][countProjects]['code'] = relation.code; + } else { + result['projects'][countProjects]['id'] = ""; + result['projects'][countProjects]['acronym'] = ""; + result['projects'][countProjects]['title'] = ""; + result['projects'][countProjects]['code'] = ""; + } if(relation.hasOwnProperty("funding")) { let fundingLength = Array.isArray(relation['funding']) ? relation['funding'].length : 1; @@ -247,6 +281,28 @@ export class SearchDatasetsService { return results; } + parseRefineResults(id: string, data: any): any { + var results:any = []; + if(data.hasOwnProperty("resulthostingdatasource")) { + let length = Array.isArray(data['resulthostingdatasource']) ? data['resulthostingdatasource'].length : 1; + + for(let i=0; i { diff --git a/portal-2/src/app/utils/fetchEntitiesClasses/fetchDatasets.class.ts b/portal-2/src/app/utils/fetchEntitiesClasses/fetchDatasets.class.ts index 29e29462..feb1714f 100644 --- a/portal-2/src/app/utils/fetchEntitiesClasses/fetchDatasets.class.ts +++ b/portal-2/src/app/utils/fetchEntitiesClasses/fetchDatasets.class.ts @@ -76,6 +76,9 @@ export class FetchDatasets{ public getResultsForEntity(entity:string, id:string, page: number, size: number){ + var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = errorCodes.LOADING; + var parameters = ""; if(entity == "project") { @@ -112,6 +115,9 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number) } public getResultsForDataproviders(id:string, resultsFrom:string, page: number, size: number){ + var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = errorCodes.LOADING; + var parameters; if(resultsFrom == "collectedFrom") { parameters = "datasets?fq=collectedfromdatasourceid exact "+'"'+id+'"'; @@ -146,4 +152,30 @@ public getResultsForDataproviders(id:string, resultsFrom:string, page: number, s } } +public getAggregatorResults(id:string, page: number, size: number){ + var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = errorCodes.LOADING; + + this.subResults = this._searchDatasetsService.searchAggregators(id, '&fq=collectedfromdatasourceid exact "'+id+'"',"&refine=true&fields=resulthostingdatasource" , page, size).subscribe( + data => { + this.results = data; + + var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = errorCodes.DONE; + if(this.searchUtils.totalResults == 0 ){ + this.searchUtils.status = errorCodes.NONE; + } + }, + err => { + console.log(err); + //TODO check erros (service not available, bad request) + // if( ){ + // this.searchUtils.status = ErrorCodes.ERROR; + // } + var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = errorCodes.ERROR; + } + ); +} + } diff --git a/portal-2/src/app/utils/fetchEntitiesClasses/fetchProjects.class.ts b/portal-2/src/app/utils/fetchEntitiesClasses/fetchProjects.class.ts index 7c92cdd3..ce985a01 100644 --- a/portal-2/src/app/utils/fetchEntitiesClasses/fetchProjects.class.ts +++ b/portal-2/src/app/utils/fetchEntitiesClasses/fetchProjects.class.ts @@ -63,6 +63,8 @@ export class FetchProjects{ } public getResultsForDataproviders(id:string, page: number, size: number){ + var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = errorCodes.LOADING; this._searchProjectsService.getProjectsforDataProvider(id, page, size).subscribe( data => { @@ -89,6 +91,9 @@ export class FetchProjects{ } public getResultsForOrganizations(organizationId:string, filterquery:string, page: number, size: number, refineFields:string[]){ + var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = errorCodes.LOADING; + this._searchProjectsService.getProjectsForOrganizations(organizationId,filterquery, page, size,refineFields).subscribe( data => { this.searchUtils.totalResults = data[0]; // the results can be filtered so this number can be no total results diff --git a/portal-2/src/app/utils/fetchEntitiesClasses/fetchPublications.class.ts b/portal-2/src/app/utils/fetchEntitiesClasses/fetchPublications.class.ts index 069b1781..6be0bd48 100644 --- a/portal-2/src/app/utils/fetchEntitiesClasses/fetchPublications.class.ts +++ b/portal-2/src/app/utils/fetchEntitiesClasses/fetchPublications.class.ts @@ -88,30 +88,10 @@ export class FetchPublications { ); } -public getCSVResultsForEntity(entity:string, id:string): any { - let exportPublications = []; - exportPublications.push(//[exportPublications.length] = - [ - this.quote(["bli", "blo"]), - this.quote("bla"), - this.quote("bla"), - this.quote("bla"), - this.quote("bla"), - this.quote("bla"), - this.quote("bla"), - this.quote("bla"), - this.quote("bla"), - this.quote("blaaaaa") - ] - ); - return exportPublications; -} - -private quote(word: any): string { - return '"'+word+'"'; -} - public getResultsForEntity(entity:string, id:string, page: number, size: number){ + var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = errorCodes.LOADING; + var parameters = ""; if(entity == "project") { parameters = "projects/"+id; @@ -147,6 +127,9 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number) } public getResultsForDataproviders(id:string, resultsFrom:string, page: number, size: number){ + var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = errorCodes.LOADING; + var parameters; if(resultsFrom == "collectedFrom") { parameters = "publications?fq=collectedfromdatasourceid exact "+'"'+id+'"'; @@ -182,6 +165,9 @@ public getResultsForDataproviders(id:string, resultsFrom:string, page: number, s } public getAggregatorResults(id:string, page: number, size: number){ + var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = errorCodes.LOADING; + this.subResults = this._searchPublicationsService.searchAggregators(id, '&fq=collectedfromdatasourceid exact "'+id+'"',"&refine=true&fields=resulthostingdatasource" , page, size).subscribe( data => { this.results = data;