[Trunk | Connect]:

1. app.module.ts & directLinking.module.ts & linkingGeneric.module.ts & community.module.ts & deposit.module.ts & 
   searchDataprovidersToDeposit.module.ts & shareInZenodo.module.ts & subjects.module.ts &
   invite.module.ts & inviteBasic.module.ts & subscribe.module.ts:
	Remove CommunityService from providers (singleton service, providedIn: 'root').
2. community.component.ts & curators.component.ts & deposit.component.ts & 
   searchDataprovidersToDeposit.component.ts & shareInZenodo.component.ts & statistics.component.ts & subjects.component.ts & 
   invite.component.ts & subscribe.component.ts:
	Get community from state (call communityService.getCommunityByState) | Add subscriptions in array to unsubscribe in ngOnDestroy |  Get properties from environment (no service needed).


git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@59141 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2020-07-16 23:25:23 +00:00
parent b4df338564
commit d71892ed9e
20 changed files with 445 additions and 469 deletions

View File

@ -51,7 +51,6 @@ import {PageURLResolverModule} from "./openaireLibrary/utils/pageURLResolver.mod
exports: [ AppComponent ], exports: [ AppComponent ],
providers:[ providers:[
EnvironmentSpecificResolver, CommunitiesService, LayoutService, SubscribeService, EnvironmentSpecificResolver, CommunitiesService, LayoutService, SubscribeService,
//FreeGuard, PreviousRouteRecorder, PiwikService, CommunityService,
{ {
provide: HTTP_INTERCEPTORS, provide: HTTP_INTERCEPTORS,
useClass: HttpInterceptorService, useClass: HttpInterceptorService,

View File

@ -8,13 +8,12 @@ import {LoginGuard} from '../../openaireLibrary/login/loginGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard'; import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard';
import {ConnectSubscriberGuard} from '../../openaireLibrary/connect/communityGuard/connectSubscriber.guard'; import {ConnectSubscriberGuard} from '../../openaireLibrary/connect/communityGuard/connectSubscriber.guard';
import {CommunityService} from '../../openaireLibrary/connect/community/community.service';
@NgModule({ @NgModule({
imports: [ imports: [
SharedModule, DirectLinkingModule, DirectLinkingRoutingModule SharedModule, DirectLinkingModule, DirectLinkingRoutingModule
], ],
providers:[LoginGuard, PreviousRouteRecorder, IsRouteEnabled, ConnectSubscriberGuard, CommunityService], providers:[LoginGuard, PreviousRouteRecorder, IsRouteEnabled, ConnectSubscriberGuard],
declarations: [ declarations: [
OpenaireDirectLinkingComponent OpenaireDirectLinkingComponent
], exports:[OpenaireDirectLinkingComponent] ], exports:[OpenaireDirectLinkingComponent]

View File

@ -3,18 +3,17 @@ import { NgModule } from '@angular/core';
import { SharedModule } from '../../shared/shared.module'; import { SharedModule } from '../../shared/shared.module';
import {OpenaireLinkingComponent} from './linkingGeneric.component'; import {OpenaireLinkingComponent} from './linkingGeneric.component';
import {LinkingRoutingModule} from './linking-routing.module'; import {LinkingRoutingModule} from './linking-routing.module';
import{ LinkingGenericModule} from '../../openaireLibrary/claims/linking/linkingGeneric.module'; import {LinkingGenericModule} from '../../openaireLibrary/claims/linking/linkingGeneric.module';
import {LoginGuard} from '../../openaireLibrary/login/loginGuard.guard'; import {LoginGuard} from '../../openaireLibrary/login/loginGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard'; import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard';
import {ConnectSubscriberGuard} from '../../openaireLibrary/connect/communityGuard/connectSubscriber.guard'; import {ConnectSubscriberGuard} from '../../openaireLibrary/connect/communityGuard/connectSubscriber.guard';
import {CommunityService} from '../../openaireLibrary/connect/community/community.service';
@NgModule({ @NgModule({
imports: [ imports: [
SharedModule, LinkingRoutingModule, LinkingGenericModule SharedModule, LinkingRoutingModule, LinkingGenericModule
], ],
providers:[LoginGuard, PreviousRouteRecorder, IsRouteEnabled, ConnectSubscriberGuard, CommunityService], providers:[LoginGuard, PreviousRouteRecorder, IsRouteEnabled, ConnectSubscriberGuard],
declarations: [ declarations: [
OpenaireLinkingComponent OpenaireLinkingComponent
], exports:[ ], exports:[

View File

@ -26,6 +26,7 @@ import {SearchCustomFilter} from "../openaireLibrary/searchPages/searchUtils/sea
import {FetchResearchResults} from "../openaireLibrary/utils/fetchEntitiesClasses/fetchResearchResults.class"; import {FetchResearchResults} from "../openaireLibrary/utils/fetchEntitiesClasses/fetchResearchResults.class";
import {ErrorCodes} from "../openaireLibrary/utils/properties/errorCodes"; import {ErrorCodes} from "../openaireLibrary/utils/properties/errorCodes";
import {Subscription} from "rxjs"; import {Subscription} from "rxjs";
import {properties} from "../../environments/environment";
@Component({ @Component({
selector: 'community', selector: 'community',
@ -143,124 +144,121 @@ export class CommunityComponent {
} }
public ngOnInit() { public ngOnInit() {
this.subs.push(this.route.data this.properties = properties;
.subscribe((data: { envSpecific: EnvProperties }) => { this.searchLinkToResults = this.properties.searchLinkToResults;
this.properties = data.envSpecific; this.searchLinkToProjects = this.properties.searchLinkToProjects;
this.searchLinkToResults = this.properties.searchLinkToResults; this.searchLinkToDataProviders = this.properties.searchLinkToDataProviders;
this.searchLinkToProjects = this.properties.searchLinkToProjects; this.searchLinkToAdvancedResults = this.properties.searchLinkToAdvancedResults;
this.searchLinkToDataProviders = this.properties.searchLinkToDataProviders; this.shareInZenodoPage = this.properties.shareInZenodoPage;
this.searchLinkToAdvancedResults = this.properties.searchLinkToAdvancedResults; this.url =properties.baseLink + this._router.url;
this.shareInZenodoPage = this.properties.shareInZenodoPage; this.seoService.createLinkForCanonicalURL(this.url, false);
this.url = data.envSpecific.baseLink + this._router.url; this._meta.updateTag({content: this.url}, "property='og:url'");
this.seoService.createLinkForCanonicalURL(this.url, false); this.subs.push(this.userManagementService.getUserInfo().subscribe(user => {
this._meta.updateTag({content: this.url}, "property='og:url'"); this.user = user;
this.subs.push(this.userManagementService.getUserInfo().subscribe(user => { }));
this.user = user; if (this.communityId != null && this.communityId != '') {
this.customFilter = new SearchCustomFilter("Community", "communityId", this.communityId, "");
this.subs.push(this._communityService.getCommunityByState(this.properties, this.properties.communityAPI + this.communityId).subscribe(
community => {
if (typeof document !== 'undefined') {
HelperFunctions.scroll();
}
this.community = community;
if(community.description != null && (community.description.length - this.thresholdDescription <= this.descriptionDiff)) {
this.thresholdDescription = community.description.length;
}
if (this.properties.environment == "development") {
this.params = {communityId: community.communityId};
}
this._meta.updateTag({content: community.description}, "name='description'");
this._meta.updateTag({content: community.description}, "property='og:description'");
this._meta.updateTag({content: community.title}, "property='og:title'");
this._title.setTitle(community.title);
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
this.subs.push(this._piwikService.trackView(this.properties, community.title, PiwikHelper.getSiteId(this.communityId, this.properties.environment)).subscribe());
}
if (this.community.zenodoCommunity) {
this.subs.push(this._ΖenodoCommunitieService.getZenodoCommunityById(this.properties, this.properties.zenodoCommunities + this.community.zenodoCommunity, null).subscribe(
result => {
this.masterZenodoCommunity = result;
},
error => {
// var emptyCommunity:ZenodoCommunityInfo = new ZenodoCommunityInfo();
// emptyCommunity.id = this.masterZenodoCommunityId;
// emptyCommunity.title = this.masterZenodoCommunityId;
// this.masterZenodoCommunity = emptyCommunity;
//console.log("Master Zenodo community'" + this.community.zenodoCommunity + "' couldn't be loaded");
this.handleError("Error getting Master Zenodo community with id: " + this.community.zenodoCommunityId, error);
}
));
}
this.subs.push(this._searchZenodoCommunitiesService.searchZCommunities(this.properties, this.communityId).subscribe(
result => {
this.zenodoCommunityIdS = result;
},
error => {
//console.error("list of zenodo communities couldn't be loaded");
this.handleError("Error getting list of zenodo communities for community with openaire id: " + this.communityId, error);
} //this.handleError('System error retrieving community profile', error)
));
//console.log(community);
})); }));
if (this.communityId != null && this.communityId != '') {
this.customFilter = new SearchCustomFilter("Community", "communityId", this.communityId, "");
this._communityService.getCommunity(this.properties, this.properties.communityAPI + this.communityId).subscribe(
community => {
if (typeof document !== 'undefined') {
HelperFunctions.scroll();
}
this.community = community;
if(community.description != null && (community.description.length - this.thresholdDescription <= this.descriptionDiff)) {
this.thresholdDescription = community.description.length;
}
if (this.properties.environment == "development") { this.countResearchResults("publication");
this.params = {communityId: community.communityId}; this.countResearchResults("dataset");
} this.countResearchResults("software");
this._meta.updateTag({content: community.description}, "name='description'"); this.countResearchResults("other");
this._meta.updateTag({content: community.description}, "property='og:description'");
this._meta.updateTag({content: community.title}, "property='og:title'");
this._title.setTitle(community.title);
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
this.subs.push(this._piwikService.trackView(this.properties, community.title, PiwikHelper.getSiteId(this.communityId, this.properties.environment)).subscribe());
}
if (this.community.zenodoCommunity) {
this.subs.push(this._ΖenodoCommunitieService.getZenodoCommunityById(this.properties, this.properties.zenodoCommunities + this.community.zenodoCommunity, null).subscribe(
result => {
this.masterZenodoCommunity = result;
}, this.subs.push(this._searchCommunityProjectsService.countTotalProjects(this.properties, this.communityId).subscribe(
error => { projectTotal => {
// var emptyCommunity:ZenodoCommunityInfo = new ZenodoCommunityInfo(); this.projectTotal = projectTotal;
// emptyCommunity.id = this.masterZenodoCommunityId; //console.log(projectTotal);
// emptyCommunity.title = this.masterZenodoCommunityId; },
// this.masterZenodoCommunity = emptyCommunity; error => {
//console.log("Master Zenodo community'" + this.community.zenodoCommunity + "' couldn't be loaded"); this.handleError("Error getting number of projects for community with id: " + this.communityId, error);
this.handleError("Error getting Master Zenodo community with id: " + this.community.zenodoCommunityId, error); },
() => {
} this.projectsCalculated = true;
));
}
this.subs.push(this._searchZenodoCommunitiesService.searchZCommunities(this.properties, this.communityId).subscribe(
result => {
this.zenodoCommunityIdS = result;
},
error => {
//console.error("list of zenodo communities couldn't be loaded");
this.handleError("Error getting list of zenodo communities for community with openaire id: " + this.communityId, error);
} //this.handleError('System error retrieving community profile', error)
));
//console.log(community);
}));
this.countResearchResults("publication");
this.countResearchResults("dataset");
this.countResearchResults("software");
this.countResearchResults("other");
this.subs.push(this._searchCommunityProjectsService.countTotalProjects(this.properties, this.communityId).subscribe(
projectTotal => {
this.projectTotal = projectTotal;
//console.log(projectTotal);
},
error => {
this.handleError("Error getting number of projects for community with id: " + this.communityId, error);
},
() => {
this.projectsCalculated = true;
}
));
this.subs.push(this._searchCommunityDataprovidersService.countTotalDataproviders(this.properties, this.communityId).subscribe(
contentProviderTotal => {
this.contentProviderTotal = contentProviderTotal;
//console.log(contentProviderTotal);
},
error => {
this.handleError("Error getting number of content providers for community with id: " + this.communityId, error);
},
() => {
this.contentProvidersCalculated = true;
}
));
// this._searchEntriesService.countTotal(this.properties.communityAPI+this.communityId+'/organizations').subscribe(
// organizationTotal => {
// this.organizationTotal = organizationTotal;
// console.log(organizationTotal);
// });
/**/
this.subs.push(this.config.communityInformationState.subscribe(
res => {
this.communityInfo = res;
},
error => {
//console.log(error)
this.handleError("Error getting community with id: " + this.communityId, error);
}
));
} }
})); ));
this.subs.push(this._searchCommunityDataprovidersService.countTotalDataproviders(this.properties, this.communityId).subscribe(
contentProviderTotal => {
this.contentProviderTotal = contentProviderTotal;
//console.log(contentProviderTotal);
},
error => {
this.handleError("Error getting number of content providers for community with id: " + this.communityId, error);
},
() => {
this.contentProvidersCalculated = true;
}
));
// this._searchEntriesService.countTotal(this.properties.communityAPI+this.communityId+'/organizations').subscribe(
// organizationTotal => {
// this.organizationTotal = organizationTotal;
// console.log(organizationTotal);
// });
/**/
this.subs.push(this.config.communityInformationState.subscribe(
res => {
this.communityInfo = res;
},
error => {
//console.log(error)
this.handleError("Error getting community with id: " + this.communityId, error);
}
));
}
} }
private searchPublications(page: number, size: number) { private searchPublications(page: number, size: number) {

View File

@ -3,10 +3,8 @@ 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 {CommunityComponent} from './community.component'; import {CommunityComponent} from './community.component';
import {SearchTabComponent} from '../openaireLibrary/utils/tabs/contents/search-tab.component';
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service'; import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
import {CommunityService} from '../openaireLibrary/connect/community/community.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';
@ -45,8 +43,7 @@ import {ErrorMessagesModule} from "../openaireLibrary/utils/errorMessages.module
CommunityComponent CommunityComponent
], ],
providers:[ providers:[
FreeGuard, PreviousRouteRecorder, FreeGuard, PreviousRouteRecorder, PiwikService
PiwikService, CommunityService
], ],
exports: [ exports: [
CommunityComponent CommunityComponent

View File

@ -3,7 +3,7 @@ import {EnvProperties} from '../openaireLibrary/utils/properties/env-properti
import {CuratorService} from "../openaireLibrary/connect/curators/curator.service"; import {CuratorService} from "../openaireLibrary/connect/curators/curator.service";
import {Curator} from "../openaireLibrary/utils/entities/CuratorInfo"; import {Curator} from "../openaireLibrary/utils/entities/CuratorInfo";
import {ActivatedRoute, Router} from "@angular/router"; import {ActivatedRoute, Router} from "@angular/router";
import {CommunitiesService} from "../openaireLibrary/connect/communities/communities.service"; import {CommunityService} from "../openaireLibrary/connect/community/community.service";
import {ConnectHelper} from "../openaireLibrary/connect/connectHelper"; import {ConnectHelper} from "../openaireLibrary/connect/connectHelper";
import {HelperFunctions} from "../openaireLibrary/utils/HelperFunctions.class"; import {HelperFunctions} from "../openaireLibrary/utils/HelperFunctions.class";
import {HelperService} from "../openaireLibrary/utils/helper/helper.service"; import {HelperService} from "../openaireLibrary/utils/helper/helper.service";
@ -13,6 +13,8 @@ import {PiwikService} from "../openaireLibrary/utils/piwik/piwik.service";
import {PiwikHelper} from "../utils/piwikHelper"; import {PiwikHelper} from "../utils/piwikHelper";
import {Breadcrumb} from "../openaireLibrary/utils/breadcrumbs/breadcrumbs.component"; import {Breadcrumb} from "../openaireLibrary/utils/breadcrumbs/breadcrumbs.component";
import {StringUtils} from "../openaireLibrary/utils/string-utils.class"; import {StringUtils} from "../openaireLibrary/utils/string-utils.class";
import {Subscription} from "rxjs";
import {properties} from "../../environments/environment";
@Component({ @Component({
selector: 'curators', selector: 'curators',
@ -39,15 +41,16 @@ export class CuratorsComponent {
public pageContents = null; public pageContents = null;
public divContents = null; public divContents = null;
public piwiksub: any;
public url: string = null; public url: string = null;
public pageTitle: string = "Curators"; public pageTitle: string = "Curators";
public breadcrumbs: Breadcrumb[] = [{name: 'home', route: '/'}, {name: 'About - curators'}]; public breadcrumbs: Breadcrumb[] = [{name: 'home', route: '/'}, {name: 'About - curators'}];
subs: Subscription[] = [];
constructor (private route: ActivatedRoute, constructor (private route: ActivatedRoute,
private curatorsService: CuratorService, private curatorsService: CuratorService,
private communitiesService: CommunitiesService, private communityService: CommunityService,
private _router: Router, private _router: Router,
private helper: HelperService, private helper: HelperService,
private _meta: Meta, private _meta: Meta,
@ -56,12 +59,11 @@ export class CuratorsComponent {
private _piwikService: PiwikService) {} private _piwikService: PiwikService) {}
ngOnInit() { ngOnInit() {
this.route.data.subscribe((data: { envSpecific: EnvProperties }) => {
this.showLoading = true; this.showLoading = true;
this.properties = data.envSpecific; this.properties = properties;
if(this.longView) { if(this.longView) {
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
this.piwiksub = this._piwikService.trackView(this.properties, this.pageTitle, PiwikHelper.getSiteId(this.communityId, this.properties.environment)).subscribe(); this.subs.push(this._piwikService.trackView(this.properties, this.pageTitle, PiwikHelper.getSiteId(this.communityId, this.properties.environment)).subscribe());
} }
this.url = this.properties.baseLink + this._router.url; this.url = this.properties.baseLink + this._router.url;
this.seoService.createLinkForCanonicalURL(this.url); this.seoService.createLinkForCanonicalURL(this.url);
@ -72,56 +74,55 @@ export class CuratorsComponent {
this.downloadUrl = this.properties.utilsService + '/download/'; this.downloadUrl = this.properties.utilsService + '/download/';
if(!this.longView) { if(!this.longView) {
let emails = this.managers.join(); let emails = this.managers.join();
this.curatorsService.getCurators(this.properties, emails).subscribe(curators => { this.subs.push(this.curatorsService.getCurators(this.properties, emails).subscribe(curators => {
this.curators = curators; this.curators = curators;
for(let i = 0; i < this.curators.length; i++) { for(let i = 0; i < this.curators.length; i++) {
this.showMore[i]= false; this.showMore[i]= false;
} }
this.showLoading = false; this.showLoading = false;
HelperFunctions.scroll(); HelperFunctions.scroll();
}) }));
} else { } else {
this.route.queryParams.subscribe(data => { this.subs.push(this.route.queryParams.subscribe(data => {
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain); this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
if(!this.communityId) { if(!this.communityId) {
this.communityId = data['communityId']; this.communityId = data['communityId'];
} }
//this.getDivContents(); //this.getDivContents();
this.getPageContents(); this.getPageContents();
this.communitiesService.getCommunities(this.properties, this.subs.push(this.communityService.getCommunityByState(this.properties,
this.properties.communityAPI + this.communityId).subscribe(community => { this.properties.communityAPI + this.communityId).subscribe(community => {
this.managers = community[0].managers; this.managers = community.managers;
let emails = this.managers.join(); let emails = this.managers.join();
this.curatorsService.getCurators(this.properties, emails).subscribe(curators => { this.subs.push(this.curatorsService.getCurators(this.properties, emails).subscribe(curators => {
this.curators = curators; this.curators = curators;
for(let i = 0; i < this.curators.length; i++) { for(let i = 0; i < this.curators.length; i++) {
this.showMore[i]= false; this.showMore[i]= false;
} }
this.showLoading = false; this.showLoading = false;
HelperFunctions.scroll(); HelperFunctions.scroll();
}); }));
}) }));
}); }));
} }
});
} }
ngOnDestroy() { ngOnDestroy() {
if(this.piwiksub) { for (let sub of this.subs) {
this.piwiksub.unsubscribe(); sub.unsubscribe();
} }
} }
private getPageContents() { private getPageContents() {
this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => { this.subs.push(this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.pageContents = contents; this.pageContents = contents;
}) }));
} }
private getDivContents() { private getDivContents() {
this.helper.getDivHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => { this.subs.push(this.helper.getDivHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.divContents = contents; this.divContents = contents;
}) }));
} }
public toggle(index: number) { public toggle(index: number) {

View File

@ -9,6 +9,8 @@ import {ZenodoCommunitiesService} from "../openaireLibrary/connect/zenodoCommuni
import {CommunityService} from "../openaireLibrary/connect/community/community.service"; import {CommunityService} from "../openaireLibrary/connect/community/community.service";
import {SearchZenodoCommunitiesService} from "../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunities.service"; import {SearchZenodoCommunitiesService} from "../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunities.service";
import {PiwikHelper} from "../utils/piwikHelper"; import {PiwikHelper} from "../utils/piwikHelper";
import {Subscription} from "rxjs";
import {properties} from "../../environments/environment";
@Component({ @Component({
selector: 'openaire-deposit', selector: 'openaire-deposit',
@ -25,10 +27,11 @@ export class OpenaireDepositComponent {
public divContents = null; public divContents = null;
public communityId = null; public communityId = null;
public zenodoInformation: ZenodoInformationClass = new ZenodoInformationClass(); public zenodoInformation: ZenodoInformationClass = new ZenodoInformationClass();
fetchZenodoInformation: FetchZenodoInformation; fetchZenodoInformation: FetchZenodoInformation;
subs: Subscription[] = [];
constructor ( private route: ActivatedRoute, constructor ( private route: ActivatedRoute,
private _zenodoCommunitieService: ZenodoCommunitiesService, private _zenodoCommunitieService: ZenodoCommunitiesService,
private _communityService: CommunityService, private _communityService: CommunityService,
@ -37,45 +40,46 @@ export class OpenaireDepositComponent {
} }
public ngOnInit() { public ngOnInit() {
this.route.data this.properties = properties;
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.route.queryParams.subscribe(params => { this.subs.push(this.route.queryParams.subscribe(params => {
let communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain); let communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
if (!communityId) { if (!communityId) {
communityId = params['communityId']; communityId = params['communityId'];
} }
if (communityId != null && communityId != '') { if (communityId != null && communityId != '') {
this.communityId = communityId; this.communityId = communityId;
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId,this.properties.environment); this.piwikSiteId = PiwikHelper.getSiteId(this.communityId,this.properties.environment);
this._communityService.getCommunity(this.properties, this.properties.communityAPI + communityId).subscribe( this.subs.push(this._communityService.getCommunityByState(this.properties, this.properties.communityAPI + communityId).subscribe(
community => { community => {
let masterZenodoCommunityId = community.zenodoCommunity; let masterZenodoCommunityId = community.zenodoCommunity;
if (masterZenodoCommunityId) { if (masterZenodoCommunityId) {
this.zenodoInformation.shareInZenodoUrl = this.properties.shareInZenodoPage; this.zenodoInformation.shareInZenodoUrl = this.properties.shareInZenodoPage;
} else { } else {
this.zenodoInformation.url = this.properties.zenodo; this.zenodoInformation.url = this.properties.zenodo;
this.zenodoInformation.name = "Zenodo"; this.zenodoInformation.name = "Zenodo";
} }
}, },
error => { error => {
this.handleError("Error getting community with id: " + communityId, error); this.handleError("Error getting community with id: " + communityId, error);
} }
); ));
} }
if (!this.zenodoInformation.shareInZenodoUrl) { if (!this.zenodoInformation.shareInZenodoUrl) {
this.zenodoInformation.url = this.properties.zenodo; this.zenodoInformation.url = this.properties.zenodo;
} }
if (!this.zenodoInformation.name) { if (!this.zenodoInformation.name) {
this.zenodoInformation.name = "Zenodo"; this.zenodoInformation.name = "Zenodo";
} }
}); }));
});
} }
public ngOnDestroy() {
for (let sub of this.subs) {
sub.unsubscribe();
}
}
private handleError(message: string, error) { private handleError(message: string, error) {
console.error("Deposit First Page: "+message, error); console.error("Deposit First Page: "+message, error);

View File

@ -12,7 +12,6 @@ import {DepositRoutingModule} from "./deposit-routing.module";
import {DepositFirstPageModule} from "../openaireLibrary/deposit/depositFirstPage.module"; import {DepositFirstPageModule} from "../openaireLibrary/deposit/depositFirstPage.module";
import {ZenodoCommunitiesService} from "../openaireLibrary/connect/zenodoCommunities/zenodo-communities.service"; import {ZenodoCommunitiesService} from "../openaireLibrary/connect/zenodoCommunities/zenodo-communities.service";
import {CommunityService} from "../openaireLibrary/connect/community/community.service";
import {SearchZenodoCommunitiesService} from "../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunities.service"; import {SearchZenodoCommunitiesService} from "../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunities.service";
@NgModule({ @NgModule({
@ -27,6 +26,6 @@ import {SearchZenodoCommunitiesService} from "../openaireLibrary/connect/zenodoC
OpenaireDepositComponent, OpenaireDepositComponent,
], ],
providers: [FreeGuard,PreviousRouteRecorder, IsRouteEnabled, providers: [FreeGuard,PreviousRouteRecorder, IsRouteEnabled,
ZenodoCommunitiesService, CommunityService, SearchZenodoCommunitiesService] ZenodoCommunitiesService, SearchZenodoCommunitiesService]
}) })
export class LibDepositModule { } export class LibDepositModule { }

View File

@ -11,6 +11,8 @@ import {CommunityService} from '../openaireLibrary/connect/community/community.s
import {ZenodoInformationClass} from '../openaireLibrary/deposit/utils/zenodoInformation.class'; import {ZenodoInformationClass} from '../openaireLibrary/deposit/utils/zenodoInformation.class';
import {FetchZenodoInformation} from './utils/fetchZenodoInformation.class'; import {FetchZenodoInformation} from './utils/fetchZenodoInformation.class';
import {Subscription} from "rxjs";
import {properties} from "../../environments/environment";
@Component({ @Component({
selector: 'openaire-search-deposit', selector: 'openaire-search-deposit',
@ -27,6 +29,8 @@ export class OpenaireSearchDataprovidersToDepositComponent {
piwikSiteId = null; piwikSiteId = null;
communityId: string = null; communityId: string = null;
subs: Subscription[] = [];
constructor ( private route: ActivatedRoute, constructor ( private route: ActivatedRoute,
private _ΖenodoCommunitieService: ZenodoCommunitiesService, private _ΖenodoCommunitieService: ZenodoCommunitiesService,
private _communityService: CommunityService,private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService ) { private _communityService: CommunityService,private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService ) {
@ -34,45 +38,48 @@ export class OpenaireSearchDataprovidersToDepositComponent {
} }
public ngOnInit() { public ngOnInit() {
this.route.data this.properties = properties;
.subscribe((data: { envSpecific: EnvProperties }) => { this.subs.push(this.route.queryParams.subscribe(params => {
this.properties = data.envSpecific; this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
this.route.queryParams.subscribe(params => { if(!this.communityId) {
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain); this.communityId = params['communityId'];
if(!this.communityId) { }
this.communityId = params['communityId'];
}
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId,this.properties.environment); this.piwikSiteId = PiwikHelper.getSiteId(this.communityId,this.properties.environment);
if(this.communityId) { if(this.communityId) {
if (this.communityId != '') { if (this.communityId != '') {
this._communityService.getCommunity(this.properties, this.properties.communityAPI+this.communityId).subscribe ( this.subs.push(this._communityService.getCommunityByState(this.properties, this.properties.communityAPI+this.communityId).subscribe (
community => { community => {
let masterZenodoCommunityId = community.zenodoCommunity; let masterZenodoCommunityId = community.zenodoCommunity;
if (masterZenodoCommunityId) { if (masterZenodoCommunityId) {
this.zenodoInformation.shareInZenodoUrl = this.properties.shareInZenodoPage; this.zenodoInformation.shareInZenodoUrl = this.properties.shareInZenodoPage;
} else { } else {
this.zenodoInformation.url = this.properties.zenodo; this.zenodoInformation.url = this.properties.zenodo;
this.zenodoInformation.name = "Zenodo"; this.zenodoInformation.name = "Zenodo";
} }, } },
error => { error => {
this.handleError("Error getting community with id: "+this.communityId, error); this.handleError("Error getting community with id: "+this.communityId, error);
}
);
} }
} ));
}
}
if (!this.zenodoInformation.shareInZenodoUrl) { if (!this.zenodoInformation.shareInZenodoUrl) {
this.zenodoInformation.url = this.properties.zenodo; this.zenodoInformation.url = this.properties.zenodo;
} }
if (!this.zenodoInformation.name) { if (!this.zenodoInformation.name) {
this.zenodoInformation.name = "Zenodo"; this.zenodoInformation.name = "Zenodo";
} }
}); }));
}); }
public ngOnDestroy() {
for (let sub of this.subs) {
sub.unsubscribe();
}
} }
private handleError(message: string, error) { private handleError(message: string, error) {

View File

@ -12,8 +12,6 @@ import {IsRouteEnabled} from '../openaireLibrary/error/isRouteEnabled.guard';
import {ZenodoCommunitiesServiceModule} from '../openaireLibrary/connect/zenodoCommunities/zenodo-communitiesService.module'; import {ZenodoCommunitiesServiceModule} from '../openaireLibrary/connect/zenodoCommunities/zenodo-communitiesService.module';
import {SearchZenodoCommunitiesServiceModule} from '../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunitiesService.module'; import {SearchZenodoCommunitiesServiceModule} from '../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunitiesService.module';
import {CommunityService} from '../openaireLibrary/connect/community/community.service';
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, FormsModule, CommonModule, FormsModule,
@ -27,6 +25,6 @@ import {CommunityService} from '../openaireLibrary/connect/community/community.s
exports: [ exports: [
OpenaireSearchDataprovidersToDepositComponent, OpenaireSearchDataprovidersToDepositComponent,
], ],
providers: [FreeGuard,PreviousRouteRecorder, IsRouteEnabled, CommunityService] providers: [FreeGuard,PreviousRouteRecorder, IsRouteEnabled]
}) })
export class LibSearchDataprovidersToDepositModule { } export class LibSearchDataprovidersToDepositModule { }

View File

@ -17,6 +17,8 @@ import {SEOService} from "../../openaireLibrary/sharedComponents/SEO/SEO.service
import {PiwikService} from "../../openaireLibrary/utils/piwik/piwik.service"; import {PiwikService} from "../../openaireLibrary/utils/piwik/piwik.service";
import {PiwikHelper} from "../../utils/piwikHelper"; import {PiwikHelper} from "../../utils/piwikHelper";
import {Breadcrumb} from "../../openaireLibrary/utils/breadcrumbs/breadcrumbs.component"; import {Breadcrumb} from "../../openaireLibrary/utils/breadcrumbs/breadcrumbs.component";
import {properties} from "../../../environments/environment";
import {Subscription} from "rxjs";
@Component({ @Component({
selector: 'share-in-zenodo', selector: 'share-in-zenodo',
@ -26,7 +28,6 @@ export class ShareInZenodoComponent {
public url: string = null; public url: string = null;
public title: string = "Share in Zenodo"; public title: string = "Share in Zenodo";
piwiksub:any;
public piwikSiteId = null; public piwikSiteId = null;
properties: EnvProperties; properties: EnvProperties;
@ -52,6 +53,9 @@ export class ShareInZenodoComponent {
depositLearnHowPage: string = null; depositLearnHowPage: string = null;
public routerHelper:RouterHelper = new RouterHelper(); public routerHelper:RouterHelper = new RouterHelper();
breadcrumbs:Breadcrumb[] = []; breadcrumbs:Breadcrumb[] = [];
subs: Subscription[] = [];
constructor(private route: ActivatedRoute, constructor(private route: ActivatedRoute,
private _router: Router, private _router: Router,
private _meta: Meta, private _meta: Meta,
@ -67,86 +71,88 @@ export class ShareInZenodoComponent {
public ngOnInit() { public ngOnInit() {
this.zenodoSearchUtils.status = this.errorCodes.LOADING; this.zenodoSearchUtils.status = this.errorCodes.LOADING;
this.route.data this.url = properties.baseLink + this._router.url;
.subscribe((data: { envSpecific: EnvProperties }) => {
this.url = data.envSpecific.baseLink + this._router.url;
this.seoService.createLinkForCanonicalURL(this.url, false); this.seoService.createLinkForCanonicalURL(this.url, false);
this.updateUrl(this.url); this.updateUrl(this.url);
this.updateTitle(this.title); this.updateTitle(this.title);
this.updateDescription("Zenodo, repository, deposit, share"); this.updateDescription("Zenodo, repository, deposit, share");
this.properties = data.envSpecific; this.properties = properties;
this.route.queryParams.subscribe(params => { this.subs.push(this.route.queryParams.subscribe(params => {
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain); this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
if (!this.communityId) { if (!this.communityId) {
this.communityId = params['communityId']; this.communityId = params['communityId'];
} }
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId,this.properties.environment); this.piwikSiteId = PiwikHelper.getSiteId(this.communityId,this.properties.environment);
if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){
this.piwiksub = this._piwikService.trackView(this.properties, this.title, this.piwikSiteId).subscribe(); this.subs.push(this._piwikService.trackView(this.properties, this.title, this.piwikSiteId).subscribe());
} }
this.depositLearnHowPage = this.properties.depositLearnHowPage; this.depositLearnHowPage = this.properties.depositLearnHowPage;
this.breadcrumbs.push({name: 'home', route: '/'}, {name: "Deposit", route: this.depositLearnHowPage},{name:"Deposit in zenodo",route:null}); this.breadcrumbs.push({name: 'home', route: '/'}, {name: "Deposit", route: this.depositLearnHowPage},{name:"Deposit in zenodo",route:null});
//this.getDivContents();
this.getPageContents();
if (this.communityId && this.communityId != '') {
this.subs.push(this._communityService.getCommunityByState(this.properties, this.properties.communityAPI + this.communityId).subscribe(
community => {
this.community = community;
this.masterZenodoCommunityId = this.community.zenodoCommunity;
if (typeof document !== 'undefined') {
HelperFunctions.scroll();
}
if (this.masterZenodoCommunityId) {
this.subs.push(this._ΖenodoCommunitieService.getZenodoCommunityById(this.properties, this.properties.zenodoCommunities + this.masterZenodoCommunityId, null).subscribe(
result => {
this.masterZenodoCommunity = result;
},
error => {
this.handleError("Error getting Master Zenodo community with id: " + this.masterZenodoCommunityId, error);
//this.getDivContents();
this.getPageContents();
if (this.communityId && this.communityId != '') {
this._communityService.getCommunity(this.properties, this.properties.communityAPI + this.communityId).subscribe(
community => {
this.community = community;
this.masterZenodoCommunityId = this.community.zenodoCommunity;
if (typeof document !== 'undefined') {
HelperFunctions.scroll();
} }
if (this.masterZenodoCommunityId) { ));
this._ΖenodoCommunitieService.getZenodoCommunityById(this.properties, this.properties.zenodoCommunities + this.masterZenodoCommunityId, null).subscribe( }
result => { this.zenodoSearchUtils.status = this.errorCodes.LOADING;
this.masterZenodoCommunity = result;
}, this.subs.push(this._searchZenodoCommunitiesService.searchZCommunities(this.properties, this.communityId).subscribe(
error => { result => {
this.handleError("Error getting Master Zenodo community with id: " + this.masterZenodoCommunityId, error); this.CommunityIds = result;
this.zenodoSearchUtils.totalResults = this.CommunityIds.length;
} if (this.CommunityIds.length == 0) {
); this.zenodoSearchUtils.status = this.errorCodes.NONE;
}
for (let i = 0; i < this.CommunityIds.length; i++) {
this.getZenodoCommunityById(this.CommunityIds[i]["zenodoid"], this.CommunityIds[i]["id"]);
} }
this.zenodoSearchUtils.status = this.errorCodes.LOADING;
this._searchZenodoCommunitiesService.searchZCommunities(this.properties, this.communityId).subscribe(
result => {
this.CommunityIds = result;
this.zenodoSearchUtils.totalResults = this.CommunityIds.length;
if (this.CommunityIds.length == 0) {
this.zenodoSearchUtils.status = this.errorCodes.NONE;
}
for (let i = 0; i < this.CommunityIds.length; i++) {
this.getZenodoCommunityById(this.CommunityIds[i]["zenodoid"], this.CommunityIds[i]["id"]);
}
},
error => {
//console.error("list of zenodo communities couldn't be loaded");
this.handleError("Error getting list of zenodo communities for community with openaire id: " + this.communityId, error);
this.zenodoSearchUtils.status = this.errorCodes.ERROR;
} //this.handleError('System error retrieving community profile', error)
);
}, },
error => { error => {
//console.error("Community couldn't be loaded"); //console.error("list of zenodo communities couldn't be loaded");
this.handleError("Error getting community with id: " + this.communityId, error); this.handleError("Error getting list of zenodo communities for community with openaire id: " + this.communityId, error);
this.zenodoSearchUtils.status = this.errorCodes.ERROR; this.zenodoSearchUtils.status = this.errorCodes.ERROR;
} } //this.handleError('System error retrieving community profile', error)
); ));
},
error => {
//console.error("Community couldn't be loaded");
this.handleError("Error getting community with id: " + this.communityId, error);
this.zenodoSearchUtils.status = this.errorCodes.ERROR;
} }
}); ));
}); }
}));
} }
public ngOnDestroy() {
for (let sub of this.subs) {
sub.unsubscribe();
}
}
private updateDescription(description: string) { private updateDescription(description: string) {
this._meta.updateTag({content: description}, "name='description'"); this._meta.updateTag({content: description}, "name='description'");
@ -164,19 +170,19 @@ export class ShareInZenodoComponent {
} }
private getPageContents() { private getPageContents() {
this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => { this.subs.push(this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.pageContents = contents; this.pageContents = contents;
}) }));
} }
private getDivContents() { private getDivContents() {
this.helper.getDivHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => { this.subs.push(this.helper.getDivHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.divContents = contents; this.divContents = contents;
}) }));
} }
getZenodoCommunityById(zenodoid, openaireId) { getZenodoCommunityById(zenodoid, openaireId) {
this._ΖenodoCommunitieService.getZenodoCommunityById(this.properties, this.properties.zenodoCommunities + zenodoid, openaireId).subscribe( this.subs.push(this._ΖenodoCommunitieService.getZenodoCommunityById(this.properties, this.properties.zenodoCommunities + zenodoid, openaireId).subscribe(
result => { result => {
this.communities.push(result); this.communities.push(result);
this.zenodocommunitiesloadedCount++; this.zenodocommunitiesloadedCount++;
@ -200,7 +206,7 @@ export class ShareInZenodoComponent {
this.handleError("Error getting Zenodo community with id: " + zenodoid + " and openaire id: " + openaireId, error); this.handleError("Error getting Zenodo community with id: " + zenodoid + " and openaire id: " + openaireId, error);
} }
); ));
} }
private handleError(message: string, error) { private handleError(message: string, error) {

View File

@ -10,7 +10,6 @@ import {ShareInZenodoRoutingModule} from './shareInZenodo-routing.module';
import {ZenodoCommunitiesServiceModule} from '../../openaireLibrary/connect/zenodoCommunities/zenodo-communitiesService.module'; import {ZenodoCommunitiesServiceModule} from '../../openaireLibrary/connect/zenodoCommunities/zenodo-communitiesService.module';
import {SearchZenodoCommunitiesServiceModule} from '../../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunitiesService.module'; import {SearchZenodoCommunitiesServiceModule} from '../../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunitiesService.module';
import {CommunityService} from '../../openaireLibrary/connect/community/community.service';
import {RouterModule} from "@angular/router"; import {RouterModule} from "@angular/router";
import {HelperModule} from "../../openaireLibrary/utils/helper/helper.module"; import {HelperModule} from "../../openaireLibrary/utils/helper/helper.module";
import {PiwikServiceModule} from "../../openaireLibrary/utils/piwik/piwikService.module"; import {PiwikServiceModule} from "../../openaireLibrary/utils/piwik/piwikService.module";
@ -27,7 +26,7 @@ import {BreadcrumbsModule} from "../../openaireLibrary/utils/breadcrumbs/breadcr
declarations: [ declarations: [
ShareInZenodoComponent ShareInZenodoComponent
], ],
providers:[FreeGuard,PreviousRouteRecorder, IsRouteEnabled, CommunityService], providers:[FreeGuard,PreviousRouteRecorder, IsRouteEnabled],
exports: [ exports: [
ShareInZenodoComponent ShareInZenodoComponent
] ]

View File

@ -18,6 +18,8 @@ import {PiwikHelper} from '../utils/piwikHelper';
import {CommunityCharts} from "../openaireLibrary/connect/statistics/communityCharts"; import {CommunityCharts} from "../openaireLibrary/connect/statistics/communityCharts";
import {HelperFunctions} from "../openaireLibrary/utils/HelperFunctions.class"; import {HelperFunctions} from "../openaireLibrary/utils/HelperFunctions.class";
import {CommunityService} from "../openaireLibrary/connect/community/community.service"; import {CommunityService} from "../openaireLibrary/connect/community/community.service";
import {Subscription} from "rxjs";
import {properties} from "../../environments/environment";
@Component({ @Component({
@ -26,7 +28,6 @@ import {CommunityService} from "../openaireLibrary/connect/community/community.s
}) })
export class StatisticsComponent { export class StatisticsComponent {
public piwiksub: any;
public pageTitle = "OpenAIRE"; public pageTitle = "OpenAIRE";
properties: EnvProperties; properties: EnvProperties;
@Input() communityId = null; @Input() communityId = null;
@ -58,6 +59,8 @@ export class StatisticsComponent {
status = null; status = null;
communityName = null; communityName = null;
subs: Subscription[] = [];
constructor( constructor(
private route: ActivatedRoute, private route: ActivatedRoute,
private _router: Router, private _router: Router,
@ -83,44 +86,40 @@ export class StatisticsComponent {
this._meta.updateTag({content: description}, "property='og:description'"); this._meta.updateTag({content: description}, "property='og:description'");
this._meta.updateTag({content: title}, "property='og:title'"); this._meta.updateTag({content: title}, "property='og:title'");
} }
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
var url = data.envSpecific.baseLink + this._router.url;
this._meta.updateTag({content: url}, "property='og:url'");
this.route.queryParams.subscribe( this.properties = properties;
communityId => { var url = properties.baseLink + this._router.url;
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain); this._meta.updateTag({content: url}, "property='og:url'");
if(!this.communityId) {
this.communityId = communityId['communityId']; this.subs.push(this.route.queryParams.subscribe(
communityId => {
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
if(!this.communityId) {
this.communityId = communityId['communityId'];
}
if (this.currentMode == "showInMonitor" && this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
this.subs.push(this._piwikService.trackView(this.properties, "Monitor " + this.communityId, PiwikHelper.siteIDs[this.communityId]).subscribe());
}
this.subs.push(this._communityService.getCommunityByState(this.properties, this.properties.communityAPI + this.communityId).subscribe(
community => {
if (typeof document !== 'undefined') {
HelperFunctions.scroll();
} }
this.communityName = community.shortTitle;
this.createStatisticsObjects();
this.createChartUrlMap();
}));
// console.log(" Stats! "+ this.properties.statisticsAPIURL);
if (this.currentMode == "showInMonitor" && this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { }));
this.piwiksub = this._piwikService.trackView(this.properties, "Monitor " + this.communityId, PiwikHelper.siteIDs[this.communityId]).subscribe();
}
this._communityService.getCommunity(this.properties, this.properties.communityAPI + this.communityId).subscribe(
community => {
if (typeof document !== 'undefined') {
HelperFunctions.scroll();
}
this.communityName = community.shortTitle;
this.createStatisticsObjects();
this.createChartUrlMap();
});
// console.log(" Stats! "+ this.properties.statisticsAPIURL);
});
});
} }
public ngOnDestroy() { public ngOnDestroy() {
if (this.piwiksub) { for (let sub of this.subs) {
this.piwiksub.unsubscribe(); sub.unsubscribe();
} }
} }
getCamelCaseString(inputString: string) { getCamelCaseString(inputString: string) {
@ -130,7 +129,7 @@ export class StatisticsComponent {
createStatisticsObjects() { createStatisticsObjects() {
// console.log(" Stats! "+ this.properties.statisticsAPIURL); // console.log(" Stats! "+ this.properties.statisticsAPIURL);
this.status = this.errorCodes.LOADING; this.status = this.errorCodes.LOADING;
this._statisticsService.getCommunityStatistics(this.properties, this.communityId).subscribe( this.subs.push(this._statisticsService.getCommunityStatistics(this.properties, this.communityId).subscribe(
res => { res => {
if(res) { if(res) {
this.statisticsSum = res; this.statisticsSum = res;
@ -147,11 +146,11 @@ export class StatisticsComponent {
//console.log(error); //console.log(error);
this.handleError("Error getting community statistics for community with id: " + this.communityId, error); this.handleError("Error getting community statistics for community with id: " + this.communityId, error);
this.status = this.errorCodes.ERROR; this.status = this.errorCodes.ERROR;
}); }));
} }
getDisplayOptions() { getDisplayOptions() {
this._statisticsService.getCommunityAdminStatisticsChoices(this.properties, this.communityId) this.subs.push(this._statisticsService.getCommunityAdminStatisticsChoices(this.properties, this.communityId)
.subscribe( .subscribe(
res => { res => {
this.statisticsDisplay = res; this.statisticsDisplay = res;
@ -165,13 +164,13 @@ export class StatisticsComponent {
this.handleError("Error getting community statistics choices by administrators for community with id: " + this.communityId, error); this.handleError("Error getting community statistics choices by administrators for community with id: " + this.communityId, error);
this.status = this.errorCodes.ERROR; this.status = this.errorCodes.ERROR;
} }
); ));
} }
getCommunityInfo() { getCommunityInfo() {
// console.log(`calling ${this.properties.adminToolsAPIURL}/communityFull/${this.communityId}`); // console.log(`calling ${this.properties.adminToolsAPIURL}/communityFull/${this.communityId}`);
this._configService.getCommunityInformation(this.properties, this.communityId).subscribe( this.subs.push(this._configService.communityInformationState.subscribe(
res => { res => {
this.communityInfo = res; this.communityInfo = res;
/*for(let i=0; i<this.communityInfo.entities.length; i++){ /*for(let i=0; i<this.communityInfo.entities.length; i++){
@ -187,7 +186,7 @@ export class StatisticsComponent {
this.handleError("Error getting community with id: " + this.communityId, error); this.handleError("Error getting community with id: " + this.communityId, error);
}, },
() => this.initializeDisplayedCharts() () => this.initializeDisplayedCharts()
); ));
} }
initializeDisplayedCharts() { initializeDisplayedCharts() {

View File

@ -11,6 +11,8 @@ import {PiwikService} from "../openaireLibrary/utils/piwik/piwik.service";
import {PiwikHelper} from "../utils/piwikHelper"; import {PiwikHelper} from "../utils/piwikHelper";
import {StringUtils} from "../openaireLibrary/utils/string-utils.class"; import {StringUtils} from "../openaireLibrary/utils/string-utils.class";
import {Breadcrumb} from "../openaireLibrary/utils/breadcrumbs/breadcrumbs.component"; import {Breadcrumb} from "../openaireLibrary/utils/breadcrumbs/breadcrumbs.component";
import {properties} from "../../environments/environment";
import {Subscription} from "rxjs";
@Component({ @Component({
selector: 'subjects', selector: 'subjects',
@ -65,12 +67,13 @@ export class SubjectsComponent {
public pageContents = null; public pageContents = null;
public divContents = null; public divContents = null;
public piwiksub: any;
public url: string = null; public url: string = null;
public pageTitle: string = "Subjects"; public pageTitle: string = "Subjects";
public breadcrumbs: Breadcrumb[] = [{name: 'home', route: '/'}, {name: 'about - subjects'}]; public breadcrumbs: Breadcrumb[] = [{name: 'home', route: '/'}, {name: 'about - subjects'}];
subs: Subscription[] = [];
constructor (private route: ActivatedRoute, constructor (private route: ActivatedRoute,
private communityService: CommunityService, private communityService: CommunityService,
private _router: Router, private _router: Router,
@ -81,33 +84,31 @@ export class SubjectsComponent {
private _piwikService: PiwikService) {} private _piwikService: PiwikService) {}
ngOnInit() { ngOnInit() {
this.route.data.subscribe((data: { envSpecific: EnvProperties }) => { this.showLoading = true;
this.showLoading = true; this.properties = properties;
this.properties = data.envSpecific;
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
this.piwiksub = this._piwikService.trackView(this.properties, this.pageTitle, PiwikHelper.getSiteId(this.communityId, this.properties.environment)).subscribe(); this.subs.push(this._piwikService.trackView(this.properties, this.pageTitle, PiwikHelper.getSiteId(this.communityId, this.properties.environment)).subscribe());
}
this.url = this.properties.baseLink + this._router.url;
this.seoService.createLinkForCanonicalURL(this.url);
this.updateUrl(this.url);
this.updateTitle(this.pageTitle);
this.updateDescription("OpenAIRE - Connect, Community Gateway, research community");
this.subs.push(this.route.queryParams.subscribe(data => {
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
if(!this.communityId) {
this.communityId = data['communityId'];
} }
this.url = this.properties.baseLink + this._router.url; //this.getDivContents();
this.seoService.createLinkForCanonicalURL(this.url); this.getPageContents();
this.updateUrl(this.url); this.subs.push(this.communityService.getCommunityByState(this.properties, this.properties.communityAPI + this.communityId).subscribe(community => {
this.updateTitle(this.pageTitle); this.subjects = community.subjects;
this.updateDescription("OpenAIRE - Connect, Community Gateway, research community"); this.showLoading = false;
HelperFunctions.scroll();
this.route.queryParams.subscribe(data => { }));
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain); }));
if(!this.communityId) {
this.communityId = data['communityId'];
}
//this.getDivContents();
this.getPageContents();
this.communityService.getCommunity(this.properties, this.properties.communityAPI + this.communityId).subscribe(community => {
this.subjects = community.subjects;
this.showLoading = false;
HelperFunctions.scroll();
});
});
});
} }
createParams(param) { createParams(param) {
@ -115,21 +116,21 @@ export class SubjectsComponent {
} }
ngOnDestroy() { ngOnDestroy() {
if(this.piwiksub) { for (let sub of this.subs) {
this.piwiksub.unsubscribe(); sub.unsubscribe();
} }
} }
private getPageContents() { private getPageContents() {
this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => { this.subs.push(this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.pageContents = contents; this.pageContents = contents;
}) }));
} }
private getDivContents() { private getDivContents() {
this.helper.getDivHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => { this.subs.push(this.helper.getDivHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.divContents = contents; this.divContents = contents;
}) }));
} }
private updateDescription(description: string) { private updateDescription(description: string) {

View File

@ -5,7 +5,6 @@ import { RouterModule } from '@angular/router';
import {SubjectsComponent} from './subjects.component'; import {SubjectsComponent} from './subjects.component';
import {SubjectsRoutingModule} from "./subjects-routing.module"; import {SubjectsRoutingModule} from "./subjects-routing.module";
import {CommunityService} from "../openaireLibrary/connect/community/community.service";
import {HelperModule} from "../openaireLibrary/utils/helper/helper.module"; import {HelperModule} from "../openaireLibrary/utils/helper/helper.module";
import {Schema2jsonldModule} from "../openaireLibrary/sharedComponents/schema2jsonld/schema2jsonld.module"; import {Schema2jsonldModule} from "../openaireLibrary/sharedComponents/schema2jsonld/schema2jsonld.module";
import {SEOServiceModule} from "../openaireLibrary/sharedComponents/SEO/SEOService.module"; import {SEOServiceModule} from "../openaireLibrary/sharedComponents/SEO/SEOService.module";
@ -22,7 +21,7 @@ import {BreadcrumbsModule} from "../openaireLibrary/utils/breadcrumbs/breadcrumb
declarations: [ declarations: [
SubjectsComponent SubjectsComponent
], ],
providers: [CommunityService], providers: [],
exports: [ exports: [
SubjectsComponent SubjectsComponent
] ]

View File

@ -23,6 +23,8 @@ import {PiwikService} from "../../../openaireLibrary/utils/piwik/piwik.service";
import {PiwikHelper} from "../../piwikHelper"; import {PiwikHelper} from "../../piwikHelper";
import {UserManagementService} from "../../../openaireLibrary/services/user-management.service"; import {UserManagementService} from "../../../openaireLibrary/services/user-management.service";
import {Breadcrumb} from "../../../openaireLibrary/utils/breadcrumbs/breadcrumbs.component"; import {Breadcrumb} from "../../../openaireLibrary/utils/breadcrumbs/breadcrumbs.component";
import {Subscription} from "rxjs";
import {properties} from "../../../../environments/environment";
@Component({ @Component({
selector: 'invite', selector: 'invite',
@ -69,11 +71,12 @@ export class InviteComponent implements OnInit {
public url: string = null; public url: string = null;
public pageTitle: string = "Invite"; public pageTitle: string = "Invite";
piwiksub: any;
private user: User; private user: User;
public breadcrumbs: Breadcrumb[] = [{name: 'home', route: '/'}, {name: 'invite'}]; public breadcrumbs: Breadcrumb[] = [{name: 'home', route: '/'}, {name: 'invite'}];
subs: Subscription[] = [];
constructor( constructor(
private route: ActivatedRoute, private route: ActivatedRoute,
private _router: Router, private _router: Router,
@ -93,36 +96,34 @@ export class InviteComponent implements OnInit {
} }
public ngOnInit() { public ngOnInit() {
this.route.data.subscribe((data: { envSpecific: EnvProperties }) => { if(!this.properties) {
if(!this.properties) { this.properties = properties;
this.properties = data.envSpecific; }
} if(this.properties) {
if(this.properties) { this.errorMessage = "";
this.errorMessage = ""; this.missingCommunityId = "";
this.missingCommunityId = ""; this.status = this.errorCodes.LOADING;
this.status = this.errorCodes.LOADING; this.subs.push(this.userManageService.getUserInfo().subscribe(
this.userManageService.getUserInfo().subscribe( user => {
user => { this.user = user;
this.user = user; this.init();
this.init(); },
}, error => {
error => { this.init();
this.init(); }
} ));
); //this.init();
//this.init(); }
}
});
} }
ngOnDestroy() { ngOnDestroy() {
if (this.piwiksub) { for (let sub of this.subs) {
this.piwiksub.unsubscribe(); sub.unsubscribe();
} }
} }
private init() { private init() {
this.route.queryParams.subscribe( this.subs.push(this.route.queryParams.subscribe(
communityId => { communityId => {
//if(!this.communityId && typeof document !== 'undefined'){ //if(!this.communityId && typeof document !== 'undefined'){
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain); this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
@ -132,7 +133,7 @@ export class InviteComponent implements OnInit {
if (this.longView) { if (this.longView) {
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
this.piwiksub = this._piwikService.trackView(this.properties, this.pageTitle, PiwikHelper.getSiteId(this.communityId, this.properties.environment)).subscribe(); this.subs.push(this._piwikService.trackView(this.properties, this.pageTitle, PiwikHelper.getSiteId(this.communityId, this.properties.environment)).subscribe());
} }
this.url = this.properties.baseLink + this._router.url; this.url = this.properties.baseLink + this._router.url;
this.seoService.createLinkForCanonicalURL(this.url); this.seoService.createLinkForCanonicalURL(this.url);
@ -144,7 +145,7 @@ export class InviteComponent implements OnInit {
if (this.communityId != null && this.communityId != '') { if (this.communityId != null && this.communityId != '') {
//this.getDivContents(); //this.getDivContents();
this.getPageContents(); this.getPageContents();
this._communityService.getCommunity(this.properties, this.properties.communityAPI + this.communityId).subscribe( this.subs.push(this._communityService.getCommunityByState(this.properties, this.properties.communityAPI + this.communityId).subscribe(
community => { community => {
this.community = community; this.community = community;
this.fullname = (this.user) ? this.user.fullname : null; this.fullname = (this.user) ? this.user.fullname : null;
@ -161,26 +162,26 @@ export class InviteComponent implements OnInit {
this.handleError("Error getting community with id: " + this.communityId, error); this.handleError("Error getting community with id: " + this.communityId, error);
this.status = this.errorMessages.getErrorCode(error.status); this.status = this.errorMessages.getErrorCode(error.status);
} }
); ));
} else { } else {
this.status = this.errorCodes.DONE; this.status = this.errorCodes.DONE;
this.missingCommunityId = "There is no community selected!"; this.missingCommunityId = "There is no community selected!";
} }
}); }));
HelperFunctions.scroll(); HelperFunctions.scroll();
} }
private getPageContents() { private getPageContents() {
this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => { this.subs.push(this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.pageContents = contents; this.pageContents = contents;
}) }));
} }
private getDivContents() { private getDivContents() {
this.helper.getDivHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => { this.subs.push(this.helper.getDivHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.divContents = contents; this.divContents = contents;
}) }));
} }
@ -194,7 +195,7 @@ export class InviteComponent implements OnInit {
if (this.validateEmails()) { if (this.validateEmails()) {
this.composeEmail(); this.composeEmail();
this._emailService.sendEmail(this.properties, this.email).subscribe( this.subs.push(this._emailService.sendEmail(this.properties, this.email).subscribe(
res => { res => {
this.status = this.errorCodes.DONE; this.status = this.errorCodes.DONE;
//console.log("Emails Sent: ",res); //console.log("Emails Sent: ",res);
@ -225,7 +226,7 @@ export class InviteComponent implements OnInit {
this.status = this.errorCodes.DONE; this.status = this.errorCodes.DONE;
this.inviteErrorMessage = "There was an error sending emails. Please try again."; this.inviteErrorMessage = "There was an error sending emails. Please try again.";
} }
); ));
} else { } else {
this.email.recipients = []; this.email.recipients = [];
this.status = this.errorCodes.DONE; this.status = this.errorCodes.DONE;

View File

@ -1,45 +1,11 @@
import {NgModule} from '@angular/core'; import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {FormsModule} from '@angular/forms';
import {RouterModule} from '@angular/router';
import {CKEditorModule} from 'ng2-ckeditor';
import {InviteComponent} from './invite.component';
import {InviteRoutingModule} from './invite-routing.module'; import {InviteRoutingModule} from './invite-routing.module';
import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {LoginGuard} from '../../../openaireLibrary/login/loginGuard.guard'; import {LoginGuard} from '../../../openaireLibrary/login/loginGuard.guard';
import {EmailService} from '../../../openaireLibrary/utils/email/email.service';
import {CommunityService} from '../../../openaireLibrary/connect/community/community.service';
import {ErrorMessagesModule} from '../../../openaireLibrary/utils/errorMessages.module';
import {IsRouteEnabled} from "../../../openaireLibrary/error/isRouteEnabled.guard";
import {HelperModule} from "../../../openaireLibrary/utils/helper/helper.module";
import {Schema2jsonldModule} from "../../../openaireLibrary/sharedComponents/schema2jsonld/schema2jsonld.module";
import {SEOServiceModule} from "../../../openaireLibrary/sharedComponents/SEO/SEOService.module";
import {PiwikService} from "../../../openaireLibrary/utils/piwik/piwik.service";
import {InviteBasicModule} from "./inviteBasic.module"; import {InviteBasicModule} from "./inviteBasic.module";
@NgModule({ @NgModule({
// imports: [
// //CommonModule, FormsModule, RouterModule, InviteRoutingModule, CKEditorModule, ErrorMessagesModule,
// RouterModule, CommonModule, FormsModule, CKEditorModule, ErrorMessagesModule,
// //InviteRoutingModule,
// HelperModule, Schema2jsonldModule, SEOServiceModule
// ],
// declarations: [
// InviteComponent
// ],
// providers: [
// //LoginGuard,
// PreviousRouteRecorder,
// EmailService, CommunityService, IsRouteEnabled,
// PiwikService
// ],
// exports: [
// InviteComponent
// ]
imports: [InviteBasicModule, InviteRoutingModule], imports: [InviteBasicModule, InviteRoutingModule],
providers: [LoginGuard] providers: [LoginGuard]
}) })

View File

@ -9,7 +9,6 @@ import {InviteComponent} from './invite.component';
import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {EmailService} from '../../../openaireLibrary/utils/email/email.service'; import {EmailService} from '../../../openaireLibrary/utils/email/email.service';
import {CommunityService} from '../../../openaireLibrary/connect/community/community.service';
import {ErrorMessagesModule} from '../../../openaireLibrary/utils/errorMessages.module'; import {ErrorMessagesModule} from '../../../openaireLibrary/utils/errorMessages.module';
import {IsRouteEnabled} from "../../../openaireLibrary/error/isRouteEnabled.guard"; import {IsRouteEnabled} from "../../../openaireLibrary/error/isRouteEnabled.guard";
import {HelperModule} from "../../../openaireLibrary/utils/helper/helper.module"; import {HelperModule} from "../../../openaireLibrary/utils/helper/helper.module";
@ -28,7 +27,7 @@ import {BreadcrumbsModule} from "../../../openaireLibrary/utils/breadcrumbs/brea
], ],
providers: [ providers: [
PreviousRouteRecorder, PreviousRouteRecorder,
EmailService, CommunityService, IsRouteEnabled, EmailService, IsRouteEnabled,
PiwikService PiwikService
], ],
exports: [ exports: [

View File

@ -12,6 +12,8 @@ import {Email} from "../../openaireLibrary/utils/email/email";
import {Composer} from "../../openaireLibrary/utils/email/composer"; import {Composer} from "../../openaireLibrary/utils/email/composer";
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class'; import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
import {UserManagementService} from "../../openaireLibrary/services/user-management.service"; import {UserManagementService} from "../../openaireLibrary/services/user-management.service";
import {Subscription} from "rxjs";
import {properties} from "../../../environments/environment";
declare var UIkit: any; declare var UIkit: any;
@ -73,6 +75,8 @@ export class SubscribeComponent {
@ViewChild(AlertModal) alert; @ViewChild(AlertModal) alert;
private user: User; private user: User;
subs: Subscription[] = [];
constructor(private route: ActivatedRoute, constructor(private route: ActivatedRoute,
private _subscribeService: SubscribeService, private _subscribeService: SubscribeService,
private _emailService: EmailService, private _emailService: EmailService,
@ -82,30 +86,34 @@ export class SubscribeComponent {
) {} ) {}
public ngOnInit() { public ngOnInit() {
this.route.data.subscribe((data: { envSpecific: EnvProperties }) => { if(!this.properties) {
if(!this.properties) { this.properties = properties;
this.properties = data.envSpecific; }
} if(!this.showNumbers) {
if(!this.showNumbers) { this.subs.push(this.userManagementService.getUserInfo().subscribe(
this.userManagementService.getUserInfo().subscribe( user => {
user => { this.user = user;
this.user = user; this.init();
this.init(); },
}, error => {},
error => {}, () => {
() => { this.init();
this.init(); }
} ));
); } else {
} else { this.init();
this.init(); }
}
});
//this.init(); //this.init();
} }
public ngOnDestroy() {
for (let sub of this.subs) {
sub.unsubscribe();
}
}
private isSubscribed() { private isSubscribed() {
this._subscribeService.isSubscribed.subscribe( this.subs.push(this._subscribeService.isSubscribed.subscribe(
res => { res => {
this.subscribed = res; this.subscribed = res;
if (this.subscribed) { if (this.subscribed) {
@ -114,7 +122,7 @@ export class SubscribeComponent {
}); });
} }
} }
); ));
} }
private init() { private init() {
@ -143,7 +151,7 @@ export class SubscribeComponent {
} }
} else { } else {
if (this.communityId) { if (this.communityId) {
this._subscribeService.getNumberOfCommunitySubscribers(this.properties, this.communityId).subscribe( this.subs.push(this._subscribeService.getNumberOfCommunitySubscribers(this.properties, this.communityId).subscribe(
res => { res => {
this.subscribers = (res && res.value) ? res.value : 0;//(res && res.subscribers && res.subscribers.length) ? res.subscribers.length : 0; this.subscribers = (res && res.value) ? res.value : 0;//(res && res.subscribers && res.subscribers.length) ? res.subscribers.length : 0;
this.countSubscribersEvent.emit({ this.countSubscribersEvent.emit({
@ -152,13 +160,13 @@ export class SubscribeComponent {
}, },
error => { error => {
this.handleError("Error getting community subscribers for community with id: " + this.communityId, error); this.handleError("Error getting community subscribers for community with id: " + this.communityId, error);
}); }));
} }
} }
if (this.communityId) { if (this.communityId) {
this.emailToInformManagers = {body: "", subject: "", recipients: []}; this.emailToInformManagers = {body: "", subject: "", recipients: []};
this._communityService.getCommunity(this.properties, this.properties.communityAPI + this.communityId).subscribe( this.subs.push(this._communityService.getCommunityByState(this.properties, this.properties.communityAPI + this.communityId).subscribe(
community => { community => {
this.community = community; this.community = community;
}, },
@ -166,7 +174,7 @@ export class SubscribeComponent {
//console.log('System error retrieving community profile', error) //console.log('System error retrieving community profile', error)
this.handleError("Error getting community with id: " + this.communityId, error); this.handleError("Error getting community with id: " + this.communityId, error);
} }
); ));
} }
} }
@ -184,7 +192,7 @@ export class SubscribeComponent {
} else { } else {
this.loading = true; this.loading = true;
this.showLoginAlert = false; this.showLoginAlert = false;
this._subscribeService.subscribeToCommunity(this.properties, this.communityId).subscribe( this.subs.push(this._subscribeService.subscribeToCommunity(this.properties, this.communityId).subscribe(
res => { res => {
this.loading = false; this.loading = false;
if (res.status && res.status != 200) { if (res.status && res.status != 200) {
@ -203,7 +211,7 @@ export class SubscribeComponent {
this.subscribeEvent.emit({ this.subscribeEvent.emit({
value: "ok" value: "ok"
}); });
this._emailService.notifyForNewManagers(this.properties, this.communityId, Composer.composeEmailToInformManagers(this.community.title, this.communityId, this.community.managers, this.subs.push(this._emailService.notifyForNewManagers(this.properties, this.communityId, Composer.composeEmailToInformManagers(this.community.title, this.communityId, this.community.managers,
email, this.properties.adminPortalURL)).subscribe( email, this.properties.adminPortalURL)).subscribe(
res => { res => {
//console.log("The email has been sent successfully!") //console.log("The email has been sent successfully!")
@ -212,7 +220,7 @@ export class SubscribeComponent {
//console.log(error) //console.log(error)
this.handleError("Error notifying managers about new subscribers for community with id: " + this.communityId, error); this.handleError("Error notifying managers about new subscribers for community with id: " + this.communityId, error);
} }
); ));
} }
} }
}, },
@ -229,7 +237,7 @@ export class SubscribeComponent {
}); });
//console.log(error) //console.log(error)
this.handleError("Error subscribing email: " + email + " to community with id: " + this.communityId, error); this.handleError("Error subscribing email: " + email + " to community with id: " + this.communityId, error);
}); }));
} }
} }
@ -240,7 +248,7 @@ export class SubscribeComponent {
} else { } else {
this.loading = true; this.loading = true;
//this.properties.adminToolsAPIURL //this.properties.adminToolsAPIURL
this._subscribeService.unSubscribeToCommunity(this.properties, this.communityId).subscribe( this.subs.push(this._subscribeService.unSubscribeToCommunity(this.properties, this.communityId).subscribe(
res => { res => {
this.loading = false; this.loading = false;
if (res.status && res.status != 200) { if (res.status && res.status != 200) {
@ -267,7 +275,7 @@ export class SubscribeComponent {
}); });
//console.log(error) //console.log(error)
this.handleError("Error unsubscribing email: " + email + " from community with id: " + this.communityId, error); this.handleError("Error unsubscribing email: " + email + " from community with id: " + this.communityId, error);
}); }));
} }
} }

View File

@ -2,9 +2,6 @@ import {ModuleWithProviders, NgModule} from '@angular/core';
import {CommonModule} from '@angular/common'; import {CommonModule} from '@angular/common';
import {RouterModule} from '@angular/router'; import {RouterModule} from '@angular/router';
import {SubscribeService} from '../../openaireLibrary/utils/subscribe/subscribe.service';
import {CommunityService} from "../../openaireLibrary/connect/community/community.service";
import {EmailService} from "../../openaireLibrary/utils/email/email.service"; import {EmailService} from "../../openaireLibrary/utils/email/email.service";
import {SubscribeComponent} from './subscribe.component'; import {SubscribeComponent} from './subscribe.component';
import {AlertModalModule} from '../../openaireLibrary/utils/modal/alertModal.module'; import {AlertModalModule} from '../../openaireLibrary/utils/modal/alertModal.module';
@ -25,7 +22,7 @@ export class SubscribeModule {
return { return {
ngModule: SubscribeModule, ngModule: SubscribeModule,
providers: [ providers: [
/*SubscribeService,*/ EmailService, CommunityService EmailService
] ]
} }
} }