From b830fb2a789f45adb4525a563cbd4139a5d2cc37 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Wed, 4 Apr 2018 12:35:31 +0000 Subject: [PATCH] 1. Add searchDataproviders.service and searchProjects.service in openaireLibrary/connect. 2. Remove connect/approvedByCommunity/approved.service.ts: Duplicate of searchDataproviders.service. 3. approved.component: Use searchDataproviders.service from openaireLibrary/connect/contentProviders/ folder. git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@51659 d315682c-612b-4755-9ff5-7f18f6832af3 --- .../approvedByCommunity/approved.component.ts | 4 ++-- .../approvedByCommunity/approved.module.ts | 8 +++----- .../searchDataproviders.service.ts} | 2 +- .../searchDataprovidersService.module.ts | 20 +++++++++++++++++++ connect/projects/searchProjects.service.ts | 15 ++++++++++++++ .../projects/searchProjectsService.module.ts | 20 +++++++++++++++++++ 6 files changed, 61 insertions(+), 8 deletions(-) rename connect/{approvedByCommunity/approved.service.ts => contentProviders/searchDataproviders.service.ts} (91%) create mode 100644 connect/contentProviders/searchDataprovidersService.module.ts create mode 100644 connect/projects/searchProjects.service.ts create mode 100644 connect/projects/searchProjectsService.module.ts diff --git a/connect/approvedByCommunity/approved.component.ts b/connect/approvedByCommunity/approved.component.ts index 5c087943..9b2ae14a 100644 --- a/connect/approvedByCommunity/approved.component.ts +++ b/connect/approvedByCommunity/approved.component.ts @@ -4,7 +4,7 @@ import { ActivatedRoute } from '@angular/router'; import { EnvProperties} from '../../utils/properties/env-properties'; import {ConnectHelper} from '../connectHelper'; -import {ApprovedByCommunityService} from './approved.service'; +import {SearchCommunityDataprovidersService} from '../contentProviders/searchDataproviders.service'; @Component({ selector: 'approved-by-community', @@ -22,7 +22,7 @@ export class ApprovedByCommunityComponent { properties:EnvProperties; - constructor (private route: ActivatedRoute, private _searchDataprovidersService: ApprovedByCommunityService) {} + constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchCommunityDataprovidersService) {} public ngOnInit() { this.route.data diff --git a/connect/approvedByCommunity/approved.module.ts b/connect/approvedByCommunity/approved.module.ts index 95f8b149..17a6c835 100644 --- a/connect/approvedByCommunity/approved.module.ts +++ b/connect/approvedByCommunity/approved.module.ts @@ -3,18 +3,16 @@ import { CommonModule } from '@angular/common'; import { RouterModule } from '@angular/router'; import { ApprovedByCommunityComponent } from './approved.component'; -import { ApprovedByCommunityService } from './approved.service'; +import { SearchDataprovidersServiceModule } from '../contentProviders/searchDataprovidersService.module'; @NgModule({ imports: [ - CommonModule, RouterModule + CommonModule, RouterModule, SearchDataprovidersServiceModule ], declarations: [ ApprovedByCommunityComponent ], - providers:[ - ApprovedByCommunityService - ], + providers:[], exports: [ ApprovedByCommunityComponent ] diff --git a/connect/approvedByCommunity/approved.service.ts b/connect/contentProviders/searchDataproviders.service.ts similarity index 91% rename from connect/approvedByCommunity/approved.service.ts rename to connect/contentProviders/searchDataproviders.service.ts index f1a7c08d..acd2b9fa 100644 --- a/connect/approvedByCommunity/approved.service.ts +++ b/connect/contentProviders/searchDataproviders.service.ts @@ -3,7 +3,7 @@ import {Http} from '@angular/http'; import{EnvProperties} from '../../utils/properties/env-properties'; @Injectable() -export class ApprovedByCommunityService { +export class SearchCommunityDataprovidersService { constructor(private http: Http ) {} searchDataproviders (properties:EnvProperties, communityId: string):any { diff --git a/connect/contentProviders/searchDataprovidersService.module.ts b/connect/contentProviders/searchDataprovidersService.module.ts new file mode 100644 index 00000000..3c33cf74 --- /dev/null +++ b/connect/contentProviders/searchDataprovidersService.module.ts @@ -0,0 +1,20 @@ +import { NgModule} from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; + +import {SearchCommunityDataprovidersService} from './searchDataproviders.service'; + + +@NgModule({ + imports: [ + CommonModule, FormsModule + ], + declarations: [ + ], + providers:[ + SearchCommunityDataprovidersService +], + exports: [ + ] +}) +export class SearchDataprovidersServiceModule { } diff --git a/connect/projects/searchProjects.service.ts b/connect/projects/searchProjects.service.ts new file mode 100644 index 00000000..ae5255ca --- /dev/null +++ b/connect/projects/searchProjects.service.ts @@ -0,0 +1,15 @@ +import {Injectable} from '@angular/core'; +import {Http} from '@angular/http'; +import{EnvProperties} from '../../utils/properties/env-properties'; + +@Injectable() +export class SearchCommunityProjectsService { + constructor(private http: Http ) {} + + searchProjects (properties:EnvProperties, communityId: string):any { + let url = properties.communityAPI+communityId+"/projects"; + + return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) + .map(res => res.json()) + } +} diff --git a/connect/projects/searchProjectsService.module.ts b/connect/projects/searchProjectsService.module.ts new file mode 100644 index 00000000..58f0201b --- /dev/null +++ b/connect/projects/searchProjectsService.module.ts @@ -0,0 +1,20 @@ +import { NgModule} from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; + +import {SearchCommunityProjectsService} from './searchProjects.service'; + + +@NgModule({ + imports: [ + CommonModule, FormsModule + ], + declarations: [ + ], + providers:[ + SearchCommunityProjectsService +], + exports: [ + ] +}) +export class SearchProjectsServiceModule { }