[Connect|Trunk]

code clean up:

-remove unused imports, code, files (Old search pages for results,  etc)
-remove Freeguard from modules
-unsubscribe all subscriptions
-Services: configuration, communities, subscribers, user management: unsubscribe from app component or the component that uses them (clearSubscriptions())
-Fetchers: unsubscribe from  the component that uses them (clearSubscriptions())



git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@59826 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2020-11-12 15:59:26 +00:00
parent 1c5d9ec4a0
commit fdc7273d09
134 changed files with 633 additions and 1224 deletions

View File

@ -9,6 +9,7 @@ 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 {StringUtils} from '../openaireLibrary/utils/string-utils.class'; import {StringUtils} from '../openaireLibrary/utils/string-utils.class';
import {Subscriber} from "rxjs";
@Component({ @Component({
selector: 'affiliations', selector: 'affiliations',
@ -28,7 +29,7 @@ export class AffiliationsComponent {
communityId: string; communityId: string;
properties:EnvProperties; properties:EnvProperties;
public piwiksub: any; subscriptions = [];
public url: string = null; public url: string = null;
public pageTitle: string = "Related Organizations"; public pageTitle: string = "Related Organizations";
@ -40,9 +41,9 @@ export class AffiliationsComponent {
private affiliationService: AffiliationService) {} private affiliationService: AffiliationService) {}
public ngOnInit() { public ngOnInit() {
this.route.data this.subscriptions.push(this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => { .subscribe((data: { envSpecific: EnvProperties }) => {
this.route.queryParams.subscribe( this.subscriptions.push(this.route.queryParams.subscribe(
communityId => { communityId => {
this.communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain); this.communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
if(!this.communityId) { if(!this.communityId) {
@ -52,7 +53,7 @@ export class AffiliationsComponent {
this.properties = data.envSpecific; this.properties = data.envSpecific;
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.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle, PiwikHelper.getSiteId(this.communityId, this.properties.environment)).subscribe());
} }
this.url = this.properties.domain + this._router.url; this.url = this.properties.domain + this._router.url;
this.seoService.createLinkForCanonicalURL(this.url); this.seoService.createLinkForCanonicalURL(this.url);
@ -63,7 +64,7 @@ export class AffiliationsComponent {
if(this.getAffiliationsFromAPI) { if(this.getAffiliationsFromAPI) {
this.showLoading = true; this.showLoading = true;
this.affiliationService.initAffiliations(this.communityId); this.affiliationService.initAffiliations(this.communityId);
this.affiliationService.affiliations.subscribe( this.subscriptions.push(this.affiliationService.affiliations.subscribe(
affiliations => { affiliations => {
this.affiliations = affiliations; this.affiliations = affiliations;
this.showLoading = false; this.showLoading = false;
@ -72,16 +73,19 @@ export class AffiliationsComponent {
console.error("Affiliations Component: Error getting affiliations for community with id: " + this.communityId, error); console.error("Affiliations Component: Error getting affiliations for community with id: " + this.communityId, error);
this.showLoading = false; this.showLoading = false;
} }
); ));
} }
}); }));
}); }));
} }
public ngOnDestroy() { ngOnDestroy() {
if (this.piwiksub) { this.subscriptions.forEach(subscription => {
this.piwiksub.unsubscribe(); if (subscription instanceof Subscriber) {
subscription.unsubscribe();
} }
});
this.affiliationService.clearSubscriptions();
} }
public urlPrefix(url: string): string { public urlPrefix(url: string): string {

View File

@ -1,6 +1,5 @@
import { NgModule, ModuleWithProviders } from '@angular/core'; import { NgModule } from '@angular/core';
import {FreeGuard} from '../openaireLibrary/login/freeGuard.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 {RouterModule} from '@angular/router'; import {RouterModule} from '@angular/router';
@ -20,7 +19,7 @@ import {PiwikServiceModule} from "../openaireLibrary/utils/piwik/piwikService.mo
declarations: [ declarations: [
AffiliationsComponent AffiliationsComponent
], ],
providers:[FreeGuard,PreviousRouteRecorder, IsRouteEnabled, AffiliationService], providers:[PreviousRouteRecorder, IsRouteEnabled, AffiliationService],
exports: [ exports: [
AffiliationsComponent AffiliationsComponent
] ]

View File

@ -13,6 +13,7 @@ import {UserManagementService} from "./openaireLibrary/services/user-management.
import {ConfigurationService} from "./openaireLibrary/utils/configuration/configuration.service"; import {ConfigurationService} from "./openaireLibrary/utils/configuration/configuration.service";
import {properties} from '../environments/environment'; import {properties} from '../environments/environment';
import {Header} from "./openaireLibrary/sharedComponents/navigationBar.component"; import {Header} from "./openaireLibrary/sharedComponents/navigationBar.component";
import {Subscriber} from "rxjs";
@Component({ @Component({
//changeDetection: ChangeDetectionStrategy.Default, //changeDetection: ChangeDetectionStrategy.Default,
@ -92,22 +93,31 @@ export class AppComponent {
communityId: string = ""; communityId: string = "";
header: Header; header: Header;
logoPath: string = 'assets/common-assets/'; logoPath: string = 'assets/common-assets/';
subscriptions = [];
// community: {id:string, name:string, logoUrl:string}; // community: {id:string, name:string, logoUrl:string};
constructor(private route: ActivatedRoute, private propertiesService: EnvironmentSpecificService, constructor(private route: ActivatedRoute, private propertiesService: EnvironmentSpecificService,
private _communitiesService: CommunitiesService, private _subscribeService: SubscribeService, private _communitiesService: CommunitiesService, private _subscribeService: SubscribeService,
private router: Router, private userManagementService: UserManagementService, private router: Router, private userManagementService: UserManagementService,
private configurationService: ConfigurationService) { private configurationService: ConfigurationService) {
router.events.forEach((event) => { this.subscriptions.push(router.events.forEach((event) => {
if (event instanceof NavigationStart) { if (event instanceof NavigationStart) {
HelperFunctions.scroll(); HelperFunctions.scroll();
} }
}));
}
ngOnDestroy() {
this.subscriptions.forEach(subscription => {
if (subscription instanceof Subscriber) {
subscription.unsubscribe();
}
}); });
this._communitiesService.clearSubscriptions();
this.userManagementService.clearSubscriptions();
this.configurationService.clearSubscriptions();
this._subscribeService.clearSubscriptions();
} }
ngOnInit() { ngOnInit() {
// this.propertiesService.loadEnvironment()
// .then(es => {
// this.properties = this.propertiesService.envSpecific;
this.properties = properties; this.properties = properties;
this._communitiesService.updateCommunities(this.properties, this.properties.communitiesAPI); this._communitiesService.updateCommunities(this.properties, this.properties.communitiesAPI);
if (typeof document !== 'undefined') { if (typeof document !== 'undefined') {
@ -116,30 +126,25 @@ export class AppComponent {
} catch (e) { } catch (e) {
} }
} }
this.userManagementService.getUserInfo().subscribe(user => { this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
this.user = user; this.user = user;
this.init(); this.init();
}, },error => this.init()));
error => this.init());
// }, error => {
// console.log("App couldn't fetch properties");
// console.log(error);
//
// });
} }
private init() { private init() {
let communityId: string = ""; let communityId: string = "";
if (this.properties.environment == "development") { if (this.properties.environment == "development") {
this.showMenu = false; this.showMenu = false;
this.route.queryParams.subscribe(params => { this.subscriptions.push(this.route.queryParams.subscribe(params => {
communityId = (params['communityId']) ? params['communityId'] : ConnectHelper.getCommunityFromDomain(this.properties.domain); communityId = (params['communityId']) ? params['communityId'] : ConnectHelper.getCommunityFromDomain(this.properties.domain);
if(communityId) { if(communityId) {
this.properties.adminToolsPortalType = "community"; this.properties.adminToolsPortalType = "community";
} }
this.configurationService.initCommunityInformation(this.properties, communityId); this.configurationService.initCommunityInformation(this.properties, communityId);
this.buildMenu(communityId); this.buildMenu(communityId);
}) }));
} else { } else {
this.showMenu = false; this.showMenu = false;
communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain); communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
@ -155,7 +160,7 @@ export class AppComponent {
public buildMenu(communityId: string) { public buildMenu(communityId: string) {
let community = null; let community = null;
this.community = null; this.community = null;
this._communitiesService.getCommunitiesState().subscribe( this.subscriptions.push(this._communitiesService.getCommunitiesState().subscribe(
communities => { communities => {
if (!communities || communities.length == 0 && communityId !== null && communityId !== '') { if (!communities || communities.length == 0 && communityId !== null && communityId !== '') {
return; return;
@ -306,6 +311,6 @@ export class AppComponent {
} }
} }
this.showMenu = true; this.showMenu = true;
}); }));
} }
} }

View File

@ -20,14 +20,13 @@ import {EnvironmentSpecificResolver} from './openaireLibrary/utils/properties/en
import {CommunitiesService} from './openaireLibrary/connect/communities/communities.service'; import {CommunitiesService} from './openaireLibrary/connect/communities/communities.service';
import {LayoutService} from "./openaireLibrary/services/layout.service"; import {LayoutService} from "./openaireLibrary/services/layout.service";
import {SubscribeModule} from './utils/subscribe/subscribe.module'; import {SubscribeModule} from './utils/subscribe/subscribe.module';
import {ThemeComponent} from "./openaireLibrary/utils/theme/theme.component";
import {CustomizationModule} from "./utils/customization/customization.module"; import {CustomizationModule} from "./utils/customization/customization.module";
import {HttpInterceptorService} from "./openaireLibrary/http-interceptor.service"; import {HttpInterceptorService} from "./openaireLibrary/http-interceptor.service";
import {PageURLResolverComponent} from "./openaireLibrary/utils/pageURLResolver.component";
import {InviteBasicModule} from "./utils/subscribe/invite/inviteBasic.module"; import {InviteBasicModule} from "./utils/subscribe/invite/inviteBasic.module";
import {SubscribeService} from "./openaireLibrary/utils/subscribe/subscribe.service"; import {SubscribeService} from "./openaireLibrary/utils/subscribe/subscribe.service";
import {PageURLResolverModule} from "./openaireLibrary/utils/pageURLResolver.module"; import {PageURLResolverModule} from "./openaireLibrary/utils/pageURLResolver.module";
import {Schema2jsonldModule} from "./openaireLibrary/sharedComponents/schema2jsonld/schema2jsonld.module"; import {Schema2jsonldModule} from "./openaireLibrary/sharedComponents/schema2jsonld/schema2jsonld.module";
import {DEFAULT_TIMEOUT, TimeoutInterceptor} from "./openaireLibrary/timeout-interceptor.service";
@NgModule({ @NgModule({
@ -56,9 +55,11 @@ import {Schema2jsonldModule} from "./openaireLibrary/sharedComponents/schema2jso
provide: HTTP_INTERCEPTORS, provide: HTTP_INTERCEPTORS,
useClass: HttpInterceptorService, useClass: HttpInterceptorService,
multi: true multi: true
} },
[{ provide: HTTP_INTERCEPTORS, useClass: TimeoutInterceptor, multi: true }],
[{ provide: DEFAULT_TIMEOUT, useValue: 30000 }]
], ],
bootstrap: [AppComponent] bootstrap: [AppComponent]
}) })
//
export class AppModule {} export class AppModule {}

View File

@ -1,68 +0,0 @@
// import { NgModule} from '@angular/core';
// import { CommonModule } from '@angular/common';
// import { FormsModule } from '@angular/forms';
// //
// import {UtilsModule} from '../utils/utils.module';
// import {ServicesModule} from '../services/services.module';
//
// import { ClaimsService} from '../services/claims.service';
// //main
// import {ClaimComponent} from './claim/claim.component';
// import {ClaimsAdminComponent} from './claims/claimsAdmin.component';
// import {MyClaimsComponent} from './myClaims/myClaims.component';
// import {LinkingHomeComponent} from './linking/linkingHome.component';
// import {LinkingComponent} from './linking/linking.component';
// import { BulkLinkingComponent } from './linking/bulkLinking.component';
//
// import {BulkClaimComponent} from './linking/bulkClaim/bulkClaim.component';
// import {ClaimsComponent} from './claim-utils/claims.component';
//
// import {ClaimContextComponent} from './claim-utils/claimContext.component';
// import {ClaimProjectsComponent} from './claim-utils/claimProject.component';
// import {ClaimResultComponent} from './claim-utils/claimResult.component';
// import {ClaimPublicationComponent} from './claim-utils/claimPublication.component';
// import {ClaimDatasetComponent} from './claim-utils/claimDataset.component';
//
// import {ClaimInsertComponent} from './linking/insertClaim/insertClaim.component';
//
// import {ClaimSelectedContextsComponent} from './linking/selected/selectedContexts.component';
// import {ClaimSelectedComponent} from './linking/selected/selected.component';
// import {ClaimSelectedDatasetsComponent} from './linking/selected/selectedDatasets.component';
// import {ClaimSelectedResultsComponent} from './linking/selected/selectedResults.component';
// import {ClaimSelectedProjectsComponent} from './linking/selected/selectedProjects.component';
// import {ClaimSelectedPublicationsComponent} from './linking/selected/selectedPublications.component';
//
// import {LinkingGenericComponent} from './linking/linkingGeneric.component';
//
// import {InlineClaimContextComponent} from './inlineClaims/inlineClaimContext.component';
// import {InlineClaimProjectComponent} from './inlineClaims/inlineClaimProject.component';
// import {InlineClaimResultComponent} from './inlineClaims/inlineClaimResult.component';
// import {ClaimEntityFormatter} from '../utils/claimEntityFormatter.component';
//
// import { Claim } from '../utils/entities/claim';
// //helpers
//
// import { ClaimRoutingModule } from './claim-routing.module';
// @NgModule({
// imports: [
// CommonModule, FormsModule,
// UtilsModule,
// ServicesModule,
// ClaimRoutingModule
//
// ],
// declarations: [
// ClaimsAdminComponent, MyClaimsComponent, ClaimComponent, ClaimsComponent,
// BulkLinkingComponent, LinkingComponent, LinkingHomeComponent, LinkingGenericComponent,
// InlineClaimContextComponent, InlineClaimProjectComponent, InlineClaimResultComponent, ClaimSelectedComponent,
// ClaimContextComponent, ClaimSelectedContextsComponent, ClaimInsertComponent, ClaimProjectsComponent, ClaimSelectedProjectsComponent,
// ClaimResultComponent, ClaimSelectedPublicationsComponent, ClaimSelectedDatasetsComponent, ClaimSelectedResultsComponent, ClaimPublicationComponent,
// ClaimDatasetComponent, BulkClaimComponent,
// ClaimEntityFormatter
// ],
// providers: [ ClaimsService ],
// exports: [
// InlineClaimContextComponent, InlineClaimProjectComponent, InlineClaimResultComponent
// ]
// })
// export class ClaimModule { }

View File

@ -2,6 +2,7 @@ import {Component} from '@angular/core';
import {ActivatedRoute} from '@angular/router'; import {ActivatedRoute} from '@angular/router';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper'; import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
import {PiwikHelper} from "../../utils/piwikHelper"; import {PiwikHelper} from "../../utils/piwikHelper";
import {Subscriber} from "rxjs";
@Component({ @Component({
selector: 'openaire-directLinking', selector: 'openaire-directLinking',
@ -11,13 +12,18 @@ import {PiwikHelper} from "../../utils/piwikHelper";
export class OpenaireDirectLinkingComponent { export class OpenaireDirectLinkingComponent {
communityId: string; communityId: string;
public piwikSiteId = null; public piwikSiteId = null;
sub;
constructor(private route: ActivatedRoute) { constructor(private route: ActivatedRoute) {
} }
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
}
public ngOnInit() { public ngOnInit() {
this.route.data this.sub = this.route.data
.subscribe((data: { envSpecific: any }) => { .subscribe((data: { envSpecific: any }) => {
this.route.queryParams.subscribe( this.route.queryParams.subscribe(
communityId => { communityId => {

View File

@ -4,12 +4,12 @@ import {OpenaireLinkingComponent} from './linkingGeneric.component';
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 {LoginGuard} from "../../openaireLibrary/login/loginGuard.guard";
//LoginGuard
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: OpenaireLinkingComponent, canActivate: [IsRouteEnabled, ConnectSubscriberGuard ], data: { { path: '', component: OpenaireLinkingComponent, canActivate: [IsRouteEnabled, LoginGuard, ConnectSubscriberGuard ], data: {
redirect: '/error' redirect: '/error'
}, canDeactivate: [PreviousRouteRecorder]}, }, canDeactivate: [PreviousRouteRecorder]},

View File

@ -2,6 +2,7 @@ import {Component} from '@angular/core';
import {ActivatedRoute} from '@angular/router'; import {ActivatedRoute} from '@angular/router';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper'; import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
import {PiwikHelper} from "../../utils/piwikHelper"; import {PiwikHelper} from "../../utils/piwikHelper";
import {Subscriber} from "rxjs";
@Component({ @Component({
selector: 'openaire-linking-generic', selector: 'openaire-linking-generic',
@ -11,9 +12,14 @@ import {PiwikHelper} from "../../utils/piwikHelper";
export class OpenaireLinkingComponent { export class OpenaireLinkingComponent {
communityId:string; communityId:string;
public piwikSiteId = null; public piwikSiteId = null;
sub;
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
}
constructor (private route: ActivatedRoute) { constructor (private route: ActivatedRoute) {
this.route.data this.sub = this.route.data
.subscribe((data: { envSpecific: any }) => { .subscribe((data: { envSpecific: any }) => {
this.route.queryParams.subscribe( this.route.queryParams.subscribe(
communityId => { communityId => {

View File

@ -3,6 +3,7 @@ import {ActivatedRoute} from '@angular/router';
import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties'; import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
import {ConnectHelper} from "../../openaireLibrary/connect/connectHelper"; import {ConnectHelper} from "../../openaireLibrary/connect/connectHelper";
import {PiwikHelper} from "../../utils/piwikHelper"; import {PiwikHelper} from "../../utils/piwikHelper";
import {Subscriber} from "rxjs";
@Component({ @Component({
@ -19,9 +20,14 @@ import {PiwikHelper} from "../../utils/piwikHelper";
public piwikSiteId = null; public piwikSiteId = null;
constructor (private route: ActivatedRoute) {} constructor (private route: ActivatedRoute) {}
sub;
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
}
public ngOnInit() { public ngOnInit() {
this.route.data this.sub = this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => { .subscribe((data: { envSpecific: EnvProperties }) => {
this.claimsInfoURL = data.envSpecific.claimsInformationLink; this.claimsInfoURL = data.envSpecific.claimsInformationLink;
this.userInfoURL = data.envSpecific.userInfoUrl; this.userInfoURL = data.envSpecific.userInfoUrl;

View File

@ -1,51 +0,0 @@
// import {Component, Input} from '@angular/core';
// import {Observable} from 'rxjs/Observable';
// import { Router } from '@angular/router';
//
//
//
// @Component({
// selector: 'my-claims-demo',
// template: `
// <div *ngIf="user" class="container">
// <div class="page-header">
// <h1> My Claims Demo</h1>
// </div>
// <div>
// <div class=""><a routerLink="/Linking">Linking</a></div>
// <div class=""><a routerLink]="/MyClaims">MyClaims</a></div>
// <div class=""><a routerLink="/Claims">Claims Admin</a></div>
// <p> Extra parameters for claims admin</p>
// <div class=""><a href="claims?fetchBy=User&fetchId=amelie.baecker@uni-bielefeld.de">Claims By user</a></div>
// <div class=""><a href="claims?fetchBy=Project&fetchId=corda_______::2c37878a0cede85dbbd1081bb9b4a2f8">Claims By project</a></div>
// <div class=""><a href="claims?fetchBy=Context&fetchId=egi::country::gr">Claims By context</a></div>
//
// <!-- <p>Orcid
// <p>N.M.
// 0000-0002-3477-3082
// </p>
// </p> -->
// <div class=""><a href="publication?articleId=od_______908::3a5b2885656a91307156325644e73b92" >Publication od_______908::3a5b2885656a91307156325644e73b92</a></div>
// <!--<div class=""><a href="publication?articleId=od_______908::3a5b2885656a91307156325644e73b92" >Publication od_______908::3a5b2885656a91307156325644e73b92</a></div>
// <div class=""><a href="publication?articleId=od_______908::3a5b2885656a91307156325644e73b92" >Publication od_______908::3a5b2885656a91307156325644e73b92</a></div>-->
// </div>
// </div>
//
//
//
// `
// //(click)="changeOrderby('target')"
// //od_______908::3a5b2885656a91307156325644e73b92
//
// })
// export class MyClaimsDemoComponent {
// constructor ( private _router: Router ) {
// }
// user:string="argirok@di.uoa.gr";
// ngOnInit() {
//
// }
// goToPub(id: number){
// this._router.navigate( ['Publication', { articleId: id}] );
// }
// }

View File

@ -5,6 +5,7 @@ import {Location} from '@angular/common';
import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties'; import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
import {CommunityInfo, prodReadyCommunities} from '../../openaireLibrary/connect/community/communityInfo'; import {CommunityInfo, prodReadyCommunities} from '../../openaireLibrary/connect/community/communityInfo';
import {LocalStorageService} from "../../openaireLibrary/services/localStorage.service"; import {LocalStorageService} from "../../openaireLibrary/services/localStorage.service";
import {Subscriber} from "rxjs";
@Component({ @Component({
selector: 'browse-community', selector: 'browse-community',
@ -33,17 +34,24 @@ export class BrowseCommunityComponent {
public ngOnInit() { public ngOnInit() {
this.route.data this.subscriptions.push(this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => { .subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific; this.properties = data.envSpecific;
this.localStorageService.get().subscribe(value => { this.subscriptions.push(this.localStorageService.get().subscribe(value => {
this.directLink = value; this.directLink = value;
}); }));
}));
}
subscriptions = [];
ngOnDestroy() {
this.subscriptions.forEach(subscription => {
if (subscription instanceof Subscriber) {
subscription.unsubscribe();
}
}); });
} }
public ngOnDestroy() {
}
isProduction(): boolean { isProduction(): boolean {
return this.properties.environment != "development"; return this.properties.environment != "development";

View File

@ -5,8 +5,6 @@ import {RouterModule} from '@angular/router';
import {BrowseCommunityComponent} from './browse-community.component'; import {BrowseCommunityComponent} from './browse-community.component';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {SearchFormModule} from '../../openaireLibrary/searchPages/searchUtils/searchForm.module'; import {SearchFormModule} from '../../openaireLibrary/searchPages/searchUtils/searchForm.module';
import {ManageModule} from '../../openaireLibrary/utils/manage/manage.module'; import {ManageModule} from '../../openaireLibrary/utils/manage/manage.module';
import {AlertModalModule} from "../../openaireLibrary/utils/modal/alertModal.module"; import {AlertModalModule} from "../../openaireLibrary/utils/modal/alertModal.module";
@ -20,7 +18,6 @@ import {AlertModalModule} from "../../openaireLibrary/utils/modal/alertM
BrowseCommunityComponent BrowseCommunityComponent
], ],
providers:[ providers:[
FreeGuard
], ],
exports: [ exports: [
BrowseCommunityComponent BrowseCommunityComponent

View File

@ -3,13 +3,12 @@ import { RouterModule } from '@angular/router';
import{CommunitiesComponent} from './communities.component'; import{CommunitiesComponent} from './communities.component';
import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: CommunitiesComponent, canActivate: [FreeGuard], canDeactivate: [PreviousRouteRecorder] } { path: '', component: CommunitiesComponent, canDeactivate: [PreviousRouteRecorder] }
]) ])
] ]

View File

@ -14,6 +14,7 @@ import {ErrorMessagesComponent} from '../openaireLibrary/utils/errorMessages.com
import {HelperService} from "../openaireLibrary/utils/helper/helper.service"; import {HelperService} from "../openaireLibrary/utils/helper/helper.service";
import {SEOService} from "../openaireLibrary/sharedComponents/SEO/SEO.service"; import {SEOService} from "../openaireLibrary/sharedComponents/SEO/SEO.service";
import {properties} from "../../environments/environment"; import {properties} from "../../environments/environment";
import {Subscriber} from "rxjs";
@Component({ @Component({
selector: 'communities', selector: 'communities',
@ -21,7 +22,7 @@ import {properties} from "../../environments/environment";
}) })
export class CommunitiesComponent { export class CommunitiesComponent {
public piwiksub: any; private subscriptions = [];
public pageTitle = "OpenAIRE" public pageTitle = "OpenAIRE"
public researchCommunities = []; public researchCommunities = [];
@ -64,32 +65,29 @@ export class CommunitiesComponent {
} }
public ngOnInit() { public ngOnInit() {
this.route.data this.properties = properties;
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
var url = this.properties.domain + this.properties.baseLink + this._router.url; var url = this.properties.domain + this.properties.baseLink + this._router.url;
this.seoService.createLinkForCanonicalURL(url, false); this.seoService.createLinkForCanonicalURL(url, false);
this._meta.updateTag({content: url}, "property='og:url'"); this._meta.updateTag({content: url}, "property='og:url'");
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
this.piwiksub = this._piwikService.trackView(this.properties, "OpenAIRE Connect", this.properties.piwikSiteId).subscribe(); this.subscriptions.push(this._piwikService.trackView(this.properties, "OpenAIRE Connect", this.properties.piwikSiteId).subscribe());
} }
this.getCommunities(); this.getCommunities();
this.createGifs(); this.createGifs();
//this.getDivContents(); //this.getDivContents();
this.getPageContents(); this.getPageContents();
});
} }
private getPageContents() { private getPageContents() {
this.helper.getPageHelpContents(this.properties, 'connect', this._router.url).subscribe(contents => { this.subscriptions.push(this.helper.getPageHelpContents(this.properties, 'connect', this._router.url).subscribe(contents => {
this.pageContents = contents; this.pageContents = contents;
}) }));
} }
private getDivContents() { private getDivContents() {
this.helper.getDivHelpContents(this.properties, 'connect', this._router.url).subscribe(contents => { this.subscriptions.push(this.helper.getDivHelpContents(this.properties, 'connect', this._router.url).subscribe(contents => {
this.divContents = contents; this.divContents = contents;
}) }));
} }
public getCommunities() { public getCommunities() {
@ -99,7 +97,7 @@ export class CommunitiesComponent {
this.researchCommunities = []; this.researchCommunities = [];
this._communitiesService.getCommunitiesState().subscribe( this.subscriptions.push(this._communitiesService.getCommunitiesState().subscribe(
communitiesResults => { communitiesResults => {
if(!communitiesResults){ if(!communitiesResults){
return; return;
@ -125,7 +123,7 @@ export class CommunitiesComponent {
this.status = this.handleError("Error getting communities", error); this.status = this.handleError("Error getting communities", error);
this.loading = false; this.loading = false;
} }
); ));
} }
private createGifs() { private createGifs() {
@ -178,23 +176,25 @@ export class CommunitiesComponent {
return StringUtils.quote(param); return StringUtils.quote(param);
} }
public ngOnDestroy() { ngOnDestroy() {
if (this.piwiksub) { this.subscriptions.forEach(subscription => {
this.piwiksub.unsubscribe(); if (subscription instanceof Subscriber) {
subscription.unsubscribe();
} }
});
} }
private handleError(message: string, error): number { private handleError(message: string, error): number {
var code = ""; var code = "";
try {
if (!error.status) { if (!error.status) {
var error = error.json(); var error = error.json();
code = error.code; code = error.code;
} else { } else {
code = error.status; code = error.status;
} }
}catch(e){}
console.error("Communities (component): " + message, error); console.error("Communities (component): " + message, error);
return this.errorMessages.getErrorCode(code); return this.errorMessages.getErrorCode(code);
} }
} }

View File

@ -6,7 +6,6 @@ import {ManageModule} from '../openaireLibrary/utils/manage/manage.m
import {CommunitiesComponent} from './communities.component'; import {CommunitiesComponent} from './communities.component';
import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service'; import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
@ -30,7 +29,7 @@ import {SEOServiceModule} from "../openaireLibrary/sharedComponents/SEO/SEOServi
CommunitiesComponent CommunitiesComponent
], ],
providers:[ providers:[
FreeGuard, PreviousRouteRecorder, PreviousRouteRecorder,
PiwikService PiwikService
], ],
exports: [ exports: [

View File

@ -2,13 +2,12 @@ import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
import{CommunityComponent} from './community.component'; import{CommunityComponent} from './community.component';
import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: CommunityComponent, canActivate: [FreeGuard], canDeactivate: [PreviousRouteRecorder] } { path: '', component: CommunityComponent,canDeactivate: [PreviousRouteRecorder] }
]) ])
] ]

View File

@ -301,6 +301,10 @@ export class CommunityComponent {
for (let sub of this.subs) { for (let sub of this.subs) {
sub.unsubscribe(); sub.unsubscribe();
} }
this.fetchPublications.clearSubscriptions();
this.fetchDatasets.clearSubscriptions();
this.fetchOrps.clearSubscriptions();
this.fetchSoftware.clearSubscriptions();
} }
isEntityEnabled(entity: string) { isEntityEnabled(entity: string) {

View File

@ -6,7 +6,6 @@ import {CommunityComponent} from './community.component';
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service'; import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {SubscribeModule} from '../utils/subscribe/subscribe.module'; import {SubscribeModule} from '../utils/subscribe/subscribe.module';
import {InviteModule} from '../utils/subscribe/invite/invite.module'; import {InviteModule} from '../utils/subscribe/invite/invite.module';
@ -42,7 +41,7 @@ import {ErrorMessagesModule} from "../openaireLibrary/utils/errorMessages.module
CommunityComponent CommunityComponent
], ],
providers:[ providers:[
FreeGuard, PreviousRouteRecorder, PiwikService PreviousRouteRecorder, PiwikService
], ],
exports: [ exports: [
CommunityComponent CommunityComponent

View File

@ -2,13 +2,12 @@ import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
import{CommunityWrapperComponent} from './communityWrapper.component'; import{CommunityWrapperComponent} from './communityWrapper.component';
import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: CommunityWrapperComponent, canActivate: [FreeGuard], canDeactivate: [PreviousRouteRecorder] } { path: '', component: CommunityWrapperComponent, canDeactivate: [PreviousRouteRecorder] }
]) ])
] ]

View File

@ -2,6 +2,8 @@ import {Component} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router'; import {ActivatedRoute, Router} from '@angular/router';
import {ConnectHelper} from '../openaireLibrary/connect/connectHelper'; import {ConnectHelper} from '../openaireLibrary/connect/connectHelper';
import {properties} from "../../environments/environment";
import {Subscriber} from "rxjs";
@Component({ @Component({
selector: 'community-wrapper', selector: 'community-wrapper',
@ -14,17 +16,13 @@ import {ConnectHelper} from '../openaireLibrary/connect/connectHelper';
export class CommunityWrapperComponent { export class CommunityWrapperComponent {
communityId:string; communityId:string;
dashboard:boolean = null; dashboard:boolean = null;
properties;
constructor ( private sub;
private route: ActivatedRoute, constructor (private route: ActivatedRoute) {
private _router: Router this.properties = properties;
this.sub = this.route.queryParams.subscribe(
) {
this.route.data
.subscribe((data: { envSpecific: any }) => {
this.route.queryParams.subscribe(
communityId => { communityId => {
this.communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain); this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
if(!this.communityId) { if(!this.communityId) {
this.communityId = communityId['communityId']; this.communityId = communityId['communityId'];
} }
@ -36,13 +34,15 @@ export class CommunityWrapperComponent {
} }
}); });
});
} }
public ngOnInit() { public ngOnInit() {
} }
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
}
} }

View File

@ -2,7 +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 {FreeGuard} from '../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import{CommunityModule} from '../community/community.module'; import{CommunityModule} from '../community/community.module';
import{CommunitiesModule} from '../communities/communities.module'; import{CommunitiesModule} from '../communities/communities.module';
@ -17,7 +16,7 @@ import {CommunityWrapperRoutingModule} from './communityWrapper-routing.module';
CommunityWrapperComponent CommunityWrapperComponent
], ],
providers:[ providers:[
FreeGuard, PreviousRouteRecorder, PreviousRouteRecorder,
], ],
exports: [ exports: [

View File

@ -11,6 +11,7 @@ import {HelperService} from "../openaireLibrary/utils/helper/helper.service";
import {SEOService} from "../openaireLibrary/sharedComponents/SEO/SEO.service"; import {SEOService} from "../openaireLibrary/sharedComponents/SEO/SEO.service";
import {FormBuilder, FormGroup, Validators} from "@angular/forms"; import {FormBuilder, FormGroup, Validators} from "@angular/forms";
import {Breadcrumb} from "../openaireLibrary/utils/breadcrumbs/breadcrumbs.component"; import {Breadcrumb} from "../openaireLibrary/utils/breadcrumbs/breadcrumbs.component";
import {Subscriber} from "rxjs";
@Component({ @Component({
selector: 'contact', selector: 'contact',
@ -20,7 +21,6 @@ import {Breadcrumb} from "../openaireLibrary/utils/breadcrumbs/breadcrumbs.compo
export class ContactComponent implements OnInit { export class ContactComponent implements OnInit {
public url: string = null; public url: string = null;
public pageTitle: string = "OpenAIRE - Connect | Contact Us"; public pageTitle: string = "OpenAIRE - Connect | Contact Us";
public piwiksub: any;
public showLoading = true; public showLoading = true;
public errorMessage = ''; public errorMessage = '';
public email: Email; public email: Email;
@ -32,6 +32,14 @@ export class ContactComponent implements OnInit {
public contactForm: FormGroup; public contactForm: FormGroup;
@ViewChild('AlertModal') modal; @ViewChild('AlertModal') modal;
@ViewChild('recaptcha') recaptcha; @ViewChild('recaptcha') recaptcha;
private subscriptions = [];
ngOnDestroy() {
this.subscriptions.forEach(subscription => {
if (subscription instanceof Subscriber) {
subscription.unsubscribe();
}
});
}
constructor(private route: ActivatedRoute, constructor(private route: ActivatedRoute,
private _router: Router, private _router: Router,
@ -46,12 +54,12 @@ export class ContactComponent implements OnInit {
ngOnInit() { ngOnInit() {
this._title.setTitle('OpenAIRE-Connect | Contact Us'); this._title.setTitle('OpenAIRE-Connect | Contact Us');
this.route.data.subscribe((data: { envSpecific: EnvProperties }) => { this.subscriptions.push(this.route.data.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific; this.properties = data.envSpecific;
this.email = {body: '', subject: '', recipients: []}; this.email = {body: '', subject: '', recipients: []};
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
this.piwiksub = this._piwikService.trackView(this.properties, this.pageTitle, this.properties.piwikSiteId).subscribe(); this.subscriptions.push( this._piwikService.trackView(this.properties, this.pageTitle, this.properties.piwikSiteId).subscribe());
} }
this.url = this.properties.domain + this._router.url; this.url = this.properties.domain + this._router.url;
this.seoService.createLinkForCanonicalURL(this.url); this.seoService.createLinkForCanonicalURL(this.url);
@ -63,19 +71,19 @@ export class ContactComponent implements OnInit {
this.getPageContents(); this.getPageContents();
HelperFunctions.scroll(); HelperFunctions.scroll();
this.showLoading = false; this.showLoading = false;
}); }));
} }
private getPageContents() { private getPageContents() {
this.helper.getPageHelpContents(this.properties, 'connect', this._router.url).subscribe(contents => { this.subscriptions.push(this.helper.getPageHelpContents(this.properties, 'connect', this._router.url).subscribe(contents => {
this.pageContents = contents; this.pageContents = contents;
}) }));
} }
private getDivContents() { private getDivContents() {
this.helper.getDivHelpContents(this.properties, 'connect', this._router.url).subscribe(contents => { this.subscriptions.push(this.helper.getDivHelpContents(this.properties, 'connect', this._router.url).subscribe(contents => {
this.divContents = contents; this.divContents = contents;
}) }));
} }
public send(event) { public send(event) {
@ -102,7 +110,7 @@ export class ContactComponent implements OnInit {
private sendMail(admins: any) { private sendMail(admins: any) {
this.showLoading = true; this.showLoading = true;
this._emailService.contact(this.properties, this.subscriptions.push(this._emailService.contact(this.properties,
Composer.composeEmailForNewCommunity(this.contactForm.value, admins), Composer.composeEmailForNewCommunity(this.contactForm.value, admins),
this.contactForm.value.recaptcha).subscribe( this.contactForm.value.recaptcha).subscribe(
res => { res => {
@ -120,7 +128,7 @@ export class ContactComponent implements OnInit {
this.showLoading = false; this.showLoading = false;
this.contactForm.get('recaptcha').setValue(''); this.contactForm.get('recaptcha').setValue('');
} }
); ));
} }
public modalOpen() { public modalOpen() {

View File

@ -2,14 +2,13 @@ import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
import {ContentPageComponent} from './contentPage.component'; import {ContentPageComponent} from './contentPage.component';
import {FreeGuard} from '../openaireLibrary/login/freeGuard.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";
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: ContentPageComponent, canActivate: [FreeGuard, IsRouteEnabled], canDeactivate: [PreviousRouteRecorder] } { path: '', component: ContentPageComponent, canActivate: [IsRouteEnabled], canDeactivate: [PreviousRouteRecorder] }
]) ])
] ]

View File

@ -1,7 +1,6 @@
import {NgModule} from '@angular/core'; import {NgModule} from '@angular/core';
import {RouterModule} from '@angular/router'; import {RouterModule} from '@angular/router';
import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {ContentPageComponent} from './contentPage.component'; import {ContentPageComponent} from './contentPage.component';
@ -20,7 +19,7 @@ import {BreadcrumbsModule} from "../openaireLibrary/utils/breadcrumbs/breadcrumb
declarations: [ declarations: [
ContentPageComponent ContentPageComponent
], ],
providers: [FreeGuard, PreviousRouteRecorder, IsRouteEnabled], providers: [ PreviousRouteRecorder, IsRouteEnabled],
exports: [ exports: [
ContentPageComponent ContentPageComponent
] ]

View File

@ -10,7 +10,6 @@ import {AffiliationsModule} from "../affiliations/affiliations.module";
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";
import {PiwikService} from "../openaireLibrary/utils/piwik/piwik.service";
import {PiwikServiceModule} from "../openaireLibrary/utils/piwik/piwikService.module"; import {PiwikServiceModule} from "../openaireLibrary/utils/piwik/piwikService.module";
import {BreadcrumbsModule} from "../openaireLibrary/utils/breadcrumbs/breadcrumbs.module"; import {BreadcrumbsModule} from "../openaireLibrary/utils/breadcrumbs/breadcrumbs.module";

View File

@ -1,14 +1,13 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
import { OpenaireDepositComponent } from './deposit.component'; import { OpenaireDepositComponent } from './deposit.component';
import {FreeGuard} from '../openaireLibrary/login/freeGuard.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'
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: OpenaireDepositComponent, canActivate: [FreeGuard, IsRouteEnabled], data: { { path: '', component: OpenaireDepositComponent, canActivate: [ IsRouteEnabled], data: {
redirect: '/error' redirect: '/error'
}, canDeactivate: [PreviousRouteRecorder] } }, canDeactivate: [PreviousRouteRecorder] }

View File

@ -1,5 +1,5 @@
import {Component} from '@angular/core'; import {Component} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router'; import {ActivatedRoute} from '@angular/router';
import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties'; import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties';
import {ConnectHelper} from "../openaireLibrary/connect/connectHelper"; import {ConnectHelper} from "../openaireLibrary/connect/connectHelper";
@ -9,7 +9,7 @@ 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 {Subscriber, Subscription} from "rxjs";
import {properties} from "../../environments/environment"; import {properties} from "../../environments/environment";
@Component({ @Component({
@ -77,9 +77,12 @@ export class OpenaireDepositComponent {
public ngOnDestroy() { public ngOnDestroy() {
for (let sub of this.subs) { for (let sub of this.subs) {
if(sub instanceof Subscriber) {
sub.unsubscribe(); sub.unsubscribe();
} }
} }
this.fetchZenodoInformation.clearSubscriptions();
}
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

@ -1,9 +1,6 @@
import { NgModule } from '@angular/core'; 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 {FreeGuard} from '../openaireLibrary/login/freeGuard.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';
@ -25,7 +22,7 @@ import {SearchZenodoCommunitiesService} from "../openaireLibrary/connect/zenodoC
exports: [ exports: [
OpenaireDepositComponent, OpenaireDepositComponent,
], ],
providers: [FreeGuard,PreviousRouteRecorder, IsRouteEnabled, providers: [PreviousRouteRecorder, IsRouteEnabled,
ZenodoCommunitiesService, SearchZenodoCommunitiesService] ZenodoCommunitiesService, SearchZenodoCommunitiesService]
}) })
export class LibDepositModule { } export class LibDepositModule { }

View File

@ -1,14 +1,13 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
import { OpenaireSearchDataprovidersToDepositComponent } from './searchDataprovidersToDeposit.component'; import { OpenaireSearchDataprovidersToDepositComponent } from './searchDataprovidersToDeposit.component';
import {FreeGuard} from '../openaireLibrary/login/freeGuard.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'
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: OpenaireSearchDataprovidersToDepositComponent, canActivate: [FreeGuard, IsRouteEnabled], data: { { path: '', component: OpenaireSearchDataprovidersToDepositComponent, canActivate: [ IsRouteEnabled], data: {
redirect: '/error' redirect: '/error'
}, canDeactivate: [PreviousRouteRecorder] } }, canDeactivate: [PreviousRouteRecorder] }

View File

@ -11,7 +11,7 @@ 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 {Subscriber, Subscription} from "rxjs";
import {properties} from "../../environments/environment"; import {properties} from "../../environments/environment";
@Component({ @Component({
@ -32,9 +32,9 @@ export class OpenaireSearchDataprovidersToDepositComponent {
subs: Subscription[] = []; subs: Subscription[] = [];
constructor ( private route: ActivatedRoute, constructor ( private route: ActivatedRoute,
private _ΖenodoCommunitieService: ZenodoCommunitiesService, private _zenodoCommunitieService: ZenodoCommunitiesService,
private _communityService: CommunityService,private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService ) { private _communityService: CommunityService,private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService ) {
this.fetchZenodoInformation = new FetchZenodoInformation(this._ΖenodoCommunitieService, this._searchZenodoCommunitiesService); this.fetchZenodoInformation = new FetchZenodoInformation(this._zenodoCommunitieService, this._searchZenodoCommunitiesService);
} }
public ngOnInit() { public ngOnInit() {
@ -78,9 +78,12 @@ export class OpenaireSearchDataprovidersToDepositComponent {
public ngOnDestroy() { public ngOnDestroy() {
for (let sub of this.subs) { for (let sub of this.subs) {
if(sub instanceof Subscriber) {
sub.unsubscribe(); sub.unsubscribe();
} }
} }
this.fetchZenodoInformation.clearSubscriptions();
}
private handleError(message: string, error) { private handleError(message: string, error) {
console.error("Deposit Publications Page: "+message, error); console.error("Deposit Publications Page: "+message, error);

View File

@ -6,7 +6,6 @@ import { OpenaireSearchDataprovidersToDepositComponent } from './searchDataprovi
import {SearchDataprovidersToDepositRoutingModule} from './searchDataprovidersToDeposit-routing.module'; import {SearchDataprovidersToDepositRoutingModule} from './searchDataprovidersToDeposit-routing.module';
import {SearchDataprovidersToDepositModule} from '../openaireLibrary/deposit/searchDataprovidersToDeposit.module'; import {SearchDataprovidersToDepositModule} from '../openaireLibrary/deposit/searchDataprovidersToDeposit.module';
import {FreeGuard} from '../openaireLibrary/login/freeGuard.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 {ZenodoCommunitiesServiceModule} from '../openaireLibrary/connect/zenodoCommunities/zenodo-communitiesService.module'; import {ZenodoCommunitiesServiceModule} from '../openaireLibrary/connect/zenodoCommunities/zenodo-communitiesService.module';
@ -25,6 +24,6 @@ import {SearchZenodoCommunitiesServiceModule} from '../openaireLibrary/connect/z
exports: [ exports: [
OpenaireSearchDataprovidersToDepositComponent, OpenaireSearchDataprovidersToDepositComponent,
], ],
providers: [FreeGuard,PreviousRouteRecorder, IsRouteEnabled] providers: [PreviousRouteRecorder, IsRouteEnabled]
}) })
export class LibSearchDataprovidersToDepositModule { } export class LibSearchDataprovidersToDepositModule { }

View File

@ -3,15 +3,26 @@ import {ZenodoCommunitiesService} from '../../openaireLibrary/connect/zenodoComm
import {SearchZenodoCommunitiesService} from '../../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunities.service'; import {SearchZenodoCommunitiesService} from '../../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunities.service';
import {ZenodoInformationClass} from '../../openaireLibrary/deposit/utils/zenodoInformation.class'; import {ZenodoInformationClass} from '../../openaireLibrary/deposit/utils/zenodoInformation.class';
import {Subscriber} from "rxjs";
export class FetchZenodoInformation { export class FetchZenodoInformation {
constructor ( private _ΖenodoCommunitieService: ZenodoCommunitiesService, private subscriptions = [];
constructor ( private _zenodoCommunitieService: ZenodoCommunitiesService,
private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService ) { } private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService ) { }
public ngOnDestroy() { } public ngOnDestroy() {
this.clearSubscriptions();
}
clearSubscriptions(){
this.subscriptions.forEach(subscription => {
if (subscription instanceof Subscriber) {
subscription.unsubscribe();
}
});
}
public getZenodoCommunityNameAndUrlById(masterZenodoCommunityId: string, properties:EnvProperties, zenodoInformation: ZenodoInformationClass){ public getZenodoCommunityNameAndUrlById(masterZenodoCommunityId: string, properties:EnvProperties, zenodoInformation: ZenodoInformationClass){
this._ΖenodoCommunitieService.getZenodoCommunityById(properties, properties.zenodoCommunities+masterZenodoCommunityId, null).subscribe( this.subscriptions.push(this._zenodoCommunitieService.getZenodoCommunityById(properties, properties.zenodoCommunities+masterZenodoCommunityId, null).subscribe(
result => { result => {
console.info("getZenodoCommunityNameAndUrlById", result); console.info("getZenodoCommunityNameAndUrlById", result);
var masterZenodoCommunity = result; var masterZenodoCommunity = result;
@ -21,11 +32,11 @@ export class FetchZenodoInformation {
error => { error => {
console.error("Master Zenodo community'"+masterZenodoCommunityId+"' couldn't be loaded"); console.error("Master Zenodo community'"+masterZenodoCommunityId+"' couldn't be loaded");
} }
); ));
} }
public searchNumberOfZCommunities(communityId: string, properties: EnvProperties, zenodoInformation: ZenodoInformationClass) { public searchNumberOfZCommunities(communityId: string, properties: EnvProperties, zenodoInformation: ZenodoInformationClass) {
this._searchZenodoCommunitiesService.searchZCommunities(properties,communityId).subscribe ( this.subscriptions.push(this._searchZenodoCommunitiesService.searchZCommunities(properties,communityId).subscribe (
result => { result => {
console.info("searchNumberOfZCommunities", result); console.info("searchNumberOfZCommunities", result);
@ -39,6 +50,6 @@ export class FetchZenodoInformation {
error => { error => {
console.error("list of zenodo communities couldn't be loaded"); console.error("list of zenodo communities couldn't be loaded");
} }
); ));
} }
} }

View File

@ -2,14 +2,13 @@ import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
import {ShareInZenodoComponent} from './shareInZenodo.component'; import {ShareInZenodoComponent} from './shareInZenodo.component';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.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";
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: ShareInZenodoComponent, canActivate: [FreeGuard, IsRouteEnabled], canDeactivate: [PreviousRouteRecorder] } { path: '', component: ShareInZenodoComponent, canActivate: [IsRouteEnabled], canDeactivate: [PreviousRouteRecorder] }
]) ])
] ]

View File

@ -18,7 +18,7 @@ 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 {properties} from "../../../environments/environment";
import {Subscription} from "rxjs"; import {Subscriber, Subscription} from "rxjs";
@Component({ @Component({
selector: 'share-in-zenodo', selector: 'share-in-zenodo',
@ -150,9 +150,11 @@ export class ShareInZenodoComponent {
public ngOnDestroy() { public ngOnDestroy() {
for (let sub of this.subs) { for (let sub of this.subs) {
if(sub instanceof Subscriber) {
sub.unsubscribe(); sub.unsubscribe();
} }
} }
}
private updateDescription(description: string) { private updateDescription(description: string) {
this._meta.updateTag({content: description}, "name='description'"); this._meta.updateTag({content: description}, "name='description'");

View File

@ -1,7 +1,6 @@
import { NgModule, ModuleWithProviders } from '@angular/core'; import { NgModule} from '@angular/core';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.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'
@ -26,7 +25,7 @@ import {BreadcrumbsModule} from "../../openaireLibrary/utils/breadcrumbs/breadcr
declarations: [ declarations: [
ShareInZenodoComponent ShareInZenodoComponent
], ],
providers:[FreeGuard,PreviousRouteRecorder, IsRouteEnabled], providers:[PreviousRouteRecorder, IsRouteEnabled],
exports: [ exports: [
ShareInZenodoComponent ShareInZenodoComponent
] ]

View File

@ -1,5 +1,4 @@
import { Component, Input } from '@angular/core'; import { Component } from '@angular/core';
import { Location } from '@angular/common';
@Component({ @Component({
selector: 'openaire-error', selector: 'openaire-error',

View File

@ -7,6 +7,7 @@ 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 {HelperService} from "../openaireLibrary/utils/helper/helper.service"; import {HelperService} from "../openaireLibrary/utils/helper/helper.service";
import {ConnectHelper} from "../openaireLibrary/connect/connectHelper"; import {ConnectHelper} from "../openaireLibrary/connect/connectHelper";
import {Subscriber} from "rxjs";
@Component({ @Component({
selector: 'html-page', selector: 'html-page',
@ -24,7 +25,7 @@ export class HtmlPageComponent {
@Input() url: string = null; @Input() url: string = null;
@Input() pageTitle: string; @Input() pageTitle: string;
@Input() description: string; @Input() description: string;
piwiksub: any; private subscriptions = [];
communityId; communityId;
constructor(private route: ActivatedRoute, private _router: Router, constructor(private route: ActivatedRoute, private _router: Router,
@ -35,18 +36,18 @@ export class HtmlPageComponent {
private helper: HelperService) {} private helper: HelperService) {}
public ngOnInit() { public ngOnInit() {
this.route.data this.subscriptions.push(this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => { .subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific; 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, this.properties.piwikSiteId).subscribe(); this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle, this.properties.piwikSiteId).subscribe());
} }
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain); this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
if (this.properties.environment == "development") { if (this.properties.environment == "development") {
this.route.queryParams.subscribe(params => { this.subscriptions.push(this.route.queryParams.subscribe(params => {
this.communityId = (params['communityId']) ? params['communityId'] : ConnectHelper.getCommunityFromDomain(this.properties.domain); this.communityId = (params['communityId']) ? params['communityId'] : ConnectHelper.getCommunityFromDomain(this.properties.domain);
}) }));
} }
//TODO set the proper URL //TODO set the proper URL
this.url = this.properties.domain + this._router.url; this.url = this.properties.domain + this._router.url;
@ -55,15 +56,18 @@ export class HtmlPageComponent {
this.updateTitle(this.pageTitle); this.updateTitle(this.pageTitle);
this.updateDescription(this.description); this.updateDescription(this.description);
this.getPageContents(); this.getPageContents();
}); }));
} }
ngOnDestroy() { ngOnDestroy() {
if(this.piwiksub) { this.subscriptions.forEach(subscription => {
this.piwiksub.unsubscribe(); if (subscription instanceof Subscriber) {
subscription.unsubscribe();
} }
});
} }
private updateDescription(description: string) { private updateDescription(description: string) {
this._meta.updateTag({content: description}, "name='description'"); this._meta.updateTag({content: description}, "name='description'");
this._meta.updateTag({content: description}, "property='og:description'"); this._meta.updateTag({content: description}, "property='og:description'");
@ -80,8 +84,8 @@ export class HtmlPageComponent {
} }
private getPageContents() { private getPageContents() {
this.helper.getPageHelpContents(this.properties, this.communityId?this.communityId:"connect", this._router.url).subscribe(contents => { this.subscriptions.push(this.helper.getPageHelpContents(this.properties, this.communityId?this.communityId:"connect", this._router.url).subscribe(contents => {
this.pageContents = contents; this.pageContents = contents;
}) }));
} }
} }

View File

@ -1,14 +1,13 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
import {NationalBulletinPageComponent} from './nationalBulletinsPage.component'; import {NationalBulletinPageComponent} from './nationalBulletinsPage.component';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.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";
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: NationalBulletinPageComponent, canActivate: [FreeGuard, IsRouteEnabled], canDeactivate: [PreviousRouteRecorder] } { path: '', component: NationalBulletinPageComponent, canActivate: [IsRouteEnabled], canDeactivate: [PreviousRouteRecorder] }
]) ])
] ]

View File

@ -1,7 +1,5 @@
import {NgModule} from '@angular/core'; import {NgModule} from '@angular/core';
import {RouterModule} from '@angular/router'; import {RouterModule} from '@angular/router';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {NationalBulletinPageComponent} from './nationalBulletinsPage.component'; import {NationalBulletinPageComponent} from './nationalBulletinsPage.component';
import {CommonModule} from "@angular/common"; import {CommonModule} from "@angular/common";
@ -18,7 +16,7 @@ import {BreadcrumbsModule} from "../../openaireLibrary/utils/breadcrumbs/breadcr
declarations: [ declarations: [
NationalBulletinPageComponent NationalBulletinPageComponent
], ],
providers: [FreeGuard, PreviousRouteRecorder, IsRouteEnabled], providers: [PreviousRouteRecorder, IsRouteEnabled],
exports: [ exports: [
NationalBulletinPageComponent NationalBulletinPageComponent
] ]

View File

@ -2,14 +2,13 @@ import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
import {OrganizationsPageComponent} from './organizationsPage.component'; import {OrganizationsPageComponent} from './organizationsPage.component';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.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'
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: OrganizationsPageComponent, canActivate: [FreeGuard, IsRouteEnabled], canDeactivate: [PreviousRouteRecorder] } { path: '', component: OrganizationsPageComponent, canActivate: [ IsRouteEnabled], canDeactivate: [PreviousRouteRecorder] }
]) ])
] ]

View File

@ -1,6 +1,5 @@
import { NgModule, ModuleWithProviders } from '@angular/core'; import { NgModule } from '@angular/core';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.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'
@ -21,7 +20,7 @@ import {BreadcrumbsModule} from "../../openaireLibrary/utils/breadcrumbs/breadcr
declarations: [ declarations: [
OrganizationsPageComponent OrganizationsPageComponent
], ],
providers:[FreeGuard,PreviousRouteRecorder, IsRouteEnabled], providers:[PreviousRouteRecorder, IsRouteEnabled],
exports: [ exports: [
OrganizationsPageComponent OrganizationsPageComponent
] ]

View File

@ -1,14 +1,13 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
import {ProjectsPageComponent} from './projectsPage.component'; import {ProjectsPageComponent} from './projectsPage.component';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.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";
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: ProjectsPageComponent, canActivate: [FreeGuard, IsRouteEnabled], canDeactivate: [PreviousRouteRecorder] } { path: '', component: ProjectsPageComponent, canActivate: [IsRouteEnabled], canDeactivate: [PreviousRouteRecorder] }
]) ])
] ]

View File

@ -1,7 +1,5 @@
import {NgModule} from '@angular/core'; import {NgModule} from '@angular/core';
import {RouterModule} from '@angular/router'; import {RouterModule} from '@angular/router';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {ProjectsPageComponent} from './projectsPage.component'; import {ProjectsPageComponent} from './projectsPage.component';
import {CommonModule} from "@angular/common"; import {CommonModule} from "@angular/common";
@ -18,7 +16,7 @@ import {BreadcrumbsModule} from "../../openaireLibrary/utils/breadcrumbs/breadcr
declarations: [ declarations: [
ProjectsPageComponent ProjectsPageComponent
], ],
providers: [FreeGuard, PreviousRouteRecorder, IsRouteEnabled], providers: [ PreviousRouteRecorder, IsRouteEnabled],
exports: [ exports: [
ProjectsPageComponent ProjectsPageComponent
] ]

View File

@ -1,7 +1,6 @@
import {NgModule} from '@angular/core'; import {NgModule} from '@angular/core';
import {RouterModule} from '@angular/router'; import {RouterModule} from '@angular/router';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {PublicationsPageComponent} from './publications-page.component'; import {PublicationsPageComponent} from './publications-page.component';
import {CommonModule} from "@angular/common"; import {CommonModule} from "@angular/common";
@ -17,7 +16,7 @@ import {IsRouteEnabled} from "../../openaireLibrary/error/isRouteEnabled.guard";
declarations: [ declarations: [
PublicationsPageComponent PublicationsPageComponent
], ],
providers: [FreeGuard, PreviousRouteRecorder, IsRouteEnabled], providers: [ PreviousRouteRecorder, IsRouteEnabled],
exports: [ exports: [
PublicationsPageComponent PublicationsPageComponent
] ]

View File

@ -1,14 +1,13 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
import {PublicationsPageComponent} from './publications-page.component'; import {PublicationsPageComponent} from './publications-page.component';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.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";
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: PublicationsPageComponent, canActivate: [FreeGuard, IsRouteEnabled], canDeactivate: [PreviousRouteRecorder] } { path: '', component: PublicationsPageComponent, canActivate: [IsRouteEnabled], canDeactivate: [PreviousRouteRecorder] }
]) ])
] ]

View File

@ -2,13 +2,12 @@ import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
import { OpenaireDataProviderComponent } from './dataProvider.component'; import { OpenaireDataProviderComponent } from './dataProvider.component';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: OpenaireDataProviderComponent, canActivate: [FreeGuard], data: { { path: '', component: OpenaireDataProviderComponent, data: {
redirect: '/error' redirect: '/error'
},canDeactivate: [PreviousRouteRecorder] } },canDeactivate: [PreviousRouteRecorder] }
]) ])

View File

@ -2,6 +2,7 @@ import {Component} from '@angular/core';
import {ActivatedRoute} from '@angular/router'; import {ActivatedRoute} from '@angular/router';
import {PiwikHelper} from '../../utils/piwikHelper'; import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper'; import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
import {Subscriber} from "rxjs";
@Component({ @Component({
selector: 'openaire-dataprovider', selector: 'openaire-dataprovider',
@ -11,9 +12,9 @@ import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
export class OpenaireDataProviderComponent { export class OpenaireDataProviderComponent {
piwikSiteId = null; piwikSiteId = null;
communityId = null; communityId = null;
private sub;
constructor(private route: ActivatedRoute) { constructor(private route: ActivatedRoute) {
this.route.data this.sub = this.route.data
.subscribe((data: { envSpecific: any }) => { .subscribe((data: { envSpecific: any }) => {
this.route.queryParams.subscribe(params => { this.route.queryParams.subscribe(params => {
this.communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain); this.communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
@ -28,6 +29,10 @@ export class OpenaireDataProviderComponent {
ngOnInit() { ngOnInit() {
} }
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
}
} }

View File

@ -2,13 +2,12 @@ import { NgModule} from '@angular/core';
import { DataProviderModule } from '../../openaireLibrary/landingPages/dataProvider/dataProvider.module'; import { DataProviderModule } from '../../openaireLibrary/landingPages/dataProvider/dataProvider.module';
import { OpenaireDataProviderComponent } from './dataProvider.component'; import { OpenaireDataProviderComponent } from './dataProvider.component';
import {DataProviderRoutingModule} from './dataProvider-routing.module'; import {DataProviderRoutingModule} from './dataProvider-routing.module';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [DataProviderModule, DataProviderRoutingModule], imports: [DataProviderModule, DataProviderRoutingModule],
declarations:[OpenaireDataProviderComponent], declarations:[OpenaireDataProviderComponent],
providers:[FreeGuard, PreviousRouteRecorder], providers:[ PreviousRouteRecorder],
exports:[OpenaireDataProviderComponent] exports:[OpenaireDataProviderComponent]
}) })
export class LibDataProviderModule { } export class LibDataProviderModule { }

View File

@ -2,13 +2,12 @@ import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
import { OpenaireDatasetComponent } from './dataset.component'; import { OpenaireDatasetComponent } from './dataset.component';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: OpenaireDatasetComponent, canActivate: [FreeGuard], data: { { path: '', component: OpenaireDatasetComponent, data: {
redirect: '/error' redirect: '/error'
},canDeactivate: [PreviousRouteRecorder] } },canDeactivate: [PreviousRouteRecorder] }
]) ])

View File

@ -2,6 +2,7 @@ import {Component} from '@angular/core';
import {ActivatedRoute} from '@angular/router'; import {ActivatedRoute} from '@angular/router';
import {PiwikHelper} from '../../utils/piwikHelper'; import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper'; import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
import {Subscriber} from "rxjs";
@Component({ @Component({
selector: 'openaire-dataset', selector: 'openaire-dataset',
@ -12,9 +13,9 @@ import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
export class OpenaireDatasetComponent { export class OpenaireDatasetComponent {
piwikSiteId = null; piwikSiteId = null;
communityId = null; communityId = null;
private sub;
constructor(private route: ActivatedRoute) { constructor(private route: ActivatedRoute) {
this.route.data this.sub = this.route.data
.subscribe((data: { envSpecific: any }) => { .subscribe((data: { envSpecific: any }) => {
this.route.queryParams.subscribe(params => { this.route.queryParams.subscribe(params => {
this.communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain); this.communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
@ -27,6 +28,12 @@ export class OpenaireDatasetComponent {
} }
ngOnInit() { ngOnInit() {
}
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
} }

View File

@ -1,13 +1,12 @@
import { NgModule} from '@angular/core'; import { NgModule} from '@angular/core';
import { OpenaireDatasetComponent } from './dataset.component'; import { OpenaireDatasetComponent } from './dataset.component';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {DatasetRoutingModule} from './dataset-routing.module'; import {DatasetRoutingModule} from './dataset-routing.module';
import {ResultLandingModule} from "../../openaireLibrary/landingPages/result/resultLanding.module"; import {ResultLandingModule} from "../../openaireLibrary/landingPages/result/resultLanding.module";
@NgModule({ @NgModule({
imports: [DatasetRoutingModule, ResultLandingModule], imports: [DatasetRoutingModule, ResultLandingModule],
declarations:[OpenaireDatasetComponent], declarations:[OpenaireDatasetComponent],
providers:[FreeGuard, PreviousRouteRecorder], providers:[ PreviousRouteRecorder],
exports:[OpenaireDatasetComponent] exports:[OpenaireDatasetComponent]
}) })
export class LibDatasetModule { } export class LibDatasetModule { }

View File

@ -2,14 +2,13 @@ import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
import { OpenaireHtmlProjectReportComponent } from './htmlProjectReport.component'; import { OpenaireHtmlProjectReportComponent } from './htmlProjectReport.component';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: OpenaireHtmlProjectReportComponent , canActivate: [FreeGuard], { path: '', component: OpenaireHtmlProjectReportComponent,
data: { data: {
redirect: '/error' redirect: '/error'
},canDeactivate: [PreviousRouteRecorder]} },canDeactivate: [PreviousRouteRecorder]}

View File

@ -2,6 +2,7 @@ import {Component, ViewChild, ElementRef} from '@angular/core';
import {ActivatedRoute} from '@angular/router'; import {ActivatedRoute} from '@angular/router';
import {PiwikHelper} from '../../utils/piwikHelper'; import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper'; import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
import {Subscriber} from "rxjs";
@Component({ @Component({
selector: 'openaire-htmlProjectReport', selector: 'openaire-htmlProjectReport',
template: `<htmlProjectReport [piwikSiteId]=piwikSiteId [communityId]="communityId"></htmlProjectReport>`, template: `<htmlProjectReport [piwikSiteId]=piwikSiteId [communityId]="communityId"></htmlProjectReport>`,
@ -9,8 +10,10 @@ import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
export class OpenaireHtmlProjectReportComponent{ export class OpenaireHtmlProjectReportComponent{
piwikSiteId = null; piwikSiteId = null;
communityId = null; communityId = null;
constructor (private route: ActivatedRoute ) { private sub;
this.route.data
constructor(private route: ActivatedRoute) {
this.sub = this.route.data
.subscribe((data: { envSpecific: any }) => { .subscribe((data: { envSpecific: any }) => {
this.route.queryParams.subscribe(params => { this.route.queryParams.subscribe(params => {
this.communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain); this.communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
@ -22,9 +25,14 @@ export class OpenaireHtmlProjectReportComponent{
}); });
} }
ngOnInit() { ngOnInit() {
}
}
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
}

View File

@ -1,6 +1,5 @@
import { NgModule} from '@angular/core'; import { NgModule} from '@angular/core';
import { HtmlProjectReportModule } from '../../openaireLibrary/landingPages/htmlProjectReport/htmlProjectReport.module'; import { HtmlProjectReportModule } from '../../openaireLibrary/landingPages/htmlProjectReport/htmlProjectReport.module';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import { OpenaireHtmlProjectReportComponent } from './htmlProjectReport.component'; import { OpenaireHtmlProjectReportComponent } from './htmlProjectReport.component';
import {HtmlProjectReportRoutingModule} from './htmlProjectReport-routing.module'; import {HtmlProjectReportRoutingModule} from './htmlProjectReport-routing.module';
@ -8,7 +7,7 @@ import {HtmlProjectReportRoutingModule} from './htmlProjectReport-routing.module
@NgModule({ @NgModule({
imports: [HtmlProjectReportModule, HtmlProjectReportRoutingModule], imports: [HtmlProjectReportModule, HtmlProjectReportRoutingModule],
declarations:[OpenaireHtmlProjectReportComponent], declarations:[OpenaireHtmlProjectReportComponent],
providers:[FreeGuard, PreviousRouteRecorder], providers:[ PreviousRouteRecorder],
exports:[OpenaireHtmlProjectReportComponent] exports:[OpenaireHtmlProjectReportComponent]
}) })
export class LibHtmlProjectReportModule { } export class LibHtmlProjectReportModule { }

View File

@ -1,6 +1,5 @@
import { NgModule} from '@angular/core'; import { NgModule} from '@angular/core';
import { OrganizationModule } from '../../openaireLibrary/landingPages/organization/organization.module'; import { OrganizationModule } from '../../openaireLibrary/landingPages/organization/organization.module';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import { OpenaireOrganizationComponent } from './organization.component'; import { OpenaireOrganizationComponent } from './organization.component';
import {OrganizationRoutingModule} from './organization-routing.module'; import {OrganizationRoutingModule} from './organization-routing.module';
@ -8,7 +7,7 @@ import {OrganizationRoutingModule} from './organization-routing.module';
@NgModule({ @NgModule({
imports: [OrganizationModule, OrganizationRoutingModule], imports: [OrganizationModule, OrganizationRoutingModule],
declarations:[OpenaireOrganizationComponent], declarations:[OpenaireOrganizationComponent],
providers:[FreeGuard, PreviousRouteRecorder], providers:[PreviousRouteRecorder],
exports:[OpenaireOrganizationComponent] exports:[OpenaireOrganizationComponent]
}) })
export class LibOrganizationModule { } export class LibOrganizationModule { }

View File

@ -2,14 +2,13 @@ import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
import { OpenaireOrganizationComponent } from './organization.component'; import { OpenaireOrganizationComponent } from './organization.component';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: OpenaireOrganizationComponent, canActivate: [FreeGuard], data: { { path: '', component: OpenaireOrganizationComponent, data: {
redirect: '/error' redirect: '/error'
},canDeactivate: [PreviousRouteRecorder] } },canDeactivate: [PreviousRouteRecorder] }
]) ])

View File

@ -2,6 +2,7 @@ import {Component} from '@angular/core';
import {ActivatedRoute} from '@angular/router'; import {ActivatedRoute} from '@angular/router';
import {PiwikHelper} from '../../utils/piwikHelper'; import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper'; import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
import {Subscriber} from "rxjs";
@Component({ @Component({
selector: 'openaire-organization', selector: 'openaire-organization',
@ -11,9 +12,10 @@ import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
export class OpenaireOrganizationComponent { export class OpenaireOrganizationComponent {
piwikSiteId = null; piwikSiteId = null;
communityId = null; communityId = null;
private sub;
constructor(private route: ActivatedRoute) { constructor(private route: ActivatedRoute) {
this.route.data this.sub = this.route.data
.subscribe((data: { envSpecific: any }) => { .subscribe((data: { envSpecific: any }) => {
this.route.queryParams.subscribe(params => { this.route.queryParams.subscribe(params => {
this.communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain); this.communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
@ -28,6 +30,9 @@ export class OpenaireOrganizationComponent {
ngOnInit() { ngOnInit() {
} }
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
}
} }

View File

@ -1,5 +1,4 @@
import {NgModule} from '@angular/core'; import {NgModule} from '@angular/core';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {OpenaireOrpComponent} from './orp.component'; import {OpenaireOrpComponent} from './orp.component';
import {OrpRoutingModule} from './orp-routing.module'; import {OrpRoutingModule} from './orp-routing.module';
@ -13,7 +12,7 @@ import {ResultLandingModule} from "../../openaireLibrary/landingPages/result/res
OpenaireOrpComponent OpenaireOrpComponent
], ],
providers: [ providers: [
FreeGuard, PreviousRouteRecorder PreviousRouteRecorder
], ],
exports: [ exports: [
OpenaireOrpComponent OpenaireOrpComponent

View File

@ -2,13 +2,12 @@ import {NgModule} from '@angular/core';
import {RouterModule} from '@angular/router'; import {RouterModule} from '@angular/router';
import {OpenaireOrpComponent } from './orp.component'; import {OpenaireOrpComponent } from './orp.component';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([{ RouterModule.forChild([{
path: '', component: OpenaireOrpComponent, canActivate: [FreeGuard], data: { path: '', component: OpenaireOrpComponent, data: {
redirect: '/error' redirect: '/error'
}, },
canDeactivate: [PreviousRouteRecorder] canDeactivate: [PreviousRouteRecorder]

View File

@ -2,6 +2,7 @@ import {Component} from '@angular/core';
import {ActivatedRoute} from '@angular/router'; import {ActivatedRoute} from '@angular/router';
import {PiwikHelper} from '../../utils/piwikHelper'; import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper'; import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
import {Subscriber} from "rxjs";
@Component({ @Component({
selector: 'openaire-orp', selector: 'openaire-orp',
@ -13,8 +14,10 @@ import {ConnectHelper} from '../../openaireLibrary/connect/co
export class OpenaireOrpComponent { export class OpenaireOrpComponent {
piwikSiteId = null; piwikSiteId = null;
communityId = null; communityId = null;
constructor (private route: ActivatedRoute ) { private sub;
this.route.data
constructor(private route: ActivatedRoute) {
this.sub = this.route.data
.subscribe((data: { envSpecific: any }) => { .subscribe((data: { envSpecific: any }) => {
this.route.queryParams.subscribe(params => { this.route.queryParams.subscribe(params => {
this.communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain); this.communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
@ -30,4 +33,9 @@ export class OpenaireOrpComponent {
ngOnInit() { ngOnInit() {
} }
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
}
} }

View File

@ -1,6 +1,5 @@
import { NgModule} from '@angular/core'; import { NgModule} from '@angular/core';
import { ProjectModule } from '../../openaireLibrary/landingPages/project/project.module'; import { ProjectModule } from '../../openaireLibrary/landingPages/project/project.module';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import { OpenaireProjectComponent } from './project.component'; import { OpenaireProjectComponent } from './project.component';
import {ProjectRoutingModule} from './project-routing.module'; import {ProjectRoutingModule} from './project-routing.module';
@ -8,7 +7,7 @@ import {ProjectRoutingModule} from './project-routing.module';
@NgModule({ @NgModule({
imports: [ProjectModule, ProjectRoutingModule], imports: [ProjectModule, ProjectRoutingModule],
declarations:[OpenaireProjectComponent], declarations:[OpenaireProjectComponent],
providers:[FreeGuard, PreviousRouteRecorder], providers:[ PreviousRouteRecorder],
exports:[OpenaireProjectComponent] exports:[OpenaireProjectComponent]
}) })
export class LibProjectModule { } export class LibProjectModule { }

View File

@ -2,13 +2,12 @@ import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
import { OpenaireProjectComponent } from './project.component'; import { OpenaireProjectComponent } from './project.component';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: OpenaireProjectComponent, canActivate: [FreeGuard], data: { { path: '', component: OpenaireProjectComponent, data: {
redirect: '/error' redirect: '/error'
},canDeactivate: [PreviousRouteRecorder] } },canDeactivate: [PreviousRouteRecorder] }
]) ])

View File

@ -2,6 +2,7 @@ import {Component} from '@angular/core';
import {ActivatedRoute} from '@angular/router'; import {ActivatedRoute} from '@angular/router';
import {PiwikHelper} from '../../utils/piwikHelper'; import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper'; import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
import {Subscriber} from "rxjs";
@Component({ @Component({
selector: 'openaire-project', selector: 'openaire-project',
@ -11,9 +12,10 @@ import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
export class OpenaireProjectComponent { export class OpenaireProjectComponent {
piwikSiteId = null; piwikSiteId = null;
communityId = null; communityId = null;
private sub;
constructor(private route: ActivatedRoute) { constructor(private route: ActivatedRoute) {
this.route.data this.sub = this.route.data
.subscribe((data: { envSpecific: any }) => { .subscribe((data: { envSpecific: any }) => {
this.route.queryParams.subscribe(params => { this.route.queryParams.subscribe(params => {
this.communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain); this.communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
@ -27,6 +29,10 @@ export class OpenaireProjectComponent {
ngOnInit() { ngOnInit() {
} }
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
}
} }

View File

@ -1,5 +1,4 @@
import { NgModule} from '@angular/core'; import { NgModule} from '@angular/core';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import { OpenairePublicationComponent } from './publication.component'; import { OpenairePublicationComponent } from './publication.component';
import {PublicationRoutingModule} from './publication-routing.module'; import {PublicationRoutingModule} from './publication-routing.module';
@ -8,7 +7,7 @@ import {ResultLandingModule} from "../../openaireLibrary/landingPages/result/res
@NgModule({ @NgModule({
imports: [PublicationRoutingModule, ResultLandingModule], imports: [PublicationRoutingModule, ResultLandingModule],
declarations:[OpenairePublicationComponent], declarations:[OpenairePublicationComponent],
providers:[FreeGuard, PreviousRouteRecorder], providers:[ PreviousRouteRecorder],
exports:[OpenairePublicationComponent] exports:[OpenairePublicationComponent]
}) })
export class LibPublicationModule { } export class LibPublicationModule { }

View File

@ -2,13 +2,12 @@ import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
import {OpenairePublicationComponent } from './publication.component'; import {OpenairePublicationComponent } from './publication.component';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: OpenairePublicationComponent, canActivate: [FreeGuard], data: { { path: '', component: OpenairePublicationComponent, data: {
redirect: '/error' redirect: '/error'
},canDeactivate: [PreviousRouteRecorder] } },canDeactivate: [PreviousRouteRecorder] }
]) ])

View File

@ -2,6 +2,7 @@ import {Component} from '@angular/core';
import {ActivatedRoute} from '@angular/router'; import {ActivatedRoute} from '@angular/router';
import {PiwikHelper} from '../../utils/piwikHelper'; import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper'; import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
import {Subscriber} from "rxjs";
@Component({ @Component({
selector: 'openaire-publication', selector: 'openaire-publication',
@ -12,9 +13,10 @@ import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
export class OpenairePublicationComponent { export class OpenairePublicationComponent {
piwikSiteId = null; piwikSiteId = null;
communityId = null; communityId = null;
private sub;
constructor(private route: ActivatedRoute) { constructor(private route: ActivatedRoute) {
this.route.data this.sub = this.route.data
.subscribe((data: { envSpecific: any }) => { .subscribe((data: { envSpecific: any }) => {
this.route.queryParams.subscribe(params => { this.route.queryParams.subscribe(params => {
this.communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain); this.communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
@ -29,6 +31,10 @@ export class OpenairePublicationComponent {
ngOnInit() { ngOnInit() {
} }
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
}
} }

View File

@ -1,5 +1,4 @@
import {NgModule} from '@angular/core'; import {NgModule} from '@angular/core';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {OpenaireResultComponent} from './result.component'; import {OpenaireResultComponent} from './result.component';
import {ResultRoutingModule} from './result-routing.module'; import {ResultRoutingModule} from './result-routing.module';
@ -8,7 +7,7 @@ import {ResultLandingModule} from "../../openaireLibrary/landingPages/result/res
@NgModule({ @NgModule({
imports: [ResultRoutingModule, ResultLandingModule], imports: [ResultRoutingModule, ResultLandingModule],
declarations:[OpenaireResultComponent], declarations:[OpenaireResultComponent],
providers:[FreeGuard, PreviousRouteRecorder], providers:[ PreviousRouteRecorder],
exports:[OpenaireResultComponent] exports:[OpenaireResultComponent]
}) })
export class LibResultModule { } export class LibResultModule { }

View File

@ -2,14 +2,13 @@ import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
import {OpenaireResultComponent } from './result.component'; import {OpenaireResultComponent } from './result.component';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: OpenaireResultComponent, canActivate: [FreeGuard], data: { { path: '', component: OpenaireResultComponent, data: {
redirect: '/error', community : 'openaire' redirect: '/error', community : 'openaire'
},canDeactivate: [PreviousRouteRecorder] } },canDeactivate: [PreviousRouteRecorder] }
]) ])

View File

@ -2,6 +2,7 @@ import {Component} from '@angular/core';
import {ActivatedRoute} from "@angular/router"; import {ActivatedRoute} from "@angular/router";
import {ConnectHelper} from "../../openaireLibrary/connect/connectHelper"; import {ConnectHelper} from "../../openaireLibrary/connect/connectHelper";
import {PiwikHelper} from "../../utils/piwikHelper"; import {PiwikHelper} from "../../utils/piwikHelper";
import {Subscriber} from "rxjs";
@Component({ @Component({
selector: 'openaire-publication', selector: 'openaire-publication',
@ -10,9 +11,10 @@ import {PiwikHelper} from "../../utils/piwikHelper";
export class OpenaireResultComponent{ export class OpenaireResultComponent{
piwikSiteId = null; piwikSiteId = null;
communityId = null; communityId = null;
private sub;
constructor(private route: ActivatedRoute) { constructor(private route: ActivatedRoute) {
this.route.data this.sub = this.route.data
.subscribe((data: { envSpecific: any }) => { .subscribe((data: { envSpecific: any }) => {
this.route.queryParams.subscribe(params => { this.route.queryParams.subscribe(params => {
this.communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain); this.communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
@ -27,6 +29,10 @@ export class OpenaireResultComponent{
ngOnInit() { ngOnInit() {
} }
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
}
} }

View File

@ -1,5 +1,4 @@
import { NgModule} from '@angular/core'; import { NgModule} from '@angular/core';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import { OpenaireSoftwareComponent } from './software.component'; import { OpenaireSoftwareComponent } from './software.component';
import {SoftwareRoutingModule} from './software-routing.module'; import {SoftwareRoutingModule} from './software-routing.module';
@ -7,7 +6,7 @@ import {ResultLandingModule} from "../../openaireLibrary/landingPages/result/res
@NgModule({ @NgModule({
imports: [SoftwareRoutingModule, ResultLandingModule], imports: [SoftwareRoutingModule, ResultLandingModule],
declarations:[OpenaireSoftwareComponent], declarations:[OpenaireSoftwareComponent],
providers:[FreeGuard, PreviousRouteRecorder], providers:[ PreviousRouteRecorder],
exports:[OpenaireSoftwareComponent] exports:[OpenaireSoftwareComponent]
}) })
export class LibSoftwareModule { } export class LibSoftwareModule { }

View File

@ -2,14 +2,13 @@ import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
import {OpenaireSoftwareComponent } from './software.component'; import {OpenaireSoftwareComponent } from './software.component';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: OpenaireSoftwareComponent, canActivate: [FreeGuard], data: { { path: '', component: OpenaireSoftwareComponent, data: {
redirect: '/error' redirect: '/error'
},canDeactivate: [PreviousRouteRecorder] } },canDeactivate: [PreviousRouteRecorder] }
]) ])

View File

@ -2,6 +2,7 @@ import {Component} from '@angular/core';
import {ActivatedRoute} from '@angular/router'; import {ActivatedRoute} from '@angular/router';
import {PiwikHelper} from '../../utils/piwikHelper'; import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper'; import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
import {Subscriber} from "rxjs";
@Component({ @Component({
selector: 'openaire-software', selector: 'openaire-software',
@ -12,9 +13,10 @@ import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
export class OpenaireSoftwareComponent { export class OpenaireSoftwareComponent {
piwikSiteId = null; piwikSiteId = null;
communityId = null; communityId = null;
private sub;
constructor(private route: ActivatedRoute) { constructor(private route: ActivatedRoute) {
this.route.data this.sub = this.route.data
.subscribe((data: { envSpecific: any }) => { .subscribe((data: { envSpecific: any }) => {
this.route.queryParams.subscribe(params => { this.route.queryParams.subscribe(params => {
this.communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain); this.communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
@ -29,6 +31,10 @@ export class OpenaireSoftwareComponent {
ngOnInit() { ngOnInit() {
} }
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
}
} }

View File

@ -1,7 +1,6 @@
import {NgModule} from '@angular/core'; import {NgModule} from '@angular/core';
import {RouterModule} from '@angular/router'; import {RouterModule} from '@angular/router';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {FaqsComponent} from "./faqs.component"; import {FaqsComponent} from "./faqs.component";
import {IsRouteEnabled} from "../../openaireLibrary/error/isRouteEnabled.guard"; import {IsRouteEnabled} from "../../openaireLibrary/error/isRouteEnabled.guard";
@ -9,7 +8,7 @@ import {IsRouteEnabled} from "../../openaireLibrary/error/isRouteEnabled.guard";
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: FaqsComponent, canActivate: [FreeGuard, IsRouteEnabled], canDeactivate: [PreviousRouteRecorder] } { path: '', component: FaqsComponent, canActivate: [ IsRouteEnabled], canDeactivate: [PreviousRouteRecorder] }
]) ])
] ]

View File

@ -6,6 +6,7 @@ import {Meta, Title} from "@angular/platform-browser";
import {SEOService} from "../../openaireLibrary/sharedComponents/SEO/SEO.service"; 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 {HelperService} from "../../openaireLibrary/utils/helper/helper.service"; import {HelperService} from "../../openaireLibrary/utils/helper/helper.service";
import {Subscriber} from "rxjs";
@Component({ @Component({
selector: 'learn-in-depth', selector: 'learn-in-depth',
@ -200,7 +201,7 @@ export class FaqsComponent {
public pageTitle: string = "OpenAIRE - Connect | FAQs"; public pageTitle: string = "OpenAIRE - Connect | FAQs";
public pageDescription: string = "Frequently asked questions about OpenAIRE Connect research gateway"; public pageDescription: string = "Frequently asked questions about OpenAIRE Connect research gateway";
public breadcrumbs: Breadcrumb[] = [{name: 'home', route: '/'}, {name: 'about', route: '/about'}, {name: 'FAQs'}]; public breadcrumbs: Breadcrumb[] = [{name: 'home', route: '/'}, {name: 'about', route: '/about'}, {name: 'FAQs'}];
public piwiksub: any; private subscriptions;
public pageContents = null; public pageContents = null;
public divContents = null; public divContents = null;
public url: string = null; public url: string = null;
@ -217,12 +218,12 @@ export class FaqsComponent {
} }
public ngOnInit() { public ngOnInit() {
this.route.data this.subscriptions.push(this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => { .subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific; 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, this.properties.piwikSiteId).subscribe(); this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle, this.properties.piwikSiteId).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);
@ -232,25 +233,27 @@ export class FaqsComponent {
//this.getDivContents(); //this.getDivContents();
this.getPageContents(); this.getPageContents();
}); }));
} }
private getPageContents() { private getPageContents() {
this.helper.getPageHelpContents(this.properties, 'connect', this._router.url).subscribe(contents => { this.subscriptions.push(this.helper.getPageHelpContents(this.properties, 'connect', this._router.url).subscribe(contents => {
this.pageContents = contents; this.pageContents = contents;
}) }));
} }
private getDivContents() { private getDivContents() {
this.helper.getDivHelpContents(this.properties, 'connect', this._router.url).subscribe(contents => { this.subscriptions.push(this.helper.getDivHelpContents(this.properties, 'connect', this._router.url).subscribe(contents => {
this.divContents = contents; this.divContents = contents;
}) }));
} }
public ngOnDestroy() { ngOnDestroy() {
if (this.piwiksub) { this.subscriptions.forEach(subscription => {
this.piwiksub.unsubscribe(); if (subscription instanceof Subscriber) {
subscription.unsubscribe();
} }
});
} }
private updateDescription(description: string) { private updateDescription(description: string) {

View File

@ -2,7 +2,6 @@ import {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 {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {PiwikService} from '../../openaireLibrary/utils/piwik/piwik.service'; import {PiwikService} from '../../openaireLibrary/utils/piwik/piwik.service';
@ -27,7 +26,7 @@ import {HtmlPagesModule} from "../../htmlPages/htmlPages.module";
FaqsComponent FaqsComponent
], ],
providers:[ providers:[
FreeGuard, PreviousRouteRecorder, PiwikService, IsRouteEnabled PreviousRouteRecorder, PiwikService, IsRouteEnabled
] ]
}) })
export class FaqsModule { } export class FaqsModule { }

View File

@ -1,7 +1,5 @@
import {NgModule} from '@angular/core'; import {NgModule} from '@angular/core';
import {RouterModule} from '@angular/router'; import {RouterModule} from '@angular/router';
import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {LearnHowComponent} from "./learn-how.component"; import {LearnHowComponent} from "./learn-how.component";
import {IsRouteEnabled} from "../openaireLibrary/error/isRouteEnabled.guard"; import {IsRouteEnabled} from "../openaireLibrary/error/isRouteEnabled.guard";
@ -9,7 +7,7 @@ import {IsRouteEnabled} from "../openaireLibrary/error/isRouteEnabled.guard";
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: LearnHowComponent, canActivate: [FreeGuard, IsRouteEnabled], canDeactivate: [PreviousRouteRecorder] } { path: '', component: LearnHowComponent, canActivate: [ IsRouteEnabled], canDeactivate: [PreviousRouteRecorder] }
]) ])
] ]

View File

@ -6,6 +6,7 @@ import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties'
import {HelperService} from "../openaireLibrary/utils/helper/helper.service"; import {HelperService} from "../openaireLibrary/utils/helper/helper.service";
import {SEOService} from "../openaireLibrary/sharedComponents/SEO/SEO.service"; import {SEOService} from "../openaireLibrary/sharedComponents/SEO/SEO.service";
import {Breadcrumb} from "../openaireLibrary/utils/breadcrumbs/breadcrumbs.component"; import {Breadcrumb} from "../openaireLibrary/utils/breadcrumbs/breadcrumbs.component";
import {Subscriber} from "rxjs";
@Component({ @Component({
selector: 'learn-how', selector: 'learn-how',
@ -232,7 +233,6 @@ import {Breadcrumb} from "../openaireLibrary/utils/breadcrumbs/breadcrumbs.compo
` `
}) })
export class LearnHowComponent implements OnInit { export class LearnHowComponent implements OnInit {
public piwiksub: any;
public pageContents = null; public pageContents = null;
public divContents = null; public divContents = null;
@ -242,7 +242,7 @@ export class LearnHowComponent implements OnInit {
public breadcrumbs: Breadcrumb[] = [{name: 'home', route: '/'}, {name: 'about'}]; public breadcrumbs: Breadcrumb[] = [{name: 'home', route: '/'}, {name: 'about'}];
properties: EnvProperties; properties: EnvProperties;
subscriptions = [];
constructor( constructor(
private route: ActivatedRoute, private route: ActivatedRoute,
private _router: Router, private _router: Router,
@ -254,12 +254,12 @@ export class LearnHowComponent implements OnInit {
} }
public ngOnInit() { public ngOnInit() {
this.route.data this.subscriptions.push(this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => { .subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific; 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, this.properties.piwikSiteId).subscribe(); this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle, this.properties.piwikSiteId).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);
@ -269,27 +269,30 @@ export class LearnHowComponent implements OnInit {
//this.getDivContents(); //this.getDivContents();
this.getPageContents(); this.getPageContents();
}); }));
} }
private getPageContents() { private getPageContents() {
this.helper.getPageHelpContents(this.properties, 'connect', this._router.url).subscribe(contents => { this.subscriptions.push(this.helper.getPageHelpContents(this.properties, 'connect', this._router.url).subscribe(contents => {
this.pageContents = contents; this.pageContents = contents;
}) }));
} }
private getDivContents() { private getDivContents() {
this.helper.getDivHelpContents(this.properties, 'connect', this._router.url).subscribe(contents => { this.subscriptions.push(this.helper.getDivHelpContents(this.properties, 'connect', this._router.url).subscribe(contents => {
this.divContents = contents; this.divContents = contents;
}) }));
} }
public ngOnDestroy() { ngOnDestroy() {
if (this.piwiksub) { this.subscriptions.forEach(subscription => {
this.piwiksub.unsubscribe(); if (subscription instanceof Subscriber) {
subscription.unsubscribe();
} }
});
} }
private updateDescription(description: string) { private updateDescription(description: string) {
this._meta.updateTag({content: description}, "name='description'"); this._meta.updateTag({content: description}, "name='description'");
this._meta.updateTag({content: description}, "property='og:description'"); this._meta.updateTag({content: description}, "property='og:description'");

View File

@ -2,7 +2,6 @@ import { 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 {FreeGuard} from '../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service'; import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
@ -28,7 +27,7 @@ import {HtmlPagesModule} from "../htmlPages/htmlPages.module";
LearnHowComponent LearnHowComponent
], ],
providers:[ providers:[
FreeGuard, PreviousRouteRecorder, PiwikService, IsRouteEnabled PreviousRouteRecorder, PiwikService, IsRouteEnabled
] ]
}) })
export class LearnHowModule { } export class LearnHowModule { }

View File

@ -1,7 +1,6 @@
import {NgModule} from '@angular/core'; import {NgModule} from '@angular/core';
import {RouterModule} from '@angular/router'; import {RouterModule} from '@angular/router';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {LearnInDepthComponent} from "./learn-in-depth.component"; import {LearnInDepthComponent} from "./learn-in-depth.component";
import {IsRouteEnabled} from "../../openaireLibrary/error/isRouteEnabled.guard"; import {IsRouteEnabled} from "../../openaireLibrary/error/isRouteEnabled.guard";
@ -9,7 +8,7 @@ import {IsRouteEnabled} from "../../openaireLibrary/error/isRouteEnabled.guard";
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: LearnInDepthComponent, canActivate: [FreeGuard, IsRouteEnabled], canDeactivate: [PreviousRouteRecorder] } { path: '', component: LearnInDepthComponent, canActivate: [IsRouteEnabled], canDeactivate: [PreviousRouteRecorder] }
]) ])
] ]

View File

@ -6,6 +6,7 @@ import {Meta, Title} from "@angular/platform-browser";
import {SEOService} from "../../openaireLibrary/sharedComponents/SEO/SEO.service"; 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 {HelperService} from "../../openaireLibrary/utils/helper/helper.service"; import {HelperService} from "../../openaireLibrary/utils/helper/helper.service";
import {Subscriber} from "rxjs";
@Component({ @Component({
selector: 'learn-in-depth', selector: 'learn-in-depth',
@ -180,7 +181,7 @@ export class LearnInDepthComponent implements OnInit {
{name: 'about', route: '/about'}, {name: 'about', route: '/about'},
{name: 'learn in-depth'} {name: 'learn in-depth'}
]; ];
public piwiksub: any; subscriptions = [];
public pageContents = null; public pageContents = null;
public divContents = null; public divContents = null;
@ -199,12 +200,12 @@ export class LearnInDepthComponent implements OnInit {
} }
public ngOnInit() { public ngOnInit() {
this.route.data this.subscriptions.push(this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => { .subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific; 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, this.properties.piwikSiteId).subscribe(); this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle, this.properties.piwikSiteId).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);
@ -214,27 +215,30 @@ export class LearnInDepthComponent implements OnInit {
//this.getDivContents(); //this.getDivContents();
this.getPageContents(); this.getPageContents();
}); }));
} }
private getPageContents() { private getPageContents() {
this.helper.getPageHelpContents(this.properties, 'connect', this._router.url).subscribe(contents => { this.subscriptions.push(this.helper.getPageHelpContents(this.properties, 'connect', this._router.url).subscribe(contents => {
this.pageContents = contents; this.pageContents = contents;
}) }));
} }
private getDivContents() { private getDivContents() {
this.helper.getDivHelpContents(this.properties, 'connect', this._router.url).subscribe(contents => { this.subscriptions.push(this.helper.getDivHelpContents(this.properties, 'connect', this._router.url).subscribe(contents => {
this.divContents = contents; this.divContents = contents;
}) }));
} }
public ngOnDestroy() { ngOnDestroy() {
if (this.piwiksub) { this.subscriptions.forEach(subscription => {
this.piwiksub.unsubscribe(); if (subscription instanceof Subscriber) {
subscription.unsubscribe();
} }
});
} }
private updateDescription(description: string) { private updateDescription(description: string) {
this._meta.updateTag({content: description}, "name='description'"); this._meta.updateTag({content: description}, "name='description'");
this._meta.updateTag({content: description}, "property='og:description'"); this._meta.updateTag({content: description}, "property='og:description'");

View File

@ -2,7 +2,6 @@ import {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 {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {PiwikService} from '../../openaireLibrary/utils/piwik/piwik.service'; import {PiwikService} from '../../openaireLibrary/utils/piwik/piwik.service';
@ -27,7 +26,7 @@ import {HtmlPagesModule} from "../../htmlPages/htmlPages.module";
LearnInDepthComponent LearnInDepthComponent
], ],
providers:[ providers:[
FreeGuard, PreviousRouteRecorder, PiwikService, IsRouteEnabled PreviousRouteRecorder, PiwikService, IsRouteEnabled
] ]
}) })
export class LearnInDepthModule { } export class LearnInDepthModule { }

View File

@ -7,7 +7,6 @@ import { UserRoutingModule } from './user-routing.module';
import { UserModule} from '../openaireLibrary/login/user.module'; import { UserModule} from '../openaireLibrary/login/user.module';
import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import { SubscribeService } from '../openaireLibrary/utils/subscribe/subscribe.service';
import {EmailService} from "../openaireLibrary/utils/email/email.service"; import {EmailService} from "../openaireLibrary/utils/email/email.service";
import {SubscribeModule} from '../utils/subscribe/subscribe.module'; import {SubscribeModule} from '../utils/subscribe/subscribe.module';
@ -16,7 +15,7 @@ import {SubscribeModule} from '../utils/subscribe/subscribe.module';
CommonModule, FormsModule, CommonModule, FormsModule,
UserRoutingModule, UserModule, SubscribeModule UserRoutingModule, UserModule, SubscribeModule
], ],
providers:[PreviousRouteRecorder, /*SubscribeService,*/ EmailService], providers:[PreviousRouteRecorder, EmailService],
declarations: [ declarations: [
OpenaireUserComponent OpenaireUserComponent

View File

@ -1,16 +1,16 @@
import {Component, ElementRef, ViewChild} from '@angular/core'; import {Component, ViewChild} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {ActivatedRoute} from '@angular/router'; import {ActivatedRoute} from '@angular/router';
import {UserComponent} from '../openaireLibrary/login/user.component'; import {UserComponent} from '../openaireLibrary/login/user.component';
import {SubscribeService} from '../openaireLibrary/utils/subscribe/subscribe.service'; import {SubscribeService} from '../openaireLibrary/utils/subscribe/subscribe.service';
import {EmailService} from "../openaireLibrary/utils/email/email.service"; import {EmailService} from "../openaireLibrary/utils/email/email.service";
import {Email} from "../openaireLibrary/utils/email/email";
import {Session} from '../openaireLibrary/login/utils/helper.class'; import {Session} from '../openaireLibrary/login/utils/helper.class';
import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties'; import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties';
import {SubscribeComponent} from '../utils/subscribe/subscribe.component'; import {SubscribeComponent} from '../utils/subscribe/subscribe.component';
import {ConnectHelper} from '../openaireLibrary/connect/connectHelper'; import {ConnectHelper} from '../openaireLibrary/connect/connectHelper';
import {properties} from "../../environments/environment";
import {Subscriber} from "rxjs";
@Component({ @Component({
selector: 'openaire-user', selector: 'openaire-user',
@ -22,7 +22,8 @@ import {ConnectHelper} from '../openaireLibrary/connect/connectHelper';
<div *ngIf="usercomponent.errorCode == '6' && !isSubscribed" class="uk-alert uk-alert-warning"> <div *ngIf="usercomponent.errorCode == '6' && !isSubscribed" class="uk-alert uk-alert-warning">
<span *ngIf="!isSubscribed ">For this action you have to <span *ngIf="!loggedIn">login and</span> subscribe to the research community. <span *ngIf="!isSubscribed ">For this action you have to <span *ngIf="!loggedIn">login and</span> subscribe to the research community.
<span *ngIf="subscribe && !subscribeLoading "> <span *ngIf="!loggedIn">Login and </span>Subscribe <a [class]="'' + (subscribe.loading ? ' uk-disabled' : '')" (click)="subscribeTo()" > here</a>.</span> <span *ngIf="subscribe && !subscribeLoading "> <span *ngIf="!loggedIn">Login and </span>Subscribe <a
[class]="'' + (subscribe.loading ? ' uk-disabled' : '')" (click)="subscribeTo()"> here</a>.</span>
</span> </span>
<span *ngIf="subscribeLoading ">Subscribing to community....</span> <span *ngIf="subscribeLoading ">Subscribing to community....</span>
<span *ngIf="subscribeError ">An error occured while trying to subscribe to community....</span> <span *ngIf="subscribeError ">An error occured while trying to subscribe to community....</span>
@ -31,72 +32,74 @@ import {ConnectHelper} from '../openaireLibrary/connect/connectHelper';
<div *ngIf="usercomponent.errorCode == '7'" class="uk-alert uk-alert-warning"> <div *ngIf="usercomponent.errorCode == '7'" class="uk-alert uk-alert-warning">
This action requires authentication. This action requires authentication.
<span *ngIf="!loggedIn"> <span *ngIf="!loggedIn">
Please <a class="" (click)="login()" > sign in</a> to continue. Please <a class="" (click)="login()"> sign in</a> to continue.
</span> </span>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<subscribe [communityId]="communityId" [showTemplate]= false class="" (subscribeEvent)="afterSubscibeEvent($event)"></subscribe> <subscribe [communityId]="communityId" [showTemplate]=false class=""
(subscribeEvent)="afterSubscibeEvent($event)"></subscribe>
` `
}) })
export class OpenaireUserComponent { export class OpenaireUserComponent {
@ViewChild(UserComponent) usercomponent:UserComponent; @ViewChild(UserComponent) usercomponent: UserComponent;
@ViewChild(SubscribeComponent) subscribe:SubscribeComponent; @ViewChild(SubscribeComponent) subscribe: SubscribeComponent;
properties:EnvProperties; properties: EnvProperties;
communityId = null; communityId = null;
subscribeLoading:boolean = false; subscribeLoading: boolean = false;
subscribeError:boolean = false; subscribeError: boolean = false;
isSubscribed:boolean = false; isSubscribed: boolean = false;
public server: boolean = true; public server: boolean = true;
loggedIn:boolean = false; loggedIn: boolean = false;
sub;
constructor(private _subscribeService: SubscribeService, constructor(private _subscribeService: SubscribeService,
private _emailService: EmailService, private route: ActivatedRoute){} private _emailService: EmailService, private route: ActivatedRoute) {
}
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
}
public ngOnInit() { public ngOnInit() {
if( typeof document !== 'undefined') { if (typeof document !== 'undefined') {
this.server = false; this.server = false;
this.loggedIn = Session.isLoggedIn(); this.loggedIn = Session.isLoggedIn();
} }
this.route.data this.properties = properties;
.subscribe((data: { envSpecific: any }) => { this.sub = this.route.queryParams.subscribe(
this.route.queryParams.subscribe(
communityId => { communityId => {
this.communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain); this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
if(!this.communityId) { if (!this.communityId) {
this.communityId = communityId['communityId']; this.communityId = communityId['communityId'];
} }
if(this.subscribe.subscribed){ if (this.subscribe.subscribed) {
this.usercomponent.redirect(); this.usercomponent.redirect();
} }
}); });
});
} }
login(){
login() {
this.usercomponent.logIn(); this.usercomponent.logIn();
} }
subscribeTo(){
if(this.subscribe && this.communityId){ subscribeTo() {
if (this.subscribe && this.communityId) {
this.subscribeLoading = true; this.subscribeLoading = true;
this.subscribe.subscribe(); this.subscribe.subscribe();
}
} }
} afterSubscibeEvent($event) {
afterSubscibeEvent($event){
var res = $event.value; var res = $event.value;
this.subscribeLoading = false; this.subscribeLoading = false;
this.isSubscribed = this.subscribe.subscribed; this.isSubscribed = this.subscribe.subscribed;
if(res == "ok"){ if (res == "ok") {
this.isSubscribed = true; this.isSubscribed = true;
this.usercomponent.redirect(); this.usercomponent.redirect();
}else{ } else {
this.subscribeError = true; this.subscribeError = true;
} }

View File

@ -17,6 +17,7 @@ import {SEOService} from "../openaireLibrary/sharedComponents/SEO/SEO.service";
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 {properties} from "../../environments/environment"; import {properties} from "../../environments/environment";
import {Subscriber} from "rxjs";
@Component({ @Component({
selector: 'my-communities', selector: 'my-communities',
@ -24,8 +25,6 @@ import {properties} from "../../environments/environment";
}) })
export class MyCommunitiesComponent { export class MyCommunitiesComponent {
public piwiksub: any;
public pageTitle = "OpenAIRE" public pageTitle = "OpenAIRE"
public subscriberOfCommunities = []; public subscriberOfCommunities = [];
public managerOfCommunities = []; public managerOfCommunities = [];
@ -42,7 +41,7 @@ export class MyCommunitiesComponent {
properties: EnvProperties; properties: EnvProperties;
private user: User; private user: User;
subscriptions = [];
constructor( constructor(
private route: ActivatedRoute, private route: ActivatedRoute,
private _router: Router, private _router: Router,
@ -70,36 +69,34 @@ export class MyCommunitiesComponent {
} }
public ngOnInit() { public ngOnInit() {
this.route.data this.properties = properties;
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
var url = this.properties.domain + this.properties.baseLink + this._router.url; var url = this.properties.domain + this.properties.baseLink + this._router.url;
this.seoService.createLinkForCanonicalURL(url, false); this.seoService.createLinkForCanonicalURL(url, false);
this._meta.updateTag({content: url}, "property='og:url'"); this._meta.updateTag({content: url}, "property='og:url'");
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
this.piwiksub = this._piwikService.trackView(this.properties, "OpenAIRE Connect", this.properties.piwikSiteId).subscribe(); this.subscriptions.push(this._piwikService.trackView(this.properties, "OpenAIRE Connect", this.properties.piwikSiteId).subscribe());
} }
this.userManagementService.getUserInfo().subscribe(user => { this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
this.user = user; this.user = user;
if(this.user) { if(this.user) {
this.getCommunities(); this.getCommunities();
} }
//this.getDivContents(); //this.getDivContents();
//this.getPageContents(); //this.getPageContents();
}); }));
});
} }
private getPageContents() { private getPageContents() {
this.helper.getPageHelpContents(this.properties, 'connect', this._router.url).subscribe(contents => { this.subscriptions.push(this.helper.getPageHelpContents(this.properties, 'connect', this._router.url).subscribe(contents => {
this.pageContents = contents; this.pageContents = contents;
}) }));
} }
private getDivContents() { private getDivContents() {
this.helper.getDivHelpContents(this.properties, 'connect', this._router.url).subscribe(contents => { this.subscriptions.push(this.helper.getDivHelpContents(this.properties, 'connect', this._router.url).subscribe(contents => {
this.divContents = contents; this.divContents = contents;
}) }));
} }
public getCommunities() { public getCommunities() {
@ -111,7 +108,7 @@ export class MyCommunitiesComponent {
this.managerOfCommunities = []; this.managerOfCommunities = [];
this.researchCommunities = []; this.researchCommunities = [];
this._communitiesService.getCommunitiesState().subscribe( this.subscriptions.push(this._communitiesService.getCommunitiesState().subscribe(
communitiesResults => { communitiesResults => {
if (!communitiesResults) { if (!communitiesResults) {
return; return;
@ -155,7 +152,7 @@ export class MyCommunitiesComponent {
this.status = this.errorCodes.DONE; this.status = this.errorCodes.DONE;
if (mail != null && showCommunity) { if (mail != null && showCommunity) {
this._subscribeService.isSubscribedToCommunity(this.properties, community.communityId).subscribe( this.subscriptions.push(this._subscribeService.isSubscribedToCommunity(this.properties, community.communityId).subscribe(
res => { res => {
isSubscriber = res; isSubscriber = res;
if (isSubscriber) { if (isSubscriber) {
@ -178,7 +175,7 @@ export class MyCommunitiesComponent {
if (subscribedLoading == 0) { if (subscribedLoading == 0) {
this.loading = false; this.loading = false;
} }
}); }));
} else { } else {
subscribedLoading--; subscribedLoading--;
if (subscribedLoading == 0) { if (subscribedLoading == 0) {
@ -191,7 +188,7 @@ export class MyCommunitiesComponent {
this.status = this.handleError("Error getting communities", error); this.status = this.handleError("Error getting communities", error);
this.loading = false; this.loading = false;
} }
); ));
} }
private sort(results: CommunityInfo[]) { private sort(results: CommunityInfo[]) {
@ -216,10 +213,12 @@ export class MyCommunitiesComponent {
return StringUtils.quote(param); return StringUtils.quote(param);
} }
public ngOnDestroy() { ngOnDestroy() {
if (this.piwiksub) { this.subscriptions.forEach(subscription => {
this.piwiksub.unsubscribe(); if (subscription instanceof Subscriber) {
subscription.unsubscribe();
} }
});
} }
private handleError(message: string, error): number { private handleError(message: string, error): number {

View File

@ -1,7 +1,6 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
import{OpenaireAdvancedSearchDataProvidersComponent} from './advancedSearchDataProviders.component'; import{OpenaireAdvancedSearchDataProvidersComponent} from './advancedSearchDataProviders.component';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
@ -9,7 +8,7 @@ import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousR
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: OpenaireAdvancedSearchDataProvidersComponent, canActivate: [FreeGuard], data: { { path: '', component: OpenaireAdvancedSearchDataProvidersComponent, data: {
redirect: '/error', community : 'openaire' redirect: '/error', community : 'openaire'
}, canDeactivate: [PreviousRouteRecorder] } }, canDeactivate: [PreviousRouteRecorder] }

View File

@ -3,6 +3,7 @@ import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/
import {ActivatedRoute} from "@angular/router"; import {ActivatedRoute} from "@angular/router";
import {ConnectHelper} from "../../openaireLibrary/connect/connectHelper"; import {ConnectHelper} from "../../openaireLibrary/connect/connectHelper";
import {PiwikHelper} from "../../utils/piwikHelper"; import {PiwikHelper} from "../../utils/piwikHelper";
import {Subscriber} from "rxjs";
@Component({ @Component({
@ -20,8 +21,14 @@ export class OpenaireAdvancedSearchDataProvidersComponent {
customFilter: SearchCustomFilter = null; customFilter: SearchCustomFilter = null;
constructor ( private route: ActivatedRoute) { constructor ( private route: ActivatedRoute) {
} }
sub;
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
}
ngOnInit() { ngOnInit() {
this.route.data this.sub = this.route.data
.subscribe((data: { envSpecific: any }) => { .subscribe((data: { envSpecific: any }) => {
var communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain); var communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);

View File

@ -5,7 +5,6 @@ import {FormsModule} from '@angular/forms';
import {AdvancedSearchDataProvidersRoutingModule} from './advancedSearchDataProviders-routing.module'; import {AdvancedSearchDataProvidersRoutingModule} from './advancedSearchDataProviders-routing.module';
import {OpenaireAdvancedSearchDataProvidersComponent} from './advancedSearchDataProviders.component'; import {OpenaireAdvancedSearchDataProvidersComponent} from './advancedSearchDataProviders.component';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {SearchDataProvidersModule} from "../../openaireLibrary/searchPages/searchDataProviders.module"; import {SearchDataProvidersModule} from "../../openaireLibrary/searchPages/searchDataProviders.module";
@NgModule({ @NgModule({
@ -18,7 +17,7 @@ import {SearchDataProvidersModule} from "../../openaireLibrary/searchPages/searc
declarations: [ declarations: [
OpenaireAdvancedSearchDataProvidersComponent OpenaireAdvancedSearchDataProvidersComponent
], ],
providers:[FreeGuard], providers:[],
exports: [ exports: [
OpenaireAdvancedSearchDataProvidersComponent OpenaireAdvancedSearchDataProvidersComponent
] ]

View File

@ -2,14 +2,13 @@ import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
import{OpenaireAdvancedSearchOrganizationsComponent} from './advancedSearchOrganizations.component'; import{OpenaireAdvancedSearchOrganizationsComponent} from './advancedSearchOrganizations.component';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: OpenaireAdvancedSearchOrganizationsComponent , canActivate: [FreeGuard], data: { { path: '', component: OpenaireAdvancedSearchOrganizationsComponent , data: {
redirect: '/error', community : 'openaire' redirect: '/error', community : 'openaire'
},canDeactivate: [PreviousRouteRecorder]} },canDeactivate: [PreviousRouteRecorder]}

View File

@ -3,6 +3,7 @@ import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/
import {ActivatedRoute} from "@angular/router"; import {ActivatedRoute} from "@angular/router";
import {ConnectHelper} from "../../openaireLibrary/connect/connectHelper"; import {ConnectHelper} from "../../openaireLibrary/connect/connectHelper";
import {PiwikHelper} from "../../utils/piwikHelper"; import {PiwikHelper} from "../../utils/piwikHelper";
import {Subscriber} from "rxjs";
@Component({ @Component({
@ -20,8 +21,14 @@ export class OpenaireAdvancedSearchOrganizationsComponent {
customFilter: SearchCustomFilter = null; customFilter: SearchCustomFilter = null;
constructor ( private route: ActivatedRoute) { constructor ( private route: ActivatedRoute) {
} }
sub;
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
}
ngOnInit() { ngOnInit() {
this.route.data this.sub =this.route.data
.subscribe((data: { envSpecific: any }) => { .subscribe((data: { envSpecific: any }) => {
var communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain); var communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);

View File

@ -5,7 +5,6 @@ import {FormsModule} from '@angular/forms';
import {AdvancedSearchOrganizationsRoutingModule} from './advancedSearchOrganizations-routing.module'; import {AdvancedSearchOrganizationsRoutingModule} from './advancedSearchOrganizations-routing.module';
import {OpenaireAdvancedSearchOrganizationsComponent} from './advancedSearchOrganizations.component'; import {OpenaireAdvancedSearchOrganizationsComponent} from './advancedSearchOrganizations.component';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {SearchOrganizationsModule} from "../../openaireLibrary/searchPages/searchOrganizations.module"; import {SearchOrganizationsModule} from "../../openaireLibrary/searchPages/searchOrganizations.module";
@NgModule({ @NgModule({
@ -18,7 +17,7 @@ import {SearchOrganizationsModule} from "../../openaireLibrary/searchPages/searc
declarations: [ declarations: [
OpenaireAdvancedSearchOrganizationsComponent OpenaireAdvancedSearchOrganizationsComponent
], ],
providers:[FreeGuard], providers:[],
exports: [ exports: [
OpenaireAdvancedSearchOrganizationsComponent OpenaireAdvancedSearchOrganizationsComponent
] ]

View File

@ -2,14 +2,13 @@ import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
import{OpenaireAdvancedSearchProjectsComponent} from './advancedSearchProjects.component'; import{OpenaireAdvancedSearchProjectsComponent} from './advancedSearchProjects.component';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: OpenaireAdvancedSearchProjectsComponent, canActivate: [FreeGuard], data: { { path: '', component: OpenaireAdvancedSearchProjectsComponent, data: {
redirect: '/error', community : 'openaire' redirect: '/error', community : 'openaire'
}, canDeactivate: [PreviousRouteRecorder] } }, canDeactivate: [PreviousRouteRecorder] }

View File

@ -3,6 +3,7 @@ import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/
import {ActivatedRoute} from "@angular/router"; import {ActivatedRoute} from "@angular/router";
import {ConnectHelper} from "../../openaireLibrary/connect/connectHelper"; import {ConnectHelper} from "../../openaireLibrary/connect/connectHelper";
import {PiwikHelper} from "../../utils/piwikHelper"; import {PiwikHelper} from "../../utils/piwikHelper";
import {Subscriber} from "rxjs";
@Component({ @Component({
selector: 'openaire-advanced-search-projects', selector: 'openaire-advanced-search-projects',
template: ` template: `
@ -18,8 +19,14 @@ export class OpenaireAdvancedSearchProjectsComponent {
customFilter: SearchCustomFilter = null; customFilter: SearchCustomFilter = null;
constructor ( private route: ActivatedRoute) { constructor ( private route: ActivatedRoute) {
} }
sub;
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
}
ngOnInit() { ngOnInit() {
this.route.data this.sub = this.route.data
.subscribe((data: { envSpecific: any }) => { .subscribe((data: { envSpecific: any }) => {
var communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain); var communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);

View File

@ -4,7 +4,6 @@ import {FormsModule} from '@angular/forms';
import {AdvancedSearchProjectsRoutingModule} from './advancedSearchProjects-routing.module'; import {AdvancedSearchProjectsRoutingModule} from './advancedSearchProjects-routing.module';
import {OpenaireAdvancedSearchProjectsComponent} from './advancedSearchProjects.component'; import {OpenaireAdvancedSearchProjectsComponent} from './advancedSearchProjects.component';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {SearchProjectsModule} from "../../openaireLibrary/searchPages/searchProjects.module"; import {SearchProjectsModule} from "../../openaireLibrary/searchPages/searchProjects.module";
@NgModule({ @NgModule({
@ -17,7 +16,7 @@ import {SearchProjectsModule} from "../../openaireLibrary/searchPages/searchProj
declarations: [ declarations: [
OpenaireAdvancedSearchProjectsComponent OpenaireAdvancedSearchProjectsComponent
], ],
providers: [FreeGuard], providers: [],
exports: [ exports: [
OpenaireAdvancedSearchProjectsComponent OpenaireAdvancedSearchProjectsComponent
] ]

View File

@ -2,13 +2,12 @@ import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
import{OpenaireSearchResearchResultsComponent} from './searchResearchResults.component'; import{OpenaireSearchResearchResultsComponent} from './searchResearchResults.component';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: OpenaireSearchResearchResultsComponent, canActivate: [FreeGuard], data: { { path: '', component: OpenaireSearchResearchResultsComponent, data: {
redirect: '/error', community : 'openaire' redirect: '/error', community : 'openaire'
}, canDeactivate: [PreviousRouteRecorder] } }, canDeactivate: [PreviousRouteRecorder] }

View File

@ -3,6 +3,7 @@ import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/
import {ActivatedRoute} from "@angular/router"; import {ActivatedRoute} from "@angular/router";
import {ConnectHelper} from "../../openaireLibrary/connect/connectHelper"; import {ConnectHelper} from "../../openaireLibrary/connect/connectHelper";
import {PiwikHelper} from "../../utils/piwikHelper"; import {PiwikHelper} from "../../utils/piwikHelper";
import {Subscriber} from "rxjs";
@Component({ @Component({
selector: 'openaire-search-results', selector: 'openaire-search-results',
@ -16,8 +17,14 @@ export class OpenaireSearchResearchResultsComponent {
customFilter: SearchCustomFilter = null; customFilter: SearchCustomFilter = null;
constructor ( private route: ActivatedRoute) { constructor ( private route: ActivatedRoute) {
} }
sub;
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
}
ngOnInit() { ngOnInit() {
this.route.data this.sub = this.route.data
.subscribe((data: { envSpecific: any }) => { .subscribe((data: { envSpecific: any }) => {
var communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain); var communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);

View File

@ -5,7 +5,6 @@ import { FormsModule } from '@angular/forms';
import{ SearchResearchResultsRoutingModule} from './searchResearchResults-routing.module'; import{ SearchResearchResultsRoutingModule} from './searchResearchResults-routing.module';
import{OpenaireSearchResearchResultsComponent} from './searchResearchResults.component'; import{OpenaireSearchResearchResultsComponent} from './searchResearchResults.component';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {SearchResearchResultsModule} from "../../openaireLibrary/searchPages/searchResearchResults.module"; import {SearchResearchResultsModule} from "../../openaireLibrary/searchPages/searchResearchResults.module";
@ -18,7 +17,7 @@ import {SearchResearchResultsModule} from "../../openaireLibrary/searchPages/sea
declarations: [ declarations: [
OpenaireSearchResearchResultsComponent OpenaireSearchResearchResultsComponent
], ],
providers:[FreeGuard,PreviousRouteRecorder], providers:[PreviousRouteRecorder],
exports: [ exports: [
OpenaireSearchResearchResultsComponent OpenaireSearchResearchResultsComponent
] ]

View File

@ -15,6 +15,8 @@ import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class
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 {NewSearchPageComponent} from "../../openaireLibrary/searchPages/searchUtils/newSearchPage.component"; import {NewSearchPageComponent} from "../../openaireLibrary/searchPages/searchUtils/newSearchPage.component";
import {properties} from "../../../environments/environment";
import {Subscriber} from "rxjs";
@Component({ @Component({
selector: 'search-communities', selector: 'search-communities',
@ -40,8 +42,7 @@ export class SearchCommunitiesComponent {
private errorMessages: ErrorMessagesComponent; private errorMessages: ErrorMessagesComponent;
public results: CommunityInfo[] = []; public results: CommunityInfo[] = [];
public totalResults: CommunityInfo[] = []; public totalResults: CommunityInfo[] = [];
public sub: any; public subscriptions = [];
public subResults: any;
public filters = []; public filters = [];
public searchFields: SearchFields = new SearchFields(); public searchFields: SearchFields = new SearchFields();
public searchUtils: SearchUtilsClass = new SearchUtilsClass(); public searchUtils: SearchUtilsClass = new SearchUtilsClass();
@ -80,13 +81,11 @@ export class SearchCommunitiesComponent {
public ngOnInit() { public ngOnInit() {
var firstLoad = true; var firstLoad = true;
this.route.data this.properties = properties;
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.piwikSiteId = this.properties.piwikSiteId; this.piwikSiteId = this.properties.piwikSiteId;
this.baseUrl = data.envSpecific.searchLinkToCommunities; this.baseUrl = this.properties.searchLinkToCommunities;
});
this.sub = this.route.queryParams.subscribe(params => { this.subscriptions.push(this.route.queryParams.subscribe(params => {
this.searchPage.resultsPerPage = 10; this.searchPage.resultsPerPage = 10;
this.keyword = (params['fv0'] ? params['fv0'] : ''); this.keyword = (params['fv0'] ? params['fv0'] : '');
this.keyword = StringUtils.URIDecode(this.keyword); this.keyword = StringUtils.URIDecode(this.keyword);
@ -108,23 +107,22 @@ export class SearchCommunitiesComponent {
let queryParams = params;//this.searchPage.getQueryParamsFromUrl(params); let queryParams = params;//this.searchPage.getQueryParamsFromUrl(params);
if (typeof document !== 'undefined') { if (typeof document !== 'undefined') {
this.userManagementService.getUserInfo().subscribe(user => { this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
this.user = user; this.user = user;
this.initCommunities(queryParams); this.initCommunities(queryParams);
}); }));
} else { } else {
this.initCommunities(queryParams); this.initCommunities(queryParams);
} }
}); }));
} }
public ngOnDestroy() { ngOnDestroy() {
if (this.sub) { this.subscriptions.forEach(subscription => {
this.sub.unsubscribe(); if (subscription instanceof Subscriber) {
} subscription.unsubscribe();
if (this.subResults) {
this.subResults.unsubscribe();
} }
});
} }
/** /**
@ -133,7 +131,7 @@ export class SearchCommunitiesComponent {
* @param params * @param params
*/ */
private initCommunities(params) { private initCommunities(params) {
this.subResults = this._communitiesService.getCommunitiesState().subscribe( this.subscriptions.push(this._communitiesService.getCommunitiesState().subscribe(
data => { data => {
if (!data) { if (!data) {
return; return;
@ -147,14 +145,14 @@ export class SearchCommunitiesComponent {
} }
} }
if (this.user) { if (this.user) {
this._subscribeService.getCommunitiesSubscribedTo(this.properties/*, this.user.email*/).subscribe( this.subscriptions.push(this._subscribeService.getCommunitiesSubscribedTo(this.properties/*, this.user.email*/).subscribe(
res => { res => {
for (let i = 0; i < this.totalResults.length; i++) { for (let i = 0; i < this.totalResults.length; i++) {
this.totalResults[i].isSubscribed = (res.indexOf(this.totalResults[i].communityId) != -1); this.totalResults[i].isSubscribed = (res.indexOf(this.totalResults[i].communityId) != -1);
} }
this._getResults(params); this._getResults(params);
} }
); ));
} else { } else {
this._getResults(params); this._getResults(params);
} }
@ -165,7 +163,7 @@ export class SearchCommunitiesComponent {
this.disableForms = false; this.disableForms = false;
HelperFunctions.scroll(); HelperFunctions.scroll();
} }
); ));
} }

View File

@ -2,7 +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 {SearchCommunitiesComponent} from "./searchCommunities.component"; import {SearchCommunitiesComponent} from "./searchCommunities.component";
import {SearchPageModule} from "../../openaireLibrary/searchPages/searchUtils/searchPage.module";
import {SearchFormModule} from "../../openaireLibrary/searchPages/searchUtils/searchForm.module"; import {SearchFormModule} from "../../openaireLibrary/searchPages/searchUtils/searchForm.module";
import {SearchCommunitiesRoutingModule} from "./searchCommunities-routing.module"; import {SearchCommunitiesRoutingModule} from "./searchCommunities-routing.module";
import {PreviousRouteRecorder} from "../../openaireLibrary/utils/piwik/previousRouteRecorder.guard"; import {PreviousRouteRecorder} from "../../openaireLibrary/utils/piwik/previousRouteRecorder.guard";
@ -11,8 +10,7 @@ import {NewSearchPageModule} from "../../openaireLibrary/searchPages/searchUtils
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, FormsModule, CommonModule, FormsModule,
SearchFormModule, SearchPageModule, SearchFormModule, SearchCommunitiesRoutingModule, NewSearchPageModule
SearchCommunitiesRoutingModule, NewSearchPageModule
], ],
declarations: [ declarations: [
SearchCommunitiesComponent SearchCommunitiesComponent

View File

@ -1,16 +1,14 @@
import { NgModule} from '@angular/core'; import { NgModule} from '@angular/core';
import {MainSearchModule} from '../../openaireLibrary/searchPages/find/mainSearch.module';
import { OpenaireSearchComponent } from './search.component'; import { OpenaireSearchComponent } from './search.component';
import { MainSearchRoutingModule } from './mainSearch-routing.module'; import { MainSearchRoutingModule } from './mainSearch-routing.module';
import {FreeGuard} from "../../openaireLibrary/login/freeGuard.guard";
import {PreviousRouteRecorder} from "../../openaireLibrary/utils/piwik/previousRouteRecorder.guard"; import {PreviousRouteRecorder} from "../../openaireLibrary/utils/piwik/previousRouteRecorder.guard";
import {SearchAllModule} from "../../openaireLibrary/searchPages/find/searchAll.module"; import {SearchAllModule} from "../../openaireLibrary/searchPages/find/searchAll.module";
@NgModule({ @NgModule({
imports: [MainSearchRoutingModule, MainSearchModule, SearchAllModule], imports: [MainSearchRoutingModule, SearchAllModule],
declarations:[OpenaireSearchComponent], declarations:[OpenaireSearchComponent],
exports:[OpenaireSearchComponent], exports:[OpenaireSearchComponent],
providers:[FreeGuard,PreviousRouteRecorder], providers:[PreviousRouteRecorder],
}) })
export class LibMainSearchModule { } export class LibMainSearchModule { }

View File

@ -2,13 +2,12 @@ import {NgModule} from '@angular/core';
import {RouterModule} from '@angular/router'; import {RouterModule} from '@angular/router';
import {OpenaireSearchComponent} from './search.component'; import {OpenaireSearchComponent} from './search.component';
import {FreeGuard} from "../../openaireLibrary/login/freeGuard.guard";
import {PreviousRouteRecorder} from "../../openaireLibrary/utils/piwik/previousRouteRecorder.guard"; import {PreviousRouteRecorder} from "../../openaireLibrary/utils/piwik/previousRouteRecorder.guard";
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{path: '', component: OpenaireSearchComponent, canActivate: [FreeGuard], canDeactivate: [PreviousRouteRecorder]} {path: '', component: OpenaireSearchComponent, canDeactivate: [PreviousRouteRecorder]}
]) ])
] ]
}) })

Some files were not shown because too many files have changed in this diff Show More