From a6db6539f8a90c02f1d3fd781dc4f2c960947621 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Fri, 14 Oct 2016 13:35:48 +0000 Subject: [PATCH] Show results in Deposit Result Page (organization is currently hardcoded: name+url or id) | array checks in services corrected (length > 1 was not the right way) git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@44084 d315682c-612b-4755-9ff5-7f18f6832af3 --- portal-2/src/app/deposit/deposit.component.ts | 1 + portal-2/src/app/deposit/deposit.module.ts | 5 ++ .../app/deposit/depositResult.component.ts | 84 ++++++++++++++++--- portal-2/src/app/services/dataset.service.ts | 2 +- .../src/app/services/publication.service.ts | 2 +- .../services/searchDataproviders.service.ts | 6 +- .../services/searchOrganizations.service.ts | 4 +- .../src/app/services/searchPeople.service.ts | 2 +- .../app/services/searchProjects.service.ts | 6 +- .../services/searchPublications.service.ts | 8 +- 10 files changed, 93 insertions(+), 27 deletions(-) diff --git a/portal-2/src/app/deposit/deposit.component.ts b/portal-2/src/app/deposit/deposit.component.ts index 1b67df04..5defe9e2 100644 --- a/portal-2/src/app/deposit/deposit.component.ts +++ b/portal-2/src/app/deposit/deposit.component.ts @@ -65,6 +65,7 @@ export class DepositComponent { keywordChanged() { console.info("keywordChanged: "+this.keyword); + this._router.navigate( ['deposit-results'] );//, {"name": this.keyword}] ); } } diff --git a/portal-2/src/app/deposit/deposit.module.ts b/portal-2/src/app/deposit/deposit.module.ts index 27127f30..02dab982 100644 --- a/portal-2/src/app/deposit/deposit.module.ts +++ b/portal-2/src/app/deposit/deposit.module.ts @@ -7,12 +7,17 @@ import { UtilsModule} from '../utils/utils.module' import { DepositComponent } from './deposit.component'; import {DepositResultComponent} from './depositResult.component'; +import {ServicesModule} from '../services/services.module'; +import {SearchModule} from '../searchPages/search.module'; + //helpers @NgModule({ imports: [ CommonModule, FormsModule, UtilsModule, + ServicesModule, + SearchModule ], declarations: [ DepositComponent, diff --git a/portal-2/src/app/deposit/depositResult.component.ts b/portal-2/src/app/deposit/depositResult.component.ts index c7100344..558e6694 100644 --- a/portal-2/src/app/deposit/depositResult.component.ts +++ b/portal-2/src/app/deposit/depositResult.component.ts @@ -2,6 +2,11 @@ import {Component, Input} from '@angular/core'; import {Observable} from 'rxjs/Observable'; import {OpenaireProperties} from '../utils/properties/openaireProperties'; +import { ActivatedRoute } from '@angular/router'; +import { SearchDataprovidersComponent } from '../searchPages/searchDataproviders.component'; +import { SearchDataprovidersService } from '../services/searchDataproviders.service'; +import { SearchResultComponent } from '../searchPages/searchUtils/searchResult.component'; + @Component({ selector: 'depositResult', template: ` @@ -10,23 +15,43 @@ import {OpenaireProperties} from '../utils/properties/openaireProperties';

Deposit Publications

-
-

+
+

Data providers for institution: - + {{organization['name']}} {{organization['name']}}

+

+ Data providers for institution with ID: + {{organizationId}} +

-
+

Please use the information/contacts shown below to deposit your publications.

- + + +
-
- No data providers found. +
+ No data providers found + + for institution: + + {{organization['name']}} + + {{organization['name']}} + + + for institution with ID: + + {{organizationId}} + + + .
You can still deposit your publications and/or research data in OpenAIRE's Zenodo catch-all repository @@ -37,12 +62,47 @@ import {OpenaireProperties} from '../utils/properties/openaireProperties'; }) export class DepositResultComponent { - @Input() organization: {"name": string, "url": string}; - private dataProviders: { "name": string, "url": string, "type": string, "websiteUrl": string, - "organizations": {"name": string, "url": string}[]}[]; + @Input() organization: {"name": string, "url": string};// = {"name": "NTUA", "url": OpenaireProperties.getsearchLinkToOrganization()+"dedup_wf_001%3A%3A44cb3a714d104139c37beb7580070b96"}; + @Input() organizationId: string;// = "dedup_wf_001%3A%3A44cb3a714d104139c37beb7580070b96"; + url: string; + + subDataproviders: any; + + private searchDataprovidersComponent : SearchDataprovidersComponent; + private linkToSearchDataproviders = ""; + private zenodo: string; - constructor () { - this.zenodo = OpenaireProperties.getZenodoURL(); + constructor (private route: ActivatedRoute, + private _searchDataprovidersService: SearchDataprovidersService) { + console.info("depositResult constructor"); + + this.zenodo = OpenaireProperties.getZenodoURL(); + this.searchDataprovidersComponent = new SearchDataprovidersComponent(this.route, this._searchDataprovidersService); + } + + ngOnInit() { + console.info('depositResult init'); + + if(this.organizationId != undefined) { + this.url = OpenaireProperties.getsearchLinkToOrganization()+this.organizationId; + } + + this.subDataproviders = this.route.queryParams.subscribe(params => { + this.searchDataproviders(); + }); + } + + ngOnDestroy() { + this.subDataproviders.unsubscribe(); + } + + private searchDataproviders() { + if(this.organization != undefined) { + this.searchDataprovidersComponent.getResults(this.organization.name, 1, 10, "searchPage"); + } else if(this.organizationId != undefined) { + this.searchDataprovidersComponent.getResults(this.organizationId, 1, 10, "organizationPage"); + } + this.linkToSearchDataproviders = OpenaireProperties.getLinkToSearchDataProviders(); } } diff --git a/portal-2/src/app/services/dataset.service.ts b/portal-2/src/app/services/dataset.service.ts index e22c3df7..ba9ed851 100644 --- a/portal-2/src/app/services/dataset.service.ts +++ b/portal-2/src/app/services/dataset.service.ts @@ -109,7 +109,7 @@ export class DatasetService { for(let j=0; j 1 ? mydata['funding'][j] : mydata['funding']; + let mydata1 = Array.isArray(mydata['funding']) ? mydata['funding'][j] : mydata['funding']; if(mydata1.hasOwnProperty("funder")) { this.datasetInfo.fundedByProjects[counter]['funderShortname'] = mydata1['funder'].shortname; diff --git a/portal-2/src/app/services/publication.service.ts b/portal-2/src/app/services/publication.service.ts index 3608973f..fac78e3f 100644 --- a/portal-2/src/app/services/publication.service.ts +++ b/portal-2/src/app/services/publication.service.ts @@ -110,7 +110,7 @@ export class PublicationService { for(let j=0; j 1 ? mydata['funding'][j] : mydata['funding']; + let mydata1 = Array.isArray(mydata['funding']) ? mydata['funding'][j] : mydata['funding']; if(mydata1.hasOwnProperty("funder")) { this.publicationInfo.fundedByProjects[counter]['funderShortname'] = mydata1['funder'].shortname; diff --git a/portal-2/src/app/services/searchDataproviders.service.ts b/portal-2/src/app/services/searchDataproviders.service.ts index bfb0d8cc..e9846dfa 100644 --- a/portal-2/src/app/services/searchDataproviders.service.ts +++ b/portal-2/src/app/services/searchDataproviders.service.ts @@ -42,7 +42,7 @@ export class SearchDataprovidersService { let length = Array.isArray(data) ? data.length : 1; for(let i=0; i 1 ? data[i]['result']['metadata']['oaf:entity']['oaf:datasource'] : data['result']['metadata']['oaf:entity']['oaf:datasource']; + let resData = Array.isArray(data) ? data[i]['result']['metadata']['oaf:entity']['oaf:datasource'] : data['result']['metadata']['oaf:entity']['oaf:datasource']; var result: SearchResult = new SearchResult(); @@ -51,7 +51,7 @@ export class SearchDataprovidersService { result['title'].name = resData.officialname; result['title'].url = OpenaireProperties.getsearchLinkToDataProvider(); - result['title'].url += length > 1 ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier']; + result['title'].url += Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier']; if(resData['datasourcetype'].hasOwnProperty("classname")) { result['type'] = resData['datasourcetype'].classname; @@ -72,7 +72,7 @@ export class SearchDataprovidersService { let relLength = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'].length : 1; for(let i=0; i 1 ? resData['rels']['rel'][i] : resData['rels']['rel']; + let relation = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'][i] : resData['rels']['rel']; if(relation.hasOwnProperty("to")) { if(relation['to'].class == "provides" && relation['to'].type == "organization") { diff --git a/portal-2/src/app/services/searchOrganizations.service.ts b/portal-2/src/app/services/searchOrganizations.service.ts index 9ee3d6ba..d89ec5d0 100644 --- a/portal-2/src/app/services/searchOrganizations.service.ts +++ b/portal-2/src/app/services/searchOrganizations.service.ts @@ -58,7 +58,7 @@ export class SearchOrganizationsService { let relLength = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'].length : 1; for(let j=0; j 1 ? resData['rels']['rel'][j] : resData['rels']['rel']; + let relation = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'][j] : resData['rels']['rel']; if(relation.hasOwnProperty("to")) { if(relation['to'].class == "isParticipant") { @@ -88,7 +88,7 @@ export class SearchOrganizationsService { let fundingLength = Array.isArray(relation['funding']) ? relation['funding'].length : 1; for(let z=0; z 1 ? relation['funding'][z] : relation['funding']; + let fundingData = Array.isArray(relation['funding']) ? relation['funding'][z] : relation['funding']; if(fundingData.hasOwnProperty("funder")) { result['projects'][countProjects]['funderShortname'] = fundingData['funder'].shortname; diff --git a/portal-2/src/app/services/searchPeople.service.ts b/portal-2/src/app/services/searchPeople.service.ts index 9596ec98..c1a26196 100644 --- a/portal-2/src/app/services/searchPeople.service.ts +++ b/portal-2/src/app/services/searchPeople.service.ts @@ -37,7 +37,7 @@ export class SearchPeopleService { let length = Array.isArray(data) ? data.length : 1; for(let i=0; i 1 ? data[i]['result']['metadata']['oaf:entity']['oaf:person'] : data['result']['metadata']['oaf:entity']['oaf:person']; + let resData = Array.isArray(data) ? data[i]['result']['metadata']['oaf:entity']['oaf:person'] : data['result']['metadata']['oaf:entity']['oaf:person']; var result: SearchResult = new SearchResult(); diff --git a/portal-2/src/app/services/searchProjects.service.ts b/portal-2/src/app/services/searchProjects.service.ts index b0b63862..8d08b5ce 100644 --- a/portal-2/src/app/services/searchProjects.service.ts +++ b/portal-2/src/app/services/searchProjects.service.ts @@ -38,7 +38,7 @@ export class SearchProjectsService { let length = Array.isArray(data) ? data.length : 1; for(let i=0; i 1 ? data[i]['result']['metadata']['oaf:entity']['oaf:project'] : data['result']['metadata']['oaf:entity']['oaf:project']; + let resData = Array.isArray(data) ? data[i]['result']['metadata']['oaf:entity']['oaf:project'] : data['result']['metadata']['oaf:entity']['oaf:project']; var result: SearchResult = new SearchResult(); @@ -63,7 +63,7 @@ export class SearchProjectsService { let relLength = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'].length : 1; for(let j=0; j 1 ? resData['rels']['rel'][j] : resData['rels']['rel']; + let relation = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'][j] : resData['rels']['rel']; if(relation.hasOwnProperty("to")) { if(relation['to'].class == "hasParticipant") { @@ -96,7 +96,7 @@ export class SearchProjectsService { let fundingLength = Array.isArray(resData['fundingtree']) ? resData['fundingtree'].length : 1; for(let z=0; z 1 ? resData['fundingtree'][z] : resData['fundingtree']; + let fundingData = Array.isArray(resData['fundingtree']) ? resData['fundingtree'][z] : resData['fundingtree']; let countFunders = result['funders'].length; if(fundingData.hasOwnProperty("funder")) { result['funders'][countFunders] = {"funderShortname": "", "funderName": ""}; diff --git a/portal-2/src/app/services/searchPublications.service.ts b/portal-2/src/app/services/searchPublications.service.ts index 8f5aec73..7908e3ed 100644 --- a/portal-2/src/app/services/searchPublications.service.ts +++ b/portal-2/src/app/services/searchPublications.service.ts @@ -47,7 +47,7 @@ export class SearchPublicationsService { let length = Array.isArray(data) ? data.length : 1; for(let i=0; i 1 ? data[i]['result']['metadata']['oaf:entity']['oaf:result'] : data['result']['metadata']['oaf:entity']['oaf:result']; + let resData = Array.isArray(data) ? data[i]['result']['metadata']['oaf:entity']['oaf:result'] : data['result']['metadata']['oaf:entity']['oaf:result']; var result: SearchResult = new SearchResult(); @@ -64,7 +64,7 @@ export class SearchPublicationsService { } result['title'].url = OpenaireProperties.getsearchLinkToPublication(); - result['title'].url += length > 1 ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier']; + result['title'].url += Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier']; if(resData['bestlicense'].hasOwnProperty("classid")) { result['title'].accessMode = resData['bestlicense'].classid; } @@ -73,7 +73,7 @@ export class SearchPublicationsService { let relLength = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'].length : 1; for(let j=0; j 1 ? resData['rels']['rel'][j] : resData['rels']['rel']; + let relation = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'][j] : resData['rels']['rel']; if(relation.hasOwnProperty("to")) { if(relation['to'].class == "hasAuthor") { @@ -109,7 +109,7 @@ export class SearchPublicationsService { let fundingLength = Array.isArray(relation['funding']) ? relation['funding'].length : 1; for(let z=0; z 1 ? relation['funding'][z] : relation['funding']; + let fundingData = Array.isArray(relation['funding']) ? relation['funding'][z] : relation['funding']; if(fundingData.hasOwnProperty("funder")) { result['projects'][countProjects]['funderShortname'] = fundingData['funder'].shortname;