[Connect | Trunk]: Delete properties resolver. Delete query param community id

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@60772 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
k.triantafyllou 2021-04-01 14:25:15 +00:00
parent 1f78864788
commit 9ee09f1f3a
18 changed files with 434 additions and 566 deletions

View File

@ -1,89 +1,201 @@
import {NgModule} from '@angular/core'; import {NgModule} from '@angular/core';
import { Routes, RouterModule } from '@angular/router'; import {RouterModule, Routes} from '@angular/router';
import { EnvironmentSpecificResolver} from './openaireLibrary/utils/properties/environmentSpecificResolver';
import { EnvironmentSpecificService} from './openaireLibrary/utils/properties/environment-specific.service';
import {OpenaireErrorPageComponent} from './error/errorPage.component'; import {OpenaireErrorPageComponent} from './error/errorPage.component';
import {PageURLResolverComponent} from "./openaireLibrary/utils/pageURLResolver.component"; import {PageURLResolverComponent} from "./openaireLibrary/utils/pageURLResolver.component";
import {IsCommunity} from "./openaireLibrary/connect/communityGuard/isCommunity.guard"; import {IsCommunity} from "./openaireLibrary/connect/communityGuard/isCommunity.guard";
const routes: Routes = [ const routes: Routes = [
// Other Pages /** Other Pages */
{path: '', loadChildren: './communitywrapper/communityWrapper.module#CommunityWrapperModule'}, {path: '', loadChildren: './communitywrapper/communityWrapper.module#CommunityWrapperModule'},
{path: 'about', redirectTo: 'about/learn-how', pathMatch: 'full'}, {path: 'about', redirectTo: 'about/learn-how', pathMatch: 'full'},
{ path: 'about/learn-how', loadChildren: './learn-how/learn-how.module#LearnHowModule', resolve: { envSpecific: EnvironmentSpecificResolver }}, {path: 'about/learn-how', loadChildren: './learn-how/learn-how.module#LearnHowModule'},
{ path: 'about/learn-in-depth', loadChildren: './learn-how/learnInDepth/learn-in-depth.module#LearnInDepthModule', resolve: { envSpecific: EnvironmentSpecificResolver }}, {path: 'about/learn-in-depth', loadChildren: './learn-how/learnInDepth/learn-in-depth.module#LearnInDepthModule'},
{ path: 'about/faq', loadChildren: './learn-how/faqs/faqs.module#FaqsModule', resolve: { envSpecific: EnvironmentSpecificResolver }}, {path: 'about/faq', loadChildren: './learn-how/faqs/faqs.module#FaqsModule'},
{path: 'contact-us', loadChildren: './contact/contact.module#ContactModule'}, {path: 'contact-us', loadChildren: './contact/contact.module#ContactModule'},
{path: 'invite', loadChildren: './utils/subscribe/invite/invite.module#InviteModule'}, {path: 'invite', loadChildren: './utils/subscribe/invite/invite.module#InviteModule'},
{path: 'content', loadChildren: './content/contentPage.module#ContentPageModule', canActivate: [IsCommunity]}, {path: 'content', loadChildren: './content/contentPage.module#ContentPageModule', canActivate: [IsCommunity]},
{ path: 'organizations', loadChildren: './htmlPages/organizations/organizationsPage.module#OrganizationsPageModule', canActivate:[IsCommunity]}, {
{ path: 'publications', loadChildren: './htmlPages/publications/publications-page.module#PublicationsPageModule', canActivate:[IsCommunity]}, path: 'organizations',
{ path: 'projects', loadChildren: './htmlPages/projects/projectsPage.module#ProjectsPageModule', canActivate:[IsCommunity]}, loadChildren: './htmlPages/organizations/organizationsPage.module#OrganizationsPageModule',
{ path: 'national-bulletins', loadChildren: './htmlPages/nationalBulletins/nationalBulletinsPage.module#NaionalBulletinPageModule', canActivate:[IsCommunity]}, canActivate: [IsCommunity]
},
{
path: 'publications',
loadChildren: './htmlPages/publications/publications-page.module#PublicationsPageModule',
canActivate: [IsCommunity]
},
{
path: 'projects',
loadChildren: './htmlPages/projects/projectsPage.module#ProjectsPageModule',
canActivate: [IsCommunity]
},
{
path: 'national-bulletins',
loadChildren: './htmlPages/nationalBulletins/nationalBulletinsPage.module#NaionalBulletinPageModule',
canActivate: [IsCommunity]
},
{path: 'curators', loadChildren: './curators/curators.module#CuratorsModule', canActivate: [IsCommunity]}, {path: 'curators', loadChildren: './curators/curators.module#CuratorsModule', canActivate: [IsCommunity]},
{path: 'subjects', loadChildren: './subjects/subjects.module#SubjectsModule', canActivate: [IsCommunity]}, {path: 'subjects', loadChildren: './subjects/subjects.module#SubjectsModule', canActivate: [IsCommunity]},
{path: 'myCommunities', loadChildren: './my-communities/my-communities.module#MyCommunitiesModule'}, {path: 'myCommunities', loadChildren: './my-communities/my-communities.module#MyCommunitiesModule'},
/** Testing Page for help contents */
// Testing Page for help contents
{path: 'helper-test', loadChildren: './helper-test/helper-test.module#HelperTestModule'}, {path: 'helper-test', loadChildren: './helper-test/helper-test.module#HelperTestModule'},
/** Landing Pages */
// Landing Pages {
{ path: 'search/result', loadChildren: './landingPages/result/libResult.module#LibResultModule', canActivate:[IsCommunity]}, path: 'search/result',
{ path: 'search/publication', loadChildren: './landingPages/publication/libPublication.module#LibPublicationModule', canActivate:[IsCommunity]}, loadChildren: './landingPages/result/libResult.module#LibResultModule',
{ path: 'search/dataset', loadChildren: './landingPages/dataset/libDataset.module#LibDatasetModule', canActivate:[IsCommunity]}, canActivate: [IsCommunity]
{ path: 'search/software', loadChildren: './landingPages/software/libSoftware.module#LibSoftwareModule', canActivate:[IsCommunity]}, },
{
path: 'search/publication',
loadChildren: './landingPages/publication/libPublication.module#LibPublicationModule',
canActivate: [IsCommunity]
},
{
path: 'search/dataset',
loadChildren: './landingPages/dataset/libDataset.module#LibDatasetModule',
canActivate: [IsCommunity]
},
{
path: 'search/software',
loadChildren: './landingPages/software/libSoftware.module#LibSoftwareModule',
canActivate: [IsCommunity]
},
{path: 'search/other', loadChildren: './landingPages/orp/libOrp.module#LibOrpModule', canActivate: [IsCommunity]}, {path: 'search/other', loadChildren: './landingPages/orp/libOrp.module#LibOrpModule', canActivate: [IsCommunity]},
{ path: 'search/project', loadChildren: './landingPages/project/libProject.module#LibProjectModule', canActivate:[IsCommunity]}, {
{ path: 'search/dataprovider', loadChildren: '././landingPages/dataProvider/libDataProvider.module#LibDataProviderModule', canActivate:[IsCommunity]}, path: 'search/project',
{ path: 'search/organization', loadChildren: './landingPages/organization/libOrganization.module#LibOrganizationModule', canActivate:[IsCommunity]}, loadChildren: './landingPages/project/libProject.module#LibProjectModule',
canActivate: [IsCommunity]
{ path: 'project-report', loadChildren: './landingPages/htmlProjectReport/libHtmlProjectReport.module#LibHtmlProjectReportModule'}, },
{
// Search Pages path: 'search/dataprovider',
loadChildren: '././landingPages/dataProvider/libDataProvider.module#LibDataProviderModule',
canActivate: [IsCommunity]
},
{
path: 'search/organization',
loadChildren: './landingPages/organization/libOrganization.module#LibOrganizationModule',
canActivate: [IsCommunity]
},
{
path: 'project-report',
loadChildren: './landingPages/htmlProjectReport/libHtmlProjectReport.module#LibHtmlProjectReportModule'
},
/** Search Pages */
{path: 'search/find', redirectTo: 'search/find/research-outcomes', pathMatch: 'full'}, {path: 'search/find', redirectTo: 'search/find/research-outcomes', pathMatch: 'full'},
{ path: 'search/find/communities', loadChildren: './searchPages/communities/searchCommunities.module#SearchCommunitiesModule'}, {
{ path: 'search/find/research-outcomes', loadChildren: './searchPages/simple/searchResearchResults.module#OpenaireSearchResearchResultsModule', canActivate:[IsCommunity]}, path: 'search/find/communities',
loadChildren: './searchPages/communities/searchCommunities.module#SearchCommunitiesModule'
},
{
path: 'search/find/research-outcomes',
loadChildren: './searchPages/simple/searchResearchResults.module#OpenaireSearchResearchResultsModule',
canActivate: [IsCommunity]
},
{path: 'search/find/publications', component: PageURLResolverComponent, canActivate: [IsCommunity]}, {path: 'search/find/publications', component: PageURLResolverComponent, canActivate: [IsCommunity]},
{path: 'search/find/datasets', component: PageURLResolverComponent, canActivate: [IsCommunity]}, {path: 'search/find/datasets', component: PageURLResolverComponent, canActivate: [IsCommunity]},
{path: 'search/find/software', component: PageURLResolverComponent, canActivate: [IsCommunity]}, {path: 'search/find/software', component: PageURLResolverComponent, canActivate: [IsCommunity]},
{path: 'search/find/other', component: PageURLResolverComponent, canActivate: [IsCommunity]}, {path: 'search/find/other', component: PageURLResolverComponent, canActivate: [IsCommunity]},
{ path: 'search/find/projects', loadChildren: './searchPages/simple/searchProjects.module#LibSearchProjectsModule', canActivate:[IsCommunity]}, {
{ path: 'search/find/dataproviders', loadChildren: './searchPages/simple/searchDataProviders.module#LibSearchDataProvidersModule', canActivate:[IsCommunity]}, path: 'search/find/projects',
loadChildren: './searchPages/simple/searchProjects.module#LibSearchProjectsModule',
// Advanced Search Pages canActivate: [IsCommunity]
{ path: 'search/advanced/research-outcomes', loadChildren: './searchPages/advanced/searchResearchResults.module#OpenaireAdvancedSearchResearchResultsModule', canActivate:[IsCommunity]}, },
{
path: 'search/find/dataproviders',
loadChildren: './searchPages/simple/searchDataProviders.module#LibSearchDataProvidersModule',
canActivate: [IsCommunity]
},
/** Advanced Search Pages */
{
path: 'search/advanced/research-outcomes',
loadChildren: './searchPages/advanced/searchResearchResults.module#OpenaireAdvancedSearchResearchResultsModule',
canActivate: [IsCommunity]
},
{path: 'search/advanced/publications', component: PageURLResolverComponent, canActivate: [IsCommunity]}, {path: 'search/advanced/publications', component: PageURLResolverComponent, canActivate: [IsCommunity]},
{path: 'search/advanced/datasets', component: PageURLResolverComponent, canActivate: [IsCommunity]}, {path: 'search/advanced/datasets', component: PageURLResolverComponent, canActivate: [IsCommunity]},
{path: 'search/advanced/software', component: PageURLResolverComponent, canActivate: [IsCommunity]}, {path: 'search/advanced/software', component: PageURLResolverComponent, canActivate: [IsCommunity]},
{path: 'search/advanced/other', component: PageURLResolverComponent, canActivate: [IsCommunity]}, {path: 'search/advanced/other', component: PageURLResolverComponent, canActivate: [IsCommunity]},
{ path: 'search/advanced/organizations', loadChildren: './searchPages/advanced/advancedSearchOrganizations.module#LibAdvancedSearchOrganizationsModule', canActivate:[IsCommunity]}, {
{ path: 'search/advanced/dataproviders', loadChildren: './searchPages/advanced/advancedSearchDataProviders.module#LibAdvancedSearchDataProvidersModule', canActivate:[IsCommunity]}, path: 'search/advanced/organizations',
{ path: 'search/advanced/projects', loadChildren: './searchPages/advanced/advancedSearchProjects.module#LibAdvancedSearchProjectsModule', canActivate:[IsCommunity]}, loadChildren: './searchPages/advanced/advancedSearchOrganizations.module#LibAdvancedSearchOrganizationsModule',
canActivate: [IsCommunity]
// Deposit Pages },
{ path: 'participate/deposit-datasets', redirectTo: 'participate/deposit/learn-how', pathMatch: 'full', canActivate:[IsCommunity]}, {
{ path: 'participate/deposit-datasets-result', redirectTo: 'participate/deposit/learn-how', pathMatch: 'full', canActivate:[IsCommunity]}, path: 'search/advanced/dataproviders',
{ path: 'participate/deposit-subject-result', redirectTo: 'participate/deposit/learn-how', pathMatch: 'full', canActivate:[IsCommunity]}, loadChildren: './searchPages/advanced/advancedSearchDataProviders.module#LibAdvancedSearchDataProvidersModule',
{ path: 'participate/deposit-publications', redirectTo: 'participate/deposit/learn-how', pathMatch: 'full', canActivate:[IsCommunity]}, canActivate: [IsCommunity]
{ path: 'participate/deposit-publications-result', redirectTo: 'participate/deposit/learn-how', pathMatch: 'full', canActivate:[IsCommunity]}, },
{ path: 'participate/share-zenodo', redirectTo: '/participate/deposit/zenodo', pathMatch: 'full', canActivate:[IsCommunity]}, {
path: 'search/advanced/projects',
{ path: 'participate/deposit/learn-how', loadChildren: './deposit/deposit.module#LibDepositModule', canActivate:[IsCommunity]}, loadChildren: './searchPages/advanced/advancedSearchProjects.module#LibAdvancedSearchProjectsModule',
{ path: 'participate/deposit/search', loadChildren: './deposit/searchDataprovidersToDeposit.module#LibSearchDataprovidersToDepositModule', canActivate:[IsCommunity]}, canActivate: [IsCommunity]
{ path: 'participate/deposit/zenodo', loadChildren: './deposit/zenodo/shareInZenodo.module#ShareInZenodoModule', canActivate:[IsCommunity]}, },
/** Deposit Pages */
// Linking Pages {
path: 'participate/deposit-datasets',
redirectTo: 'participate/deposit/learn-how',
pathMatch: 'full',
canActivate: [IsCommunity]
},
{
path: 'participate/deposit-datasets-result',
redirectTo: 'participate/deposit/learn-how',
pathMatch: 'full',
canActivate: [IsCommunity]
},
{
path: 'participate/deposit-subject-result',
redirectTo: 'participate/deposit/learn-how',
pathMatch: 'full',
canActivate: [IsCommunity]
},
{
path: 'participate/deposit-publications',
redirectTo: 'participate/deposit/learn-how',
pathMatch: 'full',
canActivate: [IsCommunity]
},
{
path: 'participate/deposit-publications-result',
redirectTo: 'participate/deposit/learn-how',
pathMatch: 'full',
canActivate: [IsCommunity]
},
{
path: 'participate/share-zenodo',
redirectTo: '/participate/deposit/zenodo',
pathMatch: 'full',
canActivate: [IsCommunity]
},
{
path: 'participate/deposit/learn-how',
loadChildren: './deposit/deposit.module#LibDepositModule',
canActivate: [IsCommunity]
},
{
path: 'participate/deposit/search',
loadChildren: './deposit/searchDataprovidersToDeposit.module#LibSearchDataprovidersToDepositModule',
canActivate: [IsCommunity]
},
{
path: 'participate/deposit/zenodo',
loadChildren: './deposit/zenodo/shareInZenodo.module#ShareInZenodoModule',
canActivate: [IsCommunity]
},
/** Linking Pages */
{path: 'myclaims', loadChildren: './claims/myClaims/myClaims.module#LibMyClaimsModule', canActivate: [IsCommunity]}, {path: 'myclaims', loadChildren: './claims/myClaims/myClaims.module#LibMyClaimsModule', canActivate: [IsCommunity]},
{ path: 'participate/claim', loadChildren: './claims/linking/linkingGeneric.module#LibLinkingGenericModule', canActivate:[IsCommunity]}, {
{ path: 'participate/direct-claim', loadChildren: './claims/directLinking/directLinking.module#LibDirectLinkingModule', canActivate:[IsCommunity]}, path: 'participate/claim',
loadChildren: './claims/linking/linkingGeneric.module#LibLinkingGenericModule',
canActivate: [IsCommunity]
// help pages - do not exist in Admin portal/api/db },
{
path: 'participate/direct-claim',
loadChildren: './claims/directLinking/directLinking.module#LibDirectLinkingModule',
canActivate: [IsCommunity]
},
/** help pages - do not exist in Admin portal/api/db */
{path: 'reload', loadChildren: './reload/libReload.module#LibReloadModule'}, {path: 'reload', loadChildren: './reload/libReload.module#LibReloadModule'},
{path: 'user-info', loadChildren: './login/libUser.module#LibUserModule'}, {path: 'user-info', loadChildren: './login/libUser.module#LibUserModule'},
{path: 'error', component: OpenaireErrorPageComponent}, {path: 'error', component: OpenaireErrorPageComponent},
@ -93,7 +205,7 @@ const routes: Routes = [
@NgModule({ @NgModule({
imports: [RouterModule.forRoot(routes)], imports: [RouterModule.forRoot(routes)],
exports: [RouterModule], exports: [RouterModule]
providers: [EnvironmentSpecificResolver, EnvironmentSpecificService]
}) })
export class AppRoutingModule { } export class AppRoutingModule {
}

View File

@ -16,6 +16,7 @@ import {Subscriber} from "rxjs";
import {CommunityService} from "./openaireLibrary/connect/community/community.service"; import {CommunityService} from "./openaireLibrary/connect/community/community.service";
import {StringUtils} from "./openaireLibrary/utils/string-utils.class"; import {StringUtils} from "./openaireLibrary/utils/string-utils.class";
import {LoginErrorCodes} from "./openaireLibrary/login/utils/guardHelper.class"; import {LoginErrorCodes} from "./openaireLibrary/login/utils/guardHelper.class";
@Component({ @Component({
//changeDetection: ChangeDetectionStrategy.Default, //changeDetection: ChangeDetectionStrategy.Default,
//encapsulation: ViewEncapsulation.Emulated, //encapsulation: ViewEncapsulation.Emulated,
@ -97,6 +98,7 @@ export class AppComponent {
header: Header; header: Header;
logoPath: string = 'assets/common-assets/'; logoPath: string = 'assets/common-assets/';
subscriptions = []; subscriptions = [];
constructor(private route: ActivatedRoute, private propertiesService: EnvironmentSpecificService, constructor(private route: ActivatedRoute, private propertiesService: EnvironmentSpecificService,
private _communitiesService: CommunitiesService, private _communitiesService: CommunitiesService,
private router: Router, private userManagementService: UserManagementService, private router: Router, private userManagementService: UserManagementService,
@ -153,12 +155,14 @@ export class AppComponent {
this.userManagementService.fixRedirectURL = null; this.userManagementService.fixRedirectURL = null;
} }
} }
initAdminToolCommunity(communityId) { initAdminToolCommunity(communityId) {
if (communityId) { if (communityId) {
this.properties.adminToolsPortalType = "community"; this.properties.adminToolsPortalType = "community";
} }
this.configurationService.initCommunityInformation(this.properties, (communityId) ? communityId : this.properties.adminToolsPortalType); this.configurationService.initCommunityInformation(this.properties, (communityId) ? communityId : this.properties.adminToolsPortalType);
} }
public buildMenu(communityId: string) { public buildMenu(communityId: string) {
if (communityId) { if (communityId) {
if (!this.community || this.community.communityId !== communityId) { if (!this.community || this.community.communityId !== communityId) {
@ -247,9 +251,11 @@ export class AppComponent {
this.buildConnectMenu(); this.buildConnectMenu();
} }
} }
isPrivate(community) { isPrivate(community) {
return community && (community.status == "hidden" || (community.status == "manager" && !(Session.isCommunityCurator(this.user) || Session.isManager("community", community.communityId, this.user)))) return community && (community.status == "hidden" || (community.status == "manager" && !(Session.isCommunityCurator(this.user) || Session.isManager("community", community.communityId, this.user))))
} }
showPrivateOrNoCommunity(restrictedData: string) { showPrivateOrNoCommunity(restrictedData: string) {
this.communityId = null; this.communityId = null;
this.community = null; this.community = null;
@ -266,12 +272,13 @@ export class AppComponent {
} }
}); });
} else { } else {
this.router.navigate(['/error'], restrictedData ? {queryParams: {'page': -1}} : {}); this.router.navigate(['/error'], {queryParams: {'page': -1}});
} }
} else { } else {
this.router.navigate(['/error'], restrictedData ? {queryParams: {'page': -1}} : {}); this.router.navigate(['/error'], restrictedData ? {queryParams: {'page': -1}} : {});
} }
} }
buildConnectMenu(restrictedData: boolean = false) { buildConnectMenu(restrictedData: boolean = false) {
let url = "https://" + (properties.environment != "production" ? "beta." : "") + "connect.openaire.eu"; let url = "https://" + (properties.environment != "production" ? "beta." : "") + "connect.openaire.eu";
this.header = { this.header = {

View File

@ -14,9 +14,6 @@ import {CookieLawModule} from './openaireLibrary/sharedComponents/cookie-law/coo
import {BottomModule} from './openaireLibrary/sharedComponents/bottom.module'; import {BottomModule} from './openaireLibrary/sharedComponents/bottom.module';
import {ErrorModule} from './openaireLibrary/error/error.module'; import {ErrorModule} from './openaireLibrary/error/error.module';
import {NavigationBarModule} from './openaireLibrary/sharedComponents/navigationBar.module'; import {NavigationBarModule} from './openaireLibrary/sharedComponents/navigationBar.module';
import {EnvironmentSpecificResolver} from './openaireLibrary/utils/properties/environmentSpecificResolver';
import {CommunitiesService} from './openaireLibrary/connect/communities/communities.service'; import {CommunitiesService} from './openaireLibrary/connect/communities/communities.service';
import {LayoutService} from "./openaireLibrary/services/layout.service"; import {LayoutService} from "./openaireLibrary/services/layout.service";
import {SubscribeModule} from './utils/subscribe/subscribe.module'; import {SubscribeModule} from './utils/subscribe/subscribe.module';
@ -53,7 +50,7 @@ import {RoleVerificationModule} from "./openaireLibrary/role-verification/role-v
declarations: [AppComponent, OpenaireErrorPageComponent], declarations: [AppComponent, OpenaireErrorPageComponent],
exports: [AppComponent], exports: [AppComponent],
providers: [ providers: [
EnvironmentSpecificResolver, CommunitiesService, LayoutService, IsCommunity, SubscribeService, CommunitiesService, LayoutService, IsCommunity, SubscribeService,
{ {
provide: HTTP_INTERCEPTORS, provide: HTTP_INTERCEPTORS,
useClass: HttpInterceptorService, useClass: HttpInterceptorService,
@ -70,4 +67,5 @@ import {RoleVerificationModule} from "./openaireLibrary/role-verification/role-v
bootstrap: [AppComponent] bootstrap: [AppComponent]
}) })
export class AppModule {} export class AppModule {
}

View File

@ -14,12 +14,12 @@ import {properties} from "../../environments/environment";
selector: 'html-page', selector: 'html-page',
template: ` template: `
<schema2jsonld *ngIf="url" [URL]="url" [name]="pageTitle" type="other" [description]="description"></schema2jsonld> <schema2jsonld *ngIf="url" [URL]="url" [name]="pageTitle" type="other" [description]="description"></schema2jsonld>
<helper *ngIf="pageContents && pageContents['top'] && pageContents['top'].length > 0" [texts]="pageContents['top']"></helper> <helper *ngIf="pageContents && pageContents['top'] && pageContents['top'].length > 0"
[texts]="pageContents['top']"></helper>
` `
}) })
export class HtmlPageComponent { export class HtmlPageComponent {
properties: EnvProperties = properties;
properties: EnvProperties;
public pageContents = null; public pageContents = null;
public divContents = null; public divContents = null;
@ -34,21 +34,14 @@ export class HtmlPageComponent {
private _title: Title, private _title: Title,
private seoService: SEOService, private seoService: SEOService,
private _piwikService: PiwikService, private _piwikService: PiwikService,
private helper: HelperService) {} private helper: HelperService) {
}
public ngOnInit() { public ngOnInit() {
this.properties = properties;
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle, this.properties.piwikSiteId).subscribe()); this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle, this.properties.piwikSiteId).subscribe());
} }
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain); this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
if (this.properties.environment == "development") {
this.subscriptions.push(this.route.queryParams.subscribe(params => {
this.communityId = (params['communityId']) ? params['communityId'] : ConnectHelper.getCommunityFromDomain(this.properties.domain);
}));
}
//TODO set the proper URL //TODO set the proper URL
this.url = this.properties.domain + this._router.url; this.url = this.properties.domain + this._router.url;
this.seoService.createLinkForCanonicalURL(this.url); this.seoService.createLinkForCanonicalURL(this.url);

View File

@ -1,8 +1,6 @@
import {Component} from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {PiwikHelper} from '../../utils/piwikHelper'; import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper'; import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
import {Subscriber} from "rxjs";
import {properties} from "../../../environments/environment"; import {properties} from "../../../environments/environment";
@Component({ @Component({
@ -10,28 +8,15 @@ import {properties} from "../../../environments/environment";
template: ` template: `
<dataprovider [piwikSiteId]=piwikSiteId [communityId]="communityId"></dataprovider>`, <dataprovider [piwikSiteId]=piwikSiteId [communityId]="communityId"></dataprovider>`,
}) })
export class OpenaireDataProviderComponent { export class OpenaireDataProviderComponent implements OnInit {
piwikSiteId = null; piwikSiteId;
communityId = null; communityId;
private sub;
constructor(private route: ActivatedRoute) {
this.sub = this.route.queryParams.subscribe(params => {
this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
if (!this.communityId) {
this.communityId = params['communityId'];
}
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId, properties.environment);
});
constructor() {
} }
ngOnInit() { ngOnInit() {
this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
} this.piwikSiteId = PiwikHelper.getSiteId(this.communityId, properties.environment);
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
} }
} }
}

View File

@ -1,8 +1,6 @@
import {Component} from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {PiwikHelper} from '../../utils/piwikHelper'; import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper'; import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
import {Subscriber} from "rxjs";
import {properties} from "../../../environments/environment"; import {properties} from "../../../environments/environment";
@Component({ @Component({
@ -11,29 +9,15 @@ import {properties} from "../../../environments/environment";
<result-landing type="dataset" [piwikSiteId]="piwikSiteId" [communityId]="communityId"></result-landing> <result-landing type="dataset" [piwikSiteId]="piwikSiteId" [communityId]="communityId"></result-landing>
`, `,
}) })
export class OpenaireDatasetComponent { export class OpenaireDatasetComponent implements OnInit {
piwikSiteId = null; piwikSiteId;
communityId = null; communityId;
private sub;
constructor(private route: ActivatedRoute) {
this.sub = this.route.queryParams.subscribe(params => {
this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
if (!this.communityId) {
this.communityId = params['communityId'];
}
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId, properties.environment);
});
constructor() {
} }
ngOnInit() { ngOnInit() {
this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
} this.piwikSiteId = PiwikHelper.getSiteId(this.communityId, properties.environment);
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
} }
} }
}

View File

@ -1,38 +1,22 @@
import {Component, ViewChild, ElementRef} from '@angular/core'; import {Component} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {PiwikHelper} from '../../utils/piwikHelper'; import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper'; import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
import {Subscriber} from "rxjs";
import {properties} from "../../../environments/environment"; import {properties} from "../../../environments/environment";
@Component({ @Component({
selector: 'openaire-htmlProjectReport', selector: 'openaire-htmlProjectReport',
template: `<htmlProjectReport [piwikSiteId]=piwikSiteId [communityId]="communityId"></htmlProjectReport>`, template: `
<htmlProjectReport [piwikSiteId]=piwikSiteId [communityId]="communityId"></htmlProjectReport>`,
}) })
export class OpenaireHtmlProjectReportComponent { export class OpenaireHtmlProjectReportComponent {
piwikSiteId = null; piwikSiteId;
communityId = null; communityId;
private sub;
constructor(private route: ActivatedRoute) {
this.sub = this.route.queryParams.subscribe(params => {
this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
if (!this.communityId) {
this.communityId = params['communityId'];
}
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId, properties.environment);
});
constructor() {
} }
ngOnInit() { ngOnInit() {
this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
} this.piwikSiteId = PiwikHelper.getSiteId(this.communityId, properties.environment);
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
} }
} }
}

View File

@ -1,8 +1,6 @@
import {Component} from '@angular/core'; import {Component} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {PiwikHelper} from '../../utils/piwikHelper'; import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper'; import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
import {Subscriber} from "rxjs";
import {properties} from "../../../environments/environment"; import {properties} from "../../../environments/environment";
@Component({ @Component({
@ -11,27 +9,14 @@ import {properties} from "../../../environments/environment";
<organization [piwikSiteId]=piwikSiteId [communityId]="communityId"></organization>`, <organization [piwikSiteId]=piwikSiteId [communityId]="communityId"></organization>`,
}) })
export class OpenaireOrganizationComponent { export class OpenaireOrganizationComponent {
piwikSiteId = null; piwikSiteId;
communityId = null; communityId;
private sub;
constructor(private route: ActivatedRoute) { constructor() {
this.sub = this.route.queryParams.subscribe(params => {
this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
if (!this.communityId) {
this.communityId = params['communityId'];
} }
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId, properties.environment);
});
}
ngOnInit() { ngOnInit() {
} this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
ngOnDestroy() { this.piwikSiteId = PiwikHelper.getSiteId(this.communityId, properties.environment);
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
} }
} }

View File

@ -1,4 +1,4 @@
import {Component} from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {ActivatedRoute} from '@angular/router'; import {ActivatedRoute} from '@angular/router';
import {PiwikHelper} from '../../utils/piwikHelper'; import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper'; import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
@ -12,29 +12,14 @@ import {properties} from "../../../environments/environment";
`, `,
}) })
export class OpenaireOrpComponent { export class OpenaireOrpComponent implements OnInit {
piwikSiteId = null; piwikSiteId = null;
communityId = null; communityId = null;
private sub;
constructor(private route: ActivatedRoute) {
this.sub = this.route.queryParams.subscribe(params => {
this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
if (!this.communityId) {
this.communityId = params['communityId'];
}
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId, properties.environment);
});
}
constructor() {}
ngOnInit() { ngOnInit() {
} this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId, properties.environment);
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
} }
} }

View File

@ -1,8 +1,6 @@
import {Component} from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {PiwikHelper} from '../../utils/piwikHelper'; import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper'; import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
import {Subscriber} from "rxjs";
import {properties} from "../../../environments/environment"; import {properties} from "../../../environments/environment";
@Component({ @Component({
@ -10,28 +8,15 @@ import {properties} from "../../../environments/environment";
template: ` template: `
<project [piwikSiteId]=piwikSiteId [communityId]="communityId"></project>`, <project [piwikSiteId]=piwikSiteId [communityId]="communityId"></project>`,
}) })
export class OpenaireProjectComponent { export class OpenaireProjectComponent implements OnInit {
piwikSiteId = null; piwikSiteId;
communityId = null; communityId;
private sub;
constructor(private route: ActivatedRoute) {
this.sub = this.route.queryParams.subscribe(params => {
this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
if (!this.communityId) {
this.communityId = params['communityId'];
}
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId, properties.environment);
});
constructor() {
} }
ngOnInit() { ngOnInit() {
} this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
ngOnDestroy() { this.piwikSiteId = PiwikHelper.getSiteId(this.communityId, properties.environment);
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
} }
} }
}

View File

@ -1,8 +1,6 @@
import {Component} from '@angular/core'; import {Component} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {PiwikHelper} from '../../utils/piwikHelper'; import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper'; import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
import {Subscriber} from "rxjs";
import {properties} from "../../../environments/environment"; import {properties} from "../../../environments/environment";
@Component({ @Component({
@ -14,25 +12,11 @@ import {properties} from "../../../environments/environment";
export class OpenairePublicationComponent { export class OpenairePublicationComponent {
piwikSiteId = null; piwikSiteId = null;
communityId = null; communityId = null;
private sub;
constructor(private route: ActivatedRoute) {
this.sub = this.route.queryParams.subscribe(params => {
this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
if (!this.communityId) {
this.communityId = params['communityId'];
}
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId, properties.environment);
});
}
constructor() {}
ngOnInit() { ngOnInit() {
} this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
ngOnDestroy() { this.piwikSiteId = PiwikHelper.getSiteId(this.communityId, properties.environment);
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
} }
} }
}

View File

@ -1,37 +1,21 @@
import {Component} from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {ActivatedRoute} from "@angular/router";
import {ConnectHelper} from "../../openaireLibrary/connect/connectHelper"; import {ConnectHelper} from "../../openaireLibrary/connect/connectHelper";
import {PiwikHelper} from "../../utils/piwikHelper"; import {PiwikHelper} from "../../utils/piwikHelper";
import {Subscriber} from "rxjs";
import {properties} from "../../../environments/environment"; import {properties} from "../../../environments/environment";
@Component({ @Component({
selector: 'openaire-publication', selector: 'openaire-publication',
template: `<result-landing type="result" [piwikSiteId]="piwikSiteId" [communityId]="communityId"></result-landing>`, template: `
<result-landing type="result" [piwikSiteId]="piwikSiteId" [communityId]="communityId"></result-landing>`,
}) })
export class OpenaireResultComponent{ export class OpenaireResultComponent implements OnInit{
piwikSiteId = null; piwikSiteId;
communityId = null; communityId;
private sub;
constructor(private route: ActivatedRoute) {
this.sub = this.route.queryParams.subscribe(params => {
this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
if (!this.communityId) {
this.communityId = params['communityId'];
}
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId, properties.environment);
});
}
constructor() {}
ngOnInit() { ngOnInit() {
} this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
ngOnDestroy() { this.piwikSiteId = PiwikHelper.getSiteId(this.communityId, properties.environment);
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
} }
} }
}

View File

@ -1,8 +1,6 @@
import {Component} from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {PiwikHelper} from '../../utils/piwikHelper'; import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper'; import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
import {Subscriber} from "rxjs";
import {properties} from "../../../environments/environment"; import {properties} from "../../../environments/environment";
@Component({ @Component({
@ -11,30 +9,15 @@ import {properties} from "../../../environments/environment";
<result-landing type="software" [piwikSiteId]="piwikSiteId" [communityId]="communityId"></result-landing> <result-landing type="software" [piwikSiteId]="piwikSiteId" [communityId]="communityId"></result-landing>
`, `,
}) })
export class OpenaireSoftwareComponent { export class OpenaireSoftwareComponent implements OnInit {
piwikSiteId = null; piwikSiteId;
communityId = null; communityId;
private sub;
constructor(private route: ActivatedRoute) { constructor() {
this.sub =
this.route.queryParams.subscribe(params => {
this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
if (!this.communityId) {
this.communityId = params['communityId'];
} }
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId, properties.environment);
});
}
ngOnInit() { ngOnInit() {
} this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
ngOnDestroy() { this.piwikSiteId = PiwikHelper.getSiteId(this.communityId, properties.environment);
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
} }
} }
}

View File

@ -1,55 +1,32 @@
import {Component, Input, ViewChild} from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/searchUtils.class"; import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/searchUtils.class";
import {ActivatedRoute} from "@angular/router";
import {ConnectHelper} from "../../openaireLibrary/connect/connectHelper"; import {ConnectHelper} from "../../openaireLibrary/connect/connectHelper";
import {PiwikHelper} from "../../utils/piwikHelper"; import {PiwikHelper} from "../../utils/piwikHelper";
import {Subscriber} from "rxjs";
import {properties} from "../../../environments/environment"; import {properties} from "../../../environments/environment";
@Component({ @Component({
selector: 'openaire-advanced-search-dataprovider', selector: 'openaire-advanced-search-dataprovider',
template: ` template: `
<search-dataproviders [simpleView]="false" [customFilter]=customFilter [piwikSiteId]="piwikSiteId" [hasPrefix]="false" [showBreadcrumb]="true" [showSwitchSearchLink]="false"> <search-dataproviders [simpleView]="false" [customFilter]=customFilter [piwikSiteId]="piwikSiteId"
[hasPrefix]="false" [showBreadcrumb]="true" [showSwitchSearchLink]="false">
</search-dataproviders> </search-dataproviders>
` `
}) })
export class OpenaireAdvancedSearchDataProvidersComponent implements OnInit {
export class OpenaireAdvancedSearchDataProvidersComponent { communityId: string;
connectCommunityId:string;
piwikSiteId = null; piwikSiteId = null;
customFilter: SearchCustomFilter = null; customFilter: SearchCustomFilter = null;
constructor ( private route: ActivatedRoute) {
} constructor() {
sub;
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
} }
ngOnInit() { ngOnInit() {
let communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
var communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
this.piwikSiteId = PiwikHelper.getSiteId(communityId, properties.environment);
if (communityId) { if (communityId) {
this.connectCommunityId = communityId; this.piwikSiteId = PiwikHelper.getSiteId(communityId, properties.environment);
this.customFilter = new SearchCustomFilter("Community", "communityId", this.connectCommunityId, ""); this.communityId = communityId;
this.customFilter.isHiddenFilter = false; this.customFilter = new SearchCustomFilter("Community", "communityId", this.communityId, "");
} else{
this.sub = this.route.queryParams.subscribe(params => {
if(params['communityId'] && params['communityId']!=""){
this.connectCommunityId = params['communityId'];
this.piwikSiteId = PiwikHelper.getSiteId(this.connectCommunityId, properties.environment);
this.customFilter = new SearchCustomFilter("Community", "communityId", this.connectCommunityId, "");
this.customFilter.isHiddenFilter = false; this.customFilter.isHiddenFilter = false;
} }
});
}
} }
} }

View File

@ -1,4 +1,4 @@
import {Component, Input, ViewChild} from '@angular/core'; import {Component, Input, OnInit, ViewChild} from '@angular/core';
import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/searchUtils.class"; import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/searchUtils.class";
import {ActivatedRoute} from "@angular/router"; import {ActivatedRoute} from "@angular/router";
import {ConnectHelper} from "../../openaireLibrary/connect/connectHelper"; import {ConnectHelper} from "../../openaireLibrary/connect/connectHelper";
@ -12,47 +12,23 @@ import {properties} from "../../../environments/environment";
template: ` template: `
<search-organizations [simpleView]="false" [customFilter]=customFilter [piwikSiteId]="piwikSiteId" [hasPrefix]="false" [showBreadcrumb]="true" [showSwitchSearchLink]="false"> <search-organizations [simpleView]="false" [customFilter]=customFilter [piwikSiteId]="piwikSiteId" [hasPrefix]="false" [showBreadcrumb]="true" [showSwitchSearchLink]="false">
</search-organizations> </search-organizations>
` `
}) })
export class OpenaireAdvancedSearchOrganizationsComponent implements OnInit {
communityId:string;
piwikSiteId;
customFilter: SearchCustomFilter;
export class OpenaireAdvancedSearchOrganizationsComponent { constructor () {
connectCommunityId:string;
piwikSiteId = null;
customFilter: SearchCustomFilter = null;
constructor ( private route: ActivatedRoute) {
}
sub;
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
} }
ngOnInit() { ngOnInit() {
let communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
var communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
this.piwikSiteId = PiwikHelper.getSiteId(communityId, properties.environment); this.piwikSiteId = PiwikHelper.getSiteId(communityId, properties.environment);
if(communityId){ if(communityId){
this.connectCommunityId = communityId; this.communityId = communityId;
this.customFilter = new SearchCustomFilter("Community", "communityId", this.connectCommunityId, ""); this.customFilter = new SearchCustomFilter("Community", "communityId", this.communityId, "");
this.customFilter.isHiddenFilter = false; this.customFilter.isHiddenFilter = false;
} else{
this.sub = this.route.queryParams.subscribe(params => {
if(params['communityId'] && params['communityId']!=""){
this.connectCommunityId = params['communityId'];
this.piwikSiteId = PiwikHelper.getSiteId(this.connectCommunityId, properties.environment);
this.customFilter = new SearchCustomFilter("Community", "communityId", this.connectCommunityId, "");
this.customFilter.isHiddenFilter = false;
} }
});
} }
}
} }

View File

@ -1,53 +1,34 @@
import {Component} from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/searchUtils.class"; import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/searchUtils.class";
import {ActivatedRoute} from "@angular/router";
import {ConnectHelper} from "../../openaireLibrary/connect/connectHelper"; import {ConnectHelper} from "../../openaireLibrary/connect/connectHelper";
import {PiwikHelper} from "../../utils/piwikHelper"; import {PiwikHelper} from "../../utils/piwikHelper";
import {Subscriber} from "rxjs";
import {properties} from "../../../environments/environment"; import {properties} from "../../../environments/environment";
@Component({ @Component({
selector: 'openaire-advanced-search-projects', selector: 'openaire-advanced-search-projects',
template: ` template: `
<search-projects [simpleView]="false" [customFilter]=customFilter [piwikSiteId]="piwikSiteId" [hasPrefix]="false" [showBreadcrumb]="true" [showSwitchSearchLink]="false"> <search-projects [simpleView]="false" [customFilter]=customFilter [piwikSiteId]="piwikSiteId" [hasPrefix]="false"
[showBreadcrumb]="true" [showSwitchSearchLink]="false">
</search-projects> </search-projects>
` `
}) })
export class OpenaireAdvancedSearchProjectsComponent { export class OpenaireAdvancedSearchProjectsComponent implements OnInit {
connectCommunityId:string; communityId: string;
piwikSiteId = null; piwikSiteId;
customFilter: SearchCustomFilter = null; customFilter: SearchCustomFilter = null;
constructor ( private route: ActivatedRoute) {
} constructor() {
sub;
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
} }
ngOnInit() { ngOnInit() {
let communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
var communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
this.piwikSiteId = PiwikHelper.getSiteId(communityId, properties.environment);
if (communityId) { if (communityId) {
this.connectCommunityId = communityId; this.communityId = communityId;
this.customFilter = new SearchCustomFilter("Community", "communityId", this.connectCommunityId, ""); this.piwikSiteId = PiwikHelper.getSiteId(communityId, properties.environment);
this.customFilter.isHiddenFilter = false; this.customFilter = new SearchCustomFilter("Community", "communityId", this.communityId, "");
} else{
this.route.queryParams.subscribe(params => {
if(params['communityId'] && params['communityId']!=""){
this.connectCommunityId = params['communityId'];
this.piwikSiteId = PiwikHelper.getSiteId(this.connectCommunityId, properties.environment);
this.customFilter = new SearchCustomFilter("Community", "communityId", this.connectCommunityId, "");
this.customFilter.isHiddenFilter = false; this.customFilter.isHiddenFilter = false;
} }
});
}
} }
} }

View File

@ -1,49 +1,32 @@
import {Component} from '@angular/core'; import {Component} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {PiwikHelper} from '../../utils/piwikHelper'; import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper'; import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/searchUtils.class"; import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/searchUtils.class";
import {properties} from "../../../environments/environment"; import {properties} from "../../../environments/environment";
import {EnvProperties} from "../../openaireLibrary/utils/properties/env-properties"; import {EnvProperties} from "../../openaireLibrary/utils/properties/env-properties";
import {Subscriber} from "rxjs";
@Component({ @Component({
selector: 'openaire-search-find', selector: 'openaire-search-find',
template: ` template: `
<search-all logoURL = "/assets/common-assets/logo-small-explore.png" name="OpenAIRE Connect" [customFilter]=customFilter [piwikSiteId]="piwikSiteId" ></search-all> <search-all logoURL="/assets/common-assets/logo-small-explore.png" name="OpenAIRE Connect"
[customFilter]=customFilter [piwikSiteId]="piwikSiteId"></search-all>
`, `,
}) })
export class OpenaireSearchComponent { export class OpenaireSearchComponent {
connectCommunityId:string; communityId: string;
customFilter: SearchCustomFilter = null; customFilter: SearchCustomFilter = null;
piwikSiteId = null; piwikSiteId = null;
properties:EnvProperties; properties: EnvProperties = properties;
constructor ( private route: ActivatedRoute) {
} constructor() {
sub;
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
} }
ngOnInit() { ngOnInit() {
this.properties = properties;
let communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain); let communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
this.piwikSiteId = PiwikHelper.getSiteId(communityId,this.properties.environment);
if (communityId) { if (communityId) {
this.connectCommunityId = communityId; this.communityId = communityId;
this.customFilter = new SearchCustomFilter("Community", "communityId", this.connectCommunityId, ""); this.piwikSiteId = PiwikHelper.getSiteId(communityId, this.properties.environment);
}else{ this.customFilter = new SearchCustomFilter("Community", "communityId", this.communityId, "");
this.sub = this.route.queryParams.subscribe(params => {
if(params['communityId'] && params['communityId']!=""){
this.connectCommunityId = params['communityId'];
this.piwikSiteId = PiwikHelper.getSiteId(this.connectCommunityId,this.properties.environment);
this.customFilter = new SearchCustomFilter("Community", "communityId", this.connectCommunityId, "");
} }
});
} }
}
} }

View File

@ -1,43 +1,25 @@
import {Component, OnDestroy, OnInit} from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {PiwikHelper} from '../../utils/piwikHelper'; import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper'; import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
import {Subscriber} from "rxjs";
import {properties} from "../../../environments/environment"; import {properties} from "../../../environments/environment";
@Component({ @Component({
selector: 'openaire-search-organizations', selector: 'openaire-search-organizations',
template: ` template: `
<search-organizations> <search-organizations></search-organizations>
</search-organizations>
` `
}) })
export class OpenaireSearchOrganizationsComponent implements OnInit, OnDestroy { export class OpenaireSearchOrganizationsComponent implements OnInit {
piwikSiteId = null; piwikSiteId = null;
sub;
constructor(private route: ActivatedRoute) { constructor() {
} }
ngOnInit() { ngOnInit() {
var communityId = ConnectHelper.getCommunityFromDomain(properties.domain); let communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
if (communityId) { if (communityId) {
this.piwikSiteId = PiwikHelper.getSiteId(communityId, properties.environment); this.piwikSiteId = PiwikHelper.getSiteId(communityId, properties.environment);
} else {
this.sub = this.route.queryParams.subscribe(params => {
if (params['communityId'] && params['communityId'] != "") {
communityId = params['communityId'];
this.piwikSiteId = PiwikHelper.getSiteId(communityId, properties.environment);
}
});
}
}
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
} }
} }
} }