diff --git a/connect-production-properties.json b/connect-production-properties.json index 5365282..85b95e3 100644 --- a/connect-production-properties.json +++ b/connect-production-properties.json @@ -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, diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index df4c4ab..7a998a8 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -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 }}, diff --git a/src/app/app.component.ts b/src/app/app.component.ts index e627037..9d3dfff 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -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: ` - 2 + +
@@ -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; - } }); diff --git a/src/app/app.module.ts b/src/app/app.module.ts index a7f6ad8..0881a7a 100755 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -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 ], diff --git a/src/app/claims/claimsAdmin/claimsAdmin-routing.module.ts b/src/app/claims/claimsAdmin/claimsAdmin-routing.module.ts index 53d5260..4957e66 100644 --- a/src/app/claims/claimsAdmin/claimsAdmin-routing.module.ts +++ b/src/app/claims/claimsAdmin/claimsAdmin-routing.module.ts @@ -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 { } diff --git a/src/app/claims/claimsByToken/claimsByToken-routing.module.ts b/src/app/claims/claimsByToken/claimsByToken-routing.module.ts index a0da3b5..1065e99 100644 --- a/src/app/claims/claimsByToken/claimsByToken-routing.module.ts +++ b/src/app/claims/claimsByToken/claimsByToken-routing.module.ts @@ -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 { } diff --git a/src/app/claims/directLinking/directLinking-routing.module.ts b/src/app/claims/directLinking/directLinking-routing.module.ts index 255da77..338f976 100644 --- a/src/app/claims/directLinking/directLinking-routing.module.ts +++ b/src/app/claims/directLinking/directLinking-routing.module.ts @@ -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]}, ]) diff --git a/src/app/claims/linking/linking-routing.module.ts b/src/app/claims/linking/linking-routing.module.ts index fec5945..e853aab 100644 --- a/src/app/claims/linking/linking-routing.module.ts +++ b/src/app/claims/linking/linking-routing.module.ts @@ -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]}, ]) diff --git a/src/app/claims/myClaims/myClaims-routing.module.ts b/src/app/claims/myClaims/myClaims-routing.module.ts index cf1d73a..45d21f4 100644 --- a/src/app/claims/myClaims/myClaims-routing.module.ts +++ b/src/app/claims/myClaims/myClaims-routing.module.ts @@ -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 { } diff --git a/src/app/communities/communities.component.html b/src/app/communities/communities.component.html index 1e488ac..175e35b 100644 --- a/src/app/communities/communities.component.html +++ b/src/app/communities/communities.component.html @@ -31,14 +31,23 @@
-
+
+

+ + {{(item.title)?item.title:item.shortTitle}} + + {{(item.title)?item.title:item.shortTitle}} +

+
+ +

{{item.description}}

diff --git a/src/app/communities/communities.component.ts b/src/app/communities/communities.component.ts index 29ae486..d596a64 100644 --- a/src/app/communities/communities.component.ts +++ b/src/app/communities/communities.component.ts @@ -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); + } } diff --git a/src/app/communities/communities.module.ts b/src/app/communities/communities.module.ts index 7498c74..f95c65f 100644 --- a/src/app/communities/communities.module.ts +++ b/src/app/communities/communities.module.ts @@ -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 diff --git a/src/app/community/community.component.ts b/src/app/community/community.component.ts index fb4b306..4195509 100644 --- a/src/app/community/community.component.ts +++ b/src/app/community/community.component.ts @@ -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 ( diff --git a/src/app/community/community.module.ts b/src/app/community/community.module.ts index 1cc5fb6..8e18c83 100644 --- a/src/app/community/community.module.ts +++ b/src/app/community/community.module.ts @@ -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 diff --git a/src/app/communitywrapper/communityWrapper-routing.module.ts b/src/app/communitywrapper/communityWrapper-routing.module.ts new file mode 100644 index 0000000..d886195 --- /dev/null +++ b/src/app/communitywrapper/communityWrapper-routing.module.ts @@ -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 { } diff --git a/src/app/communitywrapper/communityWrapper.component.ts b/src/app/communitywrapper/communityWrapper.component.ts new file mode 100644 index 0000000..e6f3fca --- /dev/null +++ b/src/app/communitywrapper/communityWrapper.component.ts @@ -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:` + + + ` +}) + +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() { + } + + + +} diff --git a/src/app/communitywrapper/communityWrapper.module.ts b/src/app/communitywrapper/communityWrapper.module.ts new file mode 100644 index 0000000..d45beb8 --- /dev/null +++ b/src/app/communitywrapper/communityWrapper.module.ts @@ -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 { } diff --git a/src/app/deposit/datasets/depositBySubjectResult-routing.module.ts b/src/app/deposit/datasets/depositBySubjectResult-routing.module.ts index 277173c..48d594c 100644 --- a/src/app/deposit/datasets/depositBySubjectResult-routing.module.ts +++ b/src/app/deposit/datasets/depositBySubjectResult-routing.module.ts @@ -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] } ]) diff --git a/src/app/deposit/datasets/depositDatasets-routing.module.ts b/src/app/deposit/datasets/depositDatasets-routing.module.ts index 22fde21..e4fcf4c 100644 --- a/src/app/deposit/datasets/depositDatasets-routing.module.ts +++ b/src/app/deposit/datasets/depositDatasets-routing.module.ts @@ -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] } ]) diff --git a/src/app/deposit/datasets/depositDatasetsResults-routing.module.ts b/src/app/deposit/datasets/depositDatasetsResults-routing.module.ts index 6445d06..5220e14 100644 --- a/src/app/deposit/datasets/depositDatasetsResults-routing.module.ts +++ b/src/app/deposit/datasets/depositDatasetsResults-routing.module.ts @@ -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] } ]) diff --git a/src/app/deposit/publications/depositPublications-routing.module.ts b/src/app/deposit/publications/depositPublications-routing.module.ts index 587e9f3..2dadf89 100644 --- a/src/app/deposit/publications/depositPublications-routing.module.ts +++ b/src/app/deposit/publications/depositPublications-routing.module.ts @@ -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] } ]) diff --git a/src/app/deposit/publications/depositPublicationsResult-routing.module.ts b/src/app/deposit/publications/depositPublicationsResult-routing.module.ts index 7af143d..34aacb6 100644 --- a/src/app/deposit/publications/depositPublicationsResult-routing.module.ts +++ b/src/app/deposit/publications/depositPublicationsResult-routing.module.ts @@ -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] } ]) diff --git a/src/app/landingPages/dataProvider/dataProvider-routing.module.ts b/src/app/landingPages/dataProvider/dataProvider-routing.module.ts index ac72796..57fcd70 100644 --- a/src/app/landingPages/dataProvider/dataProvider-routing.module.ts +++ b/src/app/landingPages/dataProvider/dataProvider-routing.module.ts @@ -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] } ]) ] diff --git a/src/app/landingPages/dataset/dataset-routing.module.ts b/src/app/landingPages/dataset/dataset-routing.module.ts index b0438ea..2c942fa 100644 --- a/src/app/landingPages/dataset/dataset-routing.module.ts +++ b/src/app/landingPages/dataset/dataset-routing.module.ts @@ -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] } ]) ] diff --git a/src/app/landingPages/htmlProjectReport/htmlProjectReport-routing.module.ts b/src/app/landingPages/htmlProjectReport/htmlProjectReport-routing.module.ts index 84995cf..448bc7d 100644 --- a/src/app/landingPages/htmlProjectReport/htmlProjectReport-routing.module.ts +++ b/src/app/landingPages/htmlProjectReport/htmlProjectReport-routing.module.ts @@ -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]} ]) ] diff --git a/src/app/landingPages/organization/organization-routing.module.ts b/src/app/landingPages/organization/organization-routing.module.ts index 22ba4d6..747b51a 100644 --- a/src/app/landingPages/organization/organization-routing.module.ts +++ b/src/app/landingPages/organization/organization-routing.module.ts @@ -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] } ]) ] diff --git a/src/app/landingPages/project/project-routing.module.ts b/src/app/landingPages/project/project-routing.module.ts index 155aca3..81521a6 100644 --- a/src/app/landingPages/project/project-routing.module.ts +++ b/src/app/landingPages/project/project-routing.module.ts @@ -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] } ]) ] diff --git a/src/app/landingPages/publication/publication-routing.module.ts b/src/app/landingPages/publication/publication-routing.module.ts index 7fdef85..27b46b1 100644 --- a/src/app/landingPages/publication/publication-routing.module.ts +++ b/src/app/landingPages/publication/publication-routing.module.ts @@ -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] } ]) ] diff --git a/src/app/landingPages/software/software-routing.module.ts b/src/app/landingPages/software/software-routing.module.ts index acf5fd0..ba3864a 100644 --- a/src/app/landingPages/software/software-routing.module.ts +++ b/src/app/landingPages/software/software-routing.module.ts @@ -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] } ]) ] diff --git a/src/app/my-communities/communities.component.ts b/src/app/my-communities/communities.component.ts index 7d62931..5150532 100644 --- a/src/app/my-communities/communities.component.ts +++ b/src/app/my-communities/communities.component.ts @@ -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'; diff --git a/src/app/searchEntries/results/results.component.ts b/src/app/searchEntries/results/results.component.ts index 6aaa0a0..b7bc9b8 100644 --- a/src/app/searchEntries/results/results.component.ts +++ b/src/app/searchEntries/results/results.component.ts @@ -12,15 +12,15 @@ import { CommunityInfo } from '../../openaireLibrary/connect/community/community
- + {{item.title}}
- + {{item.title}}
- + {{item.title}}
diff --git a/src/app/searchPages/advanced/advancedSearchDatasets-routing.module.ts b/src/app/searchPages/advanced/advancedSearchDatasets-routing.module.ts index 5c2b993..cee1b2d 100644 --- a/src/app/searchPages/advanced/advancedSearchDatasets-routing.module.ts +++ b/src/app/searchPages/advanced/advancedSearchDatasets-routing.module.ts @@ -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] } ]) diff --git a/src/app/searchPages/advanced/advancedSearchPublications-routing.module.ts b/src/app/searchPages/advanced/advancedSearchPublications-routing.module.ts index cfb4571..31e11a6 100644 --- a/src/app/searchPages/advanced/advancedSearchPublications-routing.module.ts +++ b/src/app/searchPages/advanced/advancedSearchPublications-routing.module.ts @@ -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] } ]) diff --git a/src/app/searchPages/simple/searchDataProviders-routing.module.ts b/src/app/searchPages/simple/searchDataProviders-routing.module.ts index a344e24..75bf1dc 100644 --- a/src/app/searchPages/simple/searchDataProviders-routing.module.ts +++ b/src/app/searchPages/simple/searchDataProviders-routing.module.ts @@ -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] } ]) diff --git a/src/app/searchPages/simple/searchDataproviders.component.ts b/src/app/searchPages/simple/searchDataproviders.component.ts index 6403ab8..3005901 100644 --- a/src/app/searchPages/simple/searchDataproviders.component.ts +++ b/src/app/searchPages/simple/searchDataproviders.component.ts @@ -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() { diff --git a/src/app/searchPages/simple/searchDatasets-routing.module.ts b/src/app/searchPages/simple/searchDatasets-routing.module.ts index dba5cef..fd5fae3 100644 --- a/src/app/searchPages/simple/searchDatasets-routing.module.ts +++ b/src/app/searchPages/simple/searchDatasets-routing.module.ts @@ -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 }}, ]) diff --git a/src/app/searchPages/simple/searchDatasets.component.ts b/src/app/searchPages/simple/searchDatasets.component.ts index 908118e..25c6de0 100644 --- a/src/app/searchPages/simple/searchDatasets.component.ts +++ b/src/app/searchPages/simple/searchDatasets.component.ts @@ -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); } }); } diff --git a/src/app/searchPages/simple/searchOrganizations-routing.module.ts b/src/app/searchPages/simple/searchOrganizations-routing.module.ts index 93f3624..1fff105 100644 --- a/src/app/searchPages/simple/searchOrganizations-routing.module.ts +++ b/src/app/searchPages/simple/searchOrganizations-routing.module.ts @@ -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] } ]) diff --git a/src/app/searchPages/simple/searchProjects-routing.module.ts b/src/app/searchPages/simple/searchProjects-routing.module.ts index 50978da..0d41296 100644 --- a/src/app/searchPages/simple/searchProjects-routing.module.ts +++ b/src/app/searchPages/simple/searchProjects-routing.module.ts @@ -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] } ]) diff --git a/src/app/searchPages/simple/searchProjects.component.ts b/src/app/searchPages/simple/searchProjects.component.ts index 8eaa572..527bfc8 100644 --- a/src/app/searchPages/simple/searchProjects.component.ts +++ b/src/app/searchPages/simple/searchProjects.component.ts @@ -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() { diff --git a/src/app/searchPages/simple/searchPublications-routing.module.ts b/src/app/searchPages/simple/searchPublications-routing.module.ts index 13ee8ee..001a90d 100644 --- a/src/app/searchPages/simple/searchPublications-routing.module.ts +++ b/src/app/searchPages/simple/searchPublications-routing.module.ts @@ -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] } ]) diff --git a/src/app/searchPages/simple/searchPublications.component.ts b/src/app/searchPages/simple/searchPublications.component.ts index 37dd072..1898ecc 100644 --- a/src/app/searchPages/simple/searchPublications.component.ts +++ b/src/app/searchPages/simple/searchPublications.component.ts @@ -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); } }); } diff --git a/src/app/searchPages/simple/searchSoftware-routing.module.ts b/src/app/searchPages/simple/searchSoftware-routing.module.ts index 60a0bbd..c6dd2f9 100644 --- a/src/app/searchPages/simple/searchSoftware-routing.module.ts +++ b/src/app/searchPages/simple/searchSoftware-routing.module.ts @@ -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' } } ]) diff --git a/src/app/searchPages/simple/searchSoftware.component.ts b/src/app/searchPages/simple/searchSoftware.component.ts index 7e54263..f942f43 100644 --- a/src/app/searchPages/simple/searchSoftware.component.ts +++ b/src/app/searchPages/simple/searchSoftware.component.ts @@ -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); } }); } diff --git a/src/app/statistics/statistics.component.ts b/src/app/statistics/statistics.component.ts index 609a91a..87be304 100644 --- a/src/app/statistics/statistics.component.ts +++ b/src/app/statistics/statistics.component.ts @@ -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(); } -} \ No newline at end of file +} diff --git a/src/app/utils/connectHelper.ts b/src/app/utils/connectHelper.ts new file mode 100644 index 0000000..68c3cae --- /dev/null +++ b/src/app/utils/connectHelper.ts @@ -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 ""; + } + } +} diff --git a/src/app/utils/properties.ts b/src/app/utils/properties.ts deleted file mode 100644 index e434b70..0000000 --- a/src/app/utils/properties.ts +++ /dev/null @@ -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/"; -} diff --git a/src/assets/env-properties.json b/src/assets/env-properties.json index a4aedd7..44ef332 100644 --- a/src/assets/env-properties.json +++ b/src/assets/env-properties.json @@ -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/",