Add Guard that checks if a route is enabled | add a dummy service that says which route and which entity is enabled | add checks if entity is ebnabled in search/find, home (numbers), menu

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@49353 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2017-10-09 13:20:23 +00:00
parent efc7f31043
commit 076d095e10
81 changed files with 501 additions and 299 deletions

View File

@ -1,23 +1,7 @@
import { Component, Directive, ElementRef, Renderer, ChangeDetectionStrategy, ViewEncapsulation } from '@angular/core';
import { ConfigurationService } from './utils/configuration/configuration.service';
import {Observable} from 'rxjs/Observable';
//
/////////////////////////
// ** Example Directive
// Notice we don't touch the Element directly
/*@Directive({
selector: '[xLarge]'
})
export class XLargeDirective {
constructor(element: ElementRef, renderer: Renderer) {
// ** IMPORTANT **
// we must interact with the dom through -Renderer-
// for webworker/server to see the changes
renderer.setElementStyle(element.nativeElement, 'fontSize', 'x-large');
// ^^
}
}
*/
@Component({
changeDetection: ChangeDetectionStrategy.Default,
encapsulation: ViewEncapsulation.Emulated,
@ -36,7 +20,7 @@ export class XLargeDirective {
<main>
<router-outlet></router-outlet>
</main>
</main>
</div>
<!--/div>
@ -58,8 +42,10 @@ export class XLargeDirective {
})
export class AppComponent {
isClient:boolean = false;
constructor(private config: ConfigurationService) {}
ngOnInit() {
if (typeof document !== 'undefined') {
try{
this.isClient = true;

View File

@ -1,14 +1,12 @@
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { SharedModule } from './shared/shared.module';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import {SharedComponentsModule} from './sharedComponents/sharedComponents.module'; //navbar
import { ErrorModule } from './error/error.module';
import { CacheService } from './shared/cache.service';
import { ConfigurationService } from './utils/configuration/configuration.service';
import { CookieLawModule } from './sharedComponents/cookie-law/cookie-law.module';
// import { XSRFStrategy, CookieXSRFStrategy, RequestOptions } from '@angular/http';
@ -22,7 +20,7 @@ import { CookieLawModule } from './sharedComponents/cookie-law/cookie-law.module
ErrorModule,
CookieLawModule
], exports:[],
providers:[CacheService,
providers:[CacheService, ConfigurationService
// { provide: XSRFStrategy, useFactory: cookieStrategy },
// { provide: RequestOptions, useClass: ExRequestOptions}

View File

@ -4,13 +4,13 @@ import { AdminLoginGuard} from'../../login/adminLoginGuard.guard';
import { ClaimsAdminComponent } from './claimsAdmin.component';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: ClaimsAdminComponent, canActivate: [AdminLoginGuard],canDeactivate: [PreviousRouteRecorder]},
])
{ path: '', component: ClaimsAdminComponent, canActivate: [IsRouteEnabled, AdminLoginGuard],
data: {redirect: '/error'}, canDeactivate: [PreviousRouteRecorder]}])
]
})
export class ClaimsAdminRoutingModule { }

View File

@ -7,6 +7,7 @@ import { ClaimsAdminRoutingModule } from './claimsAdmin-routing.module';
import {DisplayClaimsModule} from '../claim-utils/displayClaims/displayClaims.module';
import { AdminLoginGuard} from'../../login/adminLoginGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
@ -16,7 +17,7 @@ import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.gua
DisplayClaimsModule
],
providers:[AdminLoginGuard, PreviousRouteRecorder],
providers:[AdminLoginGuard, PreviousRouteRecorder,IsRouteEnabled],
declarations: [
ClaimsAdminComponent
]

View File

@ -3,13 +3,13 @@ import { RouterModule } from '@angular/router';
import { LoginGuard} from'../../login/loginGuard.guard';
import { ClaimsByTokenComponent } from './claimsByToken.component';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: ClaimsByTokenComponent, canActivate: [LoginGuard],canDeactivate: [PreviousRouteRecorder]}
])
{ path: '', component: ClaimsByTokenComponent, canActivate: [IsRouteEnabled, LoginGuard],
data: {redirect: '/error'}, canDeactivate: [PreviousRouteRecorder]}])
]
})
export class ClaimsByTokenRoutingModule { }

View File

@ -18,6 +18,7 @@ import {LoginGuard} from'../../login/loginGuard.guard';
import {PagingModule} from '../../utils/paging.module';
import {ClaimsDatatablePipe} from '../../utils/pipes/claimsDatatable.pipe';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
@ -36,7 +37,7 @@ import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.gua
],
providers:[
ClaimsByTokenService,
LoginGuard, PreviousRouteRecorder
LoginGuard, PreviousRouteRecorder, IsRouteEnabled
],
declarations: [
ClaimsByTokenComponent, ClaimsDatatablePipe

View File

@ -4,11 +4,14 @@ import { LoginGuard} from'../../login/loginGuard.guard';
import { DirectLinkingComponent } from './directLinking.component';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: DirectLinkingComponent, canActivate: [LoginGuard], canDeactivate: [PreviousRouteRecorder]},
{ path: '', component: DirectLinkingComponent, canActivate: [IsRouteEnabled, LoginGuard], data: {
redirect: '/error'
}, canDeactivate: [PreviousRouteRecorder]},
])
]

View File

@ -19,6 +19,7 @@ import {HelperModule} from '../../utils/helper/helper.module';
import {ClaimContextSearchFormModule} from '../claim-utils/claimContextSearchForm.module';
import {ClaimProjectsSearchFormModule} from '../claim-utils/claimProjectSearchForm.module';
import {ClaimResultSearchFormModule} from '../claim-utils/claimResultSearchForm.module';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
@ -30,7 +31,7 @@ import {ClaimResultSearchFormModule} from '../claim-utils/claimResultSearchForm.
],
providers:[LoginGuard, PreviousRouteRecorder],
providers:[LoginGuard, PreviousRouteRecorder, IsRouteEnabled],
declarations: [
DirectLinkingComponent
], exports:[DirectLinkingComponent]

View File

@ -4,11 +4,14 @@ import { LoginGuard} from'../../login/loginGuard.guard';
import { LinkingGenericComponent } from './linkingGeneric.component';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: LinkingGenericComponent, canActivate: [LoginGuard], canDeactivate: [PreviousRouteRecorder]},
{ path: '', component: LinkingGenericComponent, canActivate: [IsRouteEnabled, LoginGuard], data: {
redirect: '/error'
}, canDeactivate: [PreviousRouteRecorder]},
])
]

View File

@ -1,19 +0,0 @@
// import { NgModule } from '@angular/core';
//
// import { SharedModule } from '../../shared/shared.module';
// import { LinkingComponent } from './linking.component';
// import { LinkingRoutingModule } from './linking-routing.module';
// import {LinkingGenericModule} from './linkingGeneric.module';
//
// @NgModule({
// imports: [
// SharedModule,
// LinkingRoutingModule,
// LinkingGenericModule
//
// ],
// declarations: [
// LinkingComponent
// ], exports:[LinkingComponent]
// })
// export class LinkingModule { }

View File

@ -18,6 +18,7 @@ import {ClaimProjectsSearchFormModule} from '../claim-utils/claimProjectSearchFo
import {BulkClaimModule} from './bulkClaim/bulkClaim.module';
import {ClaimResultSearchFormModule} from '../claim-utils/claimResultSearchForm.module';
import {HelperModule} from '../../utils/helper/helper.module';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
@ -27,7 +28,7 @@ import {HelperModule} from '../../utils/helper/helper.module';
EntitySearchServiceModule, PublicationsServiceModule, DatasetsServiceModule, LinkingRoutingModule, StartOverModule,
ClaimContextSearchFormModule, ClaimProjectsSearchFormModule, BulkClaimModule, ClaimResultSearchFormModule, HelperModule
],
providers:[LoginGuard, PreviousRouteRecorder],
providers:[LoginGuard, PreviousRouteRecorder, IsRouteEnabled],
declarations: [
LinkingGenericComponent
], exports:[

View File

@ -4,13 +4,13 @@ import { LoginGuard} from'../../login/loginGuard.guard';
import { MyClaimsComponent } from './myClaims.component';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: MyClaimsComponent, canActivate: [LoginGuard], canDeactivate: [PreviousRouteRecorder]},
])
{ path: '', component: MyClaimsComponent, canActivate: [IsRouteEnabled, LoginGuard],
data: {redirect: '/error'}, canDeactivate: [PreviousRouteRecorder]}])
]
})
export class MyClaimsRoutingModule { }

View File

@ -7,6 +7,7 @@ import { MyClaimsRoutingModule } from './myClaims-routing.module';
import {DisplayClaimsModule} from '../claim-utils/displayClaims/displayClaims.module';
import {LoginGuard} from'../../login/loginGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
@ -16,7 +17,7 @@ import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.gua
DisplayClaimsModule
],
providers:[LoginGuard, PreviousRouteRecorder],
providers:[LoginGuard, PreviousRouteRecorder, IsRouteEnabled],
declarations: [
MyClaimsComponent
]

View File

@ -4,11 +4,14 @@ import { RouterModule } from '@angular/router';
import { DepositBySubjectResultComponent } from './depositBySubjectResult.component';
import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: DepositBySubjectResultComponent, canActivate: [FreeGuard],canDeactivate: [PreviousRouteRecorder] }
{ path: '', component: DepositBySubjectResultComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
redirect: '/error'
},canDeactivate: [PreviousRouteRecorder] }
])
]

View File

@ -12,6 +12,7 @@ import {PagingModule } from '../../utils/paging.module';
import {DataProvidersServiceModule} from '../../services/dataProvidersService.module';
import {SearchResultsModule } from '../../searchPages/searchUtils/searchResults.module';
import {HelperModule} from '../../utils/helper/helper.module';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
@ -28,6 +29,6 @@ import {HelperModule} from '../../utils/helper/helper.module';
exports: [
DepositBySubjectResultComponent
],
providers: [FreeGuard,PreviousRouteRecorder ]
providers: [FreeGuard,PreviousRouteRecorder, IsRouteEnabled]
})
export class DepositBySubjectResultsModule { }

View File

@ -4,11 +4,15 @@ import { RouterModule } from '@angular/router';
import { DepositDatasetsComponent } from './depositDatasets.component';
import { DepositDatasetsResultComponent } from './depositDatasetsResult.component';
import {FreeGuard} from'../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: DepositDatasetsComponent, canActivate: [FreeGuard] }
{ path: '', component: DepositDatasetsComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
redirect: '/error'
},canDeactivate: [PreviousRouteRecorder] }
])
]

View File

@ -8,6 +8,7 @@ import {DepositDatasetsRoutingModule} from './depositDatasets-routing.module';
import {DepoditModule} from '../deposit.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
@ -23,7 +24,6 @@ import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.gua
exports: [
DepositDatasetsComponent
],
providers: [FreeGuard,PreviousRouteRecorder
]
providers: [FreeGuard,PreviousRouteRecorder, IsRouteEnabled]
})
export class DepositDatasetsModule { }

View File

@ -3,11 +3,14 @@ import { RouterModule } from '@angular/router';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
import { DepositDatasetsResultComponent } from './depositDatasetsResult.component';
import {FreeGuard} from'../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: DepositDatasetsResultComponent, canActivate: [FreeGuard] ,canDeactivate: [PreviousRouteRecorder] }
{ path: '', component: DepositDatasetsResultComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
redirect: '/error'
},canDeactivate: [PreviousRouteRecorder] }
])
]

View File

@ -8,6 +8,7 @@ import {DepositDatasetsResultsRoutingModule} from './depositDatasetsResults-rout
import {DepoditModule} from '../deposit.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
@ -23,7 +24,6 @@ import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.gua
exports: [
DepositDatasetsResultComponent,
],
providers: [FreeGuard,PreviousRouteRecorder
]
providers: [FreeGuard,PreviousRouteRecorder, IsRouteEnabled]
})
export class DepositDatasetsResultsModule { }

View File

@ -3,11 +3,14 @@ import { RouterModule } from '@angular/router';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
import { DepositPublicationsComponent } from './depositPublications.component';
import {FreeGuard} from'../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: DepositPublicationsComponent, canActivate: [FreeGuard],canDeactivate: [PreviousRouteRecorder] }
{ path: '', component: DepositPublicationsComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
redirect: '/error'
}, canDeactivate: [PreviousRouteRecorder] }
])
]

View File

@ -8,6 +8,7 @@ import {DepositPublicationsRoutingModule} from './depositPublications-routing.mo
import {DepoditModule} from '../deposit.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
@ -21,7 +22,6 @@ import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.gua
exports: [
DepositPublicationsComponent,
],
providers: [FreeGuard,PreviousRouteRecorder
]
providers: [FreeGuard,PreviousRouteRecorder, IsRouteEnabled]
})
export class DepositPublicationsModule { }

View File

@ -3,11 +3,14 @@ import { RouterModule } from '@angular/router';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
import { DepositPublicationsResultComponent } from './depositPublicationsResult.component';
import {FreeGuard} from'../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: DepositPublicationsResultComponent, canActivate: [FreeGuard] ,canDeactivate: [PreviousRouteRecorder] }
{ path: '', component: DepositPublicationsResultComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
redirect: '/error'
}, canDeactivate: [PreviousRouteRecorder] }
])
]

View File

@ -8,6 +8,7 @@ import {DepositPublicationsResultRoutingModule} from './depositPublicationsResul
import {DepoditModule} from '../deposit.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
@ -21,7 +22,6 @@ import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.gua
exports: [
DepositPublicationsResultComponent
],
providers: [FreeGuard,PreviousRouteRecorder
]
providers: [FreeGuard,PreviousRouteRecorder, IsRouteEnabled]
})
export class DepositPublicationsResultsModule { }

View File

@ -7,14 +7,8 @@ import { ErrorRoutingModule } from './error-routing.module';
import {PreviousRouteRecorder} from '../utils/piwik/previousRouteRecorder.guard';
@NgModule({
imports: [
CommonModule, FormsModule,
ErrorRoutingModule
],providers:[PreviousRouteRecorder],
declarations: [
ErrorPageComponent
]
imports: [CommonModule, FormsModule, ErrorRoutingModule],
providers:[PreviousRouteRecorder],
declarations: [ErrorPageComponent]
})
export class ErrorModule { }

View File

@ -1,6 +1,7 @@
import { Component, Input } from '@angular/core';
import { Location } from '@angular/common';
import { Meta} from '../../angular2-meta';
import {ActivatedRoute} from '@angular/router';
@Component({
selector: 'error',
@ -35,10 +36,20 @@ import { Meta} from '../../angular2-meta';
export class ErrorPageComponent {
public page: string;
constructor (private _location: Location, private _meta: Meta) {
constructor (private _location: Location, private _meta: Meta,private route: ActivatedRoute) {
this._meta.setTitle("OpenAIRE | Error page");
this.page = _location.path(true);
//this.page = _router.url;
//this.page = location.href;
}
ngOnInit() {
this.route.queryParams.subscribe(data => {
this.page = data['page'];
if(!this.page){
this.page = this._location.path(true);
}
});
}
}

View File

@ -0,0 +1,23 @@
import { Injectable } from '@angular/core';
import { Router,CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot} from '@angular/router';
import {Observable} from 'rxjs/Observable';
import { ConfigurationService } from '../utils/configuration/configuration.service';
@Injectable()
export class IsRouteEnabled implements CanActivate {
constructor(private router: Router, private config: ConfigurationService) {}
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | boolean {
let customRedirect = route.data['redirect'];
console.log("In IsRouteEnabled");
console.log(state.url.split("?")[0].substring(1));
let isEnabled = this.config.isPageEnabled(state.url.split("?")[0].substring(1));
let redirect = !!customRedirect ? customRedirect : '/error';
isEnabled.filter(enabled => !enabled)
.subscribe(() => this.router.navigate([redirect], { queryParams: { "page": state.url } }));
return isEnabled;
}
}

View File

@ -20,28 +20,28 @@
<div class="search_box_bg uk-grid uk-grid-stack" uk-grid="">
<div class="uk-width-1-1@m uk-first-column">
<div class="search_box_bg uk-margin-large uk-margin-remove-bottom uk-text-center uk-grid-match uk-child-width-1-2 uk-child-width-1-2@s uk-child-width-1-4@m uk-child-width-1-4@l uk-child-width-1-4@xl uk-grid-collapse uk-grid-divider uk-grid uk-scrollspy-inview uk-animation-fade" uk-scrollspy-class="" uk-grid="" data-id="page#7" style="">
<div *ngIf="publicationsSize" class="uk-first-column">
<div *ngIf="showPublications && publicationsSize" class="uk-first-column">
<div uk-scrollspy-class="" class="uk-width-medium uk-margin-auto el-item uk-panel uk-scrollspy-inview uk-animation-fade" style="">
<h2 class="el-title uk-margin uk-h2">
<span>{{publicationsSize.number}} {{publicationsSize.size}} publications</span>
</h2>
</div>
</div>
<div *ngIf="datasetsSize">
<div *ngIf="showDatasets && datasetsSize">
<div uk-scrollspy-class="" class="uk-width-medium uk-margin-auto el-item uk-panel uk-scrollspy-inview uk-animation-fade" style="">
<h2 class="el-title uk-margin uk-h2">
<span>{{datasetsSize.number}} {{datasetsSize.size}} research data</span>
</h2>
</div>
</div>
<div *ngIf="datasourcesSize" >
<div *ngIf="showDataProviders && datasourcesSize" >
<div uk-scrollspy-class="" class="uk-width-medium uk-margin-auto el-item uk-panel uk-scrollspy-inview uk-animation-fade" style="">
<h2 class="el-title uk-margin uk-h2">
<span>{{datasourcesSize.number}} {{datasourcesSize.size}} data sources</span>
</h2>
</div>
</div>
<div *ngIf="fundersSize">
<div *ngIf="showProjects && fundersSize">
<div uk-scrollspy-class="" class="uk-width-medium uk-margin-auto el-item uk-panel uk-scrollspy-inview uk-animation-fade" style="">
<h2 class="el-title uk-margin uk-h2">
<span>{{fundersSize.number}} {{fundersSize.size}} funders</span>
@ -49,7 +49,7 @@
</div>
</div>
</div>
<div class="uk-margin-large uk-margin-remove-bottom uk-text-center uk-text-meta uk-scrollspy-inview uk-animation-fade" uk-scrollspy-class="" data-id="page#8" style="">
<div *ngIf = "showPublications || showDatasets || showProjects || showDataProviders" class="uk-margin-large uk-margin-remove-bottom uk-text-center uk-text-meta uk-scrollspy-inview uk-animation-fade" uk-scrollspy-class="" data-id="page#8" style="">
<span style="color:#fff!important; font-size:30pt!important">all linked together</span>
</div>
</div>

View File

@ -17,6 +17,7 @@ import {RouterHelper} from '../utils/routerHelper.class';
import {NumberUtils} from '../utils/number-utils.class';
import {RefineFieldResultsService} from '../services/refineFieldResults.service';
import {PiwikService} from '../utils/piwik/piwik.service';
import { ConfigurationService } from '../utils/configuration/configuration.service';
@Component({
selector: 'home',
@ -39,6 +40,11 @@ export class HomeComponent {
public projectsSize:any = null;
public datasourcesSize:any = null;
showPublications:boolean= false;
showDatasets:boolean= false;
showProjects:boolean= false;
showDataProviders:boolean= false;
public subPub;public subData;public subProjects;public subOrg; public subDataPr;
constructor (
@ -50,8 +56,8 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
private _searchDatasetsService: SearchDatasetsService,
private _searchOrganizationsService: SearchOrganizationsService,
private _refineFieldResultsService:RefineFieldResultsService,
private location: Location, private _meta: Meta,private _piwikService:PiwikService
) {
private location: Location, private _meta: Meta,private _piwikService:PiwikService,
private config: ConfigurationService) {
var description = "open access, research, scientific publication, European Commission, EC, FP7, ERC, Horizon 2020, H2020, search, projects ";
@ -63,24 +69,30 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
this._meta.updateProperty("og:description", description);
this._meta.updateProperty("og:title", title);
this._meta.updateProperty("og:url", url);
this.getNumbers();
console.log("after get numbers")
const entityOne = this.config.isEntityEnabled("publication");
const entityTwo = this.config.isEntityEnabled("dataset");
const entityThree = this.config.isEntityEnabled("project");
const entityFour = this.config.isEntityEnabled("datasource");
const example = Observable.zip(entityOne,entityTwo,entityThree,entityFour);
//wait until all observables have emitted a value then emit all as an array
example.subscribe(data => {
this.showPublications = data[0];
this.showDatasets = data[1];
this.showProjects = data[2];
this.showDataProviders = data[3];
this.getNumbers();
});
if(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){
console.log("before piwik")
this.piwiksub = this._piwikService.trackView("OpenAIRE").subscribe();
console.log("after piwik")
}
console.log("after piwik if")
}
public ngOnInit() {
console.log("init!")
}
public ngOnDestroy() {
console.log("destroy!")
if(this.piwiksub){
this.piwiksub.unsubscribe();
}
@ -102,25 +114,26 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
if(this.subDataPr){
this.subDataPr.unsubscribe();
}
console.log("destroy!!!")
}
private getNumbers() {
this.subPub = this._searchPublicationsService.numOfSearchPublications("").subscribe(
data => {
console.log("Count results: "+data);
if(data && data != null && data > 0 ){
this.publicationsSize = NumberUtils.roundNumber(data);
console.log("After round");
}
},
err => {
console.log(err);
}
);
if(this.showPublications){
this.subPub = this._searchPublicationsService.numOfSearchPublications("").subscribe(
data => {
console.log("Count results: "+data);
if(data && data != null && data > 0 ){
this.publicationsSize = NumberUtils.roundNumber(data);
console.log("After round");
}
},
err => {
console.log(err);
}
);
}
if(this.showDatasets){
this.subData = this._searchDatasetsService.numOfSearchDatasets("").subscribe(
data => {
if(data && data != null && data > 0 ){
@ -130,10 +143,10 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
err => {
console.log(err);
}
);
this.subfunders = this._refineFieldResultsService.getRefineFieldsResultsByEntityName(["funder"],"project").subscribe(
);
}
if(this.showProjects){
this.subfunders = this._refineFieldResultsService.getRefineFieldsResultsByEntityName(["funder"],"project").subscribe(
data => {
console.info("Funders: "+data[1][0].title+ " values "+data[1][0].values.length+"]");
@ -149,9 +162,10 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
},
err => {
console.log(err);
});
this.subDataPr = this._searchDataprovidersService.numOfSearchDataproviders("").subscribe(
});
}
if(this.showDataProviders){
this.subDataPr = this._searchDataprovidersService.numOfSearchDataproviders("").subscribe(
data => {
if(data && data != null && data > 0 ){
this.datasourcesSize = NumberUtils.roundNumber(data);
@ -163,8 +177,6 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
}
);
}
}
}

View File

@ -4,11 +4,14 @@ import { RouterModule } from '@angular/router';
import { DataProviderComponent } from './dataProvider.component';
import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: DataProviderComponent, canActivate: [FreeGuard],canDeactivate: [PreviousRouteRecorder] }
{ path: '', component: DataProviderComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
redirect: '/error'
},canDeactivate: [PreviousRouteRecorder] }
])
]
})

View File

@ -29,6 +29,7 @@ import {PublicationsServiceModule} from '../../services/publicationsService.modu
import { DataProviderRoutingModule } from './dataProvider-routing.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports:
@ -41,8 +42,7 @@ import {FreeGuard} from'../../login/freeGuard.guard';
RelatedDatasourcesTabComponent, DataProviderComponent
],
providers:[
DataProviderService, FreeGuard
],
DataProviderService, FreeGuard, IsRouteEnabled],
exports: [
DataProviderComponent
]

View File

@ -4,11 +4,14 @@ import { RouterModule } from '@angular/router';
import { DatasetComponent } from './dataset.component';
import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: DatasetComponent, canActivate: [FreeGuard],canDeactivate: [PreviousRouteRecorder] }
{ path: '', component: DatasetComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
redirect: '/error'
},canDeactivate: [PreviousRouteRecorder] }
])
]
})

View File

@ -16,6 +16,7 @@ import {CiteThisModule} from '../landing-utils/citeThis/citeThis.module';
import { ResultLandingModule } from '../landing-utils/resultLanding.module';
import { LandingModule } from '../landing-utils/landing.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
@ -27,7 +28,7 @@ import {FreeGuard} from'../../login/freeGuard.guard';
DatasetComponent
],
providers:[
DatasetService, FreeGuard
DatasetService, FreeGuard, IsRouteEnabled
],
exports: [
DatasetComponent

View File

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

View File

@ -21,6 +21,7 @@ import {ProjectsServiceModule} from '../../services/projectsService.module';
import { SearchingProjectsTabModule} from '../landing-utils/searchingProjectsInTab.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
@ -42,7 +43,7 @@ import {FreeGuard} from'../../login/freeGuard.guard';
OrganizationComponent,
],
providers:[
FreeGuard
FreeGuard, IsRouteEnabled
],
exports: [
OrganizationComponent

View File

@ -4,11 +4,14 @@ import { RouterModule } from '@angular/router';
import { ProjectComponent } from './project.component';
import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: ProjectComponent, canActivate: [FreeGuard],canDeactivate: [PreviousRouteRecorder] }
{ path: '', component: ProjectComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
redirect: '/error'
},canDeactivate: [PreviousRouteRecorder] }
])
]
})

View File

@ -19,6 +19,7 @@ import {DatasetsServiceModule} from '../../services/datasetsService.module';
import {TabResultModule } from '../../searchPages/searchUtils/tabResult.module';
import { LandingModule } from '../landing-utils/landing.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
@ -33,7 +34,7 @@ import {FreeGuard} from'../../login/freeGuard.guard';
providers:[
// ProjectService,
// HtmlProgressReportService
FreeGuard
FreeGuard, IsRouteEnabled
],
exports: [
ProjectComponent

View File

@ -4,11 +4,14 @@ import { RouterModule } from '@angular/router';
import { PublicationComponent } from './publication.component';
import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: PublicationComponent, canActivate: [FreeGuard],canDeactivate: [PreviousRouteRecorder] }
{ path: '', component: PublicationComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
redirect: '/error'
},canDeactivate: [PreviousRouteRecorder] }
])
]
})

View File

@ -17,20 +17,14 @@ import {PagingModule} from '../../utils/paging.module';
import { ResultLandingModule } from '../landing-utils/resultLanding.module';
import { LandingModule } from '../landing-utils/landing.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
CommonModule, FormsModule, LandingModule,SharedModule, RouterModule, CiteThisModule, PagingModule,
ResultLandingModule, PublicationRoutingModule, IFrameModule, MetricsModule, AltMetricsModule
],
declarations: [
PublicationComponent
],
providers:[
PublicationService, FreeGuard
],
exports: [
PublicationComponent
]
ResultLandingModule, PublicationRoutingModule, IFrameModule, MetricsModule, AltMetricsModule],
declarations: [PublicationComponent],
providers:[PublicationService, FreeGuard, IsRouteEnabled],
exports: [PublicationComponent]
})
export class PublicationModule { }

View File

@ -112,7 +112,10 @@ export class Session{
public static getCurrentParameters():any {
if( typeof localStorage !== 'undefined') {
var params = localStorage.getItem("params");
var object= {};
var object = null;
if(params.split("&").length > 0){
object = {};
}
for(var i=0; i<params.split("&").length; i++){
object[(params.split("&")[i]).split("=")[0]] = (params.split("&")[i]).split("=")[1];
}

View File

@ -37,10 +37,13 @@ export class ReloadComponent {
var url = Session.getCurrentUrl();
if(url && url != null && url != ""){
Session.setCurrentUrl("");
var array = Session.getCurrentParameters();
var paramsObject = Session.getCurrentParameters();
Session.setCurrentParameters("");
this._router.navigate([url],{ queryParams: array});
if(paramsObject && paramsObject != null){
this._router.navigate([url],{ queryParams: paramsObject});
}else{
this._router.navigate([url]);
}
}else{
this._router.navigate(['/']);

View File

@ -3,11 +3,14 @@ import { RouterModule } from '@angular/router';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
import{AdvancedSearchDataProvidersComponent} from './advancedSearchDataProviders.component';
import {FreeGuard} from'../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: AdvancedSearchDataProvidersComponent, canActivate: [FreeGuard],canDeactivate: [PreviousRouteRecorder] }
{ path: '', component: AdvancedSearchDataProvidersComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
redirect: '/error'
}, canDeactivate: [PreviousRouteRecorder] }
])
]

View File

@ -9,6 +9,7 @@ import{AdvancedSearchDataProvidersComponent} from './advancedSearchDataProviders
import {DataProvidersServiceModule} from '../../services/dataProvidersService.module';
import {AdvancedSearchPageModule} from '../searchUtils/advancedSearchPage.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
@ -20,8 +21,7 @@ import {DataProvidersServiceModule} from '../../services/dataProvidersService.mo
declarations: [
AdvancedSearchDataProvidersComponent
],
providers:[FreeGuard
],
providers:[FreeGuard, IsRouteEnabled],
exports: [
AdvancedSearchDataProvidersComponent
]

View File

@ -4,11 +4,14 @@ import { RouterModule } from '@angular/router';
import{AdvancedSearchDatasetsComponent} from './advancedSearchDatasets.component';
import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: AdvancedSearchDatasetsComponent, canActivate: [FreeGuard],canDeactivate: [PreviousRouteRecorder] }
{ path: '', component: AdvancedSearchDatasetsComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
redirect: '/error'
}, canDeactivate: [PreviousRouteRecorder] }
])
]

View File

@ -9,6 +9,7 @@ import{AdvancedSearchDatasetsComponent} from './advancedSearchDatasets.component
import {DatasetsServiceModule} from '../../services/datasetsService.module';
import {AdvancedSearchPageModule} from '../searchUtils/advancedSearchPage.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
@ -20,8 +21,7 @@ import {DatasetsServiceModule} from '../../services/datasetsService.module';
declarations: [
AdvancedSearchDatasetsComponent
],
providers:[FreeGuard
],
providers:[FreeGuard, IsRouteEnabled],
exports: [
AdvancedSearchDatasetsComponent
]

View File

@ -4,11 +4,14 @@ import { RouterModule } from '@angular/router';
import{AdvancedSearchOrganizationsComponent} from './advancedSearchOrganizations.component';
import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: AdvancedSearchOrganizationsComponent , canActivate: [FreeGuard],canDeactivate: [PreviousRouteRecorder]}
{ path: '', component: AdvancedSearchOrganizationsComponent , canActivate: [FreeGuard, IsRouteEnabled], data: {
redirect: '/error'
},canDeactivate: [PreviousRouteRecorder]}
])
]

View File

@ -9,6 +9,7 @@ import{AdvancedSearchOrganizationsComponent} from './advancedSearchOrganizations
import {OrganizationsServiceModule} from '../../services/organizationsService.module';
import {AdvancedSearchPageModule} from '../searchUtils/advancedSearchPage.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
@ -20,8 +21,7 @@ import {OrganizationsServiceModule} from '../../services/organizationsService.mo
declarations: [
AdvancedSearchOrganizationsComponent
],
providers:[FreeGuard
],
providers:[FreeGuard, IsRouteEnabled],
exports: [
AdvancedSearchOrganizationsComponent
]

View File

@ -4,11 +4,14 @@ import { RouterModule } from '@angular/router';
import{AdvancedSearchProjectsComponent} from './advancedSearchProjects.component';
import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: AdvancedSearchProjectsComponent, canActivate: [FreeGuard],canDeactivate: [PreviousRouteRecorder] }
{ path: '', component: AdvancedSearchProjectsComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
redirect: '/error'
}, canDeactivate: [PreviousRouteRecorder] }
])
]

View File

@ -9,6 +9,7 @@ import{AdvancedSearchProjectsComponent} from './advancedSearchProjects.component
import {ProjectsServiceModule} from '../../services/projectsService.module';
import {AdvancedSearchPageModule} from '../searchUtils/advancedSearchPage.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
@ -20,8 +21,7 @@ import {ProjectsServiceModule} from '../../services/projectsService.module';
declarations: [
AdvancedSearchProjectsComponent
],
providers:[FreeGuard
],
providers:[FreeGuard, IsRouteEnabled],
exports: [
AdvancedSearchProjectsComponent
]

View File

@ -4,11 +4,14 @@ import { RouterModule } from '@angular/router';
import{AdvancedSearchPublicationsComponent} from './advancedSearchPublications.component';
import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: AdvancedSearchPublicationsComponent, canActivate: [FreeGuard],canDeactivate: [PreviousRouteRecorder] }
{ path: '', component: AdvancedSearchPublicationsComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
redirect: '/error'
}, canDeactivate: [PreviousRouteRecorder] }
])
]

View File

@ -9,6 +9,7 @@ import{AdvancedSearchPublicationsComponent} from './advancedSearchPublications.c
import {PublicationsServiceModule} from '../../services/publicationsService.module';
import {AdvancedSearchPageModule} from '../searchUtils/advancedSearchPage.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
@ -20,8 +21,7 @@ import {PublicationsServiceModule} from '../../services/publicationsService.modu
declarations: [
AdvancedSearchPublicationsComponent
],
providers:[FreeGuard
],
providers:[FreeGuard, IsRouteEnabled],
exports: [
AdvancedSearchPublicationsComponent
]

View File

@ -4,11 +4,14 @@ import { RouterModule } from '@angular/router';
import{SearchCompatibleDataprovidersComponent} from './compatibleDataProviders.component';
import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: SearchCompatibleDataprovidersComponent, canActivate: [FreeGuard], canDeactivate: [PreviousRouteRecorder] }
{ path: '', component: SearchCompatibleDataprovidersComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
redirect: '/error'
}, canDeactivate: [PreviousRouteRecorder] }
])
]

View File

@ -12,6 +12,7 @@ import {SearchFormModule} from '../searchUtils/searchForm.module';
//import {SearchFilterModalModule} from '../searchUtils/searchFilterModal.module';
import {SearchPageModule} from '../searchUtils/searchPage.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
@ -23,8 +24,7 @@ import {FreeGuard} from'../../login/freeGuard.guard';
declarations: [
SearchCompatibleDataprovidersComponent
],
providers:[FreeGuard
],
providers:[FreeGuard, IsRouteEnabled],
exports: [
SearchCompatibleDataprovidersComponent
]

View File

@ -4,10 +4,14 @@ import { RouterModule } from '@angular/router';
import{SearchCompatibleDataprovidersTableComponent} from './compatibleDataProvidersTable.component';
import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: SearchCompatibleDataprovidersTableComponent, canActivate: [FreeGuard] , canDeactivate: [PreviousRouteRecorder] }
{ path: '', component: SearchCompatibleDataprovidersTableComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
redirect: '/error'
}, canDeactivate: [PreviousRouteRecorder] }
])
]

View File

@ -12,6 +12,7 @@ import {SearchFormModule} from '../searchUtils/searchForm.module';
//import {SearchFilterModalModule} from '../searchUtils/searchFilterModal.module';
import {SearchPageTableViewModule} from '../searchUtils/searchPageTableView.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
@ -23,8 +24,7 @@ import {FreeGuard} from'../../login/freeGuard.guard';
declarations: [
SearchCompatibleDataprovidersTableComponent
],
providers:[FreeGuard
],
providers:[FreeGuard, IsRouteEnabled],
exports: [
SearchCompatibleDataprovidersTableComponent
]

View File

@ -4,10 +4,14 @@ import { RouterModule } from '@angular/router';
import{SearchEntityRegistriesComponent} from './entityRegistries.component';
import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: SearchEntityRegistriesComponent, canActivate: [FreeGuard], canDeactivate: [PreviousRouteRecorder] }
{ path: '', component: SearchEntityRegistriesComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
redirect: '/error'
}, canDeactivate: [PreviousRouteRecorder] }
])
]

View File

@ -12,6 +12,7 @@ import {SearchFormModule} from '../searchUtils/searchForm.module';
//import {SearchFilterModalModule} from '../searchUtils/searchFilterModal.module';
import {SearchPageModule} from '../searchUtils/searchPage.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
@ -23,8 +24,7 @@ import {FreeGuard} from'../../login/freeGuard.guard';
declarations: [
SearchEntityRegistriesComponent
],
providers:[FreeGuard
],
providers:[FreeGuard, IsRouteEnabled],
exports: [
SearchEntityRegistriesComponent
]

View File

@ -4,10 +4,14 @@ import { RouterModule } from '@angular/router';
import{SearchEntityRegistriesTableComponent} from './entityRegistriesTable.component';
import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: SearchEntityRegistriesTableComponent, canActivate: [FreeGuard], canDeactivate: [PreviousRouteRecorder] }
{ path: '', component: SearchEntityRegistriesTableComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
redirect: '/error'
}, canDeactivate: [PreviousRouteRecorder] }
])
]

View File

@ -12,6 +12,7 @@ import {SearchFormModule} from '../searchUtils/searchForm.module';
//import {SearchFilterModalModule} from '../searchUtils/searchFilterModal.module';
import {SearchPageTableViewModule} from '../searchUtils/searchPageTableView.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
@ -23,8 +24,7 @@ import {FreeGuard} from'../../login/freeGuard.guard';
declarations: [
SearchEntityRegistriesTableComponent
],
providers:[FreeGuard
],
providers:[FreeGuard, IsRouteEnabled],
exports: [
SearchEntityRegistriesTableComponent
]

View File

@ -4,10 +4,14 @@ import { RouterModule } from '@angular/router';
import{SearchJournalsComponent} from './journals.component';
import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: SearchJournalsComponent, canActivate: [FreeGuard], canDeactivate: [PreviousRouteRecorder] }
{ path: '', component: SearchJournalsComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
redirect: '/error'
}, canDeactivate: [PreviousRouteRecorder] }
])
]

View File

@ -12,19 +12,19 @@ import {SearchFormModule} from '../searchUtils/searchForm.module';
//import {SearchFilterModalModule} from '../searchUtils/searchFilterModal.module';
import {SearchPageModule} from '../searchUtils/searchPage.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
CommonModule, FormsModule,
DataProvidersServiceModule,
SearchFormModule, SearchResultsModule, JournalsRoutingModule, SearchPageModule
SearchFormModule, SearchResultsModule, JournalsRoutingModule, SearchPageModule
],
declarations: [
SearchJournalsComponent
],
providers:[FreeGuard
],
providers:[FreeGuard, IsRouteEnabled],
exports: [
SearchJournalsComponent
]

View File

@ -4,10 +4,14 @@ import { RouterModule } from '@angular/router';
import{SearchJournalsTableComponent} from './journalsTable.component';
import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: SearchJournalsTableComponent, canActivate: [FreeGuard] , canDeactivate: [PreviousRouteRecorder] }
{ path: '', component: SearchJournalsTableComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
redirect: '/error'
} , canDeactivate: [PreviousRouteRecorder] }
])
]

View File

@ -12,6 +12,7 @@ import {SearchFormModule} from '../searchUtils/searchForm.module';
//import {SearchFilterModalModule} from '../searchUtils/searchFilterModal.module';
import {SearchPageTableViewModule} from '../searchUtils/searchPageTableView.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
@ -23,8 +24,7 @@ import {FreeGuard} from'../../login/freeGuard.guard';
declarations: [
SearchJournalsTableComponent
],
providers:[FreeGuard
],
providers:[FreeGuard, IsRouteEnabled],
exports: [
SearchJournalsTableComponent
]

View File

@ -15,35 +15,35 @@
<div class=" uk-margin-small-top uk-container">
<div class="uk-grid uk-margin-top">
<ul class=" uk-tab uk-tab-left uk-width-1-5 uk-visible@m" uk-tab="animation: uk-animation-fade">
<li (click)="searchPublications()" [class]="activeTab == 'publications'?'uk-active':''">
<li *ngIf="showPublications" (click)="searchPublications()" [class]="activeTab == 'publications'?'uk-active':''">
<a>
Publications
<span [class]="(fetchPublications.searchUtils.status != errorCodes.LOADING && keyword.length > 0)?'uk-badge uk-badge-notification':''"> {{((fetchPublications.searchUtils.status != errorCodes.LOADING && keyword.length > 0)? fetchPublications.searchUtils.totalResults :'')}}</span>
</a>
</li>
<li (click)="searchDatasets()" [class]="activeTab == 'research data'?'uk-active':''">
<li *ngIf="showDatasets" (click)="searchDatasets()" [class]="activeTab == 'research data'?'uk-active':''">
<a>
Research Data
<span [class]="(fetchDatasets.searchUtils.status != errorCodes.LOADING && keyword.length > 0)?'uk-badge uk-badge-notification':''"> {{((fetchDatasets.searchUtils.status != errorCodes.LOADING && keyword.length > 0)? fetchDatasets.searchUtils.totalResults :'')}}</span>
</a>
</li>
<li (click)="searchProjects()" [class]="activeTab == 'projects'?'uk-active':''">
<li *ngIf="showProjects" (click)="searchProjects()" [class]="activeTab == 'projects'?'uk-active':''">
<a>
Projects
<span [class]="(fetchProjects.searchUtils.status != errorCodes.LOADING && keyword.length > 0)?'uk-badge uk-badge-notification':''"> {{((fetchProjects.searchUtils.status != errorCodes.LOADING && keyword.length > 0)? fetchProjects.searchUtils.totalResults :'')}}</span>
</a>
</li>
<li (click)="searchDataProviders()" [class]="activeTab == 'content providers'?'uk-active':''">
<li *ngIf="showDataProviders" (click)="searchDataProviders()" [class]="activeTab == 'content providers'?'uk-active':''">
<a>
Content Providers
<span [class]="(fetchDataproviders.searchUtils.status != errorCodes.LOADING && keyword.length > 0)?'uk-badge uk-badge-notification':''"> {{((fetchDataproviders.searchUtils.status != errorCodes.LOADING && keyword.length > 0)? fetchDataproviders.searchUtils.totalResults :'')}}</span>
</a>
</li>
<li (click)="searchOrganizations()" [class]="activeTab == 'organizations'?'uk-active':''">
<li *ngIf="showOrganizations" (click)="searchOrganizations()" [class]="activeTab == 'organizations'?'uk-active':''">
<a>
Organizations
<span [class]="(fetchOrganizations.searchUtils.status != errorCodes.LOADING && keyword.length > 0)?'uk-badge uk-badge-notification':''"> {{((fetchOrganizations.searchUtils.status != errorCodes.LOADING && keyword.length > 0)? fetchOrganizations.searchUtils.totalResults :'')}}</span>
@ -56,35 +56,35 @@
</button>
<ul id="toggle-small-tabs" class="uk-subnav uk-subnav-pill uk-dropdown uk-hidden@m" uk-switcher="connect: #searchtabs; animation: uk-animation-fade" uk-dropdown="mode: click" uk-toggle="target: #toggle-small-tabs">
<li (click)="searchPublications()" [class]="activeTab == 'publications'?'uk-active':''">
<li *ngIf="showPublications" (click)="searchPublications()" [class]="activeTab == 'publications'?'uk-active':''">
<a>
Publications
<span *ngIf = "fetchPublications.searchUtils.status == errorCodes.LOADING && keyword.length > 0" class="uk-icon-spinner uk-icon-spin"></span>
<span *ngIf = "fetchPublications.searchUtils.status != errorCodes.LOADING && keyword.length > 0" class="uk-badge uk-badge-notification">{{((keyword.length > 0)? fetchPublications.searchUtils.totalResults :'')}}</span>
</a>
</li>
<li (click)="searchDatasets()" [class]="activeTab == 'research data'?'uk-active':''">
<li *ngIf="showDatasets" (click)="searchDatasets()" [class]="activeTab == 'research data'?'uk-active':''">
<a>
Research Data
<span *ngIf = "fetchDatasets.searchUtils.status == errorCodes.LOADING && keyword.length > 0" class="uk-icon-spinner uk-icon-spin"></span>
<span *ngIf = "fetchDatasets.searchUtils.status != errorCodes.LOADING && keyword.length > 0" class="uk-badge uk-badge-notification"> {{((keyword.length > 0)? fetchDatasets.searchUtils.totalResults :'')}}</span>
</a>
</li>
<li (click)="searchProjects()" [class]="activeTab == 'projects'?'uk-active':''">
<li *ngIf="showProjects" (click)="searchProjects()" [class]="activeTab == 'projects'?'uk-active':''">
<a>
Projects
<span *ngIf = "fetchProjects.searchUtils.status == errorCodes.LOADING && keyword.length > 0" class="uk-icon-spinner uk-icon-spin"></span>
<span *ngIf = "fetchProjects.searchUtils.status != errorCodes.LOADING && keyword.length > 0" class="uk-badge uk-badge-notification"> {{((keyword.length > 0)? fetchProjects.searchUtils.totalResults :'')}}</span>
</a>
</li>
<li (click)="searchDataProviders()" [class]="activeTab == 'content providers'?'uk-active':''">
<li *ngIf="showDataProviders" (click)="searchDataProviders()" [class]="activeTab == 'content providers'?'uk-active':''">
<a>
Content Providers
<span *ngIf = "fetchDataproviders.searchUtils.status == errorCodes.LOADING && keyword.length > 0" class="uk-icon-spinner uk-icon-spin"></span>
<span *ngIf = "fetchDataproviders.searchUtils.status != errorCodes.LOADING && keyword.length > 0" class="uk-badge uk-badge-notification"> {{((keyword.length > 0)? fetchDataproviders.searchUtils.totalResults :'')}}</span>
</a>
</li>
<li (click)="searchOrganizations()" [class]="activeTab == 'organizations'?'uk-active':''">
<li *ngIf="showOrganizations" (click)="searchOrganizations()" [class]="activeTab == 'organizations'?'uk-active':''">
<a>
Organizations
<span *ngIf = "fetchOrganizations.searchUtils.status == errorCodes.LOADING && keyword.length > 0" class="uk-icon-spinner uk-icon-spin"></span>
@ -98,7 +98,7 @@
<!--ul id="searchtabs" class="uk-switcher uk-width-1-1 uk-margin-top custom-tab-content-large">
<li-->
<div class="uk-width-expand custom-tab-content-large">
<div *ngIf = "activeTab=='publications'">
<div *ngIf = "activeTab=='publications' && showPublications">
<div *ngIf = "keyword.length > 0 && activeTab=='publications'" class ="uk-animation-fade">
<div class = "uk-text-right" *ngIf = "fetchPublications.searchUtils.totalResults> 10">
<!--a [href] = "linkToSearchPublications"-->
@ -118,7 +118,7 @@
<!--/li>
<li-->
</div>
<div *ngIf = "activeTab=='research data'" >
<div *ngIf = "activeTab=='research data' && showDatasets" >
<div *ngIf = "keyword.length > 0 && activeTab=='research data'" class ="uk-animation-fade">
<div class = "uk-text-right" *ngIf = "fetchDatasets.searchUtils.totalResults> 10">
<!--a [href] = "linkToSearchDatasets"-->
@ -138,7 +138,7 @@
<!--/li>
<li-->
</div>
<div *ngIf = "activeTab=='projects'">
<div *ngIf = "activeTab=='projects' && showProjects">
<div *ngIf = "keyword.length > 0 && activeTab=='projects'" class ="uk-animation-fade">
<div class = "uk-text-right" *ngIf = "fetchProjects.searchUtils.totalResults> 10">
<!--a [href] = "linkToSearchProjects"-->
@ -158,7 +158,7 @@
<!--/li>
<li-->
</div>
<div *ngIf = "activeTab=='content providers'">
<div *ngIf = "activeTab=='content providers' && showDataProviders">
<div *ngIf = "keyword.length > 0 && activeTab=='content providers'" class ="uk-animation-fade">
<div class = "uk-text-right" *ngIf = "fetchDataproviders.searchUtils.totalResults> 10">
<!--a [href] = "linkToSearchDataproviders"-->
@ -178,7 +178,7 @@
<!--/li>
<li-->
</div>
<div *ngIf = "activeTab=='organizations'">
<div *ngIf = "activeTab=='organizations' && showOrganizations">
<div *ngIf = "keyword.length > 0" class ="uk-animation-fade">
<div class = "uk-text-right" *ngIf = "fetchOrganizations.searchUtils.totalResults> 10">
<!--a [href] = "linkToSearchOrganizations"-->

View File

@ -23,6 +23,7 @@ import {ErrorCodes} from '../../utils/properties/openaireProperties';
import {RouterHelper} from '../../utils/routerHelper.class';
import {RefineFieldResultsService} from '../../services/refineFieldResults.service';
import {PiwikService} from '../../utils/piwik/piwik.service';
import { ConfigurationService } from '../../utils/configuration/configuration.service';
@Component({
changeDetection: ChangeDetectionStrategy.Default,
@ -69,7 +70,11 @@ export class SearchComponent {
public fundersSize:any = null;
public projectsSize:any = null;
public datasourcesSize:any = null;
showPublications:boolean= false;
showDatasets:boolean= false;
showProjects:boolean= false;
showDataProviders:boolean= false;
showOrganizations:boolean= false;
public subPub;public subData;public subProjects;public subOrg; public subDataPr;
constructor ( private route: ActivatedRoute,
private _router: Router,
@ -79,7 +84,8 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
private _searchDatasetsService: SearchDatasetsService,
private _searchOrganizationsService: SearchOrganizationsService,
private _refineFieldResultsService:RefineFieldResultsService,
private location: Location, private _meta: Meta,private _piwikService:PiwikService ) {
private location: Location, private _meta: Meta,private _piwikService:PiwikService,
private config: ConfigurationService ) {
this.fetchPublications = new FetchPublications(this._searchPublicationsService);
this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService);
this.fetchProjects = new FetchProjects(this._searchProjectsService);
@ -101,18 +107,51 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
}
}
public ngOnInit() {
const entityOne = this.config.isEntityEnabled("publication");
const entityTwo = this.config.isEntityEnabled("dataset");
const entityThree = this.config.isEntityEnabled("project");
const entityFour = this.config.isEntityEnabled("organization");
const entityFive = this.config.isEntityEnabled("datasource");
const example = Observable.zip(entityOne,entityTwo,entityThree,entityFour,entityFive);
//wait until all observables have emitted a value then emit all as an array
this.sub = this.route.queryParams.subscribe(params => {
this.keyword = (params['keyword'])?params['keyword']:"";
if(this.keyword !=null && this.keyword.length > 0){
this.reloadTabs();
this.activeTab = "publications";
this.searchPublications();
this.count();
}
});
const subscribe = example.subscribe(data => {
this.showPublications = data[0];
this.showDatasets = data[1];
this.showProjects = data[2];
this.showOrganizations = data[3];
this.showDataProviders = data[4];
console.log(data)
this.keyword = (params['keyword'])?params['keyword']:"";
if(this.keyword !=null && this.keyword.length > 0){
this.reloadTabs();
//if showPublications == false will set another entity as the first
if(this.showPublications){
this.activeTab = "publications";
this.searchPublications();
}else if(this.showDatasets){
this.activeTab = "research data";
this.searchDatasets();
}else if(this.showProjects){
this.activeTab = "projects";
this.searchProjects();
}else if(this.showDataProviders){
this.activeTab = "content providers";
this.searchDataProviders();
}else if(this.showOrganizations){
this.activeTab = "organizations";
this.searchOrganizations();
}
this.count();
}
});
});
}
public ngOnDestroy() {
@ -142,8 +181,8 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
public searchPublications() {
this.activeTab = "publications";
if( this.reloadPublications &&
( this.fetchPublications.searchUtils.status == this.errorCodes.LOADING ||
this.fetchPublications.searchUtils.status == this.errorCodes.DONE )) {
this.fetchPublications.searchUtils.status != this.errorCodes.NONE &&
this.fetchPublications.searchUtils.status != this.errorCodes.ERROR) {
this.reloadPublications = false;
this.fetchPublications.getResultsByKeyword(this.keyword, 1, 10);
this.linkToSearchPublications = OpenaireProperties.getLinkToSearchPublications();// + "?keyword=" + this.keyword;
@ -152,8 +191,8 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
public searchDatasets() {
this.activeTab = "research data";
if(this.reloadDatasets &&
( this.fetchDatasets.searchUtils.status == this.errorCodes.LOADING ||
this.fetchDatasets.searchUtils.status == this.errorCodes.DONE )) {
this.fetchDatasets.searchUtils.status != this.errorCodes.NONE &&
this.fetchDatasets.searchUtils.status != this.errorCodes.ERROR) {
this.reloadDatasets = false;
this.fetchDatasets.getResultsByKeyword(this.keyword, 1, 10);
this.linkToSearchDatasets = OpenaireProperties.getLinkToSearchDatasets();// + "?keyword=" + this.keyword;
@ -163,8 +202,8 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
this.activeTab = "projects";
console.log("searchProjects");
if(this.reloadProjects &&
( this.fetchProjects.searchUtils.status == this.errorCodes.LOADING ||
this.fetchProjects.searchUtils.status == this.errorCodes.DONE )) {
this.fetchProjects.searchUtils.status != this.errorCodes.NONE &&
this.fetchProjects.searchUtils.status != this.errorCodes.ERROR) {
this.reloadProjects = false;
console.log("do the search searchProjects");
@ -175,8 +214,8 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
public searchDataProviders() {
this.activeTab = "content providers";
if( this.reloadDataproviders &&
( this.fetchDataproviders.searchUtils.status == this.errorCodes.LOADING ||
this.fetchDataproviders.searchUtils.status == this.errorCodes.DONE )) {
this.fetchDataproviders.searchUtils.status != this.errorCodes.NONE &&
this.fetchDataproviders.searchUtils.status != this.errorCodes.ERROR) {
this.reloadDataproviders = false;
this.fetchDataproviders.getResultsByKeyword(this.keyword, 1, 10);
this.linkToSearchDataproviders = OpenaireProperties.getLinkToSearchDataProviders();// + "?keyword=" + this.keyword;
@ -185,8 +224,8 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
public searchOrganizations() {
this.activeTab = "organizations";
if( this.reloadOrganizations &&
( this.fetchOrganizations.searchUtils.status == this.errorCodes.LOADING ||
this.fetchOrganizations.searchUtils.status == this.errorCodes.DONE )) {
this.fetchOrganizations.searchUtils.status != this.errorCodes.NONE &&
this.fetchOrganizations.searchUtils.status != this.errorCodes.ERROR) {
this.reloadOrganizations = false;
this.fetchOrganizations.getResultsByKeyword(this.keyword, 1, 10);
this.linkToSearchOrganizations = OpenaireProperties.getLinkToSearchOrganizations();// + "?keyword=" + this.keyword;
@ -220,7 +259,7 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
}
private count() {
if(this.activeTab != "publications"){
if(this.activeTab != "publications" && this.showPublications){
this.fetchPublications.searchUtils.status = this.errorCodes.LOADING;
this.fetchPublications.results = [];
this.subPub = this._searchPublicationsService.numOfSearchPublications(this.keyword).subscribe(
@ -234,18 +273,11 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
},
err => {
console.log(err);
if(err.status == '404') {
this.fetchPublications.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.fetchPublications.searchUtils.status = this.errorCodes.ERROR;
} else {
this.fetchPublications.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
//this.fetchPublications.searchUtils.status = this.errorCodes.ERROR;
this.fetchPublications.searchUtils.status = this.errorCodes.ERROR;
}
);
}
if(this.activeTab != "research data"){
if(this.activeTab != "research data" && this.showDatasets){
this.fetchDatasets.searchUtils.status = this.errorCodes.LOADING;
this.fetchDatasets.results = [];
this.subData = this._searchDatasetsService.numOfSearchDatasets(this.keyword).subscribe(
@ -258,18 +290,11 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
},
err => {
console.log(err);
if(err.status == '404') {
this.fetchDatasets.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.fetchDatasets.searchUtils.status = this.errorCodes.ERROR;
} else {
this.fetchDatasets.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
//this.fetchDatasets.searchUtils.status = this.errorCodes.ERROR;
this.fetchDatasets.searchUtils.status = this.errorCodes.ERROR;
}
);
}
if(this.activeTab != "projects"){
if(this.activeTab != "projects" && this.showProjects){
this.fetchProjects.searchUtils.status = this.errorCodes.LOADING;
this.fetchProjects.results = [];
this.subProjects = this._searchProjectsService.numOfSearchProjects(this.keyword).subscribe(
@ -282,22 +307,15 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
},
err => {
console.log(err);
if(err.status == '404') {
this.fetchProjects.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.fetchProjects.searchUtils.status = this.errorCodes.ERROR;
} else {
this.fetchProjects.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
//this.fetchProjects.searchUtils.status = this.errorCodes.ERROR;
this.fetchProjects.searchUtils.status = this.errorCodes.ERROR;
}
);
}
if(this.activeTab != "content providers"){
if(this.activeTab != "content providers" && this.showDataProviders){
this.fetchDataproviders.results = [];
this.fetchDataproviders.getNumForSearch(this.keyword);
}
if(this.activeTab != "organizations"){
if(this.activeTab != "organizations" && this.showOrganizations){
this.fetchOrganizations.searchUtils.status = this.errorCodes.LOADING;
this.fetchOrganizations.results = [];
this.subOrg = this._searchOrganizationsService.numOfSearchOrganizations(this.keyword).subscribe(
@ -310,14 +328,7 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
},
err => {
console.log(err);
if(err.status == '404') {
this.fetchOrganizations.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.fetchOrganizations.searchUtils.status = this.errorCodes.ERROR;
} else {
this.fetchOrganizations.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
//this.fetchOrganizations.searchUtils.status = this.errorCodes.ERROR;
this.fetchOrganizations.searchUtils.status = this.errorCodes.ERROR;
}
);

View File

@ -20,7 +20,6 @@
<div class="uk-width-1-1">
<helper position="top"></helper>
</div>
<div class="uk-width-1-1 uk-grid helper-grid" >
<helper class="helper-left-right uk-visible@m" position="left"></helper>
<div class="uk-width-expand@m uk-with-1-1@s">

View File

@ -4,10 +4,14 @@ import { RouterModule } from '@angular/router';
import{SearchDataprovidersComponent} from './searchDataproviders.component';
import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: SearchDataprovidersComponent, canActivate: [FreeGuard], canDeactivate: [PreviousRouteRecorder] }
{ path: '', component: SearchDataprovidersComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
redirect: '/error'
}, canDeactivate: [PreviousRouteRecorder] }
])
]

View File

@ -12,20 +12,20 @@ import {SearchFormModule} from '../searchUtils/searchForm.module';
//import {SearchFilterModalModule} from '../searchUtils/searchFilterModal.module';
import {SearchPageModule} from '../searchUtils/searchPage.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
CommonModule, FormsModule,
DataProvidersServiceModule,
SearchFormModule, SearchResultsModule, SearchDataProvidersRoutingModule, SearchPageModule
SearchFormModule, SearchResultsModule, SearchDataProvidersRoutingModule, SearchPageModule
],
declarations: [
SearchDataprovidersComponent
],
providers:[FreeGuard
],
providers:[FreeGuard, IsRouteEnabled],
exports: [
SearchDataprovidersComponent
]

View File

@ -4,10 +4,14 @@ import { RouterModule } from '@angular/router';
import{SearchDatasetsComponent} from './searchDatasets.component';
import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: SearchDatasetsComponent, canActivate: [FreeGuard], canDeactivate: [PreviousRouteRecorder] }
{ path: '', component: SearchDatasetsComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
redirect: '/error'
}, canDeactivate: [PreviousRouteRecorder] }
])
]

View File

@ -12,20 +12,20 @@ import {SearchFormModule} from '../searchUtils/searchForm.module';
//import {SearchFilterModalModule} from '../searchUtils/searchFilterModal.module';
import {SearchPageModule} from '../searchUtils/searchPage.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
CommonModule, FormsModule,
DatasetsServiceModule,
SearchFormModule, SearchResultsModule, SearchDatasetsRoutingModule, SearchPageModule
SearchFormModule, SearchResultsModule, SearchDatasetsRoutingModule, SearchPageModule
],
declarations: [
SearchDatasetsComponent
],
providers:[FreeGuard
],
providers:[FreeGuard, IsRouteEnabled],
exports: [
SearchDatasetsComponent
]

View File

@ -4,10 +4,14 @@ import { RouterModule } from '@angular/router';
import{SearchOrganizationsComponent} from './searchOrganizations.component';
import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: SearchOrganizationsComponent, canActivate: [FreeGuard] , canDeactivate: [PreviousRouteRecorder] }
{ path: '', component: SearchOrganizationsComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
redirect: '/error'
}, canDeactivate: [PreviousRouteRecorder] }
])
]

View File

@ -11,6 +11,7 @@ import {OrganizationsServiceModule} from '../../services/organizationsService.mo
import {SearchFormModule} from '../searchUtils/searchForm.module';
import {SearchPageModule} from '../searchUtils/searchPage.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
@ -23,8 +24,7 @@ import {FreeGuard} from'../../login/freeGuard.guard';
declarations: [
SearchOrganizationsComponent
],
providers:[FreeGuard
],
providers:[FreeGuard, IsRouteEnabled],
exports: [
SearchOrganizationsComponent
]

View File

@ -4,10 +4,14 @@ import { RouterModule } from '@angular/router';
import{SearchProjectsComponent} from './searchProjects.component';
import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: SearchProjectsComponent, canActivate: [FreeGuard], canDeactivate: [PreviousRouteRecorder] }
{ path: '', component: SearchProjectsComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
redirect: '/error'
}, canDeactivate: [PreviousRouteRecorder] }
])
]

View File

@ -12,6 +12,7 @@ import {SearchFormModule} from '../searchUtils/searchForm.module';
//import {SearchFilterModalModule} from '../searchUtils/searchFilterModal.module';
import {SearchPageModule} from '../searchUtils/searchPage.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
@ -24,8 +25,7 @@ import {FreeGuard} from'../../login/freeGuard.guard';
declarations: [
SearchProjectsComponent
],
providers:[FreeGuard
],
providers:[FreeGuard, IsRouteEnabled],
exports: [
SearchProjectsComponent
]

View File

@ -4,10 +4,14 @@ import { RouterModule } from '@angular/router';
import{SearchPublicationsComponent} from './searchPublications.component';
import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: SearchPublicationsComponent, canActivate: [FreeGuard], canDeactivate: [PreviousRouteRecorder] }
{ path: '', component: SearchPublicationsComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
redirect: '/error'
}, canDeactivate: [PreviousRouteRecorder] }
])
]

View File

@ -12,6 +12,7 @@ import {SearchFormModule} from '../searchUtils/searchForm.module';
//import {SearchFilterModalModule} from '../searchUtils/searchFilterModal.module';
import {SearchPageModule} from '../searchUtils/searchPage.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
@ -24,8 +25,7 @@ import {FreeGuard} from'../../login/freeGuard.guard';
declarations: [
SearchPublicationsComponent
],
providers:[FreeGuard
],
providers:[FreeGuard, IsRouteEnabled],
exports: [
SearchPublicationsComponent
]

View File

@ -23,22 +23,22 @@
<li class="uk-nav-header uk-parent">
<a routerLinkActive="uk-link" routerLink="/search/find" class="uk-offcanvas-close custom-offcanvas-close">Search</a>
<ul class="uk-nav-sub">
<li><a routerLinkActive="uk-link" routerLink="/search/find/publications" class="uk-offcanvas-close custom-offcanvas-close">Publications</a></li>
<li><a routerLinkActive="uk-link" routerLink="/search/find/datasets" class="uk-offcanvas-close custom-offcanvas-close">Research Data</a></li>
<li><a routerLinkActive="uk-link" routerLink="/search/find/projects" class="uk-offcanvas-close custom-offcanvas-close">Projects</a></li>
<li><a routerLinkActive="uk-link" routerLink="/search/find/dataproviders" class="uk-offcanvas-close custom-offcanvas-close">Content Providers</a></li>
<li><a routerLinkActive="uk-link" routerLink="/search/find/organizations" class="uk-offcanvas-close custom-offcanvas-close">Organizations</a></li>
<li *ngIf="showPublications"><a routerLinkActive="uk-link" routerLink="/search/find/publications" class="uk-offcanvas-close custom-offcanvas-close">Publications</a></li>
<li *ngIf="showDatasets"><a routerLinkActive="uk-link" routerLink="/search/find/datasets" class="uk-offcanvas-close custom-offcanvas-close">Research Data</a></li>
<li *ngIf="showProjects"><a routerLinkActive="uk-link" routerLink="/search/find/projects" class="uk-offcanvas-close custom-offcanvas-close">Projects</a></li>
<li *ngIf="showDataProviders"><a routerLinkActive="uk-link" routerLink="/search/find/dataproviders" class="uk-offcanvas-close custom-offcanvas-close">Content Providers</a></li>
<li *ngIf="showOrganizations"><a routerLinkActive="uk-link" routerLink="/search/find/organizations" class="uk-offcanvas-close custom-offcanvas-close">Organizations</a></li>
</ul>
</li>
<li class="uk-nav-header uk-parent">
<li *ngIf="showDepositDatasets||showDepositPublications"class="uk-nav-header uk-parent">
Deposit
<ul class="uk-nav-sub">
<li><a routerLinkActive="uk-link" routerLink="/participate/deposit-publications" class="uk-offcanvas-close custom-offcanvas-close" >Deposit Publications</a></li>
<li><a routerLinkActive="uk-link" routerLink="/participate/deposit-datasets" class="uk-offcanvas-close custom-offcanvas-close" >Deposit Research Data</a></li>
<li *ngIf="showDepositPublications" ><a routerLinkActive="uk-link" routerLink="/participate/deposit-publications" class="uk-offcanvas-close custom-offcanvas-close" >Deposit Publications</a></li>
<li *ngIf="showDepositDatasets"><a routerLinkActive="uk-link" routerLink="/participate/deposit-datasets" class="uk-offcanvas-close custom-offcanvas-close" >Deposit Research Data</a></li>
</ul>
</li>
<li class="uk-nav-header uk-parent">
<li *ngIf="showLinking" class="uk-nav-header uk-parent">
<a routerLinkActive="uk-link" routerLink="/participate/claim" class="" aria-expanded="false">Link</a>
<!--ul class="uk-nav-sub">
<li><a routerLinkActive="uk-link" routerLink="/participate/claim" class="uk-offcanvas-close custom-offcanvas-close" >Link</a></li>
@ -46,7 +46,7 @@
<li *ngIf="isAuthorized"><a routerLinkActive="uk-link" routerLink="/claims" class="uk-offcanvas-close custom-offcanvas-close">Manage all Claims</a></li>
</ul-->
</li>
<li class="uk-nav-header uk-parent">
<li *ngIf="showDataProviders" class="uk-nav-header uk-parent">
Resources
<ul class="uk-nav-sub">
<li><a href="https://beta.openaire.eu/oa-policies-mandates" class="uk-offcanvas-close custom-offcanvas-close" >Policies and mandates</a></li>
@ -63,6 +63,9 @@
</div>
</div>
</div>
</div>
<div *ngIf="specialAnnouncementContent" class="uk-hidden@m" [innerHTML]="specialAnnouncementContent">
</div>
<div class="tm-toolbar custom-discover-toolbar uk-visible@m">
<div class="uk-container uk-flex uk-flex-middle uk-container-expand">
@ -86,6 +89,9 @@
</div>
</div>
</div>
</div>
<div *ngIf="specialAnnouncementContent" class="uk-visible@m" [innerHTML]="specialAnnouncementContent">
</div>
<div class="tm-header uk-visible@m tm-header-transparent" uk-header="">
<div class="uk-navbar-container uk-sticky uk-navbar-transparent uk-light" uk-sticky="" media="768" cls-active="uk-active uk-navbar-sticky" animation="uk-animation-slide-top" top=".tm-header + [class*=&quot;uk-section&quot;]" cls-inactive="uk-navbar-transparent uk-light" style="">
@ -107,31 +113,31 @@
<div class="uk-navbar-dropdown-grid uk-child-width-1-1 uk-grid uk-grid-stack" uk-grid="">
<div class="uk-first-column">
<ul class="uk-nav uk-navbar-dropdown-nav">
<li><a routerLinkActive="uk-link" routerLink="/search/find/publications">Publications</a></li>
<li><a routerLinkActive="uk-link" routerLink="/search/find/datasets">Research Data</a></li>
<li><a routerLinkActive="uk-link" routerLink="/search/find/projects">Projects</a></li>
<li><a routerLinkActive="uk-link" routerLink="/search/find/dataproviders">Content Providers</a></li>
<li><a routerLinkActive="uk-link" routerLink="/search/find/organizations">Organizations</a></li>
<li *ngIf="showPublications"><a routerLinkActive="uk-link" routerLink="/search/find/publications">Publications</a></li>
<li *ngIf="showDatasets"><a routerLinkActive="uk-link" routerLink="/search/find/datasets">Research Data</a></li>
<li *ngIf="showProjects"><a routerLinkActive="uk-link" routerLink="/search/find/projects">Projects</a></li>
<li *ngIf="showDataProviders"><a routerLinkActive="uk-link" routerLink="/search/find/dataproviders">Content Providers</a></li>
<li *ngIf="showOrganizations"><a routerLinkActive="uk-link" routerLink="/search/find/organizations">Organizations</a></li>
</ul>
</div>
</div>
</div>
</li>
<li class="uk-parent">
<li *ngIf="showDepositDatasets||showDepositPublications" class="uk-parent">
<a routerLinkActive="uk-link" routerLink="/participate/deposit-publications" class="" aria-expanded="false">Deposit</a>
<div class="uk-navbar-dropdown uk-navbar-dropdown-bottom-left" style="top: 80px; left: 240px;" id="depositMenu" (click)="onClick('depositMenu')">
<div class="uk-navbar-dropdown-grid uk-child-width-1-1 uk-grid uk-grid-stack" uk-grid="">
<div class="uk-first-column">
<ul class="uk-nav uk-navbar-dropdown-nav">
<li><a routerLinkActive="uk-link" routerLink="/participate/deposit-publications">Deposit Publications</a></li>
<li><a routerLinkActive="uk-link" routerLink="/participate/deposit-datasets">Deposit Research Data</a></li>
<ul class="uk-nav uk-navbar-dropdown-nav">
<li *ngIf="showDepositPublications"><a routerLinkActive="uk-link" routerLink="/participate/deposit-publications">Deposit Publications</a></li>
<li *ngIf="showDepositDatasets"><a routerLinkActive="uk-link" routerLink="/participate/deposit-datasets">Deposit Research Data</a></li>
</ul>
</div>
</div>
</div>
</li>
<li class="uk-parent">
<li *ngIf="showLinking" class="uk-parent">
<a routerLinkActive="uk-link" routerLink="/participate/claim" class="" aria-expanded="false">Link</a>
<!--div class="uk-navbar-dropdown uk-navbar-dropdown-bottom-left" style="top: 80px; left: 358px;" id="linkingMenu" (click)="onClick('linkingMenu')" >
<div class="uk-navbar-dropdown-grid uk-child-width-1-1 uk-grid uk-grid-stack" uk-grid="">
@ -145,7 +151,7 @@
</div>
</div-->
</li>
<li class="uk-parent">
<li *ngIf="showDataProviders" class="uk-parent">
<a routerLinkActive="uk-link" routerLink="/search/content-providers" class="" aria-expanded="false">Resources</a>
<div class="uk-navbar-dropdown uk-navbar-dropdown-bottom-left" style="top: 80px; left: 113px;" id="dpMenu" (click)="onClick('dpMenu')">
<div class="uk-navbar-dropdown-grid uk-child-width-1-1 uk-grid uk-grid-stack" uk-grid="">

View File

@ -3,6 +3,7 @@ import 'rxjs/Rx';
import {ActivatedRoute, Router} from '@angular/router';
import {Session} from '../login/utils/helper.class';
import { ConfigurationService } from '../utils/configuration/configuration.service';
@Component({
selector: 'navbar',
@ -13,8 +14,18 @@ export class NavigationBarComponent {
sub:any;
isClient:boolean = false;
showPublications:boolean= false;
showDatasets:boolean= false;
showProjects:boolean= false;
showDataProviders:boolean= false;
showOrganizations:boolean= false;
showDepositDatasets:boolean= false;
showDepositPublications:boolean= false;
showLinking:boolean= false;
specialAnnouncementContent:string= null;
constructor( private router: Router, private route: ActivatedRoute) {}
constructor( private router: Router, private route: ActivatedRoute, private config: ConfigurationService) {}
ngOnInit() {
if (typeof document !== 'undefined') {
@ -27,6 +38,16 @@ export class NavigationBarComponent {
this.sub = this.route.queryParams.subscribe(params => {
this.initialize();
});
this.config.isEntityEnabled("publication").subscribe(data => { this.showPublications = data;});
this.config.isEntityEnabled("dataset").subscribe(data => { this.showDatasets = data;});
this.config.isEntityEnabled("project").subscribe(data => { this.showProjects = data;});
this.config.isEntityEnabled("organization").subscribe(data => { this.showOrganizations = data;});
this.config.isEntityEnabled("datasource").subscribe(data => { this.showDataProviders = data;});
this.config.isPageEnabled("participate/deposit-publications").subscribe(data => { this.showDepositPublications = data;});
this.config.isPageEnabled("participate/deposit-datasets").subscribe(data => { this.showDepositDatasets = data;});
this.config.isPageEnabled("participate/claim").subscribe(data => { this.showLinking = data;});
this.config.getSpecialAnouncementContent().subscribe(data => { this.specialAnnouncementContent = data;});
}
ngOnDestroy(){
this.sub.unsubscribe();

View File

@ -0,0 +1,56 @@
import {Injectable} from '@angular/core';
import {Http, Response, Headers} from '@angular/http';
import {Observable} from 'rxjs/Observable';
import {OpenaireProperties} from '../properties/openaireProperties';
import 'rxjs/add/observable/of';
import 'rxjs/add/operator/do';
import 'rxjs/add/operator/share';
import { CacheService } from '../../shared/cache.service';
@Injectable()
export class ConfigurationService {
constructor(private http: Http, public _cache: CacheService) {}
isEntityEnabled(entity: string){
let url = "isEntityEnabled-"+entity;
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key));
}
// if(entity == "publication" || entity == "dataset" || entity == "datasource"){
// return Observable.of(new Object()).mapTo(false).do(res => this._cache.set(key, false));
// }
return Observable.of(new Object()).mapTo(true).do(res => this._cache.set(key, true));
// return this.http.get(url)
// .map(res => res.data);
}
isPageEnabled(router: string){
let url = "isPageEnabled-"+router;
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key));
}
// if(router == "search/journals" ){
//
// return Observable.of(new Object()).mapTo(false).do(res => this._cache.set(key, false));
// }
return Observable.of(new Object()).mapTo(true).do(res => this._cache.set(key, true));
}
getMainPageContent(){
return Observable.of(new Object()).mapTo(true);
}
getSpecialAnouncementContent(){
return Observable.of(new Object()).mapTo(null);//"<div class='uk-margin uk-text-center'>Testinggg!!!!!!!!!1</div>");
}
getHelpPageContent(router:string){
return Observable.of(new Object()).mapTo(true);
}
private handleError (error: Response) {
// in a real world app, we may send the error to some remote logging infrastructure
// instead of just logging it to the console
console.log(error);
return Observable.throw(error || 'Server error');
}
}

View File

@ -94,7 +94,7 @@ export class OpenaireProperties {
private static piwikBaseUrl =" https://analytics.openaire.eu/piwik.php?idsite=6";
private static enablePiwikTrack:boolean = false;
private static loginUrl ="http://mpagasas.di.uoa.gr:8080/uoa-user-management-1.0.0-SNAPSHOT/openid_connect_login";
private static loginUrl ="http://mpagasas.di.uoa.gr:8080/dnet-openaire-users-1.0.0-SNAPSHOT/openid_connect_login";
private static loginUrl_pm ="https://beta.services.openaire.eu/uoa-user-management/openid_connect_login";
private static logoutUrl ="https://aai.openminted.eu/proxy/saml2/idp/SingleLogoutService.php?ReturnTo=";

View File

@ -501,8 +501,8 @@ h2, .uk-h2{
color: #d4d4d4 !important;
}
.tm-toolbar .uk-subnav-line li:hover {display: block;} // remove the others
.tm-toolbar .uk-subnav-line li:hover {display: block;} /* remove the others*/
.helper-grid>*{
padding-left: 0px !important;
padding-left: 25px !important;
}

View File

@ -11,9 +11,9 @@
**/
export const routes: string[] = [
'search/find', 'home',
'search/person','search/publication','search/project','search/dataset','search/dataprovider','search/organization',
'search/find/people','search/find/publications','search/find/projects','search/find/datasets','search/find/dataproviders','search/find/organizations',
'search/advanced/people','search/advanced/publications','search/advanced/projects','search/advanced/datasets','search/advanced/dataproviders','search/advanced/organizations',
'search/publication','search/project','search/dataset','search/dataprovider','search/organization',
'search/find/publications','search/find/projects','search/find/datasets','search/find/dataproviders','search/find/organizations',
'search/advanced/publications','search/advanced/projects','search/advanced/datasets','search/advanced/dataproviders','search/advanced/organizations',
'participate/deposit-publications','participate/deposit-datasets','participate/deposit-publications-result','participate/deposit-datasets-result', 'participate/deposit-subject-result',
'search/content-providers','search/content-providers-table','search/entity-registries','search/entity-registries-table','search/journals','search/journals-table',
'project-report', 'claims','myclaims','participate/claim', 'participate/direct-claim', 'claims-project-manager',