From f07a66d9bc9de403a4ff909db7ad2f890a05cf32 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Thu, 20 Oct 2016 10:37:43 +0000 Subject: [PATCH] Show results in Deposit Result Page (query for organization's name and url - query for data providers of this organization) git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@44274 d315682c-612b-4755-9ff5-7f18f6832af3 --- portal-2/package.json | 1 - portal-2/src/app.browser.module.ts | 1 + portal-2/src/app.node.module.ts | 1 + portal-2/src/app/deposit/deposit.component.ts | 6 +- .../app/deposit/depositResult.component.ts | 81 ++++++++++++------- .../organization/organization.component.ts | 4 +- 6 files changed, 58 insertions(+), 36 deletions(-) diff --git a/portal-2/package.json b/portal-2/package.json index 4ca373ca..8c46b8db 100644 --- a/portal-2/package.json +++ b/portal-2/package.json @@ -47,7 +47,6 @@ "bootstrap": "^4.0.0-alpha.4", "express": "^4.14.0", "methods": "~1.1.2", - "ng2-webstorage": "^1.2.2", "preboot": "~4.5.2", "rxjs": "5.0.0-beta.12", "zone.js": "~0.6.25" diff --git a/portal-2/src/app.browser.module.ts b/portal-2/src/app.browser.module.ts index 1a420589..8754dac8 100644 --- a/portal-2/src/app.browser.module.ts +++ b/portal-2/src/app.browser.module.ts @@ -43,6 +43,7 @@ import {TestComponent} from './app/test/test.component'; TestComponent ], providers: [ + ] }) export class MainModule { diff --git a/portal-2/src/app.node.module.ts b/portal-2/src/app.node.module.ts index 1b2c3bae..dedc030f 100644 --- a/portal-2/src/app.node.module.ts +++ b/portal-2/src/app.node.module.ts @@ -44,6 +44,7 @@ import {TestComponent} from './app/test/test.component'; TestComponent ], providers: [ + ] }) export class MainModule { diff --git a/portal-2/src/app/deposit/deposit.component.ts b/portal-2/src/app/deposit/deposit.component.ts index 5defe9e2..96fb824a 100644 --- a/portal-2/src/app/deposit/deposit.component.ts +++ b/portal-2/src/app/deposit/deposit.component.ts @@ -47,6 +47,7 @@ import {OpenaireProperties} from '../utils/properties/openaireProperties'; export class DepositComponent { private keyword: string=''; + private organizationId: string='dedup_wf_001%3A%3A44cb3a714d104139c37beb7580070b96'; private openAccess: string; private openAccessRepo: string; private fp7Guidlines: string; @@ -55,6 +56,8 @@ export class DepositComponent { private helpdesk: string; constructor (private _router: Router) { + console.info("constructor deposit"); + this.openAccess = OpenaireProperties.getOpenAccess(); this.openAccessRepo = OpenaireProperties.getOpenAccessRepo(); this.fp7Guidlines = OpenaireProperties.getFP7Guidlines(); @@ -65,7 +68,6 @@ export class DepositComponent { keywordChanged() { console.info("keywordChanged: "+this.keyword); - - this._router.navigate( ['deposit-results'] );//, {"name": this.keyword}] ); + this._router.navigate( ['deposit-results'], { queryParams: { "organizationId": this.organizationId } } ); } } diff --git a/portal-2/src/app/deposit/depositResult.component.ts b/portal-2/src/app/deposit/depositResult.component.ts index 558e6694..99e98caf 100644 --- a/portal-2/src/app/deposit/depositResult.component.ts +++ b/portal-2/src/app/deposit/depositResult.component.ts @@ -7,6 +7,8 @@ import { SearchDataprovidersComponent } from '../searchPages/searchDataproviders import { SearchDataprovidersService } from '../services/searchDataproviders.service'; import { SearchResultComponent } from '../searchPages/searchUtils/searchResult.component'; +import {OrganizationService} from '../services/organization.service'; + @Component({ selector: 'depositResult', template: ` @@ -23,10 +25,7 @@ import { SearchResultComponent } from '../searchPages/searchUtils/searchResult.c {{organization['name']}} -

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

+
@@ -37,22 +36,21 @@ import { SearchResultComponent } from '../searchPages/searchUtils/searchResult.c
- No data providers found - - for institution: - - {{organization['name']}} - - {{organization['name']}} - - - for institution with ID: - - {{organizationId}} - - - . -
+
+ No data providers found + + for institution: + + {{organization['name']}} + + {{organization['name']}} + + . +
+
+ No organization with ID: {{organizationId}} found. +
+ You can still deposit your publications and/or research data in OpenAIRE's Zenodo catch-all repository hosted by CERN. @@ -62,10 +60,10 @@ import { SearchResultComponent } from '../searchPages/searchUtils/searchResult.c }) export class DepositResultComponent { - @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; + private organization: {"name": string, "url": string}; + private organizationId: string; + sub: any; subDataproviders: any; private searchDataprovidersComponent : SearchDataprovidersComponent; @@ -74,7 +72,8 @@ export class DepositResultComponent { private zenodo: string; constructor (private route: ActivatedRoute, - private _searchDataprovidersService: SearchDataprovidersService) { + private _searchDataprovidersService: SearchDataprovidersService, + private _organizationService: OrganizationService) { console.info("depositResult constructor"); this.zenodo = OpenaireProperties.getZenodoURL(); @@ -84,17 +83,20 @@ export class DepositResultComponent { ngOnInit() { console.info('depositResult init'); - if(this.organizationId != undefined) { - this.url = OpenaireProperties.getsearchLinkToOrganization()+this.organizationId; - } - - this.subDataproviders = this.route.queryParams.subscribe(params => { - this.searchDataproviders(); + this.sub = this.route.queryParams.subscribe(params => { + this.organizationId = params['organizationId']; + console.info("Id is :"+this.organizationId); + if(this.organizationId){ + this.getOrganizationInfo(); + } }); } ngOnDestroy() { - this.subDataproviders.unsubscribe(); + this.sub.unsubscribe(); + if(this.subDataproviders != undefined) { + this.subDataproviders.unsubscribe(); + } } private searchDataproviders() { @@ -105,4 +107,21 @@ export class DepositResultComponent { } this.linkToSearchDataproviders = OpenaireProperties.getLinkToSearchDataProviders(); } + + private getOrganizationInfo () { + console.info("inside getOrganizationInfo of component"); + + this._organizationService.getOrganizationInfo(this.organizationId).subscribe( + data => { + this.organization = data.title; + this.subDataproviders = this.route.queryParams.subscribe(params => { + this.searchDataproviders(); + }); + }, + err => { + console.error(err) + console.info("error"); + } + ); + } } diff --git a/portal-2/src/app/landingPages/organization/organization.component.ts b/portal-2/src/app/landingPages/organization/organization.component.ts index 5f4013df..f42a16f9 100644 --- a/portal-2/src/app/landingPages/organization/organization.component.ts +++ b/portal-2/src/app/landingPages/organization/organization.component.ts @@ -47,7 +47,7 @@ export class OrganizationComponent { if(this.organizationId){ this.getOrganizationInfo(); }else{ - this.warningMessage="No valid project id"; + this.warningMessage="No valid organization id"; } }); @@ -63,7 +63,7 @@ export class OrganizationComponent { } private getOrganizationInfo () { - console.info("inside getProjectInfo of component"); + console.info("inside getOrganizationInfo of component"); this.warningMessage = ''; this.errorMessage=""