[Trunk|Connect]: 1. Remove some no used services from communitiesModule and StatisticModule. 2. Initialize communities only on app component and use getCommunitiesState to get communities.

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@55401 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
k.triantafyllou 2019-04-18 12:50:14 +00:00
parent a9f725c2f3
commit 1880857303
8 changed files with 10 additions and 48 deletions

View File

@ -70,8 +70,8 @@ export class AppComponent {
this.propertiesService.loadEnvironment() this.propertiesService.loadEnvironment()
.then(es => { .then(es => {
this.properties = this.propertiesService.envSpecific; this.properties = this.propertiesService.envSpecific;
var communityId: string = ""; var communityId: string = "";
this._communitiesService.updateCommunities(this.properties, this.properties.communitiesAPI);
if(this.properties.environment == "development") { if(this.properties.environment == "development") {
this.route.queryParams.subscribe(data => { this.route.queryParams.subscribe(data => {
communityId = data['communityId']; communityId = data['communityId'];
@ -245,7 +245,7 @@ export class AppComponent {
var community = null; var community = null;
this.community = null; this.community = null;
this.showMenu = false; this.showMenu = false;
this._communitiesService.getCommunities(this.properties, this.properties.communitiesAPI).subscribe ( this._communitiesService.getCommunitiesState().subscribe (
communities => { communities => {
for(var com of communities){ for(var com of communities){
if( (communityId && communityId!="" && com.communityId == communityId if( (communityId && communityId!="" && com.communityId == communityId
@ -254,7 +254,6 @@ export class AppComponent {
!(communityId && communityId!="" && com.communityId == communityId) !(communityId && communityId!="" && com.communityId == communityId)
&& &&
this.managerOfCommunities && this.subscriberOfCommunities)) { this.managerOfCommunities && this.subscriberOfCommunities)) {
break; break;
} }
if(Session.isLoggedIn() && com['status'] != "hidden"){ if(Session.isLoggedIn() && com['status'] != "hidden"){
@ -314,7 +313,6 @@ export class AppComponent {
items: [] items: []
} }
]; ];
} }
} }

View File

@ -1,18 +1,9 @@
import {Component, Input, Output, EventEmitter} from '@angular/core'; import {Component} from '@angular/core';
import {ViewChild, ChangeDetectionStrategy} from '@angular/core';
import {ViewEncapsulation} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router'; import {ActivatedRoute, Router} from '@angular/router';
import {Location} from '@angular/common';
import {Title, Meta} from '@angular/platform-browser'; import {Title, Meta} from '@angular/platform-browser';
import {Observable} from 'rxjs/Observable';
import "rxjs/add/observable/zip"; import "rxjs/add/observable/zip";
import {ConnectHelper} from '../openaireLibrary/connect/connectHelper';
import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties'; import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties';
import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service';
import {CommunitiesService} from '../openaireLibrary/connect/communities/communities.service'; import {CommunitiesService} from '../openaireLibrary/connect/communities/communities.service';
import {SubscribeService} from '../openaireLibrary/utils/subscribe/subscribe.service'; import {SubscribeService} from '../openaireLibrary/utils/subscribe/subscribe.service';
import {CommunityInfo} from '../openaireLibrary/connect/community/communityInfo'; import {CommunityInfo} from '../openaireLibrary/connect/community/communityInfo';
@ -31,13 +22,8 @@ import {ErrorMessagesComponent} from '../openaireLibrary/utils/e
export class CommunitiesComponent { export class CommunitiesComponent {
public piwiksub: any; public piwiksub: any;
public subfunders: any;
public pageTitle = "OpenAIRE" public pageTitle = "OpenAIRE"
public communitiesResults = null;
public communitiesToShow = null;
public researchCommunities = []; public researchCommunities = [];
public researchInitiatives = []; public researchInitiatives = [];
public subscriberOfCommunities = []; public subscriberOfCommunities = [];
@ -56,13 +42,11 @@ export class CommunitiesComponent {
constructor ( constructor (
private route: ActivatedRoute, private route: ActivatedRoute,
private _router: Router, private _router: Router,
private location: Location,
private _meta: Meta, private _meta: Meta,
private _title: Title, private _title: Title,
private _piwikService:PiwikService, private _piwikService:PiwikService,
private _communitiesService:CommunitiesService, private _communitiesService:CommunitiesService,
private _subscribeService: SubscribeService, private _subscribeService: SubscribeService) {
private config: ConfigurationService) {
var description = "OpenAIRE - Connect, Community Dashboard, research community"; var description = "OpenAIRE - Connect, Community Dashboard, research community";
var title = "OpenAIRE - Connect"; var title = "OpenAIRE - Connect";
@ -101,7 +85,7 @@ export class CommunitiesComponent {
this.subscriberOfCommunities = []; this.subscriberOfCommunities = [];
this.managerOfCommunities = []; this.managerOfCommunities = [];
this._communitiesService.getCommunities(this.properties, this.properties.communitiesAPI).subscribe( this._communitiesService.getCommunitiesState().subscribe(
communitiesResults => { communitiesResults => {
//this.communitiesResults = communitiesResults; //this.communitiesResults = communitiesResults;
//this.communitiesToShow = this.communitiesResults.slice(); //this.communitiesToShow = this.communitiesResults.slice();

View File

@ -2,8 +2,6 @@ import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common'; import {CommonModule} from '@angular/common';
import {FormsModule} from '@angular/forms'; import {FormsModule} from '@angular/forms';
import {RouterModule} from '@angular/router'; import {RouterModule} from '@angular/router';
// import {CommunitiesRoutingModule} from './communities-routing.module';
import {SubscribeModule} from '../utils/subscribe/subscribe.module'; import {SubscribeModule} from '../utils/subscribe/subscribe.module';
import {ManageModule} from '../openaireLibrary/utils/manage/manage.module'; import {ManageModule} from '../openaireLibrary/utils/manage/manage.module';
@ -14,7 +12,6 @@ import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousR
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service'; import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service'; import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service';
import {CommunitiesService} from '../openaireLibrary/connect/communities/communities.service';
import {ErrorMessagesModule} from '../openaireLibrary/utils/errorMessages.module'; import {ErrorMessagesModule} from '../openaireLibrary/utils/errorMessages.module';
import {SearchFormModule} from '../openaireLibrary/searchPages/searchUtils/searchForm.module'; import {SearchFormModule} from '../openaireLibrary/searchPages/searchUtils/searchForm.module';
@ -22,7 +19,6 @@ import {BrowseCommunityModule} from './browseCommunity/browse-community.modul
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, FormsModule, RouterModule, CommonModule, FormsModule, RouterModule,
// CommunitiesRoutingModule,
SubscribeModule, ManageModule, ErrorMessagesModule, SubscribeModule, ManageModule, ErrorMessagesModule,
SearchFormModule, BrowseCommunityModule SearchFormModule, BrowseCommunityModule
], ],
@ -31,7 +27,7 @@ import {BrowseCommunityModule} from './browseCommunity/browse-community.modul
], ],
providers:[ providers:[
FreeGuard, PreviousRouteRecorder, ConfigurationService, FreeGuard, PreviousRouteRecorder, ConfigurationService,
PiwikService, CommunitiesService PiwikService
], ],
exports: [ exports: [
CommunitiesComponent CommunitiesComponent

View File

@ -2,8 +2,6 @@ import { NgModule} from '@angular/core';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms'; import { FormsModule } from '@angular/forms';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
// import{CommunityRoutingModule} from './community-routing.module';
import{CommunityComponent} from './community.component'; import{CommunityComponent} from './community.component';
import {ResultsComponent} from '../searchEntries/results/results.component'; import {ResultsComponent} from '../searchEntries/results/results.component';
@ -26,7 +24,6 @@ import {SearchFormModule} from '../openaireLibrary/searchPages/searchUti
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, FormsModule, RouterModule, CommonModule, FormsModule, RouterModule,
// CommunityRoutingModule,
SubscribeModule, StatisticsModule, ManageModule, InviteModule, SubscribeModule, StatisticsModule, ManageModule, InviteModule,
SearchZenodoCommunitiesServiceModule, ZenodoCommunitiesServiceModule, SearchFormModule SearchZenodoCommunitiesServiceModule, ZenodoCommunitiesServiceModule, SearchFormModule
], ],

View File

@ -102,7 +102,7 @@ export class SearchCommunitiesComponent {
* @param params * @param params
*/ */
private initCommunities(params: Map<string, string>) { private initCommunities(params: Map<string, string>) {
this.subResults = this._communitiesService.getCommunities(this.properties, this.properties.communitiesAPI).subscribe( this.subResults = this._communitiesService.getCommunitiesState().subscribe(
data => { data => {
let observables: Observable<boolean>[] = []; let observables: Observable<boolean>[] = [];
for(let i = 0; i < data.length; i++) { for(let i = 0; i < data.length; i++) {

View File

@ -19,7 +19,7 @@ import {PiwikService} from "../../openaireLibrary/utils/piwik/piwik.service";
declarations: [ declarations: [
SearchCommunitiesComponent SearchCommunitiesComponent
], ],
providers:[CommunitiesService, SubscribeService, PreviousRouteRecorder, PiwikService], providers:[ SubscribeService, PreviousRouteRecorder, PiwikService],
exports: [ exports: [
SearchCommunitiesComponent SearchCommunitiesComponent
] ]

View File

@ -3,9 +3,6 @@ import {ActivatedRoute, Router} from '@angular/router';
import {Location, TitleCasePipe} from '@angular/common'; import {Location, TitleCasePipe} from '@angular/common';
import {Title, Meta} from '@angular/platform-browser'; import {Title, Meta} from '@angular/platform-browser';
import {DomSanitizer} from '@angular/platform-browser'; import {DomSanitizer} from '@angular/platform-browser';
import {SafeResourceUrl, SafeUrl} from '@angular/platform-browser';
import {Observable} from 'rxjs/Observable';
import "rxjs/add/observable/zip"; import "rxjs/add/observable/zip";
@ -13,9 +10,6 @@ import {EnvProperties} from '../openaireLibrary/utils/properties/e
import {ErrorCodes} from '../openaireLibrary/utils/properties/errorCodes'; import {ErrorCodes} from '../openaireLibrary/utils/properties/errorCodes';
import {StatisticsService} from '../utils/services/statistics.service'; import {StatisticsService} from '../utils/services/statistics.service';
import {CommunityService} from "../openaireLibrary/connect/community/community.service";
import {CommunitiesService} from "../openaireLibrary/connect/communities/communities.service";
import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service'; import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service';
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service'; import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
@ -33,7 +27,6 @@ import {PiwikHelper} from '../utils/piwikHelper';
export class StatisticsComponent { export class StatisticsComponent {
public piwiksub: any; public piwiksub: any;
public subfunders: any;
public pageTitle = "OpenAIRE"; public pageTitle = "OpenAIRE";
@ -68,9 +61,6 @@ export class StatisticsComponent {
private _meta: Meta, private _meta: Meta,
private _title: Title, private _title: Title,
private _piwikService:PiwikService, private _piwikService:PiwikService,
private config: ConfigurationService,
private _communityService:CommunityService,
private _communitiesService:CommunitiesService,
private _statisticsService: StatisticsService, private _statisticsService: StatisticsService,
private _configService: ConfigurationService, private _configService: ConfigurationService,
private titleCase: TitleCasePipe, private titleCase: TitleCasePipe,

View File

@ -9,10 +9,7 @@ import {IFrameModule} from '../openaireLibrary/utils/iframe.modul
import {StatisticsComponent, StatisticsForDashboardComponent} from './statistics.component'; import {StatisticsComponent, StatisticsForDashboardComponent} from './statistics.component';
import {StatisticsService} from '../utils/services/statistics.service'; import {StatisticsService} from '../utils/services/statistics.service';
import {CommunityService} from '../openaireLibrary/connect/community/community.service';
import {CommunitiesService} from '../openaireLibrary/connect/communities/communities.service';
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service'; import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service';
import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard'; import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
@ -28,8 +25,8 @@ import {IsRouteEnabled} from '../openaireLibrary/error/isRouteEnabled.guard'
StatisticsForDashboardComponent StatisticsForDashboardComponent
], ],
providers: [ providers: [
IsRouteEnabled, FreeGuard, PreviousRouteRecorder, ConfigurationService, IsRouteEnabled, FreeGuard, PreviousRouteRecorder,
PiwikService, CommunityService, CommunitiesService, StatisticsService, TitleCasePipe PiwikService, StatisticsService, TitleCasePipe
], ],
exports: [ exports: [
StatisticsForDashboardComponent StatisticsForDashboardComponent