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

View File

@ -13,6 +13,7 @@ import {UserManagementService} from "./openaireLibrary/services/user-management.
import {ConfigurationService} from "./openaireLibrary/utils/configuration/configuration.service";
import {properties} from '../environments/environment';
import {Header} from "./openaireLibrary/sharedComponents/navigationBar.component";
import {Subscriber} from "rxjs";
@Component({
//changeDetection: ChangeDetectionStrategy.Default,
@ -92,22 +93,31 @@ export class AppComponent {
communityId: string = "";
header: Header;
logoPath: string = 'assets/common-assets/';
subscriptions = [];
// community: {id:string, name:string, logoUrl:string};
constructor(private route: ActivatedRoute, private propertiesService: EnvironmentSpecificService,
private _communitiesService: CommunitiesService, private _subscribeService: SubscribeService,
private router: Router, private userManagementService: UserManagementService,
private configurationService: ConfigurationService) {
router.events.forEach((event) => {
this.subscriptions.push(router.events.forEach((event) => {
if (event instanceof NavigationStart) {
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() {
// this.propertiesService.loadEnvironment()
// .then(es => {
// this.properties = this.propertiesService.envSpecific;
this.properties = properties;
this._communitiesService.updateCommunities(this.properties, this.properties.communitiesAPI);
if (typeof document !== 'undefined') {
@ -116,30 +126,25 @@ export class AppComponent {
} catch (e) {
}
}
this.userManagementService.getUserInfo().subscribe(user => {
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
this.user = user;
this.init();
},
error => this.init());
// }, error => {
// console.log("App couldn't fetch properties");
// console.log(error);
//
// });
},error => this.init()));
}
private init() {
let communityId: string = "";
if (this.properties.environment == "development") {
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);
if(communityId) {
this.properties.adminToolsPortalType = "community";
}
this.configurationService.initCommunityInformation(this.properties, communityId);
this.buildMenu(communityId);
})
}));
} else {
this.showMenu = false;
communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
@ -155,7 +160,7 @@ export class AppComponent {
public buildMenu(communityId: string) {
let community = null;
this.community = null;
this._communitiesService.getCommunitiesState().subscribe(
this.subscriptions.push(this._communitiesService.getCommunitiesState().subscribe(
communities => {
if (!communities || communities.length == 0 && communityId !== null && communityId !== '') {
return;
@ -306,6 +311,6 @@ export class AppComponent {
}
}
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 {LayoutService} from "./openaireLibrary/services/layout.service";
import {SubscribeModule} from './utils/subscribe/subscribe.module';
import {ThemeComponent} from "./openaireLibrary/utils/theme/theme.component";
import {CustomizationModule} from "./utils/customization/customization.module";
import {HttpInterceptorService} from "./openaireLibrary/http-interceptor.service";
import {PageURLResolverComponent} from "./openaireLibrary/utils/pageURLResolver.component";
import {InviteBasicModule} from "./utils/subscribe/invite/inviteBasic.module";
import {SubscribeService} from "./openaireLibrary/utils/subscribe/subscribe.service";
import {PageURLResolverModule} from "./openaireLibrary/utils/pageURLResolver.module";
import {Schema2jsonldModule} from "./openaireLibrary/sharedComponents/schema2jsonld/schema2jsonld.module";
import {DEFAULT_TIMEOUT, TimeoutInterceptor} from "./openaireLibrary/timeout-interceptor.service";
@NgModule({
@ -56,9 +55,11 @@ import {Schema2jsonldModule} from "./openaireLibrary/sharedComponents/schema2jso
provide: HTTP_INTERCEPTORS,
useClass: HttpInterceptorService,
multi: true
}
},
[{ provide: HTTP_INTERCEPTORS, useClass: TimeoutInterceptor, multi: true }],
[{ provide: DEFAULT_TIMEOUT, useValue: 30000 }]
],
bootstrap: [AppComponent]
})
//
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 {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
import {PiwikHelper} from "../../utils/piwikHelper";
import {Subscriber} from "rxjs";
@Component({
selector: 'openaire-directLinking',
@ -11,13 +12,18 @@ import {PiwikHelper} from "../../utils/piwikHelper";
export class OpenaireDirectLinkingComponent {
communityId: string;
public piwikSiteId = null;
sub;
constructor(private route: ActivatedRoute) {
}
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
}
public ngOnInit() {
this.route.data
this.sub = this.route.data
.subscribe((data: { envSpecific: any }) => {
this.route.queryParams.subscribe(
communityId => {

View File

@ -4,12 +4,12 @@ import {OpenaireLinkingComponent} from './linkingGeneric.component';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard';
import {ConnectSubscriberGuard} from '../../openaireLibrary/connect/communityGuard/connectSubscriber.guard';
import {LoginGuard} from "../../openaireLibrary/login/loginGuard.guard";
//LoginGuard
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: OpenaireLinkingComponent, canActivate: [IsRouteEnabled, ConnectSubscriberGuard ], data: {
{ path: '', component: OpenaireLinkingComponent, canActivate: [IsRouteEnabled, LoginGuard, ConnectSubscriberGuard ], data: {
redirect: '/error'
}, canDeactivate: [PreviousRouteRecorder]},

View File

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

View File

@ -3,6 +3,7 @@ import {ActivatedRoute} from '@angular/router';
import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
import {ConnectHelper} from "../../openaireLibrary/connect/connectHelper";
import {PiwikHelper} from "../../utils/piwikHelper";
import {Subscriber} from "rxjs";
@Component({
@ -19,9 +20,14 @@ import {PiwikHelper} from "../../utils/piwikHelper";
public piwikSiteId = null;
constructor (private route: ActivatedRoute) {}
sub;
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
}
public ngOnInit() {
this.route.data
this.sub = this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.claimsInfoURL = data.envSpecific.claimsInformationLink;
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 {CommunityInfo, prodReadyCommunities} from '../../openaireLibrary/connect/community/communityInfo';
import {LocalStorageService} from "../../openaireLibrary/services/localStorage.service";
import {Subscriber} from "rxjs";
@Component({
selector: 'browse-community',
@ -33,17 +34,24 @@ export class BrowseCommunityComponent {
public ngOnInit() {
this.route.data
this.subscriptions.push(this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.localStorageService.get().subscribe(value => {
this.subscriptions.push(this.localStorageService.get().subscribe(value => {
this.directLink = value;
});
}));
}));
}
subscriptions = [];
ngOnDestroy() {
this.subscriptions.forEach(subscription => {
if (subscription instanceof Subscriber) {
subscription.unsubscribe();
}
});
}
public ngOnDestroy() {
}
isProduction(): boolean {
return this.properties.environment != "development";

View File

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

View File

@ -3,13 +3,12 @@ import { RouterModule } from '@angular/router';
import{CommunitiesComponent} from './communities.component';
import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
@NgModule({
imports: [
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 {SEOService} from "../openaireLibrary/sharedComponents/SEO/SEO.service";
import {properties} from "../../environments/environment";
import {Subscriber} from "rxjs";
@Component({
selector: 'communities',
@ -21,7 +22,7 @@ import {properties} from "../../environments/environment";
})
export class CommunitiesComponent {
public piwiksub: any;
private subscriptions = [];
public pageTitle = "OpenAIRE"
public researchCommunities = [];
@ -64,32 +65,29 @@ export class CommunitiesComponent {
}
public ngOnInit() {
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.properties = properties;
var url = this.properties.domain + this.properties.baseLink + this._router.url;
this.seoService.createLinkForCanonicalURL(url, false);
this._meta.updateTag({content: url}, "property='og:url'");
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.createGifs();
//this.getDivContents();
this.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;
})
}));
}
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;
})
}));
}
public getCommunities() {
@ -99,7 +97,7 @@ export class CommunitiesComponent {
this.researchCommunities = [];
this._communitiesService.getCommunitiesState().subscribe(
this.subscriptions.push(this._communitiesService.getCommunitiesState().subscribe(
communitiesResults => {
if(!communitiesResults){
return;
@ -125,7 +123,7 @@ export class CommunitiesComponent {
this.status = this.handleError("Error getting communities", error);
this.loading = false;
}
);
));
}
private createGifs() {
@ -178,23 +176,25 @@ export class CommunitiesComponent {
return StringUtils.quote(param);
}
public ngOnDestroy() {
if (this.piwiksub) {
this.piwiksub.unsubscribe();
ngOnDestroy() {
this.subscriptions.forEach(subscription => {
if (subscription instanceof Subscriber) {
subscription.unsubscribe();
}
});
}
private handleError(message: string, error): number {
var code = "";
try {
if (!error.status) {
var error = error.json();
code = error.code;
} else {
code = error.status;
}
}catch(e){}
console.error("Communities (component): " + message, error);
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 {FreeGuard} from '../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
@ -30,7 +29,7 @@ import {SEOServiceModule} from "../openaireLibrary/sharedComponents/SEO/SEOServi
CommunitiesComponent
],
providers:[
FreeGuard, PreviousRouteRecorder,
PreviousRouteRecorder,
PiwikService
],
exports: [

View File

@ -2,13 +2,12 @@ import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import{CommunityComponent} from './community.component';
import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
@NgModule({
imports: [
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) {
sub.unsubscribe();
}
this.fetchPublications.clearSubscriptions();
this.fetchDatasets.clearSubscriptions();
this.fetchOrps.clearSubscriptions();
this.fetchSoftware.clearSubscriptions();
}
isEntityEnabled(entity: string) {

View File

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

View File

@ -2,13 +2,12 @@ import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import{CommunityWrapperComponent} from './communityWrapper.component';
import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
@NgModule({
imports: [
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 {ConnectHelper} from '../openaireLibrary/connect/connectHelper';
import {properties} from "../../environments/environment";
import {Subscriber} from "rxjs";
@Component({
selector: 'community-wrapper',
@ -14,17 +16,13 @@ import {ConnectHelper} from '../openaireLibrary/connect/connectHelper';
export class CommunityWrapperComponent {
communityId:string;
dashboard:boolean = null;
constructor (
private route: ActivatedRoute,
private _router: Router
) {
this.route.data
.subscribe((data: { envSpecific: any }) => {
this.route.queryParams.subscribe(
properties;
private sub;
constructor (private route: ActivatedRoute) {
this.properties = properties;
this.sub = this.route.queryParams.subscribe(
communityId => {
this.communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
if(!this.communityId) {
this.communityId = communityId['communityId'];
}
@ -36,13 +34,15 @@ export class CommunityWrapperComponent {
}
});
});
}
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 { FormsModule } from '@angular/forms';
import { RouterModule } from '@angular/router';
import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import{CommunityModule} from '../community/community.module';
import{CommunitiesModule} from '../communities/communities.module';
@ -17,7 +16,7 @@ import {CommunityWrapperRoutingModule} from './communityWrapper-routing.module';
CommunityWrapperComponent
],
providers:[
FreeGuard, PreviousRouteRecorder,
PreviousRouteRecorder,
],
exports: [

View File

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

View File

@ -2,14 +2,13 @@ import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import {ContentPageComponent} from './contentPage.component';
import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from "../openaireLibrary/error/isRouteEnabled.guard";
@NgModule({
imports: [
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 {RouterModule} from '@angular/router';
import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {ContentPageComponent} from './contentPage.component';
@ -20,7 +19,7 @@ import {BreadcrumbsModule} from "../openaireLibrary/utils/breadcrumbs/breadcrumb
declarations: [
ContentPageComponent
],
providers: [FreeGuard, PreviousRouteRecorder, IsRouteEnabled],
providers: [ PreviousRouteRecorder, IsRouteEnabled],
exports: [
ContentPageComponent
]

View File

@ -10,7 +10,6 @@ import {AffiliationsModule} from "../affiliations/affiliations.module";
import {HelperModule} from "../openaireLibrary/utils/helper/helper.module";
import {Schema2jsonldModule} from "../openaireLibrary/sharedComponents/schema2jsonld/schema2jsonld.module";
import {SEOServiceModule} from "../openaireLibrary/sharedComponents/SEO/SEOService.module";
import {PiwikService} from "../openaireLibrary/utils/piwik/piwik.service";
import {PiwikServiceModule} from "../openaireLibrary/utils/piwik/piwikService.module";
import {BreadcrumbsModule} from "../openaireLibrary/utils/breadcrumbs/breadcrumbs.module";

View File

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

View File

@ -1,5 +1,5 @@
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 {ConnectHelper} from "../openaireLibrary/connect/connectHelper";
@ -9,7 +9,7 @@ import {ZenodoCommunitiesService} from "../openaireLibrary/connect/zenodoCommuni
import {CommunityService} from "../openaireLibrary/connect/community/community.service";
import {SearchZenodoCommunitiesService} from "../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunities.service";
import {PiwikHelper} from "../utils/piwikHelper";
import {Subscription} from "rxjs";
import {Subscriber, Subscription} from "rxjs";
import {properties} from "../../environments/environment";
@Component({
@ -77,9 +77,12 @@ export class OpenaireDepositComponent {
public ngOnDestroy() {
for (let sub of this.subs) {
if(sub instanceof Subscriber) {
sub.unsubscribe();
}
}
this.fetchZenodoInformation.clearSubscriptions();
}
private handleError(message: string, error) {
console.error("Deposit First Page: "+message, error);

View File

@ -1,9 +1,6 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../openaireLibrary/error/isRouteEnabled.guard';
@ -25,7 +22,7 @@ import {SearchZenodoCommunitiesService} from "../openaireLibrary/connect/zenodoC
exports: [
OpenaireDepositComponent,
],
providers: [FreeGuard,PreviousRouteRecorder, IsRouteEnabled,
providers: [PreviousRouteRecorder, IsRouteEnabled,
ZenodoCommunitiesService, SearchZenodoCommunitiesService]
})
export class LibDepositModule { }

View File

@ -1,14 +1,13 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { OpenaireSearchDataprovidersToDepositComponent } from './searchDataprovidersToDeposit.component';
import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../openaireLibrary/error/isRouteEnabled.guard'
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: OpenaireSearchDataprovidersToDepositComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
{ path: '', component: OpenaireSearchDataprovidersToDepositComponent, canActivate: [ IsRouteEnabled], data: {
redirect: '/error'
}, 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 {FetchZenodoInformation} from './utils/fetchZenodoInformation.class';
import {Subscription} from "rxjs";
import {Subscriber, Subscription} from "rxjs";
import {properties} from "../../environments/environment";
@Component({
@ -32,9 +32,9 @@ export class OpenaireSearchDataprovidersToDepositComponent {
subs: Subscription[] = [];
constructor ( private route: ActivatedRoute,
private _ΖenodoCommunitieService: ZenodoCommunitiesService,
private _zenodoCommunitieService: ZenodoCommunitiesService,
private _communityService: CommunityService,private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService ) {
this.fetchZenodoInformation = new FetchZenodoInformation(this._ΖenodoCommunitieService, this._searchZenodoCommunitiesService);
this.fetchZenodoInformation = new FetchZenodoInformation(this._zenodoCommunitieService, this._searchZenodoCommunitiesService);
}
public ngOnInit() {
@ -78,9 +78,12 @@ export class OpenaireSearchDataprovidersToDepositComponent {
public ngOnDestroy() {
for (let sub of this.subs) {
if(sub instanceof Subscriber) {
sub.unsubscribe();
}
}
this.fetchZenodoInformation.clearSubscriptions();
}
private handleError(message: string, 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 {SearchDataprovidersToDepositModule} from '../openaireLibrary/deposit/searchDataprovidersToDeposit.module';
import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../openaireLibrary/error/isRouteEnabled.guard';
import {ZenodoCommunitiesServiceModule} from '../openaireLibrary/connect/zenodoCommunities/zenodo-communitiesService.module';
@ -25,6 +24,6 @@ import {SearchZenodoCommunitiesServiceModule} from '../openaireLibrary/connect/z
exports: [
OpenaireSearchDataprovidersToDepositComponent,
],
providers: [FreeGuard,PreviousRouteRecorder, IsRouteEnabled]
providers: [PreviousRouteRecorder, IsRouteEnabled]
})
export class LibSearchDataprovidersToDepositModule { }

View File

@ -3,15 +3,26 @@ import {ZenodoCommunitiesService} from '../../openaireLibrary/connect/zenodoComm
import {SearchZenodoCommunitiesService} from '../../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunities.service';
import {ZenodoInformationClass} from '../../openaireLibrary/deposit/utils/zenodoInformation.class';
import {Subscriber} from "rxjs";
export class FetchZenodoInformation {
constructor ( private _ΖenodoCommunitieService: ZenodoCommunitiesService,
private subscriptions = [];
constructor ( private _zenodoCommunitieService: ZenodoCommunitiesService,
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){
this._ΖenodoCommunitieService.getZenodoCommunityById(properties, properties.zenodoCommunities+masterZenodoCommunityId, null).subscribe(
this.subscriptions.push(this._zenodoCommunitieService.getZenodoCommunityById(properties, properties.zenodoCommunities+masterZenodoCommunityId, null).subscribe(
result => {
console.info("getZenodoCommunityNameAndUrlById", result);
var masterZenodoCommunity = result;
@ -21,11 +32,11 @@ export class FetchZenodoInformation {
error => {
console.error("Master Zenodo community'"+masterZenodoCommunityId+"' couldn't be loaded");
}
);
));
}
public searchNumberOfZCommunities(communityId: string, properties: EnvProperties, zenodoInformation: ZenodoInformationClass) {
this._searchZenodoCommunitiesService.searchZCommunities(properties,communityId).subscribe (
this.subscriptions.push(this._searchZenodoCommunitiesService.searchZCommunities(properties,communityId).subscribe (
result => {
console.info("searchNumberOfZCommunities", result);
@ -39,6 +50,6 @@ export class FetchZenodoInformation {
error => {
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 {ShareInZenodoComponent} from './shareInZenodo.component';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from "../../openaireLibrary/error/isRouteEnabled.guard";
@NgModule({
imports: [
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 {Breadcrumb} from "../../openaireLibrary/utils/breadcrumbs/breadcrumbs.component";
import {properties} from "../../../environments/environment";
import {Subscription} from "rxjs";
import {Subscriber, Subscription} from "rxjs";
@Component({
selector: 'share-in-zenodo',
@ -150,9 +150,11 @@ export class ShareInZenodoComponent {
public ngOnDestroy() {
for (let sub of this.subs) {
if(sub instanceof Subscriber) {
sub.unsubscribe();
}
}
}
private updateDescription(description: string) {
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 {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard'
@ -26,7 +25,7 @@ import {BreadcrumbsModule} from "../../openaireLibrary/utils/breadcrumbs/breadcr
declarations: [
ShareInZenodoComponent
],
providers:[FreeGuard,PreviousRouteRecorder, IsRouteEnabled],
providers:[PreviousRouteRecorder, IsRouteEnabled],
exports: [
ShareInZenodoComponent
]

View File

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

View File

@ -1,14 +1,13 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import {NationalBulletinPageComponent} from './nationalBulletinsPage.component';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from "../../openaireLibrary/error/isRouteEnabled.guard";
@NgModule({
imports: [
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 {RouterModule} from '@angular/router';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {NationalBulletinPageComponent} from './nationalBulletinsPage.component';
import {CommonModule} from "@angular/common";
@ -18,7 +16,7 @@ import {BreadcrumbsModule} from "../../openaireLibrary/utils/breadcrumbs/breadcr
declarations: [
NationalBulletinPageComponent
],
providers: [FreeGuard, PreviousRouteRecorder, IsRouteEnabled],
providers: [PreviousRouteRecorder, IsRouteEnabled],
exports: [
NationalBulletinPageComponent
]

View File

@ -2,14 +2,13 @@ import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import {OrganizationsPageComponent} from './organizationsPage.component';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard'
@NgModule({
imports: [
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 {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard'
@ -21,7 +20,7 @@ import {BreadcrumbsModule} from "../../openaireLibrary/utils/breadcrumbs/breadcr
declarations: [
OrganizationsPageComponent
],
providers:[FreeGuard,PreviousRouteRecorder, IsRouteEnabled],
providers:[PreviousRouteRecorder, IsRouteEnabled],
exports: [
OrganizationsPageComponent
]

View File

@ -1,14 +1,13 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import {ProjectsPageComponent} from './projectsPage.component';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from "../../openaireLibrary/error/isRouteEnabled.guard";
@NgModule({
imports: [
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 {RouterModule} from '@angular/router';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {ProjectsPageComponent} from './projectsPage.component';
import {CommonModule} from "@angular/common";
@ -18,7 +16,7 @@ import {BreadcrumbsModule} from "../../openaireLibrary/utils/breadcrumbs/breadcr
declarations: [
ProjectsPageComponent
],
providers: [FreeGuard, PreviousRouteRecorder, IsRouteEnabled],
providers: [ PreviousRouteRecorder, IsRouteEnabled],
exports: [
ProjectsPageComponent
]

View File

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

View File

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

View File

@ -2,6 +2,7 @@ import {Component} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
import {Subscriber} from "rxjs";
@Component({
selector: 'openaire-dataprovider',
@ -11,9 +12,9 @@ import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
export class OpenaireDataProviderComponent {
piwikSiteId = null;
communityId = null;
private sub;
constructor(private route: ActivatedRoute) {
this.route.data
this.sub = this.route.data
.subscribe((data: { envSpecific: any }) => {
this.route.queryParams.subscribe(params => {
this.communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
@ -28,6 +29,10 @@ export class OpenaireDataProviderComponent {
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 { OpenaireDataProviderComponent } from './dataProvider.component';
import {DataProviderRoutingModule} from './dataProvider-routing.module';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
@NgModule({
imports: [DataProviderModule, DataProviderRoutingModule],
declarations:[OpenaireDataProviderComponent],
providers:[FreeGuard, PreviousRouteRecorder],
providers:[ PreviousRouteRecorder],
exports:[OpenaireDataProviderComponent]
})
export class LibDataProviderModule { }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,6 @@
import {NgModule} from '@angular/core';
import {RouterModule} from '@angular/router';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {FaqsComponent} from "./faqs.component";
import {IsRouteEnabled} from "../../openaireLibrary/error/isRouteEnabled.guard";
@ -9,7 +8,7 @@ import {IsRouteEnabled} from "../../openaireLibrary/error/isRouteEnabled.guard";
@NgModule({
imports: [
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 {PiwikService} from "../../openaireLibrary/utils/piwik/piwik.service";
import {HelperService} from "../../openaireLibrary/utils/helper/helper.service";
import {Subscriber} from "rxjs";
@Component({
selector: 'learn-in-depth',
@ -200,7 +201,7 @@ export class FaqsComponent {
public pageTitle: string = "OpenAIRE - Connect | FAQs";
public pageDescription: string = "Frequently asked questions about OpenAIRE Connect research gateway";
public breadcrumbs: Breadcrumb[] = [{name: 'home', route: '/'}, {name: 'about', route: '/about'}, {name: 'FAQs'}];
public piwiksub: any;
private subscriptions;
public pageContents = null;
public divContents = null;
public url: string = null;
@ -217,12 +218,12 @@ export class FaqsComponent {
}
public ngOnInit() {
this.route.data
this.subscriptions.push(this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
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.seoService.createLinkForCanonicalURL(this.url);
@ -232,25 +233,27 @@ export class FaqsComponent {
//this.getDivContents();
this.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;
})
}));
}
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;
})
}));
}
public ngOnDestroy() {
if (this.piwiksub) {
this.piwiksub.unsubscribe();
ngOnDestroy() {
this.subscriptions.forEach(subscription => {
if (subscription instanceof Subscriber) {
subscription.unsubscribe();
}
});
}
private updateDescription(description: string) {

View File

@ -2,7 +2,6 @@ import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {RouterModule} from '@angular/router';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {PiwikService} from '../../openaireLibrary/utils/piwik/piwik.service';
@ -27,7 +26,7 @@ import {HtmlPagesModule} from "../../htmlPages/htmlPages.module";
FaqsComponent
],
providers:[
FreeGuard, PreviousRouteRecorder, PiwikService, IsRouteEnabled
PreviousRouteRecorder, PiwikService, IsRouteEnabled
]
})
export class FaqsModule { }

View File

@ -1,7 +1,5 @@
import {NgModule} from '@angular/core';
import {RouterModule} from '@angular/router';
import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {LearnHowComponent} from "./learn-how.component";
import {IsRouteEnabled} from "../openaireLibrary/error/isRouteEnabled.guard";
@ -9,7 +7,7 @@ import {IsRouteEnabled} from "../openaireLibrary/error/isRouteEnabled.guard";
@NgModule({
imports: [
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 {SEOService} from "../openaireLibrary/sharedComponents/SEO/SEO.service";
import {Breadcrumb} from "../openaireLibrary/utils/breadcrumbs/breadcrumbs.component";
import {Subscriber} from "rxjs";
@Component({
selector: 'learn-how',
@ -232,7 +233,6 @@ import {Breadcrumb} from "../openaireLibrary/utils/breadcrumbs/breadcrumbs.compo
`
})
export class LearnHowComponent implements OnInit {
public piwiksub: any;
public pageContents = null;
public divContents = null;
@ -242,7 +242,7 @@ export class LearnHowComponent implements OnInit {
public breadcrumbs: Breadcrumb[] = [{name: 'home', route: '/'}, {name: 'about'}];
properties: EnvProperties;
subscriptions = [];
constructor(
private route: ActivatedRoute,
private _router: Router,
@ -254,12 +254,12 @@ export class LearnHowComponent implements OnInit {
}
public ngOnInit() {
this.route.data
this.subscriptions.push(this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
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.seoService.createLinkForCanonicalURL(this.url);
@ -269,27 +269,30 @@ export class LearnHowComponent implements OnInit {
//this.getDivContents();
this.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;
})
}));
}
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;
})
}));
}
public ngOnDestroy() {
if (this.piwiksub) {
this.piwiksub.unsubscribe();
ngOnDestroy() {
this.subscriptions.forEach(subscription => {
if (subscription instanceof Subscriber) {
subscription.unsubscribe();
}
});
}
private updateDescription(description: string) {
this._meta.updateTag({content: description}, "name='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 { RouterModule } from '@angular/router';
import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
@ -28,7 +27,7 @@ import {HtmlPagesModule} from "../htmlPages/htmlPages.module";
LearnHowComponent
],
providers:[
FreeGuard, PreviousRouteRecorder, PiwikService, IsRouteEnabled
PreviousRouteRecorder, PiwikService, IsRouteEnabled
]
})
export class LearnHowModule { }

View File

@ -1,7 +1,6 @@
import {NgModule} from '@angular/core';
import {RouterModule} from '@angular/router';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {LearnInDepthComponent} from "./learn-in-depth.component";
import {IsRouteEnabled} from "../../openaireLibrary/error/isRouteEnabled.guard";
@ -9,7 +8,7 @@ import {IsRouteEnabled} from "../../openaireLibrary/error/isRouteEnabled.guard";
@NgModule({
imports: [
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 {PiwikService} from "../../openaireLibrary/utils/piwik/piwik.service";
import {HelperService} from "../../openaireLibrary/utils/helper/helper.service";
import {Subscriber} from "rxjs";
@Component({
selector: 'learn-in-depth',
@ -180,7 +181,7 @@ export class LearnInDepthComponent implements OnInit {
{name: 'about', route: '/about'},
{name: 'learn in-depth'}
];
public piwiksub: any;
subscriptions = [];
public pageContents = null;
public divContents = null;
@ -199,12 +200,12 @@ export class LearnInDepthComponent implements OnInit {
}
public ngOnInit() {
this.route.data
this.subscriptions.push(this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
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.seoService.createLinkForCanonicalURL(this.url);
@ -214,27 +215,30 @@ export class LearnInDepthComponent implements OnInit {
//this.getDivContents();
this.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;
})
}));
}
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;
})
}));
}
public ngOnDestroy() {
if (this.piwiksub) {
this.piwiksub.unsubscribe();
ngOnDestroy() {
this.subscriptions.forEach(subscription => {
if (subscription instanceof Subscriber) {
subscription.unsubscribe();
}
});
}
private updateDescription(description: string) {
this._meta.updateTag({content: description}, "name='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 {RouterModule} from '@angular/router';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {PiwikService} from '../../openaireLibrary/utils/piwik/piwik.service';
@ -27,7 +26,7 @@ import {HtmlPagesModule} from "../../htmlPages/htmlPages.module";
LearnInDepthComponent
],
providers:[
FreeGuard, PreviousRouteRecorder, PiwikService, IsRouteEnabled
PreviousRouteRecorder, PiwikService, IsRouteEnabled
]
})
export class LearnInDepthModule { }

View File

@ -7,7 +7,6 @@ import { UserRoutingModule } from './user-routing.module';
import { UserModule} from '../openaireLibrary/login/user.module';
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 {SubscribeModule} from '../utils/subscribe/subscribe.module';
@ -16,7 +15,7 @@ import {SubscribeModule} from '../utils/subscribe/subscribe.module';
CommonModule, FormsModule,
UserRoutingModule, UserModule, SubscribeModule
],
providers:[PreviousRouteRecorder, /*SubscribeService,*/ EmailService],
providers:[PreviousRouteRecorder, EmailService],
declarations: [
OpenaireUserComponent

View File

@ -1,16 +1,16 @@
import {Component, ElementRef, ViewChild} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {Component, ViewChild} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {UserComponent} from '../openaireLibrary/login/user.component';
import {SubscribeService} from '../openaireLibrary/utils/subscribe/subscribe.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 {EnvProperties} from '../openaireLibrary/utils/properties/env-properties';
import {SubscribeComponent} from '../utils/subscribe/subscribe.component';
import {ConnectHelper} from '../openaireLibrary/connect/connectHelper';
import {properties} from "../../environments/environment";
import {Subscriber} from "rxjs";
@Component({
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">
<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 *ngIf="subscribeLoading ">Subscribing 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">
This action requires authentication.
<span *ngIf="!loggedIn">
Please <a class="" (click)="login()" > sign in</a> to continue.
Please <a class="" (click)="login()"> sign in</a> to continue.
</span>
</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 {
@ViewChild(UserComponent) usercomponent:UserComponent;
@ViewChild(SubscribeComponent) subscribe:SubscribeComponent;
properties:EnvProperties;
@ViewChild(UserComponent) usercomponent: UserComponent;
@ViewChild(SubscribeComponent) subscribe: SubscribeComponent;
properties: EnvProperties;
communityId = null;
subscribeLoading:boolean = false;
subscribeError:boolean = false;
isSubscribed:boolean = false;
subscribeLoading: boolean = false;
subscribeError: boolean = false;
isSubscribed: boolean = false;
public server: boolean = true;
loggedIn:boolean = false;
loggedIn: boolean = false;
sub;
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() {
if( typeof document !== 'undefined') {
if (typeof document !== 'undefined') {
this.server = false;
this.loggedIn = Session.isLoggedIn();
}
this.route.data
.subscribe((data: { envSpecific: any }) => {
this.route.queryParams.subscribe(
this.properties = properties;
this.sub = this.route.queryParams.subscribe(
communityId => {
this.communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
if(!this.communityId) {
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
if (!this.communityId) {
this.communityId = communityId['communityId'];
}
if(this.subscribe.subscribed){
if (this.subscribe.subscribed) {
this.usercomponent.redirect();
}
});
});
}
login(){
login() {
this.usercomponent.logIn();
}
subscribeTo(){
if(this.subscribe && this.communityId){
subscribeTo() {
if (this.subscribe && this.communityId) {
this.subscribeLoading = true;
this.subscribe.subscribe();
}
}
}
afterSubscibeEvent($event){
afterSubscibeEvent($event) {
var res = $event.value;
this.subscribeLoading = false;
this.isSubscribed = this.subscribe.subscribed;
if(res == "ok"){
if (res == "ok") {
this.isSubscribed = true;
this.usercomponent.redirect();
}else{
} else {
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 {Breadcrumb} from "../openaireLibrary/utils/breadcrumbs/breadcrumbs.component";
import {properties} from "../../environments/environment";
import {Subscriber} from "rxjs";
@Component({
selector: 'my-communities',
@ -24,8 +25,6 @@ import {properties} from "../../environments/environment";
})
export class MyCommunitiesComponent {
public piwiksub: any;
public pageTitle = "OpenAIRE"
public subscriberOfCommunities = [];
public managerOfCommunities = [];
@ -42,7 +41,7 @@ export class MyCommunitiesComponent {
properties: EnvProperties;
private user: User;
subscriptions = [];
constructor(
private route: ActivatedRoute,
private _router: Router,
@ -70,36 +69,34 @@ export class MyCommunitiesComponent {
}
public ngOnInit() {
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.properties = properties;
var url = this.properties.domain + this.properties.baseLink + this._router.url;
this.seoService.createLinkForCanonicalURL(url, false);
this._meta.updateTag({content: url}, "property='og:url'");
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;
if(this.user) {
this.getCommunities();
}
//this.getDivContents();
//this.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;
})
}));
}
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;
})
}));
}
public getCommunities() {
@ -111,7 +108,7 @@ export class MyCommunitiesComponent {
this.managerOfCommunities = [];
this.researchCommunities = [];
this._communitiesService.getCommunitiesState().subscribe(
this.subscriptions.push(this._communitiesService.getCommunitiesState().subscribe(
communitiesResults => {
if (!communitiesResults) {
return;
@ -155,7 +152,7 @@ export class MyCommunitiesComponent {
this.status = this.errorCodes.DONE;
if (mail != null && showCommunity) {
this._subscribeService.isSubscribedToCommunity(this.properties, community.communityId).subscribe(
this.subscriptions.push(this._subscribeService.isSubscribedToCommunity(this.properties, community.communityId).subscribe(
res => {
isSubscriber = res;
if (isSubscriber) {
@ -178,7 +175,7 @@ export class MyCommunitiesComponent {
if (subscribedLoading == 0) {
this.loading = false;
}
});
}));
} else {
subscribedLoading--;
if (subscribedLoading == 0) {
@ -191,7 +188,7 @@ export class MyCommunitiesComponent {
this.status = this.handleError("Error getting communities", error);
this.loading = false;
}
);
));
}
private sort(results: CommunityInfo[]) {
@ -216,10 +213,12 @@ export class MyCommunitiesComponent {
return StringUtils.quote(param);
}
public ngOnDestroy() {
if (this.piwiksub) {
this.piwiksub.unsubscribe();
ngOnDestroy() {
this.subscriptions.forEach(subscription => {
if (subscription instanceof Subscriber) {
subscription.unsubscribe();
}
});
}
private handleError(message: string, error): number {

View File

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

View File

@ -3,6 +3,7 @@ import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/
import {ActivatedRoute} from "@angular/router";
import {ConnectHelper} from "../../openaireLibrary/connect/connectHelper";
import {PiwikHelper} from "../../utils/piwikHelper";
import {Subscriber} from "rxjs";
@Component({
@ -20,8 +21,14 @@ export class OpenaireAdvancedSearchDataProvidersComponent {
customFilter: SearchCustomFilter = null;
constructor ( private route: ActivatedRoute) {
}
sub;
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
}
ngOnInit() {
this.route.data
this.sub = this.route.data
.subscribe((data: { envSpecific: any }) => {
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 {OpenaireAdvancedSearchDataProvidersComponent} from './advancedSearchDataProviders.component';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {SearchDataProvidersModule} from "../../openaireLibrary/searchPages/searchDataProviders.module";
@NgModule({
@ -18,7 +17,7 @@ import {SearchDataProvidersModule} from "../../openaireLibrary/searchPages/searc
declarations: [
OpenaireAdvancedSearchDataProvidersComponent
],
providers:[FreeGuard],
providers:[],
exports: [
OpenaireAdvancedSearchDataProvidersComponent
]

View File

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

View File

@ -3,6 +3,7 @@ import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/
import {ActivatedRoute} from "@angular/router";
import {ConnectHelper} from "../../openaireLibrary/connect/connectHelper";
import {PiwikHelper} from "../../utils/piwikHelper";
import {Subscriber} from "rxjs";
@Component({
@ -20,8 +21,14 @@ export class OpenaireAdvancedSearchOrganizationsComponent {
customFilter: SearchCustomFilter = null;
constructor ( private route: ActivatedRoute) {
}
sub;
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
}
ngOnInit() {
this.route.data
this.sub =this.route.data
.subscribe((data: { envSpecific: any }) => {
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 {OpenaireAdvancedSearchOrganizationsComponent} from './advancedSearchOrganizations.component';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {SearchOrganizationsModule} from "../../openaireLibrary/searchPages/searchOrganizations.module";
@NgModule({
@ -18,7 +17,7 @@ import {SearchOrganizationsModule} from "../../openaireLibrary/searchPages/searc
declarations: [
OpenaireAdvancedSearchOrganizationsComponent
],
providers:[FreeGuard],
providers:[],
exports: [
OpenaireAdvancedSearchOrganizationsComponent
]

View File

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

View File

@ -3,6 +3,7 @@ import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/
import {ActivatedRoute} from "@angular/router";
import {ConnectHelper} from "../../openaireLibrary/connect/connectHelper";
import {PiwikHelper} from "../../utils/piwikHelper";
import {Subscriber} from "rxjs";
@Component({
selector: 'openaire-advanced-search-projects',
template: `
@ -18,8 +19,14 @@ export class OpenaireAdvancedSearchProjectsComponent {
customFilter: SearchCustomFilter = null;
constructor ( private route: ActivatedRoute) {
}
sub;
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
}
ngOnInit() {
this.route.data
this.sub = this.route.data
.subscribe((data: { envSpecific: any }) => {
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 {OpenaireAdvancedSearchProjectsComponent} from './advancedSearchProjects.component';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {SearchProjectsModule} from "../../openaireLibrary/searchPages/searchProjects.module";
@NgModule({
@ -17,7 +16,7 @@ import {SearchProjectsModule} from "../../openaireLibrary/searchPages/searchProj
declarations: [
OpenaireAdvancedSearchProjectsComponent
],
providers: [FreeGuard],
providers: [],
exports: [
OpenaireAdvancedSearchProjectsComponent
]

View File

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

View File

@ -3,6 +3,7 @@ import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/
import {ActivatedRoute} from "@angular/router";
import {ConnectHelper} from "../../openaireLibrary/connect/connectHelper";
import {PiwikHelper} from "../../utils/piwikHelper";
import {Subscriber} from "rxjs";
@Component({
selector: 'openaire-search-results',
@ -16,8 +17,14 @@ export class OpenaireSearchResearchResultsComponent {
customFilter: SearchCustomFilter = null;
constructor ( private route: ActivatedRoute) {
}
sub;
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
}
ngOnInit() {
this.route.data
this.sub = this.route.data
.subscribe((data: { envSpecific: any }) => {
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{OpenaireSearchResearchResultsComponent} from './searchResearchResults.component';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {SearchResearchResultsModule} from "../../openaireLibrary/searchPages/searchResearchResults.module";
@ -18,7 +17,7 @@ import {SearchResearchResultsModule} from "../../openaireLibrary/searchPages/sea
declarations: [
OpenaireSearchResearchResultsComponent
],
providers:[FreeGuard,PreviousRouteRecorder],
providers:[PreviousRouteRecorder],
exports: [
OpenaireSearchResearchResultsComponent
]

View File

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

View File

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

View File

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

View File

@ -2,13 +2,12 @@ import {NgModule} from '@angular/core';
import {RouterModule} from '@angular/router';
import {OpenaireSearchComponent} from './search.component';
import {FreeGuard} from "../../openaireLibrary/login/freeGuard.guard";
import {PreviousRouteRecorder} from "../../openaireLibrary/utils/piwik/previousRouteRecorder.guard";
@NgModule({
imports: [
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