Delete properties file | remove community API url from routes | create wrapper for '/' to serve community or communities component based on domain or communityId parameter

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@51407 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2018-03-22 15:38:42 +00:00
parent 0c8dd813ab
commit 37ae936f5c
48 changed files with 248 additions and 103 deletions

View File

@ -30,7 +30,7 @@
"vocabulariesAPI" :"https://beta.services.openaire.eu/provision/mvc/vocabularies/",
"piwikBaseUrl" :" https://analytics.openaire.eu/piwik.php?idsite=6",
"loginUrl" :"https://beta.services.openaire.eu/uoa-user-management/openid_connect_login",
"loginUrl" :"https://beta.services.openaire.eu/connect-user-management/openid_connect_login",
"logoutUrl" :"https://aai.openminted.eu/proxy/saml2/idp/SingleLogoutService.php?ReturnTo=",
@ -48,7 +48,8 @@
"adminToolsCommunity" :"openaire",
"communityAPI": "https://dev-openaire.d4science.org/openaire/community/",
"communityAPI": "https://dev-openaire.d4science.org/openaire/community/",
"communitiesAPI": "https://dev-openaire.d4science.org/openaire/community/communities",
"csvLimit": 2000,
"pagingLimit": 20,

View File

@ -7,9 +7,9 @@ import { EnvironmentSpecificService} from './openaireLibrary/utils/properties/en
import { OpenaireErrorPageComponent } from './error/errorPage.component';
const routes: Routes = [
{ path: '', loadChildren: './communities/communities.module#CommunitiesModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'community', loadChildren: './community/community.module#CommunityModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'communities', loadChildren: './communities/communities.module#CommunitiesModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
// { path: '', loadChildren: './communities/communities.module#CommunitiesModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: '', loadChildren: './communitywrapper/communityWrapper.module#CommunityWrapperModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
// { path: 'communities', loadChildren: './communities/communities.module#CommunitiesModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'my-communities', loadChildren: './my-communities/communities.module#CommunitiesModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'statistics', loadChildren: './statistics/statistics.module#StatisticsModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'search/publication', loadChildren: './landingPages/publication/libPublication.module#LibPublicationModule', resolve: { envSpecific: EnvironmentSpecificResolver }},

View File

@ -7,7 +7,7 @@ import{MenuItem, RootMenuItem} from './openaireLibrary/sharedComponents/menu';
import { EnvironmentSpecificService} from './openaireLibrary/utils/properties/environment-specific.service';
import {CommunitiesService} from "./openaireLibrary/connect/communities/communities.service";
import {Session} from './openaireLibrary/login/utils/helper.class';
import {ConnectHelper} from './utils/connectHelper';
@Component({
//changeDetection: ChangeDetectionStrategy.Default,
@ -17,8 +17,10 @@ import {Session} from './openaireLibrary/login/utils/helper.class';
`],
template: `
<navbar *ngIf= "properties" portal="connect" onlyTop=false [(communityId)]="properties.adminToolsCommunity" [userMenuItems]=userMenuItems [menuItems]=menuItems
[(APIUrl)]="properties.adminToolsAPIURL" [(logInUrl)]="properties.loginUrl" [(logOutUrl)]="properties.logoutUrl" [(cookieDomain)]="properties.cookieDomain" [(community)]=community [showMenu]=showMenu>2</navbar>
<navbar *ngIf= "properties && showMenu && !community" portal="connect" onlyTop=false [userMenuItems]=userMenuItems [menuItems]=menuItems
[(APIUrl)]="properties.adminToolsAPIURL" [(logInUrl)]="properties.loginUrl" [(logOutUrl)]="properties.logoutUrl" [(cookieDomain)]="properties.cookieDomain" [showMenu]=showMenu></navbar>
<navbar *ngIf= "properties && community" portal="connect" onlyTop=false [communityId]="community.id" [userMenuItems]=userMenuItems [menuItems]=menuItems
[(APIUrl)]="properties.adminToolsAPIURL" [(logInUrl)]="properties.loginUrl" [(logOutUrl)]="properties.logoutUrl" [(cookieDomain)]="properties.cookieDomain" [(community)]=community [showMenu]=showMenu></navbar>
<div class="custom-main-content" >
<main>
@ -75,13 +77,16 @@ export class AppComponent {
this.userMenuItems.push(new MenuItem("","Manage "+((com.shortTitle)?com.shortTitle:com.title),"https://admin.demo.openaire.eu?communityId="+com.communityId,"",false,[],[],{}));
}
}
if((data['communityId'] && data['communityId']!="" && com.communityId ==data['communityId']) || (data['community'] && data['community']!="" && com.communityId ==data['communityId'])){
if((data['communityId'] && data['communityId']!="" && com.communityId == data['communityId'])
|| (ConnectHelper.getCommunityFromDomain(document.location.hostname) == com.communityId )){
community = com;
this.community = {id: community.communityId, name: (community.shortTitle)?community.shortTitle:community.title, logoUrl:community.logoUrl};
this.menuItems= [
{rootItem: new MenuItem("home","Home","","/",false,[],[],{}),
{rootItem: new MenuItem("home","Home",(typeof document !== 'undefined' && ConnectHelper.isProduction(document.location.hostname))?'https://beta.connect.openaire.eu':'',(typeof document === 'undefined' || !ConnectHelper.isProduction(document.location.hostname))?'/':'',false,[],[],{}),
items: []},
{rootItem: new MenuItem("dashboard","Dashboard","","/community",false,[],[],{communityId:community.communityId}),
{rootItem: new MenuItem("dashboard","Dashboard","","/",false,[],[],(typeof document !== 'undefined' && ConnectHelper.isProduction(document.location.hostname))?{}:{communityId:community.communityId}),
items: []
},
{rootItem: new MenuItem("search","Search","","",false,[],[],{}),
@ -106,21 +111,18 @@ export class AppComponent {
items: []
}
];
this.showMenu = true;
}
}
if(!((data['communityId'] && data['communityId']!="") || (data['community'] && data['community']!="") )){
this.community = null;
if(community == null){
this.menuItems= [
{rootItem: new MenuItem("communities","Communities","","/",false,[],[],{}),
items: []
items: []}
];
}
];
this.showMenu = true;
}
});

View File

@ -34,8 +34,7 @@ import {CommunitiesService} from './openaireLibrary/connect/communi
NavigationBarModule, FeedbackModule, BottomModule,
CookieLawModule,
BrowserModule.withServerTransition({appId: 'my-app'}),
AppRoutingModule//,LibSearchProjectsModule
AppRoutingModule,//,LibSearchProjectsModule
],
declarations: [ AppComponent, OpenaireErrorPageComponent],
exports: [ AppComponent ],

View File

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

View File

@ -6,12 +6,12 @@ import {LoginGuard} from '../../openaireLibrary/login/loginGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard';
import {Properties} from '../../utils/properties';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: OpenaireClaimsByTokenComponent, canActivate: [IsRouteEnabled, LoginGuard],
data: {redirect: '/error', api: Properties.adminToolsAPIURL}, canDeactivate: [PreviousRouteRecorder]}])
data: {redirect: '/error' }, canDeactivate: [PreviousRouteRecorder]}])
]
})
export class ClaimsByTokenRoutingModule { }

View File

@ -5,12 +5,12 @@ import { OpenaireDirectLinkingComponent } from './directLinking.component';
import {LoginGuard} from '../../openaireLibrary/login/loginGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard';
import {Properties} from '../../utils/properties';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: OpenaireDirectLinkingComponent, canActivate: [IsRouteEnabled, LoginGuard], data: {
redirect: '/error', api: Properties.adminToolsAPIURL
redirect: '/error'
}, canDeactivate: [PreviousRouteRecorder]},
])

View File

@ -5,12 +5,12 @@ import { OpenaireLinkingComponent } from './linkingGeneric.component';
import {LoginGuard} from '../../openaireLibrary/login/loginGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard';
import {Properties} from '../../utils/properties';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: OpenaireLinkingComponent, canActivate: [IsRouteEnabled, LoginGuard], data: {
redirect: '/error', api: Properties.adminToolsAPIURL
redirect: '/error'
}, canDeactivate: [PreviousRouteRecorder]},
])

View File

@ -5,12 +5,12 @@ import {OpenaireMyClaimsComponent } from './myClaims.component';
import {LoginGuard} from '../../openaireLibrary/login/loginGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard';
import {Properties} from '../../utils/properties';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: OpenaireMyClaimsComponent, canActivate: [IsRouteEnabled, LoginGuard],
data: {redirect: '/error', api: Properties.adminToolsAPIURL}, canDeactivate: [PreviousRouteRecorder]}])
data: {redirect: '/error' }, canDeactivate: [PreviousRouteRecorder]}])
]
})
export class MyClaimsRoutingModule { }

View File

@ -31,14 +31,23 @@
</div>
</span>
<div class="uk-card-body">
<div *ngIf="item.title != null">
<div>
<h3 class="uk-card-title">
<a *ngIf="!isProduction()" [queryParams]="{communityId: item.communityId}" routerLinkActive="router-link-active" routerLink="/">
{{(item.title)?item.title:item.shortTitle}}</a>
<a *ngIf="isProduction()" href="{{'https://'+getProductionPrefix()+item.communityId+'.openaire.eu'}}">
{{(item.title)?item.title:item.shortTitle}}</a>
</h3>
</div>
<!--div *ngIf="item.title != null">
<h3 class="uk-card-title"><a [queryParams]="{communityId: item.communityId}" routerLinkActive="router-link-active" routerLink="/community">
{{item.title}}</a></h3>
</div>
<div *ngIf="item.title == null && item.shortTitle != null">
<h3 class="uk-card-title"><a [queryParams]="{communityId: item.communityId}" routerLinkActive="router-link-active" routerLink="/community">
{{item.shortTitle}}</a></h3>
</div>
</div-->
<p *ngIf="item.description != null" >{{item.description}}</p>
<subscribe [communityId]="item.communityId"></subscribe>
</div>

View File

@ -7,7 +7,6 @@ import {Location} from '@angular/common';
import {Observable} from 'rxjs/Observable';
import "rxjs/add/observable/zip";
import {Properties} from '../utils/properties';
import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties';
import {ErrorCodes} from '../openaireLibrary/utils/properties/errorCodes';
@ -15,6 +14,7 @@ import {PiwikService} from '../openaireLibrary/utils/
import {Meta} from '../openaireLibrary/sharedComponents/metaService';
import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service';
import {CommunitiesService} from '../openaireLibrary/connect/communities/communities.service';
import {ConnectHelper} from '../utils/connectHelper';
@Component({
selector: 'communities',
@ -70,4 +70,11 @@ export class CommunitiesComponent {
this.piwiksub.unsubscribe();
}
}
isProduction():boolean{
return ConnectHelper.isProduction(document.location.hostname);
}
getProductionPrefix():string{
return ConnectHelper.getProductionPrefix(document.location.hostname);
}
}

View File

@ -3,7 +3,7 @@ import {CommonModule} from '@angular/common';
import {FormsModule} from '@angular/forms';
import {RouterModule} from '@angular/router';
import {CommunitiesRoutingModule} from './communities-routing.module';
// import {CommunitiesRoutingModule} from './communities-routing.module';
import {SubscribeModule} from '../utils/subscribe/subscribe.module';
import {CommunitiesComponent} from './communities.component';
@ -19,7 +19,8 @@ import {CommunitiesService} from '../openaireLibrary/connect/communities/c
@NgModule({
imports: [
CommonModule, FormsModule, RouterModule,
CommunitiesRoutingModule, SubscribeModule
// CommunitiesRoutingModule,
SubscribeModule
],
declarations: [
CommunitiesComponent

View File

@ -5,7 +5,6 @@ import {Location} from '@angular/common';
import "rxjs/add/observable/zip";
import { EnvProperties} from '../openaireLibrary/utils/properties/env-properties';
import { ErrorCodes} from '../openaireLibrary/utils/properties/errorCodes';
import {Properties} from '../utils/properties';
import {CommunityService} from "../openaireLibrary/connect/community/community.service";
import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service';
@ -39,7 +38,7 @@ export class CommunityComponent {
public researchDataResults = null;
public softwareResults = null;
public communityId = null;
@Input() communityId = null;
public community = null;
constructor (
@ -70,10 +69,13 @@ export class CommunityComponent {
this.piwiksub = this._piwikService.trackView(this.properties, "OpenAIRE").subscribe();
}
this.route.queryParams.subscribe(
communityId => {
this.communityId = communityId['communityId'];
});
// this.route.queryParams.subscribe(
// communityId => {
// this.communityId = communityId['communityId'];
// if(!this.communityId){
// this.communityId = this.route.snapshot.paramMap.get('id');
// }
// });
if (this.communityId != null && this.communityId != '') {
this._communityService.getCommunity(this.properties.communityAPI+this.communityId).subscribe (

View File

@ -3,7 +3,7 @@ import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { RouterModule } from '@angular/router';
import{CommunityRoutingModule} from './community-routing.module';
// import{CommunityRoutingModule} from './community-routing.module';
import{CommunityComponent} from './community.component';
import {ResultsComponent} from '../searchEntries/results/results.component';
@ -21,7 +21,8 @@ import {StatisticsModule} from "../statistics/statistics.module";
@NgModule({
imports: [
CommonModule, FormsModule, RouterModule,
CommunityRoutingModule, SubscribeModule, StatisticsModule
// CommunityRoutingModule,
SubscribeModule, StatisticsModule
],
declarations: [
CommunityComponent, ResultsComponent

View File

@ -0,0 +1,16 @@
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] }
])
]
})
export class CommunityWrapperRoutingModule { }

View File

@ -0,0 +1,44 @@
import {Component, Input, Output, EventEmitter, ViewChild, ChangeDetectionStrategy, ViewEncapsulation} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {ActivatedRoute, Router} from '@angular/router';
import {ConnectHelper} from '../utils/connectHelper';
@Component({
selector: 'community-wrapper',
template:`
<community *ngIf="dashboard && communityId" [communityId]=communityId></community>
<communities *ngIf="dashboard!=null && !dashboard" ></communities>
`
})
export class CommunityWrapperComponent {
communityId:string;
dashboard:boolean = null;
constructor (
private route: ActivatedRoute,
private _router: Router
) {
this.route.queryParams.subscribe(
communityId => {
this.communityId = communityId['communityId'];
if(!this.communityId){
this.communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
}
if(this.communityId){
this.dashboard = true;
}else{
this.dashboard = false;
}
});
}
public ngOnInit() {
}
}

View File

@ -0,0 +1,27 @@
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';
import {CommunityWrapperComponent} from './communityWrapper.component';
import {CommunityWrapperRoutingModule} from './communityWrapper-routing.module';
@NgModule({
imports: [
CommonModule, FormsModule, RouterModule,
CommunityWrapperRoutingModule, CommunityModule, CommunitiesModule
],
declarations: [
CommunityWrapperComponent
],
providers:[
FreeGuard, PreviousRouteRecorder,
],
exports: [
CommunityWrapperComponent
]
})
export class CommunityWrapperModule { }

View File

@ -5,12 +5,12 @@ import { OpenaireDepositBySubjectResultComponent } from './depositBySubjectResul
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard';
import {Properties} from '../../utils/properties';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: OpenaireDepositBySubjectResultComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
redirect: '/error', api: Properties.adminToolsAPIURL
redirect: '/error'
},canDeactivate: [PreviousRouteRecorder] }
])

View File

@ -2,7 +2,7 @@ import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { OpenaireDepositDatasetsComponent } from './depositDatasets.component';
import {Properties} from '../../utils/properties';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard'
@ -10,7 +10,7 @@ import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard'
imports: [
RouterModule.forChild([
{ path: '', component: OpenaireDepositDatasetsComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
redirect: '/error', api: Properties.adminToolsAPIURL
redirect: '/error'
},canDeactivate: [PreviousRouteRecorder] }
])

View File

@ -4,12 +4,12 @@ import { OpenaireDepositDatasetsResultComponent } from './depositDatasetsResult.
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard';
import {Properties} from '../../utils/properties';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: OpenaireDepositDatasetsResultComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
redirect: '/error', api: Properties.adminToolsAPIURL
redirect: '/error'
},canDeactivate: [PreviousRouteRecorder] }
])

View File

@ -4,12 +4,12 @@ import { OpenaireDepositPublicationsComponent } from './depositPublications.comp
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard'
import {Properties} from '../../utils/properties';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: OpenaireDepositPublicationsComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
redirect: '/error', api: Properties.adminToolsAPIURL
redirect: '/error'
}, canDeactivate: [PreviousRouteRecorder] }
])

View File

@ -4,12 +4,12 @@ import { OpenaireDepositPublicationsResultComponent } from './depositPublication
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard'
import {Properties} from '../../utils/properties';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: OpenaireDepositPublicationsResultComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
redirect: '/error', api: Properties.adminToolsAPIURL
redirect: '/error'
}, canDeactivate: [PreviousRouteRecorder] }
])

View File

@ -5,12 +5,12 @@ import { OpenaireDataProviderComponent } from './dataProvider.component';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard'
import {Properties} from '../../utils/properties';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: OpenaireDataProviderComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
redirect: '/error', api: Properties.adminToolsAPIURL
redirect: '/error'
},canDeactivate: [PreviousRouteRecorder] }
])
]

View File

@ -5,12 +5,12 @@ import { OpenaireDatasetComponent } from './dataset.component';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard';
import {Properties} from '../../utils/properties';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: OpenaireDatasetComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
redirect: '/error', api: Properties.adminToolsAPIURL
redirect: '/error'
},canDeactivate: [PreviousRouteRecorder] }
])
]

View File

@ -5,14 +5,14 @@ import { OpenaireHtmlProjectReportComponent } from './htmlProjectReport.componen
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard';
import {Properties} from '../../utils/properties';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: OpenaireHtmlProjectReportComponent , canActivate: [FreeGuard, IsRouteEnabled],
data: {
redirect: '/error', api: Properties.adminToolsAPIURL
redirect: '/error'
},canDeactivate: [PreviousRouteRecorder]}
])
]

View File

@ -5,13 +5,13 @@ import { OpenaireOrganizationComponent } from './organization.component';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard';
import {Properties} from '../../utils/properties';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: OpenaireOrganizationComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
redirect: '/error', api: Properties.adminToolsAPIURL
redirect: '/error'
},canDeactivate: [PreviousRouteRecorder] }
])
]

View File

@ -5,12 +5,12 @@ import { OpenaireProjectComponent } from './project.component';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard';
import {Properties} from '../../utils/properties';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: OpenaireProjectComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
redirect: '/error', api: Properties.adminToolsAPIURL
redirect: '/error'
},canDeactivate: [PreviousRouteRecorder] }
])
]

View File

@ -5,12 +5,12 @@ import {OpenairePublicationComponent } from './publication.component';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard';
import {Properties} from '../../utils/properties';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: OpenairePublicationComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
redirect: '/error', api: Properties.adminToolsAPIURL
redirect: '/error'
},canDeactivate: [PreviousRouteRecorder] }
])
]

View File

@ -5,13 +5,13 @@ import {OpenaireSoftwareComponent } from './software.component';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard';
import {Properties} from '../../utils/properties';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: OpenaireSoftwareComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
redirect: '/error', api: Properties.adminToolsAPIURL
redirect: '/error'
},canDeactivate: [PreviousRouteRecorder] }
])
]

View File

@ -7,7 +7,6 @@ import {Meta} from '../openaireLibrary/sharedComponents/metaService';
import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service';
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
import {Properties} from '../utils/properties';
import { EnvProperties} from '../openaireLibrary/utils/properties/env-properties';
import { ErrorCodes} from '../openaireLibrary/utils/properties/errorCodes';

View File

@ -12,15 +12,15 @@ import { CommunityInfo } from '../../openaireLibrary/connect/community/community
<div class="el-item uk-panel">
<h6 class="el-title uk-margin uk-h6 uk-text-primary uk-margin-remove-adjacent uk-margin-remove-bottom">
<div *ngIf="item.type == 'publication' && community != null && community.communityId != null">
<a [queryParams]="{articleId: item.id, community: community.communityId}" routerLinkActive="router-link-active" routerLink="/search/publication" >
<a [queryParams]="{articleId: item.id}" routerLinkActive="router-link-active" routerLink="/search/publication" >
{{item.title}} </a>
</div>
<div *ngIf="item.type == 'dataset' && community != null && community.communityId != null">
<a [queryParams]="{datasetId: item.id, community: community.communityId}" routerLinkActive="router-link-active" routerLink="/search/dataset" >
<a [queryParams]="{datasetId: item.id}" routerLinkActive="router-link-active" routerLink="/search/dataset" >
{{item.title}} </a>
</div>
<div *ngIf="item.type == 'software' && community != null && community.communityId != null">
<a [queryParams]="{softwareId: item.id, community: community.communityId}" routerLinkActive="router-link-active" routerLink="/search/software" >
<a [queryParams]="{softwareId: item.id}" routerLinkActive="router-link-active" routerLink="/search/software" >
{{item.title}} </a>
</div>
</h6>

View File

@ -4,7 +4,7 @@ import { RouterModule } from '@angular/router';
import{OpenaireAdvancedSearchDatasetsComponent} from './advancedSearchDatasets.component';
import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard'
import {Properties} from '../../utils/properties';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
@ -13,7 +13,7 @@ import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousR
imports: [
RouterModule.forChild([
{ path: '', component: OpenaireAdvancedSearchDatasetsComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
redirect: '/error', api: Properties.adminToolsAPIURL
redirect: '/error'
}, canDeactivate: [PreviousRouteRecorder] }
])

View File

@ -5,13 +5,13 @@ import{OpenaireAdvancedSearchPublicationsComponent} from './advancedSearchPublic
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard'
import {Properties} from '../../utils/properties';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: OpenaireAdvancedSearchPublicationsComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
redirect: '/error', api: Properties.adminToolsAPIURL
redirect: '/error'
}, canDeactivate: [PreviousRouteRecorder] }
])

View File

@ -5,13 +5,13 @@ import{OpenaireSearchDataprovidersComponent} from './searchDataproviders.compone
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard'
import {Properties} from '../../utils/properties';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: OpenaireSearchDataprovidersComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
redirect: '/error', api: Properties.adminToolsAPIURL
redirect: '/error'
}, canDeactivate: [PreviousRouteRecorder] }
])

View File

@ -10,6 +10,7 @@ import {SearchPageTableViewComponent } from '../../openaireLibrary/searchPages/s
import {SearchUtilsClass } from '../../openaireLibrary/searchPages/searchUtils/searchUtils.class';
import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
import {SearchCommunityDataprovidersService} from '../../services/searchDataproviders.service';
import {ConnectHelper} from '../../utils/connectHelper';
@Component({
selector: 'openaire-search-dataproviders',
@ -55,16 +56,20 @@ export class OpenaireSearchDataprovidersComponent {
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
});
//this.searchPage.refineFields = this.refineFields;
this.sub = this.route.queryParams.subscribe(params => {
this.communityId = params['communityId'];
if(!this.communityId){
this.communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
}
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
//this.filters = this.createFilters();
//this.searchPage.getParametersFromUrl(params);
this._getResults(params);
});
});
}
public ngOnDestroy() {

View File

@ -8,12 +8,12 @@ import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard'
import {Properties} from '../../utils/properties';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: OpenaireSearchDatasetsComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
redirect: '/error', api: Properties.adminToolsAPIURL
redirect: '/error'
}, canDeactivate: [PreviousRouteRecorder] , resolve: { envSpecific: EnvironmentSpecificResolver }},
])

View File

@ -24,7 +24,6 @@ export class OpenaireSearchDatasetsComponent {
if(data['community'] && data['community']!=""){
var id= decodeURIComponent(data['community']);
this.connectCommunityId = id.slice(1,id.length - 1);
console.log("HEREEEE"+this.connectCommunityId);
}
});
}

View File

@ -5,13 +5,13 @@ import{OpenaireSearchOrganizationsComponent} from './searchOrganizations.compone
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard'
import {Properties} from '../../utils/properties';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: OpenaireSearchOrganizationsComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
redirect: '/error', api: Properties.adminToolsAPIURL
redirect: '/error'
}, canDeactivate: [PreviousRouteRecorder] }
])

View File

@ -5,13 +5,13 @@ import{OpenaireSearchProjectsComponent} from './searchProjects.component';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard'
import {Properties} from '../../utils/properties';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: OpenaireSearchProjectsComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
redirect: '/error', api: Properties.adminToolsAPIURL
redirect: '/error'
}, canDeactivate: [PreviousRouteRecorder] }
])

View File

@ -10,6 +10,7 @@ import {SearchPageTableViewComponent } from '../../openaireLibrary/searchPages/s
import {SearchUtilsClass } from '../../openaireLibrary/searchPages/searchUtils/searchUtils.class';
import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
import {SearchCommunityProjectsService} from '../../services/searchProjects.service';
import {ConnectHelper} from '../../utils/connectHelper';
@Component({
selector: 'openaire-search-projects',
@ -55,16 +56,20 @@ export class OpenaireSearchProjectsComponent {
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
});
//this.searchPage.refineFields = this.refineFields;
this.sub = this.route.queryParams.subscribe(params => {
this.communityId = params['communityId'];
if(!this.communityId){
this.communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
}
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
//this.filters = this.createFilters();
//this.searchPage.getParametersFromUrl(params);
this._getResults(params);
});
});
}
public ngOnDestroy() {

View File

@ -5,13 +5,13 @@ import{OpenaireSearchPublicationsComponent} from './searchPublications.component
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard'
import {Properties} from '../../utils/properties';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: OpenaireSearchPublicationsComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
redirect: '/error', api: Properties.adminToolsAPIURL
redirect: '/error'
}, canDeactivate: [PreviousRouteRecorder] }
])

View File

@ -25,7 +25,6 @@ export class OpenaireSearchPublicationsComponent {
if(data['community'] && data['community']!=""){
var id= decodeURIComponent(data['community']);
this.connectCommunityId = id.slice(1,id.length - 1);
console.log("HEREEEE"+this.connectCommunityId);
}
});
}

View File

@ -5,13 +5,13 @@ import {OpenaireSearchSoftwareComponent} from './searchSoftware.component';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard'
import {Properties} from '../../utils/properties';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: OpenaireSearchSoftwareComponent, canActivate: [FreeGuard, IsRouteEnabled], canDeactivate: [PreviousRouteRecorder], data: {
redirect: '/error', api: Properties.adminToolsAPIURL
redirect: '/error'
} }
])

View File

@ -24,7 +24,6 @@ export class OpenaireSearchSoftwareComponent {
if(data['community'] && data['community']!=""){
var id= decodeURIComponent(data['community']);
this.connectCommunityId = id.slice(1,id.length - 1);
console.log("HEREEEE"+this.connectCommunityId);
}
});
}

View File

@ -10,7 +10,6 @@ import {ErrorCodes} from '../openaireLibrary/utils/properties/e
import { availableCharts, availableEntities, StatisticsDisplay, StatisticsSummary } from "./statisticsEntities";
import {Properties} from '../utils/properties';
import {StatisticsService} from '../utils/services/statistics.service';
import {CommunityService} from "../openaireLibrary/connect/community/community.service";
@ -19,6 +18,7 @@ import {ConfigurationService} from '../openaireLibrary/utils/configuratio
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
import {Meta} from '../openaireLibrary/sharedComponents/metaService';
import { DomSanitizer, SafeResourceUrl, SafeUrl } from '@angular/platform-browser';
import {ConnectHelper} from '../utils/connectHelper';
@Component({
selector: 'statistics',
@ -32,7 +32,7 @@ export class StatisticsComponent {
public pageTitle = "OpenAIRE";
properties:EnvProperties;
public communityId = null;
@Input() communityId = null;
public communityInfo = null;
@Input() currentMode = 'showInMonitor';
@ -75,7 +75,6 @@ export class StatisticsComponent {
this._meta.updateMeta("description", description);
this._meta.updateProperty("og:description", description);
this._meta.updateProperty("og:title", title);
console.log("Heree " +document.location.hostname);
}
@ -93,6 +92,9 @@ export class StatisticsComponent {
this.route.queryParams.subscribe(
communityId => {
this.communityId = communityId['communityId'];
if(!this.communityId){
this.communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
}
console.log(" Stats! "+ this.properties.statisticsAPIURL);
this.createStatisticsObjects();
});
@ -221,4 +223,4 @@ export class StatisticsForDashboardComponent extends StatisticsComponent {
super.ngOnInit();
}
}
}

View File

@ -0,0 +1,34 @@
export class ConnectHelper{
public static getCommunityFromDomain(domain:string):string{
// domain = "beta.egi.openaire.eu"; for testing
if(domain.indexOf("di.uoa.gr")!=-1){
return null;
}
if(domain.indexOf("beta")!=-1){
domain = domain.substr(domain.indexOf(".")+1,domain.length);
domain = domain.substr(0,domain.indexOf("."));
}else{
domain = domain.substr(0,domain.indexOf("."));
}
if(domain == "connect"){
return null;
}
return domain;
}
public static isProduction(domain:string):boolean{
console.log("Domain:"+domain);
if(domain.indexOf(".di.uoa.gr")!=-1){
return false;
}else if(domain.indexOf(".openaire.eu")!=-1){
return true;
}
}
public static getProductionPrefix(domain:string):string{
if(domain.indexOf("beta.")!=-1){
return "beta.";
}else{
return "";
}
}
}

View File

@ -1,6 +0,0 @@
export class Properties {
public static adminToolsAPIURL = "http://duffy.di.uoa.gr:8080/uoa-admin-tools";
// public static adminToolsAPIURL = "https://beta.services.openaire.eu/uoa-admin-tools/";
public static adminToolsCommunity = "egi";
public static communityAPI = "https://dev-openaire.d4science.org/openaire/community/";
}

View File

@ -1,7 +1,7 @@
{
"enablePiwikTrack" : false,
"enableHelper" : false,
"useCache" : true,
"useCache" : false,
"metricsAPIURL" : "https://beta.services.openaire.eu/usagestats/",
"framesAPIURL" : "https://beta.openaire.eu/stats3/",
"statisticsAPIURL" : "https://beta.services.openaire.eu/stats-api/",