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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -3,9 +3,6 @@ import {ActivatedRoute, Router} from '@angular/router';
import {Location, TitleCasePipe} from '@angular/common';
import {Title, Meta} 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";
@ -13,9 +10,6 @@ import {EnvProperties} from '../openaireLibrary/utils/properties/e
import {ErrorCodes} from '../openaireLibrary/utils/properties/errorCodes';
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 {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
@ -33,7 +27,6 @@ import {PiwikHelper} from '../utils/piwikHelper';
export class StatisticsComponent {
public piwiksub: any;
public subfunders: any;
public pageTitle = "OpenAIRE";
@ -68,9 +61,6 @@ export class StatisticsComponent {
private _meta: Meta,
private _title: Title,
private _piwikService:PiwikService,
private config: ConfigurationService,
private _communityService:CommunityService,
private _communitiesService:CommunitiesService,
private _statisticsService: StatisticsService,
private _configService: ConfigurationService,
private titleCase: TitleCasePipe,

View File

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