From fbf296640dade7f7a078af230ecdacdc29cd8df0 Mon Sep 17 00:00:00 2001 From: "argiro.kokogiannaki" Date: Mon, 12 Jun 2017 12:48:05 +0000 Subject: [PATCH] Linking: in bulk mode search also in datacite, change the info layout git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@47473 d315682c-612b-4755-9ff5-7f18f6832af3 --- .../claimContextSearchForm.component.ts | 2 +- .../claims/claim-utils/claimEntities.class.ts | 63 ++++++++++++++ .../claimResultSearchForm.component.ts | 60 +------------- .../claimResultSearchForm.module.ts | 7 +- .../service/searchDatacite.service.ts | 16 ++++ .../linking/bulkClaim/bulkClaim.component.ts | 82 ++++++++++--------- .../linking/bulkClaim/bulkClaim.module.ts | 2 + .../linking/linkingGeneric.component.ts | 9 +- .../selected/selectedResults.component.ts | 1 + 9 files changed, 143 insertions(+), 99 deletions(-) diff --git a/portal-2/src/app/claims/claim-utils/claimContextSearchForm.component.ts b/portal-2/src/app/claims/claim-utils/claimContextSearchForm.component.ts index 9b11b618..801a8636 100644 --- a/portal-2/src/app/claims/claim-utils/claimContextSearchForm.component.ts +++ b/portal-2/src/app/claims/claim-utils/claimContextSearchForm.component.ts @@ -249,7 +249,6 @@ getCommunities () { console.log("displaySubcategory: "+id+" value:"+ this.conceptsClassDisplay[id]); } browseConcepts (categoryId) { - this.conceptsCategoryLoading[categoryId] = true; if(!Session.isValidAndRemove()){ this.saveStateAndRedirectLogin(); }else{ @@ -261,6 +260,7 @@ getCommunities () { } this.conceptsClass[categoryId] = []; var token=Session.getUserJwt(); + this.conceptsCategoryLoading[categoryId] = true; this._contextService.getConcepts(categoryId, "",token,false).subscribe( data => { for(var i=0;i 0 )?itemTitle[0]:itemTitle; + result.url = itemUrl; + result.accessRights = 'OPEN'; + result.date = date; + result.result = item; + if(item.publisher){ + result.publisher = item.publisher; + } + + if(itemSource == 'datacite'){ + + result.publisher = item.attributes['container-title']; + if(item.attributes.author){ + result.authors =[] + for(var i=0; i< item.attributes.author.length; i++){ + result.authors.push((item.attributes.author[i].family)?item.attributes.author[i].family+', '+item.attributes.author[i].given:item.attributes.author[i].literal); + } + } + + // result = {id: itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: 'OPEN', embargoEndDate: this.nextDate, date : date}; + }else if (itemSource == 'openaire'){ + //TODO put right access rights + // result = {id:itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: accessMode, embargoEndDate: this.nextDate, date: date}; + // result = {id:itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: accessmode, embargoEndDate: this.nextDate, date : date}; + result.embargoEndDate = accessmode; + + }else if(itemSource == 'crossref'){ + date = (date == null) ? null : date.substring(0,10); + result.date = date; + result.resourceType = item.type; + result.description = item.abstract; + if(item.author){ + result.authors =[] + for(var i=0; i< item.author.length; i++){ + result.authors.push(item.author[i].family +" "+ item.author[i].given ); + } + } + // result = {id: itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: 'OPEN', embargoEndDate: this.nextDate, date: date}; + }else if (itemSource == 'orcid'){ + date = (date == null) ? null : date + "-01.-01" + result.date = date; + if(item['work-type']){ + result.resourceType = item.type; + + } + if(item.contributors){ + result.authors =[] + for(var i=0; i< item.contributors.length; i++){ + result.authors.push(item.contributors[i]); + } + } + + } + return result; + } } export class ClaimProject{ public funderId: string; diff --git a/portal-2/src/app/claims/claim-utils/claimResultSearchForm.component.ts b/portal-2/src/app/claims/claim-utils/claimResultSearchForm.component.ts index 70b17c89..2ee4ff60 100644 --- a/portal-2/src/app/claims/claim-utils/claimResultSearchForm.component.ts +++ b/portal-2/src/app/claims/claim-utils/claimResultSearchForm.component.ts @@ -507,67 +507,15 @@ openaireDataPageChange($event) { } add(item, itemId,itemSource,itemType, itemUrl, itemTitle, date, accessmode){ + console.log(' adding ' + itemType + " From " + itemSource+" "+ itemTitle); - var result: ClaimResult = new ClaimResult(); - result.id = itemId; - result.type = itemType; - result.source = itemSource; + var result: ClaimResult = ClaimResult.generateResult(item, itemId,itemSource,itemType, itemUrl, itemTitle, date, accessmode); - result.title = (Array.isArray(itemTitle) && itemTitle.length > 0 )?itemTitle[0]:itemTitle; - result.url = itemUrl; - result.accessRights = 'OPEN'; - result.embargoEndDate = this.nextDate; - result.date = date; - result.result = item; - if(item.publisher){ - result.publisher = item.publisher; - } - if(itemSource == 'datacite'){ - - result.publisher = item.attributes['container-title']; - if(item.attributes.author){ - result.authors =[] - for(var i=0; i< item.attributes.author.length; i++){ - result.authors.push((item.attributes.author[i].family)?item.attributes.author[i].family+', '+item.attributes.author[i].given:item.attributes.author[i].literal); - } - } - - // result = {id: itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: 'OPEN', embargoEndDate: this.nextDate, date : date}; - }else if (itemSource == 'openaire'){ - //TODO put right access rights - // result = {id:itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: accessMode, embargoEndDate: this.nextDate, date: date}; - // result = {id:itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: accessmode, embargoEndDate: this.nextDate, date : date}; - result.embargoEndDate = accessmode; - - }else if(itemSource == 'crossref'){ - date = (date == null) ? null : date.substring(0,10); - result.date = date; - result.resourceType = item.type; - result.description = item.abstract; - if(item.author){ - result.authors =[] - for(var i=0; i< item.author.length; i++){ - result.authors.push(item.author[i].family +" "+ item.author[i].given ); - } - } - // result = {id: itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: 'OPEN', embargoEndDate: this.nextDate, date: date}; - }else if (itemSource == 'orcid'){ - date = (date == null) ? null : date + "-01.-01" - result.date = date; - if(item['work-type']){ - result.resourceType = item.type; - - } - if(item.contributors){ - result.authors =[] - for(var i=0; i< item.contributors.length; i++){ - result.authors.push(item.contributors[i]); - } - }else{ + if (itemSource == 'orcid'){ + if(result.authors.length ==0 ){ result.authors.push(this.authorGivenName + ', '+ this.authorFamilyName); } - // result = {id:itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: 'OPEN', embargoEndDate: this.nextDate, date: date}; } var found:boolean = this.isSelected( result.id); diff --git a/portal-2/src/app/claims/claim-utils/claimResultSearchForm.module.ts b/portal-2/src/app/claims/claim-utils/claimResultSearchForm.module.ts index a7874d35..201c91b2 100644 --- a/portal-2/src/app/claims/claim-utils/claimResultSearchForm.module.ts +++ b/portal-2/src/app/claims/claim-utils/claimResultSearchForm.module.ts @@ -4,7 +4,8 @@ import { SharedModule } from '../../shared/shared.module'; import { CommonModule } from '@angular/common'; import {ClaimResultSearchFormComponent} from './claimResultSearchForm.component'; -import {SearchDataciteService} from './service/searchDatacite.service'; +import {SearchDataciteServiceModule} from './service/searchDataciteService.module'; + import {SearchCrossrefServiceModule} from './service/searchCrossrefService.module'; import {SearchOrcidService} from './service/searchOrcid.service'; @@ -14,10 +15,10 @@ import {PagingModule } from '../../utils/paging.module'; @NgModule({ imports: [ - SharedModule, CommonModule, PublicationsServiceModule, DatasetsServiceModule, PagingModule, SearchCrossrefServiceModule + SharedModule, CommonModule, PublicationsServiceModule, DatasetsServiceModule, PagingModule, SearchCrossrefServiceModule, SearchDataciteServiceModule ], providers:[ - SearchDataciteService, SearchOrcidService + SearchOrcidService ], declarations: [ ClaimResultSearchFormComponent diff --git a/portal-2/src/app/claims/claim-utils/service/searchDatacite.service.ts b/portal-2/src/app/claims/claim-utils/service/searchDatacite.service.ts index 03d76067..5ad77b34 100644 --- a/portal-2/src/app/claims/claim-utils/service/searchDatacite.service.ts +++ b/portal-2/src/app/claims/claim-utils/service/searchDatacite.service.ts @@ -26,6 +26,22 @@ export class SearchDataciteService { }); //.catch(this.handleError); } + getDataciteResultByDOI (doi: string):any { + console.info("Fetch datacite resultt by DOI: "+doi); + let url = OpenaireProperties.getSearchDataciteAPIURL()+'/'+doi; + let key = url; + if (this._cache.has(key)) { + return Observable.of(this._cache.get(key)); + } + return this.http.get( url) + .map(request => request.json()) + .do(items => console.info(items)) + // .do(items => console.log("Datacite Results: total results = "+items.meta.total+" doi = "+doi)) + .do(res => { + this._cache.set(key, res); + }); + //.catch(this.handleError); + } private handleError (error: Response) { diff --git a/portal-2/src/app/claims/linking/bulkClaim/bulkClaim.component.ts b/portal-2/src/app/claims/linking/bulkClaim/bulkClaim.component.ts index 38f25a68..2fda7780 100644 --- a/portal-2/src/app/claims/linking/bulkClaim/bulkClaim.component.ts +++ b/portal-2/src/app/claims/linking/bulkClaim/bulkClaim.component.ts @@ -1,9 +1,12 @@ import {Component, Input, Output, EventEmitter,ViewChild} from '@angular/core'; import {Observable} from 'rxjs/Observable'; import {SearchCrossrefService} from '../../claim-utils/service/searchCrossref.service'; +import {SearchDataciteService} from '../../claim-utils/service/searchDatacite.service'; + import {ModalLoading} from '../../../utils/modal/loading.component'; import {Dates, DOI} from '../../../utils/string-utils.class'; import {OpenaireProperties} from '../../../utils/properties/openaireProperties'; +import {ClaimResult} from '../../claim-utils/claimEntities.class'; @Component({ @@ -11,15 +14,41 @@ import {OpenaireProperties} from '../../../utils/properties/openaireProperties'; template: `
+ + + + + + +
Upload a DOI csv file:
- +