From 22f772851bea41c233861a65d7cdf26049a9a28e Mon Sep 17 00:00:00 2001 From: "argiro.kokogiannaki" Date: Wed, 1 Mar 2017 10:29:24 +0000 Subject: [PATCH] enable inline linking from landing pages pubs/data -> contexts/ projects, project -> pubs/data git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@46078 d315682c-612b-4755-9ff5-7f18f6832af3 --- .../claim-utils/claimDataset.component.ts | 2 +- .../claim-utils/claimPublication.component.ts | 6 +- .../linking/linkingGeneric.component.ts | 118 +++++++++++------- .../claims/linking/linkingGeneric.module.ts | 10 +- .../selected/selectedDatasets.component.ts | 15 ++- .../selectedPublications.component.ts | 4 +- .../dataset/dataset.component.html | 16 ++- .../landingPages/dataset/dataset.component.ts | 2 + .../landingPages/dataset/dataset.module.ts | 3 +- .../project/project.component.html | 6 +- .../landingPages/project/project.component.ts | 2 + .../landingPages/project/project.module.ts | 3 +- .../publication/publication.component.html | 4 +- .../publication/publication.component.ts | 3 +- .../publication/publication.module.ts | 3 +- .../app/services/searchDatasets.service.ts | 15 +++ .../services/searchPublications.service.ts | 14 +++ .../entitiesAutoComplete.module.ts | 6 +- .../entitySearch.service.ts | 8 ++ .../entitySearchService.module.ts | 18 +++ .../utils/properties/openaireProperties.ts | 11 +- portal-2/src/server.routes.ts | 5 +- 22 files changed, 187 insertions(+), 87 deletions(-) create mode 100644 portal-2/src/app/utils/entitiesAutoComplete/entitySearchService.module.ts diff --git a/portal-2/src/app/claims/claim-utils/claimDataset.component.ts b/portal-2/src/app/claims/claim-utils/claimDataset.component.ts index a8a1b83b..17aa2058 100644 --- a/portal-2/src/app/claims/claim-utils/claimDataset.component.ts +++ b/portal-2/src/app/claims/claim-utils/claimDataset.component.ts @@ -65,7 +65,7 @@ import{DOI} from '../../utils/string-utils.class'; - Publisher: {{result.publisher}}({{result.year}}) + Publisher: {{result.publisher}}({{result.year}})
Authors: {{author.name}}{{(i < (result.authors.length-1))?"; ":""}}
diff --git a/portal-2/src/app/claims/claim-utils/claimPublication.component.ts b/portal-2/src/app/claims/claim-utils/claimPublication.component.ts index d8242f28..b01b205d 100644 --- a/portal-2/src/app/claims/claim-utils/claimPublication.component.ts +++ b/portal-2/src/app/claims/claim-utils/claimPublication.component.ts @@ -332,13 +332,13 @@ private getCrossrefResults (term: string, size : number, page : number) { var result: ClaimResult ; if(itemSource == 'crossref'){ date = (date == null) ? null : date.substring(0,10); - result = {id: id, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: 'OPEN', embargoEndDate: this.nextDate, date}; + result = {id: id, 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 = {id:id, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: 'OPEN', embargoEndDate: this.nextDate, date}; + result = {id:id, 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:id, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: accessMode, embargoEndDate: null, date}; + result = {id:id, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: accessMode, embargoEndDate: null, date: date}; } console.info("Added result:"+result.date); diff --git a/portal-2/src/app/claims/linking/linkingGeneric.component.ts b/portal-2/src/app/claims/linking/linkingGeneric.component.ts index 2fac7d80..bb02a94d 100644 --- a/portal-2/src/app/claims/linking/linkingGeneric.component.ts +++ b/portal-2/src/app/claims/linking/linkingGeneric.component.ts @@ -1,10 +1,13 @@ import {Component, Input} from '@angular/core'; import {Observable} from 'rxjs/Observable'; -import { Router } from '@angular/router'; +import {ActivatedRoute, Router} from '@angular/router'; +import {EntitiesSearchService} from '../../utils/entitiesAutoComplete/entitySearch.service'; +import {ClaimProject, ClaimResult} from '../claim-utils/claimEntities.class'; +import {SearchPublicationsService} from '../../services/searchPublications.service'; +import {SearchDatasetsService} from '../../services/searchDatasets.service'; @Component({ selector: 'linking-generic', - //providers: [MdRadioDispatcher], template: `
- +
diff --git a/portal-2/src/app/landingPages/dataset/dataset.component.ts b/portal-2/src/app/landingPages/dataset/dataset.component.ts index af37ff94..ee282ff7 100644 --- a/portal-2/src/app/landingPages/dataset/dataset.component.ts +++ b/portal-2/src/app/landingPages/dataset/dataset.component.ts @@ -4,6 +4,7 @@ import {DatasetService} from './dataset.service'; import {DatasetInfo} from '../../utils/entities/datasetInfo'; import {ActivatedRoute} from '@angular/router'; import {OpenaireProperties} from '../../utils/properties/openaireProperties' +import {RouterHelper} from '../../utils/routerHelper.class'; @Component({ selector: 'dataset', @@ -28,6 +29,7 @@ export class DatasetComponent { public warningMessage = ""; public errorMessage = ""; + public routerHelper:RouterHelper = new RouterHelper(); constructor (private _datasetService: DatasetService, private route: ActivatedRoute) {} diff --git a/portal-2/src/app/landingPages/dataset/dataset.module.ts b/portal-2/src/app/landingPages/dataset/dataset.module.ts index 37c25a7c..80d34b16 100644 --- a/portal-2/src/app/landingPages/dataset/dataset.module.ts +++ b/portal-2/src/app/landingPages/dataset/dataset.module.ts @@ -3,6 +3,7 @@ import { NgModule} from '@angular/core'; import { CommonModule } from '@angular/common'; import { FormsModule } from '@angular/forms'; import { SharedModule } from '../../shared/shared.module'; +import { RouterModule } from '@angular/router'; import { DatasetService} from './dataset.service'; import { DatasetComponent } from './dataset.component'; @@ -17,7 +18,7 @@ import { LandingModule } from '../landing.module'; @NgModule({ imports: [ //MaterialModule.forRoot(), - CommonModule, FormsModule,SharedModule, LandingModule, + CommonModule, FormsModule,SharedModule, RouterModule, LandingModule, ResultLandingModule, DatasetRoutingModule, MetricsModule, IFrameModule, AltMetricsModule ], declarations: [ diff --git a/portal-2/src/app/landingPages/project/project.component.html b/portal-2/src/app/landingPages/project/project.component.html index f250e7a8..6d23dbd6 100644 --- a/portal-2/src/app/landingPages/project/project.component.html +++ b/portal-2/src/app/landingPages/project/project.component.html @@ -191,7 +191,11 @@ {{projectInfo.funder}} progress report (CSV) - +
  • + + Link to research results + +
  • Deposit Publications diff --git a/portal-2/src/app/landingPages/project/project.component.ts b/portal-2/src/app/landingPages/project/project.component.ts index 65b52744..911b0fbd 100644 --- a/portal-2/src/app/landingPages/project/project.component.ts +++ b/portal-2/src/app/landingPages/project/project.component.ts @@ -3,6 +3,7 @@ import {Observable} from 'rxjs/Observable'; import {ActivatedRoute, Params} from '@angular/router'; import {ProjectService} from './project.service'; import {ProjectInfo} from '../../utils/entities/projectInfo'; +import {RouterHelper} from '../../utils/routerHelper.class'; import { FetchPublications } from '../../utils/fetchEntitiesClasses/fetchPublications.class'; @@ -49,6 +50,7 @@ export class ProjectComponent{ public linkToSearchPublications = ""; public fetchDatasets : FetchDatasets; public linkToSearchDatasets = ""; + public routerHelper:RouterHelper = new RouterHelper(); constructor (private _projectService: ProjectService, private route: ActivatedRoute, diff --git a/portal-2/src/app/landingPages/project/project.module.ts b/portal-2/src/app/landingPages/project/project.module.ts index 71028d44..7105ec05 100644 --- a/portal-2/src/app/landingPages/project/project.module.ts +++ b/portal-2/src/app/landingPages/project/project.module.ts @@ -2,6 +2,7 @@ import { NgModule} from '@angular/core'; import { CommonModule } from '@angular/common'; import { FormsModule } from '@angular/forms'; +import { RouterModule } from '@angular/router'; import { ProjectServiceModule} from './projectService.module'; // import {HtmlProgressReportService} from './htmlProgressReport.service'; @@ -18,7 +19,7 @@ import { LandingModule } from '../landing.module'; @NgModule({ imports: [ - CommonModule, FormsModule, LandingModule, + CommonModule, FormsModule, RouterModule, LandingModule, ProjectRoutingModule, SearchResultsModule, IFrameModule, MetricsModule, ReportsServiceModule, PublicationsServiceModule, DatasetsServiceModule, ProjectServiceModule ], diff --git a/portal-2/src/app/landingPages/publication/publication.component.html b/portal-2/src/app/landingPages/publication/publication.component.html index 039e8bf0..43e82d60 100644 --- a/portal-2/src/app/landingPages/publication/publication.component.html +++ b/portal-2/src/app/landingPages/publication/publication.component.html @@ -360,10 +360,11 @@ View more +
    Add links to projects
  • -
  • +
  • Related to
    @@ -378,6 +379,7 @@ : {{item['labelConcept']}}
    +
    Add links to contexts
  • diff --git a/portal-2/src/app/landingPages/publication/publication.component.ts b/portal-2/src/app/landingPages/publication/publication.component.ts index da7dc7ba..461a02b8 100644 --- a/portal-2/src/app/landingPages/publication/publication.component.ts +++ b/portal-2/src/app/landingPages/publication/publication.component.ts @@ -4,6 +4,7 @@ import {PublicationService} from './publication.service'; import {PublicationInfo} from '../../utils/entities/publicationInfo'; import {ActivatedRoute} from '@angular/router'; import {OpenaireProperties} from '../../utils/properties/openaireProperties'; +import {RouterHelper} from '../../utils/routerHelper.class'; @Component({ selector: 'publication', @@ -40,7 +41,7 @@ export class PublicationComponent { public warningMessage = ""; public errorMessage = ""; - + public routerHelper:RouterHelper = new RouterHelper(); constructor (private _publicationService: PublicationService, private route: ActivatedRoute) {} diff --git a/portal-2/src/app/landingPages/publication/publication.module.ts b/portal-2/src/app/landingPages/publication/publication.module.ts index a3d61386..0a6322c1 100644 --- a/portal-2/src/app/landingPages/publication/publication.module.ts +++ b/portal-2/src/app/landingPages/publication/publication.module.ts @@ -3,6 +3,7 @@ import { NgModule} from '@angular/core'; import { CommonModule } from '@angular/common'; import { FormsModule } from '@angular/forms'; import { SharedModule } from '../../shared/shared.module'; +import { RouterModule } from '@angular/router'; import { PublicationService} from './publication.service'; import { PublicationComponent } from './publication.component'; @@ -17,7 +18,7 @@ import { LandingModule } from '../landing.module'; @NgModule({ imports: [ - CommonModule, FormsModule, LandingModule,SharedModule, + CommonModule, FormsModule, LandingModule,SharedModule, RouterModule, ResultLandingModule, PublicationRoutingModule, IFrameModule, MetricsModule, AltMetricsModule ], declarations: [ diff --git a/portal-2/src/app/services/searchDatasets.service.ts b/portal-2/src/app/services/searchDatasets.service.ts index b4df5e21..c6add1aa 100644 --- a/portal-2/src/app/services/searchDatasets.service.ts +++ b/portal-2/src/app/services/searchDatasets.service.ts @@ -39,6 +39,21 @@ export class SearchDatasetsService { }) .map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "dataset")]); } + searchDatasetById (id: string ):any { + + let url = OpenaireProperties.getSearchAPIURLLast()+"datasets/"+id+"?format=json"; + let key = url+"-searchById"; + if (this._cache.has(key)) { + return Observable.of(this._cache.get(key)).map(res => this.parseResults(res)); + } + + return this.http.get(url) + .map(res => res.json()) + .do(res => { + this._cache.set(key, res); + }) + .map(res => this.parseResults(res)); + } searchDatasetsByDois (DOIs: string[], refineParams:string, page: number, size: number, refineFields:string[] ):any { let link = OpenaireProperties.getSearchAPIURLLast()+"datasets"; let url = link+"?"; diff --git a/portal-2/src/app/services/searchPublications.service.ts b/portal-2/src/app/services/searchPublications.service.ts index 479ca305..e3fbff5d 100644 --- a/portal-2/src/app/services/searchPublications.service.ts +++ b/portal-2/src/app/services/searchPublications.service.ts @@ -42,6 +42,20 @@ export class SearchPublicationsService { }) .map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "publication")]); } + searchPublicationById (id: string ):any { + + let url = OpenaireProperties.getSearchAPIURLLast()+"publications/"+id+"?format=json"; + let key =url+"-searchById"; + if (this._cache.has(key)) { + return Observable.of(this._cache.get(key)).map(res => this.parseResults(res)); + } + return this.http.get(url) + .map(res => res.json()) + .do(res => { + this._cache.set(key, res); + }) + .map(res => this.parseResults(res)); + } searchAggregators (params: string, refineParams:string, page: number, size: number ):any { diff --git a/portal-2/src/app/utils/entitiesAutoComplete/entitiesAutoComplete.module.ts b/portal-2/src/app/utils/entitiesAutoComplete/entitiesAutoComplete.module.ts index 6d3c5b00..af8e0697 100644 --- a/portal-2/src/app/utils/entitiesAutoComplete/entitiesAutoComplete.module.ts +++ b/portal-2/src/app/utils/entitiesAutoComplete/entitiesAutoComplete.module.ts @@ -3,12 +3,12 @@ import { CommonModule } from '@angular/common'; import { FormsModule } from '@angular/forms'; import {EntitiesAutocompleteComponent} from './entitiesAutoComplete.component'; -import {EntitiesSearchService} from './entitySearch.service'; +import {EntitySearchServiceModule} from './entitySearchService.module'; @NgModule({ imports: [ - CommonModule, FormsModule + CommonModule, FormsModule, EntitySearchServiceModule ], declarations: [ EntitiesAutocompleteComponent @@ -16,6 +16,6 @@ import {EntitiesSearchService} from './entitySearch.service'; exports: [ EntitiesAutocompleteComponent ], - providers:[ EntitiesSearchService] + providers:[ ] }) export class EntitiesAutocompleteModule { } diff --git a/portal-2/src/app/utils/entitiesAutoComplete/entitySearch.service.ts b/portal-2/src/app/utils/entitiesAutoComplete/entitySearch.service.ts index d4468dec..1fe273d3 100644 --- a/portal-2/src/app/utils/entitiesAutoComplete/entitySearch.service.ts +++ b/portal-2/src/app/utils/entitiesAutoComplete/entitySearch.service.ts @@ -139,6 +139,10 @@ private fetch (link,id,oafEntityType,type){ } else { value.label = resData['title']; } + if(oafEntityType=="oaf:result"){ + value.label = value.label.content; + value.result = resData; + } }else if(resData["fullname"]){ if(Array.isArray(resData["fullname"])) { value.label = resData["fullname"][0]; @@ -169,6 +173,8 @@ private fetch (link,id,oafEntityType,type){ value.projectName = value.label; value.endDate = null; value.startDate = null; + value.funderId = resData['fundingtree']['funder']['id']; + value.funderName = resData['fundingtree']['funder']['shortname']; if(resData.hasOwnProperty("startdate")) { value.startDate = resData.startdate.split('-')[0]; } @@ -177,6 +183,8 @@ private fetch (link,id,oafEntityType,type){ } } + console.info("add:"+value.label+" "+value.id); + array.push(value); } console.info("Parsing results.... Size:"+array.length); diff --git a/portal-2/src/app/utils/entitiesAutoComplete/entitySearchService.module.ts b/portal-2/src/app/utils/entitiesAutoComplete/entitySearchService.module.ts new file mode 100644 index 00000000..8cb6823e --- /dev/null +++ b/portal-2/src/app/utils/entitiesAutoComplete/entitySearchService.module.ts @@ -0,0 +1,18 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; + + import {EntitiesSearchService} from './entitySearch.service'; + + +@NgModule({ + imports: [ + CommonModule, FormsModule + ], + declarations: [ + ], + exports: [ + ], + providers:[ EntitiesSearchService] +}) +export class EntitySearchServiceModule { } diff --git a/portal-2/src/app/utils/properties/openaireProperties.ts b/portal-2/src/app/utils/properties/openaireProperties.ts index ee1de612..67c8b7aa 100644 --- a/portal-2/src/app/utils/properties/openaireProperties.ts +++ b/portal-2/src/app/utils/properties/openaireProperties.ts @@ -25,6 +25,7 @@ export class OpenaireProperties { public static searchLinkToAdvancedPeople = "search/advanced/people"; //http://beta.services.openaire.eu:8480/search/ +//http://rudie.di.uoa.gr:6081/dnet-functionality-services-2.0.0-SNAPSHOT // Services - APIs private static metricsAPIURL = "http://vatopedi.di.uoa.gr:8080/stats/"; @@ -37,23 +38,23 @@ export class OpenaireProperties { // private static searchAPIURL = " http://beta.services.openaire.eu/search/v2/api/"; // private searchAPIURL = "http://beta.services.openaire.eu:8480/search/rest/v2.0/api/"; - private static searchAPIURL = "http://rudie.di.uoa.gr:6081/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/"; + private static searchAPIURL = "http://beta.services.openaire.eu:8480/search/rest/v2/api/"; //"http://scoobydoo.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/"; // private static searchAPIURLLAst = " http://beta.services.openaire.eu/search/v2/api/"; - private static searchAPIURLLAst = "http://rudie.di.uoa.gr:6081/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/"; + private static searchAPIURLLAst = "http://beta.services.openaire.eu:8480/search/rest/v2/api/"; //private static searchAPIURLLAst = "http://scoobydoo.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/"; //private static searchAPIURLLAst = "http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/"; // private static searchResourcesAPIURL = " http://beta.services.openaire.eu/search/v2/api/resources"; - private static searchResourcesAPIURL = "http://rudie.di.uoa.gr:6081/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/resources"; + private static searchResourcesAPIURL = "http://beta.services.openaire.eu:8480/search/rest/v2/api/resources"; //private static searchServiveURL = "http://astero.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/"; - private static searchServiveURL = "http://rudie.di.uoa.gr:6081/dnet-functionality-services-2.0.0-SNAPSHOT/rest/"; + private static searchServiveURL = "http://beta.services.openaire.eu:8480/search/rest/"; // private static searchServiveURL = "http://services.openaire.eu:8380/search/"; // private static searchServiveURL = "http://beta.services.openaire.eu:8480/search/"; - private static csvAPIURL = "http://rudie.di.uoa.gr:6081/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/";//publications?format=csv + private static csvAPIURL = "http://beta.services.openaire.eu:8480/search/rest/v2/api/";//publications?format=csv private static searchCrossrefAPIURL = "http://api.crossref.org/works"; private static searchDataciteAPIURL = "https://search.datacite.org/api"; diff --git a/portal-2/src/server.routes.ts b/portal-2/src/server.routes.ts index b6869d81..cd9bd822 100644 --- a/portal-2/src/server.routes.ts +++ b/portal-2/src/server.routes.ts @@ -15,8 +15,9 @@ export const routes: string[] = [ 'search/find/people','search/find/publications','search/find/projects','search/find/datasets','search/find/dataproviders','search/find/organizations', 'search/advanced/people','search/advanced/publications','search/advanced/projects','search/advanced/datasets','search/advanced/dataproviders','search/advanced/organizations', 'deposit-publications','deposit-datasets','deposit-publications-result','deposit-datasets-result', - 'search/data-providers','search/entity-registries', 'login', + 'search/data-providers','search/entity-registries', + 'claims','myclaims','linking', 'bulk-linking', 'test', - 'error' + 'error', 'login' ];