diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 205f84d..69c804c 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -19,7 +19,7 @@ const routes: Routes = [ }, { path: 'researcher', - loadChildren: () => import('./researcher/researcher-routing.module').then(m => m.ResearcherRoutingModule) + loadChildren: () => import('./researcher/researcher.module').then(m => m.ResearcherModule) }, { path: 'upload-dois', diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 79b3a2a..496af68 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -9,6 +9,7 @@ import {Option} from "./openaireLibrary/sharedComponents/input/input.component"; import {ConfigurationService} from "./openaireLibrary/utils/configuration/configuration.service"; import {Portal} from "./openaireLibrary/utils/entities/adminTool/portal"; import {Irish} from "./shared/irish"; +import {CustomFilterService} from "./shared/customFilter.service"; @Component({ selector: 'app-root', @@ -52,7 +53,7 @@ export class AppComponent extends BaseComponent implements OnInit { irish: Irish = new Irish(); constructor(private route: ActivatedRoute, - private router: Router, private configurationService: ConfigurationService) { + private router: Router, private configurationService: ConfigurationService, private customFilterService:CustomFilterService) { super(); configurationService.initStaticPortal(this.irish.portal); //Test track event @@ -60,6 +61,11 @@ export class AppComponent extends BaseComponent implements OnInit { // this._piwikService.doTrackEvent(properties,"test", properties.piwikSiteId,location.href,"Linking", "Link", JSON.stringify(json) ) } + ngOnDestroy() { + super.ngOnDestroy(); + this.customFilterService.clearSubscriptions(); + this.configurationService.clearSubscriptions() + } ngOnInit() { this.initialize(); diff --git a/src/app/researcher/author/author.component.ts b/src/app/researcher/author/author.component.ts new file mode 100644 index 0000000..56d2578 --- /dev/null +++ b/src/app/researcher/author/author.component.ts @@ -0,0 +1,39 @@ +import {Component, OnDestroy, OnInit} from "@angular/core"; +import {Stakeholder} from "../../openaireLibrary/monitor/entities/stakeholder"; +import {StakeholderService} from "../../openaireLibrary/monitor/services/stakeholder.service"; +import {BaseComponent} from "../../openaireLibrary/sharedComponents/base/base.component"; +import {ActivatedRoute, Router} from "@angular/router"; +import {SEOService} from "../../openaireLibrary/sharedComponents/SEO/SEO.service"; +import {PiwikService} from "../../openaireLibrary/utils/piwik/piwik.service"; +import {Meta, Title} from "@angular/platform-browser"; +import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/searchUtils.class"; +import {SearchOrcidService} from "../../openaireLibrary/claims/claim-utils/service/searchOrcid.service"; +import {properties} from "../../../environments/environment"; + +@Component({ + selector: 'author', + template: ` + + + + ` +}) +export class AuthorComponent extends BaseComponent implements OnInit { + + constructor(private stakeholderService: StakeholderService, + private _searchOrcidService: SearchOrcidService, + protected _route: ActivatedRoute, + protected _router: Router, + protected seoService: SEOService, + protected _piwikService: PiwikService, + protected _title: Title, + protected _meta: Meta) { + super(); + } + + ngOnInit() { + + } + + +} diff --git a/src/app/researcher/author/author.module.ts b/src/app/researcher/author/author.module.ts new file mode 100644 index 0000000..b3091a8 --- /dev/null +++ b/src/app/researcher/author/author.module.ts @@ -0,0 +1,18 @@ +import {NgModule} from "@angular/core"; +import {CommonModule} from "@angular/common"; +import {Route, RouterModule} from "@angular/router"; +import {AuthorComponent} from "./author.component"; +import {MonitorSearchResearchResultsModule} from "../../search/searchPages/simple/searchResearchResults.module"; +const routes: Route[] = [ + { + path: '', component: AuthorComponent + } +]; + +@NgModule({ + imports: [CommonModule, RouterModule.forChild(routes), MonitorSearchResearchResultsModule], + declarations: [AuthorComponent], + exports: [AuthorComponent], +}) +export class AuthorModule { +} diff --git a/src/app/researcher/researcher-routing.module.ts b/src/app/researcher/researcher-routing.module.ts deleted file mode 100644 index 4cf8610..0000000 --- a/src/app/researcher/researcher-routing.module.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; - -const routes: Routes = [ - { - path: '', - loadChildren: () => import('./search-researcher/search-researcher.module').then(m => m.SearchResearcherModule) - } -]; - -@NgModule({ - imports: [RouterModule.forChild(routes)] -}) -export class ResearcherRoutingModule { } diff --git a/src/app/researcher/researcher.component.ts b/src/app/researcher/researcher.component.ts new file mode 100644 index 0000000..8c29cb0 --- /dev/null +++ b/src/app/researcher/researcher.component.ts @@ -0,0 +1,78 @@ +import {Component, OnInit} from "@angular/core"; +import {BaseComponent} from "../openaireLibrary/sharedComponents/base/base.component"; +import {ActivatedRoute, Router} from "@angular/router"; +import {SEOService} from "../openaireLibrary/sharedComponents/SEO/SEO.service"; +import {PiwikService} from "../openaireLibrary/utils/piwik/piwik.service"; +import {Meta, Title} from "@angular/platform-browser"; +import {properties} from "../../environments/environment"; +import {SearchCustomFilter} from "../openaireLibrary/searchPages/searchUtils/searchUtils.class"; +import {SearchOrcidService} from "../openaireLibrary/claims/claim-utils/service/searchOrcid.service"; + +import {CustomFilterService} from "../shared/customFilter.service"; +import {LinksResolver} from "../search/links-resolver"; + +@Component({ + selector: 'researcher', + template: ` +
+
+
+ + + + {{author.authorGivenName}} {{author.authorFamilyName}} +
+ + +
+
+
Researcher Monitors
+
Lorem ipsum...
+
+
+
+ +
+ ` +}) +export class ResearcherComponent extends BaseComponent implements OnInit { + author; + authorId; + properties = properties; + constructor(protected _router: Router, + protected _route: ActivatedRoute, + protected seoService: SEOService, + protected _piwikService: PiwikService, + protected _title: Title, + protected _meta: Meta, + private _searchOrcidService: SearchOrcidService, + private _customFilterService:CustomFilterService) { + super(); + super.initRouterParams(this._route); + + } + + + ngOnInit() { + this.params.subscribe(params => { + console.log(params) + this.authorId = params['stakeholder']; + if(this.authorId) { + this.subscriptions.push(this._searchOrcidService.searchOrcidSingleAuthor(this.authorId, properties, true).subscribe(data => { + this.author = data; + this._customFilterService.setCustomFilter(new SearchCustomFilter("Orcid", "authorId", this.authorId, this.author.authorGivenName + " " + this.author.authorFamilyName)); + LinksResolver.setProperties("researcher/"+this.authorId); + + // TODO not correct id/ no author // no irish author? + })); + } + }); + + } +} diff --git a/src/app/researcher/researcher.module.ts b/src/app/researcher/researcher.module.ts new file mode 100644 index 0000000..f6e3b8c --- /dev/null +++ b/src/app/researcher/researcher.module.ts @@ -0,0 +1,24 @@ +import {NgModule} from '@angular/core'; +import {Route, RouterModule} from '@angular/router'; +import {CommonModule} from "@angular/common"; +import {ResearcherComponent} from "./researcher.component"; +import {SearchOrcidServiceModule} from "../openaireLibrary/claims/claim-utils/service/searchOrcidService.module"; + +const routes: Route[] = [ + { + path: '', component: ResearcherComponent, children: [ + {path: '', loadChildren: () => import('./search-researcher/search-researcher.module').then(m => m.SearchResearcherModule)}, + {path: ':stakeholder', loadChildren: () => import('./author/author.module').then(m => m.AuthorModule)}, + {path: ':stakeholder/search', loadChildren: () => import('../search/search.module').then(m => m.SearchModule)} + ] + } +]; + +@NgModule({ + imports: [CommonModule, RouterModule.forChild(routes), SearchOrcidServiceModule], + declarations: [ResearcherComponent], + exports: [ResearcherComponent], +}) +export class ResearcherModule { } + + diff --git a/src/app/researcher/search-researcher/search-researcher.component.html b/src/app/researcher/search-researcher/search-researcher.component.html index c1f9f9f..c77468a 100644 --- a/src/app/researcher/search-researcher/search-researcher.component.html +++ b/src/app/researcher/search-researcher/search-researcher.component.html @@ -1,7 +1,3 @@ -
- -
-
@@ -31,7 +27,7 @@ diff --git a/src/app/researcher/search-researcher/search-researcher.module.ts b/src/app/researcher/search-researcher/search-researcher.module.ts index d6c94fc..1e63476 100644 --- a/src/app/researcher/search-researcher/search-researcher.module.ts +++ b/src/app/researcher/search-researcher/search-researcher.module.ts @@ -7,13 +7,15 @@ import {MatSelectModule} from "@angular/material/select"; import {SearchOrcidServiceModule} from "../../openaireLibrary/claims/claim-utils/service/searchOrcidService.module"; import {SearchResearchResultsServiceModule} from "../../openaireLibrary/services/searchResearchResultsService.module"; import {LoadingModule} from "../../openaireLibrary/utils/loading/loading.module"; +import {RouterModule} from "@angular/router"; @NgModule({ declarations: [SearchResearcherComponent], imports: [ - CommonModule, SearchResearcherRoutingModule, SearchInputModule, MatSelectModule, SearchOrcidServiceModule, SearchResearchResultsServiceModule, LoadingModule + CommonModule, SearchResearcherRoutingModule, SearchInputModule, MatSelectModule, SearchOrcidServiceModule, SearchResearchResultsServiceModule, LoadingModule, + RouterModule ] }) diff --git a/src/app/search/landingPages/dataProvider/dataProvider-routing.module.ts b/src/app/search/landingPages/dataProvider/dataProvider-routing.module.ts new file mode 100644 index 0000000..834e841 --- /dev/null +++ b/src/app/search/landingPages/dataProvider/dataProvider-routing.module.ts @@ -0,0 +1,15 @@ +import {NgModule} from '@angular/core'; +import {RouterModule} from '@angular/router'; + +import {MonitorDataProviderComponent} from './dataProvider.component'; +import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + {path: '', component: MonitorDataProviderComponent, canDeactivate: [PreviousRouteRecorder]} + ]) + ] +}) +export class DataProviderRoutingModule { +} diff --git a/src/app/search/landingPages/dataProvider/dataProvider.component.ts b/src/app/search/landingPages/dataProvider/dataProvider.component.ts new file mode 100644 index 0000000..57b21b5 --- /dev/null +++ b/src/app/search/landingPages/dataProvider/dataProvider.component.ts @@ -0,0 +1,41 @@ +import {Component} from '@angular/core'; +import {ActivatedRoute, Router} from "@angular/router"; +import {StakeholderService} from "../../../openaireLibrary/monitor/services/stakeholder.service"; +import {Subscriber} from "rxjs"; + +@Component({ + selector: 'monitor-dataprovider', + template: ` +
+ +
`, +}) +export class MonitorDataProviderComponent { + initialized: boolean = false; + communityId; + constructor(private route: ActivatedRoute, + private router: Router, + private stakeholderService: StakeholderService) { + } + subscriptions = []; + ngOnDestroy() { + this.subscriptions.forEach(subscription => { + if (subscription instanceof Subscriber) { + subscription.unsubscribe(); + } + }); + } + ngOnInit() { + /* this.subscriptions.push(this.route.params.subscribe(params => { + if (params['stakeholder']) { + this.subscriptions.push(this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => { + if (stakeholder) { + this.initialized = true; + this.communityId = stakeholder.alias; + } + })); + } + }));*/ + this.initialized =true; + } +} diff --git a/src/app/search/landingPages/dataProvider/libDataProvider.module.ts b/src/app/search/landingPages/dataProvider/libDataProvider.module.ts new file mode 100644 index 0000000..f224d39 --- /dev/null +++ b/src/app/search/landingPages/dataProvider/libDataProvider.module.ts @@ -0,0 +1,14 @@ +import { NgModule} from '@angular/core'; +import { DataProviderModule } from '../../../openaireLibrary/landingPages/dataProvider/dataProvider.module'; +import { MonitorDataProviderComponent } from './dataProvider.component'; +import {DataProviderRoutingModule} from './dataProvider-routing.module'; +import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; +import {CommonModule} from "@angular/common"; + +@NgModule({ + imports: [DataProviderModule, DataProviderRoutingModule, CommonModule], + declarations:[MonitorDataProviderComponent], + providers:[ PreviousRouteRecorder], + exports:[MonitorDataProviderComponent] +}) +export class LibDataProviderModule { } diff --git a/src/app/search/landingPages/dataset/dataset-routing.module.ts b/src/app/search/landingPages/dataset/dataset-routing.module.ts new file mode 100644 index 0000000..6bb44f4 --- /dev/null +++ b/src/app/search/landingPages/dataset/dataset-routing.module.ts @@ -0,0 +1,15 @@ +import {NgModule} from '@angular/core'; +import {RouterModule} from '@angular/router'; + +import {MonitorDatasetComponent} from './dataset.component'; +import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + {path: '', component: MonitorDatasetComponent, canDeactivate: [PreviousRouteRecorder]} + ]) + ] +}) +export class DatasetRoutingModule { +} diff --git a/src/app/search/landingPages/dataset/dataset.component.ts b/src/app/search/landingPages/dataset/dataset.component.ts new file mode 100644 index 0000000..fe37316 --- /dev/null +++ b/src/app/search/landingPages/dataset/dataset.component.ts @@ -0,0 +1,42 @@ +import {Component} from '@angular/core'; +import {ActivatedRoute, Router} from "@angular/router"; +import {StakeholderService} from "../../../openaireLibrary/monitor/services/stakeholder.service"; +import {Subscriber} from "rxjs"; +import {ConfigurationService} from "../../../openaireLibrary/utils/configuration/configuration.service"; + +@Component({ + selector: 'monitor-dataset', + template: ` + + `, +}) +export class MonitorDatasetComponent { + initialized: boolean = false; + communityId; + constructor(private route: ActivatedRoute, + private router: Router, + private stakeholderService: StakeholderService) { + } + subscriptions = []; + ngOnDestroy() { + this.subscriptions.forEach(subscription => { + if (subscription instanceof Subscriber) { + subscription.unsubscribe(); + } + }); + } + ngOnInit() { + /*this.subscriptions.push(this.route.params.subscribe(params => { + if (params['stakeholder']) { + this.subscriptions.push(this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => { + if (stakeholder) { + this.initialized = true; + this.communityId = stakeholder.alias; + } + })); + } + }));*/ + this.initialized =true; + } +} + diff --git a/src/app/search/landingPages/dataset/libDataset.module.ts b/src/app/search/landingPages/dataset/libDataset.module.ts new file mode 100644 index 0000000..ef39994 --- /dev/null +++ b/src/app/search/landingPages/dataset/libDataset.module.ts @@ -0,0 +1,14 @@ +import {NgModule} from '@angular/core'; +import {MonitorDatasetComponent} from './dataset.component'; +import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; +import {DatasetRoutingModule} from './dataset-routing.module'; +import {ResultLandingModule} from "../../../openaireLibrary/landingPages/result/resultLanding.module"; +import {CommonModule} from "@angular/common"; + +@NgModule({ + imports: [DatasetRoutingModule, ResultLandingModule, CommonModule], + declarations:[MonitorDatasetComponent], + providers:[PreviousRouteRecorder], + exports:[MonitorDatasetComponent] +}) +export class LibDatasetModule { } diff --git a/src/app/search/landingPages/organization/libOrganization.module.ts b/src/app/search/landingPages/organization/libOrganization.module.ts new file mode 100644 index 0000000..f858741 --- /dev/null +++ b/src/app/search/landingPages/organization/libOrganization.module.ts @@ -0,0 +1,14 @@ +import {NgModule} from '@angular/core'; +import {OrganizationModule} from '../../../openaireLibrary/landingPages/organization/organization.module'; +import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; +import {MonitorOrganizationComponent} from './organization.component'; +import {OrganizationRoutingModule} from './organization-routing.module'; +import {CommonModule} from "@angular/common"; + +@NgModule({ + imports: [OrganizationModule, OrganizationRoutingModule, CommonModule], + declarations:[MonitorOrganizationComponent], + providers:[ PreviousRouteRecorder], + exports:[MonitorOrganizationComponent] +}) +export class LibOrganizationModule { } diff --git a/src/app/search/landingPages/organization/organization-routing.module.ts b/src/app/search/landingPages/organization/organization-routing.module.ts new file mode 100644 index 0000000..ac35326 --- /dev/null +++ b/src/app/search/landingPages/organization/organization-routing.module.ts @@ -0,0 +1,16 @@ +import {NgModule} from '@angular/core'; +import {RouterModule} from '@angular/router'; + +import {MonitorOrganizationComponent} from './organization.component'; +import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; + + +@NgModule({ + imports: [ + RouterModule.forChild([ + {path: '', component: MonitorOrganizationComponent, canDeactivate: [PreviousRouteRecorder]} + ]) + ] +}) +export class OrganizationRoutingModule { +} diff --git a/src/app/search/landingPages/organization/organization.component.ts b/src/app/search/landingPages/organization/organization.component.ts new file mode 100644 index 0000000..ecd6443 --- /dev/null +++ b/src/app/search/landingPages/organization/organization.component.ts @@ -0,0 +1,45 @@ +import {Component} from '@angular/core'; +import {ActivatedRoute, Router} from "@angular/router"; +import {StakeholderService} from "../../../openaireLibrary/monitor/services/stakeholder.service"; +import {Subscriber} from "rxjs"; +import {ConfigurationService} from "../../../openaireLibrary/utils/configuration/configuration.service"; + +@Component({ + selector: 'monitor-organization', + template: ` + + `, +}) +export class MonitorOrganizationComponent { + initialized: boolean = false; + communityId; + + constructor(private route: ActivatedRoute, + private router: Router, + private stakeholderService: StakeholderService) { + } + + subscriptions = []; + + ngOnDestroy() { + this.subscriptions.forEach(subscription => { + if (subscription instanceof Subscriber) { + subscription.unsubscribe(); + } + }); + } + + ngOnInit() { + /* this.subscriptions.push(this.route.params.subscribe(params => { + if (params['stakeholder']) { + this.subscriptions.push(this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => { + if (stakeholder) { + this.initialized = true; + this.communityId = stakeholder.alias; + } + })); + } + }));*/ + this.initialized =true; + } +} diff --git a/src/app/search/landingPages/orp/libOrp.module.ts b/src/app/search/landingPages/orp/libOrp.module.ts new file mode 100644 index 0000000..9a9aec9 --- /dev/null +++ b/src/app/search/landingPages/orp/libOrp.module.ts @@ -0,0 +1,22 @@ +import {NgModule} from '@angular/core'; +import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; +import {MonitorOrpComponent} from './orp.component'; +import {OrpRoutingModule} from './orp-routing.module'; +import {ResultLandingModule} from "../../../openaireLibrary/landingPages/result/resultLanding.module"; +import {CommonModule} from "@angular/common"; + +@NgModule({ + imports: [ + OrpRoutingModule, ResultLandingModule, CommonModule + ], + declarations: [ + MonitorOrpComponent + ], + providers: [ + PreviousRouteRecorder + ], + exports: [ + MonitorOrpComponent + ] +}) +export class LibOrpModule { } diff --git a/src/app/search/landingPages/orp/orp-routing.module.ts b/src/app/search/landingPages/orp/orp-routing.module.ts new file mode 100644 index 0000000..f357cb1 --- /dev/null +++ b/src/app/search/landingPages/orp/orp-routing.module.ts @@ -0,0 +1,15 @@ +import {NgModule} from '@angular/core'; +import {RouterModule} from '@angular/router'; + +import {MonitorOrpComponent} from './orp.component'; +import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; + +@NgModule({ + imports: [ + RouterModule.forChild([{ + path: '', component: MonitorOrpComponent, canDeactivate: [PreviousRouteRecorder] + }]) + ] +}) + +export class OrpRoutingModule { } diff --git a/src/app/search/landingPages/orp/orp.component.ts b/src/app/search/landingPages/orp/orp.component.ts new file mode 100644 index 0000000..4f28fe0 --- /dev/null +++ b/src/app/search/landingPages/orp/orp.component.ts @@ -0,0 +1,43 @@ +import {Component} from '@angular/core'; +import {ActivatedRoute, Router} from "@angular/router"; +import {StakeholderService} from "../../../openaireLibrary/monitor/services/stakeholder.service"; +import {Subscriber} from "rxjs"; +import {ConfigurationService} from "../../../openaireLibrary/utils/configuration/configuration.service"; + +@Component({ + selector: 'monitor-orp', + template: ` + + `, +}) + +export class MonitorOrpComponent { + initialized: boolean = false; + communityId; + + constructor(private route: ActivatedRoute, + private router: Router, + private stakeholderService: StakeholderService) { + } + subscriptions = []; + ngOnDestroy() { + this.subscriptions.forEach(subscription => { + if (subscription instanceof Subscriber) { + subscription.unsubscribe(); + } + }); + } + ngOnInit() { + /* this.subscriptions.push(this.route.params.subscribe(params => { + if (params['stakeholder']) { + this.subscriptions.push(this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => { + if (stakeholder) { + this.initialized = true; + this.communityId = stakeholder.alias; + } + })); + } + }));*/ + this.initialized =true; + } +} diff --git a/src/app/search/landingPages/project/libProject.module.ts b/src/app/search/landingPages/project/libProject.module.ts new file mode 100644 index 0000000..0eaa797 --- /dev/null +++ b/src/app/search/landingPages/project/libProject.module.ts @@ -0,0 +1,14 @@ +import {NgModule} from '@angular/core'; +import {ProjectModule} from '../../../openaireLibrary/landingPages/project/project.module'; +import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; +import {MonitorProjectComponent} from './project.component'; +import {ProjectRoutingModule} from './project-routing.module'; +import {CommonModule} from "@angular/common"; + +@NgModule({ + imports: [ProjectModule, ProjectRoutingModule, CommonModule], + declarations:[MonitorProjectComponent], + providers:[PreviousRouteRecorder], + exports:[MonitorProjectComponent] +}) +export class LibProjectModule { } diff --git a/src/app/search/landingPages/project/project-routing.module.ts b/src/app/search/landingPages/project/project-routing.module.ts new file mode 100644 index 0000000..18f7f44 --- /dev/null +++ b/src/app/search/landingPages/project/project-routing.module.ts @@ -0,0 +1,14 @@ +import {NgModule} from '@angular/core'; +import {RouterModule} from '@angular/router'; + +import {MonitorProjectComponent} from './project.component'; +import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: MonitorProjectComponent, canDeactivate: [PreviousRouteRecorder] } + ]) + ] +}) +export class ProjectRoutingModule { } diff --git a/src/app/search/landingPages/project/project.component.ts b/src/app/search/landingPages/project/project.component.ts new file mode 100644 index 0000000..9267a1d --- /dev/null +++ b/src/app/search/landingPages/project/project.component.ts @@ -0,0 +1,43 @@ +import {Component} from '@angular/core'; +import {ActivatedRoute, Router} from "@angular/router"; +import {StakeholderService} from "../../../openaireLibrary/monitor/services/stakeholder.service"; +import {Subscriber} from "rxjs"; +import {ConfigurationService} from "../../../openaireLibrary/utils/configuration/configuration.service"; + +@Component({ + selector: 'monitor-project', + template: ` + + `, +}) +export class MonitorProjectComponent { + initialized: boolean = false; + communityId; + + constructor(private route: ActivatedRoute, + private router: Router, + private stakeholderService: StakeholderService) { + } + subscriptions = []; + ngOnDestroy() { + this.subscriptions.forEach(subscription => { + if (subscription instanceof Subscriber) { + subscription.unsubscribe(); + } + }); + } + ngOnInit() { + /* this.subscriptions.push(this.route.params.subscribe(params => { + if (params['stakeholder']) { + this.subscriptions.push(this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => { + if (stakeholder) { + this.initialized = true; + this.communityId = stakeholder.alias; + } + })); + } + }));*/ + this.initialized =true; + } +} + diff --git a/src/app/search/landingPages/publication/libPublication.module.ts b/src/app/search/landingPages/publication/libPublication.module.ts new file mode 100644 index 0000000..3f54a84 --- /dev/null +++ b/src/app/search/landingPages/publication/libPublication.module.ts @@ -0,0 +1,14 @@ +import { NgModule} from '@angular/core'; +import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; +import { MonitorPublicationComponent } from './publication.component'; +import {PublicationRoutingModule} from './publication-routing.module'; +import {ResultLandingModule} from "../../../openaireLibrary/landingPages/result/resultLanding.module"; +import {CommonModule} from "@angular/common"; + +@NgModule({ + imports: [PublicationRoutingModule, ResultLandingModule, CommonModule], + declarations:[MonitorPublicationComponent], + providers:[PreviousRouteRecorder], + exports:[MonitorPublicationComponent] +}) +export class LibPublicationModule { } diff --git a/src/app/search/landingPages/publication/publication-routing.module.ts b/src/app/search/landingPages/publication/publication-routing.module.ts new file mode 100644 index 0000000..0ff3ff0 --- /dev/null +++ b/src/app/search/landingPages/publication/publication-routing.module.ts @@ -0,0 +1,14 @@ +import {NgModule} from '@angular/core'; +import {RouterModule} from '@angular/router'; + +import {MonitorPublicationComponent} from './publication.component'; +import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: MonitorPublicationComponent, canDeactivate: [PreviousRouteRecorder] } + ]) +] +}) +export class PublicationRoutingModule { } diff --git a/src/app/search/landingPages/publication/publication.component.ts b/src/app/search/landingPages/publication/publication.component.ts new file mode 100644 index 0000000..b6a2035 --- /dev/null +++ b/src/app/search/landingPages/publication/publication.component.ts @@ -0,0 +1,41 @@ +import {Component} from '@angular/core'; +import {ActivatedRoute, Router} from "@angular/router"; +import {StakeholderService} from "../../../openaireLibrary/monitor/services/stakeholder.service"; +import {Subscriber} from "rxjs"; +import {ConfigurationService} from "../../../openaireLibrary/utils/configuration/configuration.service"; + +@Component({ + selector: 'monitor-publication', + template: ` + + `, +}) +export class MonitorPublicationComponent { + initialized: boolean = false; + communityId; + + constructor(private route: ActivatedRoute, + private router: Router, + private stakeholderService: StakeholderService) { + } + subscriptions = []; + ngOnDestroy() { + this.subscriptions.forEach(subscription => { + if (subscription instanceof Subscriber) { + subscription.unsubscribe(); + } + }); + } + ngOnInit() { + /* this.subscriptions.push(this.route.params.subscribe(params => { + if (params['stakeholder']) { + this.subscriptions.push(this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => { + if (stakeholder) { + this.initialized = true; + this.communityId = stakeholder.alias; + } + })); + } + }));*/ + } +} diff --git a/src/app/search/landingPages/result/libResult.module.ts b/src/app/search/landingPages/result/libResult.module.ts new file mode 100644 index 0000000..6efb86a --- /dev/null +++ b/src/app/search/landingPages/result/libResult.module.ts @@ -0,0 +1,14 @@ +import {NgModule} from '@angular/core'; +import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; +import {MonitorResultComponent} from './result.component'; +import {ResultRoutingModule} from './result-routing.module'; +import {ResultLandingModule} from "../../../openaireLibrary/landingPages/result/resultLanding.module"; +import {CommonModule} from "@angular/common"; + +@NgModule({ + imports: [ResultRoutingModule, ResultLandingModule, CommonModule], + declarations:[MonitorResultComponent], + providers:[PreviousRouteRecorder], + exports:[MonitorResultComponent] +}) +export class LibResultModule { } diff --git a/src/app/search/landingPages/result/result-routing.module.ts b/src/app/search/landingPages/result/result-routing.module.ts new file mode 100644 index 0000000..867d76f --- /dev/null +++ b/src/app/search/landingPages/result/result-routing.module.ts @@ -0,0 +1,15 @@ +import {NgModule} from '@angular/core'; +import {RouterModule} from '@angular/router'; + +import {MonitorResultComponent} from './result.component'; +import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; + + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: MonitorResultComponent, canDeactivate: [PreviousRouteRecorder] } + ]) +] +}) +export class ResultRoutingModule { } diff --git a/src/app/search/landingPages/result/result.component.ts b/src/app/search/landingPages/result/result.component.ts new file mode 100644 index 0000000..18f79c7 --- /dev/null +++ b/src/app/search/landingPages/result/result.component.ts @@ -0,0 +1,42 @@ +import {Component} from '@angular/core'; +import {ActivatedRoute, Router} from "@angular/router"; +import {StakeholderService} from "../../../openaireLibrary/monitor/services/stakeholder.service"; +import {Subscriber} from "rxjs"; +import {ConfigurationService} from "../../../openaireLibrary/utils/configuration/configuration.service"; + +@Component({ + selector: 'monitor-result', + template: ` + + `, +}) +export class MonitorResultComponent { + initialized: boolean = false; + communityId; + + constructor(private route: ActivatedRoute, + private router: Router, + private stakeholderService: StakeholderService) { + } + subscriptions = []; + ngOnDestroy() { + this.subscriptions.forEach(subscription => { + if (subscription instanceof Subscriber) { + subscription.unsubscribe(); + } + }); + } + ngOnInit() { + /* this.subscriptions.push(this.route.params.subscribe(params => { + if (params['stakeholder']) { + this.subscriptions.push(this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => { + if (stakeholder) { + this.initialized = true; + this.communityId = stakeholder.alias; + } + })); + } + }));*/ + this.initialized =true; + } +} diff --git a/src/app/search/landingPages/software/libSoftware.module.ts b/src/app/search/landingPages/software/libSoftware.module.ts new file mode 100644 index 0000000..2b28566 --- /dev/null +++ b/src/app/search/landingPages/software/libSoftware.module.ts @@ -0,0 +1,13 @@ +import { NgModule} from '@angular/core'; +import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; +import { MonitorSoftwareComponent } from './software.component'; +import {SoftwareRoutingModule} from './software-routing.module'; +import {ResultLandingModule} from "../../../openaireLibrary/landingPages/result/resultLanding.module"; +import {CommonModule} from "@angular/common"; +@NgModule({ + imports: [SoftwareRoutingModule, ResultLandingModule, CommonModule], + declarations:[MonitorSoftwareComponent], + providers:[ PreviousRouteRecorder], + exports:[MonitorSoftwareComponent] +}) +export class LibSoftwareModule { } diff --git a/src/app/search/landingPages/software/software-routing.module.ts b/src/app/search/landingPages/software/software-routing.module.ts new file mode 100644 index 0000000..8e0d3cd --- /dev/null +++ b/src/app/search/landingPages/software/software-routing.module.ts @@ -0,0 +1,15 @@ +import {NgModule} from '@angular/core'; +import {RouterModule} from '@angular/router'; + +import {MonitorSoftwareComponent} from './software.component'; +import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; + + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: MonitorSoftwareComponent, canDeactivate: [PreviousRouteRecorder] } + ]) +] +}) +export class SoftwareRoutingModule { } diff --git a/src/app/search/landingPages/software/software.component.ts b/src/app/search/landingPages/software/software.component.ts new file mode 100644 index 0000000..99eb9f6 --- /dev/null +++ b/src/app/search/landingPages/software/software.component.ts @@ -0,0 +1,42 @@ +import {Component} from '@angular/core'; +import {ActivatedRoute, Router} from "@angular/router"; +import {StakeholderService} from "../../../openaireLibrary/monitor/services/stakeholder.service"; +import {Subscriber} from "rxjs"; +import {ConfigurationService} from "../../../openaireLibrary/utils/configuration/configuration.service"; + +@Component({ + selector: 'monitor-software', + template: ` + + `, +}) +export class MonitorSoftwareComponent { + initialized: boolean = false; + communityId; + + constructor(private route: ActivatedRoute, + private router: Router, + private stakeholderService: StakeholderService) { + } + subscriptions = []; + ngOnDestroy() { + this.subscriptions.forEach(subscription => { + if (subscription instanceof Subscriber) { + subscription.unsubscribe(); + } + }); + } + ngOnInit() { + /*this.subscriptions.push(this.route.params.subscribe(params => { + if (params['stakeholder']) { + this.subscriptions.push(this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => { + if (stakeholder) { + this.initialized = true; + this.communityId = stakeholder.alias; + } + })); + } + }));*/ + this.initialized =true; + } +} diff --git a/src/app/search/links-resolver.ts b/src/app/search/links-resolver.ts new file mode 100644 index 0000000..b179ca7 --- /dev/null +++ b/src/app/search/links-resolver.ts @@ -0,0 +1,72 @@ +import {properties} from "../../environments/environment"; + +interface Links { + searchLinkToResult; + searchLinkToPublication; + searchLinkToProject; + searchLinkToDataProvider; + searchLinkToDataset; + searchLinkToSoftwareLanding; + searchLinkToOrp; + searchLinkToOrganization; + searchLinkToResults, + searchLinkToPublications, + searchLinkToDatasets, + searchLinkToSoftware, + searchLinkToOrps, + searchLinkToProjects, + searchLinkToDataProviders, + searchLinkToOrganizations, + searchLinkToAdvancedResults, + searchLinkToAdvancedPublications, + searchLinkToAdvancedDatasets + searchLinkToAdvancedSoftware, + searchLinkToAdvancedOrps, + searchLinkToAdvancedProjects, + searchLinkToAdvancedDataProviders, + searchLinkToAdvancedOrganizations, + errorLink +} + +export class LinksResolver { + + private static default: Links = { + searchLinkToResult: properties.searchLinkToResult, + searchLinkToPublication: properties.searchLinkToPublication, + searchLinkToProject: properties.searchLinkToProject, + searchLinkToDataProvider: properties.searchLinkToDataProvider, + searchLinkToDataset: properties.searchLinkToDataset, + searchLinkToSoftwareLanding: properties.searchLinkToSoftwareLanding, + searchLinkToOrp: properties.searchLinkToOrp, + searchLinkToOrganization: properties.searchLinkToOrganization, + searchLinkToResults: properties.searchLinkToResults, + searchLinkToPublications: properties.searchLinkToPublications, + searchLinkToDatasets: properties.searchLinkToDatasets, + searchLinkToSoftware: properties.searchLinkToSoftware, + searchLinkToOrps: properties.searchLinkToOrps, + searchLinkToDataProviders: properties.searchLinkToDataProviders, + searchLinkToProjects: properties.searchLinkToProjects, + searchLinkToOrganizations: properties.searchLinkToOrganizations, + searchLinkToAdvancedResults: properties.searchLinkToAdvancedResults, + searchLinkToAdvancedPublications: properties.searchLinkToAdvancedPublications, + searchLinkToAdvancedDatasets: properties.searchLinkToAdvancedDatasets, + searchLinkToAdvancedSoftware: properties.searchLinkToAdvancedSoftware, + searchLinkToAdvancedOrps: properties.searchLinkToAdvancedOrps, + searchLinkToAdvancedProjects: properties.searchLinkToAdvancedProjects, + searchLinkToAdvancedDataProviders: properties.searchLinkToAdvancedDataProviders, + searchLinkToAdvancedOrganizations: properties.searchLinkToAdvancedOrganizations, + errorLink: properties.errorLink + }; + + public static setProperties(alias: string) { + Object.keys(this.default).forEach(field => { + properties[field] = "/" + alias + (this.default[field]); + }); + } + + public static resetProperties() { + Object.keys(this.default).forEach(field => { + properties[field] = this.default[field]; + }); + } +} diff --git a/src/app/search/search.module.ts b/src/app/search/search.module.ts new file mode 100644 index 0000000..c14997d --- /dev/null +++ b/src/app/search/search.module.ts @@ -0,0 +1,28 @@ +import {NgModule} from "@angular/core"; +import {CommonModule} from "@angular/common"; +import {RouterModule} from "@angular/router"; +@NgModule({ + imports: [CommonModule, RouterModule.forChild([ + // Search Pages + { path: '', redirectTo: 'find/research-outcomes', pathMatch: 'full'}, + { path: 'find/research-outcomes', loadChildren: () => import('./searchPages/simple/searchResearchResults.module').then(m => m.MonitorSearchResearchResultsModule)}, + { path: 'find/projects', loadChildren: () => import('./searchPages/simple/searchProjects.module').then(m => m.MonitorSearchProjectsModule)}, + { path: 'find/dataproviders', loadChildren: () => import('./searchPages/simple/searchDataProviders.module').then(m => m.MonitorSearchDataProvidersModule)}, + { path: 'find/organizations', loadChildren: () => import('./searchPages/simple/searchOrganizations.module').then(m => m.MonitorSearchOrganizationsModule)}, + // Advanced Search Pages + { path: 'advanced/research-outcomes', loadChildren: () => import('./searchPages/advanced/searchResearchResults.module').then(m => m.MonitorAdvancedSearchResearchResultsModule)}, + { path: 'advanced/projects', loadChildren: () => import('./searchPages/advanced/searchProjects.module').then(m => m.MonitorAdvancedSearchProjectsModule)}, + { path: 'advanced/dataproviders', loadChildren: () => import('./searchPages/advanced/searchDataProviders.module').then(m => m.MonitorAdvancedSearchDataProvidersModule)}, + { path: 'advanced/organizations', loadChildren: () => import('./searchPages/advanced/searchOrganizations.module').then(m => m.MonitorAdvancedSearchOrganizationsModule)}, + // Landing Pages + { path: 'result', loadChildren: () => import('./landingPages/result/libResult.module').then(m => m.LibResultModule), data: {hasMenuSearchBar: true}}, + { path: 'publication', loadChildren: () => import('./landingPages/publication/libPublication.module').then(m => m.LibPublicationModule), data: {hasMenuSearchBar: true}}, + { path: 'dataset', loadChildren: () => import('./landingPages/dataset/libDataset.module').then(m => m.LibDatasetModule), data: {hasMenuSearchBar: true}}, + { path: 'software', loadChildren: () => import('./landingPages/software/libSoftware.module').then(m => m.LibSoftwareModule), data: {hasMenuSearchBar: true}}, + { path: 'other', loadChildren: () => import('./landingPages/orp/libOrp.module').then(m => m.LibOrpModule), data: {hasMenuSearchBar: true}}, + { path: 'project', loadChildren: () => import('./landingPages/project/libProject.module').then(m => m.LibProjectModule), data: {hasMenuSearchBar: true}}, + { path: 'dataprovider', loadChildren: () => import('./landingPages/dataProvider/libDataProvider.module').then(m => m.LibDataProviderModule), data: {hasMenuSearchBar: true}}, + { path: 'organization', loadChildren: () => import('./landingPages/organization/libOrganization.module').then(m => m.LibOrganizationModule), data: {hasMenuSearchBar: true}}, + ])] +}) +export class SearchModule {} diff --git a/src/app/search/searchPages/advanced/searchDataProviders-routing.module.ts b/src/app/search/searchPages/advanced/searchDataProviders-routing.module.ts new file mode 100644 index 0000000..ea00186 --- /dev/null +++ b/src/app/search/searchPages/advanced/searchDataProviders-routing.module.ts @@ -0,0 +1,16 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import{MonitorAdvancedSearchDataprovidersComponent} from './searchDataproviders.component'; +import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; + + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: MonitorAdvancedSearchDataprovidersComponent, canDeactivate: [PreviousRouteRecorder] } + + ]) + ] +}) +export class SearchDataProvidersRoutingModule { } diff --git a/src/app/search/searchPages/advanced/searchDataProviders.module.ts b/src/app/search/searchPages/advanced/searchDataProviders.module.ts new file mode 100644 index 0000000..c854294 --- /dev/null +++ b/src/app/search/searchPages/advanced/searchDataProviders.module.ts @@ -0,0 +1,24 @@ +import {NgModule} from '@angular/core'; +import {CommonModule} from '@angular/common'; +import {FormsModule} from '@angular/forms'; +import {MonitorAdvancedSearchDataprovidersComponent} from './searchDataproviders.component'; +import {SearchDataProvidersRoutingModule} from './searchDataProviders-routing.module'; +import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; +import {SearchDataProvidersModule} from '../../../openaireLibrary/searchPages/searchDataProviders.module'; + +@NgModule({ + imports: [ + CommonModule, FormsModule, + SearchDataProvidersModule, SearchDataProvidersRoutingModule + + ], + declarations: [ + MonitorAdvancedSearchDataprovidersComponent + ], + providers: [PreviousRouteRecorder], + exports: [ + MonitorAdvancedSearchDataprovidersComponent + ] +}) +export class MonitorAdvancedSearchDataProvidersModule { +} diff --git a/src/app/search/searchPages/advanced/searchDataproviders.component.ts b/src/app/search/searchPages/advanced/searchDataproviders.component.ts new file mode 100644 index 0000000..a235af1 --- /dev/null +++ b/src/app/search/searchPages/advanced/searchDataproviders.component.ts @@ -0,0 +1,61 @@ +import {Component, Input} from '@angular/core'; +import {SearchCustomFilter} from "../../../openaireLibrary/searchPages/searchUtils/searchUtils.class"; +import {ActivatedRoute, Router} from "@angular/router"; +import {StakeholderService} from "../../../openaireLibrary/monitor/services/stakeholder.service"; +import {Subscriber} from "rxjs"; +import {SearchForm} from "../../../openaireLibrary/searchPages/searchUtils/newSearchPage.component"; + +@Component({ + selector: 'monitor-advanced-search-dataproviders', + template: ` + + + ` +}) +export class MonitorAdvancedSearchDataprovidersComponent { + @Input() searchForm: SearchForm = {class: 'search-form', dark: false}; + customFilter: SearchCustomFilter = null; + initialized: boolean = false; + showSwitchSearchLink: boolean = false; + + constructor(private route: ActivatedRoute, + private router: Router, + private stakeholderService: StakeholderService) { + } + + subscriptions = []; + + ngOnDestroy() { + this.subscriptions.forEach(subscription => { + if (subscription instanceof Subscriber) { + subscription.unsubscribe(); + } + }); + } + + ngOnInit() { + this.subscriptions.push(this.route.params.subscribe(params => { + if (params['stakeholder']) { + this.subscriptions.push(this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => { + if (stakeholder) { + if (stakeholder.type === "organization") { + let value = stakeholder.index_id; + this.customFilter = new SearchCustomFilter("Organization", "relorganizationid", value, ""); + this.showSwitchSearchLink = true; + } else if (stakeholder.type === "funder") { + let value = stakeholder.index_id + "||" + stakeholder.index_name + "||" + stakeholder.index_shortName; + this.customFilter = new SearchCustomFilter("Funder", "relfunder", value, stakeholder.name); + } else if (stakeholder.type === "ri") { + let value = stakeholder.index_id + "||" + stakeholder.index_name; + this.customFilter = new SearchCustomFilter("Community", "community", value, stakeholder.name); + } + this.initialized = true; + } + })); + } + })); + } + +} diff --git a/src/app/search/searchPages/advanced/searchOrganizations-routing.module.ts b/src/app/search/searchPages/advanced/searchOrganizations-routing.module.ts new file mode 100644 index 0000000..a5d4ad4 --- /dev/null +++ b/src/app/search/searchPages/advanced/searchOrganizations-routing.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import{MonitorAdvancedSearchOrganizationsComponent} from './searchOrganizations.component'; +import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; + + + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: MonitorAdvancedSearchOrganizationsComponent, canDeactivate: [PreviousRouteRecorder] } + + ]) + ] +}) +export class SearchOrganizationsRoutingModule { } diff --git a/src/app/search/searchPages/advanced/searchOrganizations.component.ts b/src/app/search/searchPages/advanced/searchOrganizations.component.ts new file mode 100644 index 0000000..1f4db89 --- /dev/null +++ b/src/app/search/searchPages/advanced/searchOrganizations.component.ts @@ -0,0 +1,57 @@ +import {Component, Input} from '@angular/core'; +import {ActivatedRoute, Router} from "@angular/router"; +import {StakeholderService} from "../../../openaireLibrary/monitor/services/stakeholder.service"; +import {SearchCustomFilter} from "../../../openaireLibrary/searchPages/searchUtils/searchUtils.class"; +import {Subscriber} from "rxjs"; +import {SearchForm} from "../../../openaireLibrary/searchPages/searchUtils/newSearchPage.component"; + +@Component({ + selector: 'monitor-advanced-search-organizations', + template: ` + + + ` +}) +export class MonitorAdvancedSearchOrganizationsComponent { + @Input() searchForm: SearchForm = {class: 'search-form', dark: false}; + initialized: boolean = false; + customFilter: SearchCustomFilter = null; + + constructor(private route: ActivatedRoute, + private router: Router, + private stakeholderService: StakeholderService) { + } + subscriptions = []; + ngOnDestroy() { + this.subscriptions.forEach(subscription => { + if (subscription instanceof Subscriber) { + subscription.unsubscribe(); + } + }); + } + + ngOnInit() { + this.subscriptions.push(this.route.params.subscribe(params => { + if (params['stakeholder']) { + this.subscriptions.push(this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => { + if (stakeholder) { + if (stakeholder.type === "funder") { + let value = stakeholder.index_id+"||"+stakeholder.index_name+"||"+stakeholder.index_shortName; + this.customFilter = new SearchCustomFilter("Funder", "relfunder", value, stakeholder.name); + this.customFilter.isHiddenFilter = false; + } else if (stakeholder.type === "organization") { + let value = stakeholder.index_id; + this.customFilter = new SearchCustomFilter("Organization", "relorganizationid", value, stakeholder.name); + this.customFilter.isHiddenFilter = false; + } else if (stakeholder.type === "ri") { + let value = stakeholder.index_id+"||"+stakeholder.index_name; + this.customFilter = new SearchCustomFilter("Community", "community", value, stakeholder.name); + this.customFilter.isHiddenFilter = false; + } + this.initialized = true; + } + })); + } + })); + } +} diff --git a/src/app/search/searchPages/advanced/searchOrganizations.module.ts b/src/app/search/searchPages/advanced/searchOrganizations.module.ts new file mode 100644 index 0000000..0afac53 --- /dev/null +++ b/src/app/search/searchPages/advanced/searchOrganizations.module.ts @@ -0,0 +1,26 @@ +import {NgModule} from '@angular/core'; +import {CommonModule} from '@angular/common'; +import {FormsModule} from '@angular/forms'; + +import {SearchOrganizationsRoutingModule} from './searchOrganizations-routing.module'; +import {MonitorAdvancedSearchOrganizationsComponent} from './searchOrganizations.component'; +import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; +import {SearchOrganizationsModule} from "../../../openaireLibrary/searchPages/searchOrganizations.module"; + + +@NgModule({ + imports: [ + CommonModule, FormsModule, + SearchOrganizationsRoutingModule, SearchOrganizationsModule + + ], + declarations: [ + MonitorAdvancedSearchOrganizationsComponent + ], + providers: [PreviousRouteRecorder], + exports: [ + MonitorAdvancedSearchOrganizationsComponent + ] +}) +export class MonitorAdvancedSearchOrganizationsModule { +} diff --git a/src/app/search/searchPages/advanced/searchProjects-routing.module.ts b/src/app/search/searchPages/advanced/searchProjects-routing.module.ts new file mode 100644 index 0000000..039464a --- /dev/null +++ b/src/app/search/searchPages/advanced/searchProjects-routing.module.ts @@ -0,0 +1,16 @@ +import {NgModule} from '@angular/core'; +import {RouterModule} from '@angular/router'; + +import {MonitorAdvancedSearchProjectsComponent} from './searchProjects.component'; +import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; + + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: MonitorAdvancedSearchProjectsComponent, canDeactivate: [PreviousRouteRecorder] } + + ]) + ] +}) +export class SearchProjectsRoutingModule { } diff --git a/src/app/search/searchPages/advanced/searchProjects.component.ts b/src/app/search/searchPages/advanced/searchProjects.component.ts new file mode 100644 index 0000000..cdbe0fe --- /dev/null +++ b/src/app/search/searchPages/advanced/searchProjects.component.ts @@ -0,0 +1,67 @@ +import {Component, Input} from '@angular/core'; +import {SearchCustomFilter} from "../../../openaireLibrary/searchPages/searchUtils/searchUtils.class"; +import {ActivatedRoute, Router} from "@angular/router"; +import {StakeholderService} from "../../../openaireLibrary/monitor/services/stakeholder.service"; +import {Subscriber} from "rxjs"; +import {properties} from "../../../../environments/environment"; +import {SearchForm} from "../../../openaireLibrary/searchPages/searchUtils/newSearchPage.component"; + +@Component({ + selector: 'monitor-advanced-search-projects', + template: ` + + + ` + +}) +export class MonitorAdvancedSearchProjectsComponent { + @Input() searchForm: SearchForm = {class: 'search-form', dark: false}; + customFilter: SearchCustomFilter = null; + initialized: boolean = false; + showSwitchSearchLink:boolean = false; + properties; + + constructor(private route: ActivatedRoute, + private router: Router, + private stakeholderService: StakeholderService) { + } + subscriptions = []; + ngOnDestroy() { + this.subscriptions.forEach(subscription => { + if (subscription instanceof Subscriber) { + subscription.unsubscribe(); + } + }); + } + + ngOnInit() { + this.properties = properties; + this.subscriptions.push(this.route.params.subscribe(params => { + if (params['stakeholder']) { + this.subscriptions.push(this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => { + if (stakeholder) { + if (stakeholder.type === "funder") { + let value = stakeholder.index_id+"||"+stakeholder.index_name+"||"+stakeholder.index_shortName; + this.customFilter = new SearchCustomFilter("Funder", "funder", value, ""); + this.showSwitchSearchLink = true; + } else if (stakeholder.type === "organization") { + let value = stakeholder.index_id; + this.customFilter = new SearchCustomFilter("Organization", "relorganizationid", value, ""); + this.showSwitchSearchLink = true; + } else if (stakeholder.type === "ri") { + let value = stakeholder.index_id+"||"+stakeholder.index_name; + this.customFilter = new SearchCustomFilter("Community", "community", value, stakeholder.name); + } + this.initialized = true; + } + })); + } + })); + } + +} diff --git a/src/app/search/searchPages/advanced/searchProjects.module.ts b/src/app/search/searchPages/advanced/searchProjects.module.ts new file mode 100644 index 0000000..6844e86 --- /dev/null +++ b/src/app/search/searchPages/advanced/searchProjects.module.ts @@ -0,0 +1,24 @@ +import {NgModule} from '@angular/core'; +import {CommonModule} from '@angular/common'; +import {FormsModule} from '@angular/forms'; + +import {SearchProjectsRoutingModule} from './searchProjects-routing.module'; +import {MonitorAdvancedSearchProjectsComponent} from './searchProjects.component'; +import {SearchProjectsModule} from "../../../openaireLibrary/searchPages/searchProjects.module"; +import {PreviousRouteRecorder} from "../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard"; + +@NgModule({ + imports: [ + CommonModule, FormsModule, SearchProjectsRoutingModule, SearchProjectsModule + + ], + declarations: [ + MonitorAdvancedSearchProjectsComponent + ], + providers: [PreviousRouteRecorder], + exports: [ + MonitorAdvancedSearchProjectsComponent + ] +}) +export class MonitorAdvancedSearchProjectsModule { +} diff --git a/src/app/search/searchPages/advanced/searchResearchResults-routing.module.ts b/src/app/search/searchPages/advanced/searchResearchResults-routing.module.ts new file mode 100644 index 0000000..68bae31 --- /dev/null +++ b/src/app/search/searchPages/advanced/searchResearchResults-routing.module.ts @@ -0,0 +1,16 @@ +import {NgModule} from '@angular/core'; +import {RouterModule} from '@angular/router'; + +import {MonitorAdvancedSearchResearchResultsComponent,} from './searchResearchResults.component'; +import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; + + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: MonitorAdvancedSearchResearchResultsComponent, canDeactivate: [PreviousRouteRecorder] } + + ]) + ] +}) +export class SearchResearchResultsRoutingModule { } diff --git a/src/app/search/searchPages/advanced/searchResearchResults.component.ts b/src/app/search/searchPages/advanced/searchResearchResults.component.ts new file mode 100644 index 0000000..ba4aa25 --- /dev/null +++ b/src/app/search/searchPages/advanced/searchResearchResults.component.ts @@ -0,0 +1,62 @@ +import {Component, Input} from '@angular/core'; +import {SearchCustomFilter} from "../../../openaireLibrary/searchPages/searchUtils/searchUtils.class"; +import {ActivatedRoute, Router} from "@angular/router"; +import {StakeholderService} from "../../../openaireLibrary/monitor/services/stakeholder.service"; +import {Subscriber} from "rxjs"; +import {properties} from "../../../../environments/environment"; +import {ConfigurationService} from "../../../openaireLibrary/utils/configuration/configuration.service"; +import {SearchForm} from "../../../openaireLibrary/searchPages/searchUtils/newSearchPage.component"; + +@Component({ + selector: 'monitor-advanced-search-results', + template: ` + + ` +}) +export class MonitorAdvancedSearchResearchResultsComponent { + customFilter: SearchCustomFilter = null; + initialized: boolean = false; + @Input() searchForm: SearchForm = {class: 'search-form', dark: false}; + properties; + constructor(private route: ActivatedRoute, + private router: Router, + private stakeholderService: StakeholderService) { + } + subscriptions = []; + ngOnDestroy() { + this.subscriptions.forEach(subscription => { + if (subscription instanceof Subscriber) { + subscription.unsubscribe(); + } + }); + } + + ngOnInit() { + this.properties = properties; + this.subscriptions.push(this.route.params.subscribe(params => { + if (params['stakeholder']) { + this.subscriptions.push(this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => { + if (stakeholder) { + if (stakeholder.type === "funder") { + let value = stakeholder.index_id+"||"+stakeholder.index_name+"||"+stakeholder.index_shortName; + this.customFilter = new SearchCustomFilter("Funder", "relfunder", value, stakeholder.name); + } else if (stakeholder.type === "organization") { + let value = stakeholder.index_id; + this.customFilter = new SearchCustomFilter("Organization", "relorganizationid", value, stakeholder.name); + } else if (stakeholder.type === "ri") { + let value = stakeholder.index_id+"||"+stakeholder.index_name; + this.customFilter = new SearchCustomFilter("Community", "community", value, stakeholder.name); + } + this.initialized = true; + } + })); + } + })); + } +} diff --git a/src/app/search/searchPages/advanced/searchResearchResults.module.ts b/src/app/search/searchPages/advanced/searchResearchResults.module.ts new file mode 100644 index 0000000..9d14d34 --- /dev/null +++ b/src/app/search/searchPages/advanced/searchResearchResults.module.ts @@ -0,0 +1,25 @@ +import {NgModule} from '@angular/core'; +import {CommonModule} from '@angular/common'; +import {FormsModule} from '@angular/forms'; + +import {SearchResearchResultsRoutingModule} from './searchResearchResults-routing.module'; +import {MonitorAdvancedSearchResearchResultsComponent} from './searchResearchResults.component'; +import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; +import {SearchResearchResultsModule} from "../../../openaireLibrary/searchPages/searchResearchResults.module"; + +@NgModule({ + imports: [ + CommonModule, FormsModule, + SearchResearchResultsRoutingModule, SearchResearchResultsModule + + ], + declarations: [ + MonitorAdvancedSearchResearchResultsComponent + ], + providers: [PreviousRouteRecorder], + exports: [ + MonitorAdvancedSearchResearchResultsComponent + ] +}) +export class MonitorAdvancedSearchResearchResultsModule { +} diff --git a/src/app/search/searchPages/simple/searchDataProviders-routing.module.ts b/src/app/search/searchPages/simple/searchDataProviders-routing.module.ts new file mode 100644 index 0000000..6d71853 --- /dev/null +++ b/src/app/search/searchPages/simple/searchDataProviders-routing.module.ts @@ -0,0 +1,16 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import{MonitorSearchDataprovidersComponent} from './searchDataproviders.component'; +import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; + + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: MonitorSearchDataprovidersComponent, canDeactivate: [PreviousRouteRecorder] } + + ]) + ] +}) +export class SearchDataProvidersRoutingModule { } diff --git a/src/app/search/searchPages/simple/searchDataProviders.module.ts b/src/app/search/searchPages/simple/searchDataProviders.module.ts new file mode 100644 index 0000000..9fd7257 --- /dev/null +++ b/src/app/search/searchPages/simple/searchDataProviders.module.ts @@ -0,0 +1,24 @@ +import {NgModule} from '@angular/core'; +import {CommonModule} from '@angular/common'; +import {FormsModule} from '@angular/forms'; +import {MonitorSearchDataprovidersComponent} from './searchDataproviders.component'; +import {SearchDataProvidersRoutingModule} from './searchDataProviders-routing.module'; +import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; +import {SearchDataProvidersModule} from '../../../openaireLibrary/searchPages/searchDataProviders.module'; + +@NgModule({ + imports: [ + CommonModule, FormsModule, + SearchDataProvidersModule, SearchDataProvidersRoutingModule + + ], + declarations: [ + MonitorSearchDataprovidersComponent + ], + providers: [PreviousRouteRecorder], + exports: [ + MonitorSearchDataprovidersComponent + ] +}) +export class MonitorSearchDataProvidersModule { +} diff --git a/src/app/search/searchPages/simple/searchDataproviders.component.ts b/src/app/search/searchPages/simple/searchDataproviders.component.ts new file mode 100644 index 0000000..8e5c3d5 --- /dev/null +++ b/src/app/search/searchPages/simple/searchDataproviders.component.ts @@ -0,0 +1,65 @@ +import {Component, Input} from '@angular/core'; +import {SearchCustomFilter} from "../../../openaireLibrary/searchPages/searchUtils/searchUtils.class"; +import {ActivatedRoute, Router} from "@angular/router"; +import {StakeholderService} from "../../../openaireLibrary/monitor/services/stakeholder.service"; +import {Subscriber} from "rxjs"; +import {ConfigurationService} from "../../../openaireLibrary/utils/configuration/configuration.service"; +import {SearchForm} from "../../../openaireLibrary/searchPages/searchUtils/newSearchPage.component"; +import {EnvProperties} from "../../../openaireLibrary/utils/properties/env-properties"; +import {properties} from "../../../../environments/environment"; + +@Component({ + selector: 'monitor-search-dataproviders', + template: ` + + + ` +}) +export class MonitorSearchDataprovidersComponent { + @Input() searchForm: SearchForm = {class: 'search-form', dark: false}; + customFilter: SearchCustomFilter = null; + initialized: boolean = false; + showSwitchSearchLink: boolean = false; + public properties: EnvProperties = properties; + + constructor(private route: ActivatedRoute, + private router: Router, + private stakeholderService: StakeholderService) { + } + + subscriptions = []; + + ngOnDestroy() { + this.subscriptions.forEach(subscription => { + if (subscription instanceof Subscriber) { + subscription.unsubscribe(); + } + }); + } + + ngOnInit() { + this.subscriptions.push(this.route.params.subscribe(params => { + if (params['stakeholder']) { + this.subscriptions.push(this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => { + if (stakeholder) { + if (stakeholder.type === "funder") { + this.navigateToError(); + } else if (stakeholder.type === "organization") { + let value = stakeholder.index_id; + this.customFilter = new SearchCustomFilter("Organization", "relorganizationid", value, ""); + } else if (stakeholder.type === "ri") { + this.navigateToError(); + } + this.initialized = true; + } + })); + } + })); + } + + navigateToError() { + this.router.navigate([this.properties.errorLink], {queryParams: {'page': this.router.url}}); + } +} diff --git a/src/app/search/searchPages/simple/searchOrganizations-routing.module.ts b/src/app/search/searchPages/simple/searchOrganizations-routing.module.ts new file mode 100644 index 0000000..2d1a738 --- /dev/null +++ b/src/app/search/searchPages/simple/searchOrganizations-routing.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import{MonitorSearchOrganizationsComponent} from './searchOrganizations.component'; +import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; + + + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: MonitorSearchOrganizationsComponent, canDeactivate: [PreviousRouteRecorder] } + + ]) + ] +}) +export class SearchOrganizationsRoutingModule { } diff --git a/src/app/search/searchPages/simple/searchOrganizations.component.ts b/src/app/search/searchPages/simple/searchOrganizations.component.ts new file mode 100644 index 0000000..e708257 --- /dev/null +++ b/src/app/search/searchPages/simple/searchOrganizations.component.ts @@ -0,0 +1,42 @@ +import {Component, Input} from '@angular/core'; +import {ActivatedRoute, Router} from "@angular/router"; +import {StakeholderService} from "../../../openaireLibrary/monitor/services/stakeholder.service"; +import {Subscriber} from "rxjs"; +import {ConfigurationService} from "../../../openaireLibrary/utils/configuration/configuration.service"; +import {SearchForm} from "../../../openaireLibrary/searchPages/searchUtils/newSearchPage.component"; + +@Component({ + selector: 'monitor-search-organizations', + template: ` + + + ` +}) +export class MonitorSearchOrganizationsComponent { + @Input() searchForm: SearchForm = {class: 'search-form', dark: false}; + initialized: boolean = false; + constructor(private route: ActivatedRoute, + private router: Router, + private stakeholderService: StakeholderService, private configurationService: ConfigurationService) { + } + subscriptions = []; + ngOnDestroy() { + this.subscriptions.forEach(subscription => { + if (subscription instanceof Subscriber) { + subscription.unsubscribe(); + } + }); + } + + ngOnInit() { + this.subscriptions.push(this.route.params.subscribe(params => { + if (params['stakeholder']) { + this.subscriptions.push(this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => { + if (stakeholder) { + this.initialized = true; + } + })); + } + })); + } +} diff --git a/src/app/search/searchPages/simple/searchOrganizations.module.ts b/src/app/search/searchPages/simple/searchOrganizations.module.ts new file mode 100644 index 0000000..7b839b5 --- /dev/null +++ b/src/app/search/searchPages/simple/searchOrganizations.module.ts @@ -0,0 +1,26 @@ +import {NgModule} from '@angular/core'; +import {CommonModule} from '@angular/common'; +import {FormsModule} from '@angular/forms'; + +import {SearchOrganizationsRoutingModule} from './searchOrganizations-routing.module'; +import {MonitorSearchOrganizationsComponent} from './searchOrganizations.component'; +import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; +import {SearchOrganizationsModule} from "../../../openaireLibrary/searchPages/searchOrganizations.module"; + + +@NgModule({ + imports: [ + CommonModule, FormsModule, + SearchOrganizationsRoutingModule, SearchOrganizationsModule + + ], + declarations: [ + MonitorSearchOrganizationsComponent + ], + providers: [PreviousRouteRecorder], + exports: [ + MonitorSearchOrganizationsComponent + ] +}) +export class MonitorSearchOrganizationsModule { +} diff --git a/src/app/search/searchPages/simple/searchProjects-routing.module.ts b/src/app/search/searchPages/simple/searchProjects-routing.module.ts new file mode 100644 index 0000000..d7abf1f --- /dev/null +++ b/src/app/search/searchPages/simple/searchProjects-routing.module.ts @@ -0,0 +1,16 @@ +import {NgModule} from '@angular/core'; +import {RouterModule} from '@angular/router'; + +import {MonitorSearchProjectsComponent} from './searchProjects.component'; +import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; + + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: MonitorSearchProjectsComponent, canDeactivate: [PreviousRouteRecorder] } + + ]) + ] +}) +export class SearchProjectsRoutingModule { } diff --git a/src/app/search/searchPages/simple/searchProjects.component.ts b/src/app/search/searchPages/simple/searchProjects.component.ts new file mode 100644 index 0000000..306dbc0 --- /dev/null +++ b/src/app/search/searchPages/simple/searchProjects.component.ts @@ -0,0 +1,65 @@ +import {Component, Input} from '@angular/core'; +import {SearchCustomFilter} from "../../../openaireLibrary/searchPages/searchUtils/searchUtils.class"; +import {ActivatedRoute, Router} from "@angular/router"; +import {StakeholderService} from "../../../openaireLibrary/monitor/services/stakeholder.service"; +import {Subscriber} from "rxjs"; +import {properties} from "../../../../environments/environment"; +import {SearchForm} from "../../../openaireLibrary/searchPages/searchUtils/newSearchPage.component"; + +@Component({ + selector: 'monitor-search-projects', + template: ` + + + ` + +}) +export class MonitorSearchProjectsComponent { + @Input() searchForm: SearchForm = {class: 'search-form', dark: false}; + customFilter: SearchCustomFilter = null; + initialized: boolean = false; + properties; + constructor(private route: ActivatedRoute, + private router: Router, + private stakeholderService: StakeholderService) { + } + subscriptions = []; + ngOnDestroy() { + this.subscriptions.forEach(subscription => { + if (subscription instanceof Subscriber) { + subscription.unsubscribe(); + } + }); + } + + ngOnInit() { + this.properties = properties; + this.subscriptions.push(this.route.params.subscribe(params => { + if (params['stakeholder']) { + this.subscriptions.push(this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => { + if (stakeholder) { + if (stakeholder.type === "funder") { + let value = stakeholder.index_id+"||"+stakeholder.index_name+"||"+stakeholder.index_shortName; + this.customFilter = new SearchCustomFilter("Funder", "funder", value, ""); + } else if (stakeholder.type === "organization") { + let value = stakeholder.index_id; + this.customFilter = new SearchCustomFilter("Organization", "relorganizationid", value, ""); + } else if (stakeholder.type === "ri") { + this.navigateToError(); + } + this.initialized = true; + + } + })); + } + })); + } + + navigateToError() { + this.router.navigate([this.properties.errorLink], {queryParams: {'page': this.router.url}}); + } +} diff --git a/src/app/search/searchPages/simple/searchProjects.module.ts b/src/app/search/searchPages/simple/searchProjects.module.ts new file mode 100644 index 0000000..357da27 --- /dev/null +++ b/src/app/search/searchPages/simple/searchProjects.module.ts @@ -0,0 +1,24 @@ +import {NgModule} from '@angular/core'; +import {CommonModule} from '@angular/common'; +import {FormsModule} from '@angular/forms'; + +import {SearchProjectsRoutingModule} from './searchProjects-routing.module'; +import {MonitorSearchProjectsComponent} from './searchProjects.component'; +import {SearchProjectsModule} from "../../../openaireLibrary/searchPages/searchProjects.module"; +import {PreviousRouteRecorder} from "../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard"; + +@NgModule({ + imports: [ + CommonModule, FormsModule, SearchProjectsRoutingModule, SearchProjectsModule + + ], + declarations: [ + MonitorSearchProjectsComponent + ], + providers: [PreviousRouteRecorder], + exports: [ + MonitorSearchProjectsComponent + ] +}) +export class MonitorSearchProjectsModule { +} diff --git a/src/app/search/searchPages/simple/searchResearchResults-routing.module.ts b/src/app/search/searchPages/simple/searchResearchResults-routing.module.ts new file mode 100644 index 0000000..7f95d18 --- /dev/null +++ b/src/app/search/searchPages/simple/searchResearchResults-routing.module.ts @@ -0,0 +1,15 @@ +import {NgModule} from '@angular/core'; +import {RouterModule} from '@angular/router'; + +import {MonitorSearchResearchResultsComponent} from './searchResearchResults.component'; +import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; + + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: MonitorSearchResearchResultsComponent, canDeactivate: [PreviousRouteRecorder] } + ]) + ] +}) +export class SearchResearchResultsRoutingModule { } diff --git a/src/app/search/searchPages/simple/searchResearchResults.component.ts b/src/app/search/searchPages/simple/searchResearchResults.component.ts new file mode 100644 index 0000000..d7c264b --- /dev/null +++ b/src/app/search/searchPages/simple/searchResearchResults.component.ts @@ -0,0 +1,85 @@ +import {Component} from '@angular/core'; +import {SearchCustomFilter} from "../../../openaireLibrary/searchPages/searchUtils/searchUtils.class"; +import {ActivatedRoute, Router} from "@angular/router"; +import {StakeholderService} from "../../../openaireLibrary/monitor/services/stakeholder.service"; +import {Subscriber} from "rxjs"; +import {properties} from "../../../../environments/environment"; +import {CustomFilterService} from "../../../shared/customFilter.service"; + +@Component({ + selector: 'monitor-search-results', + template: ` +
+
+
+ + `, +}) +export class MonitorSearchResearchResultsComponent { + + customFilter: SearchCustomFilter = null; + initialized: boolean = false; + properties; + keyword = ""; + parameters = {}; + constructor(private route: ActivatedRoute, + private router: Router, + private stakeholderService: StakeholderService, + private customFilterService: CustomFilterService) { + } + subscriptions = []; + ngOnDestroy() { + this.subscriptions.forEach(subscription => { + if (subscription instanceof Subscriber) { + subscription.unsubscribe(); + } + }); + } + + ngOnInit() { + this.properties = properties; + this.subscriptions.push(this.route.params.subscribe(params => { + if (params['stakeholder']) { + + this.subscriptions.push((this.customFilterService.getCustomFilterAsObservable().subscribe(customFilter => { + this.customFilter = customFilter; + this.initialized = true; + }))); + }else{ + // TODO + } + })); + + this.subscriptions.push(this.route.queryParams.subscribe(queryParams => { + this.parameters = Object.assign({}, queryParams); + this.keyword = (queryParams['keyword']) ? queryParams['keyword'] : (queryParams["q"] ? queryParams["q"] : (queryParams["f0"] && queryParams["f0"] == "q" && queryParams["fv0"] ? queryParams["fv0"] : "")); + })); + } + + + search(){ + this.prepareKeywordParam(this.keyword); + this.parameters["page"] = 1; + this.router.navigate([location.pathname], {queryParams: this.parameters}); + } + + private prepareKeywordParam(keyword){ + if (this.parameters["q"]) { + delete this.parameters['q']; + delete this.parameters['op']; + } + if(keyword.length > 0){ + this.parameters["fv0"] = keyword; + this.parameters["f0"] = "q"; + }else if(keyword.length ==0 && this.parameters["f0"]=="q"){ + delete this.parameters['f0']; + delete this.parameters['fv0']; + } + } +} diff --git a/src/app/search/searchPages/simple/searchResearchResults.module.ts b/src/app/search/searchPages/simple/searchResearchResults.module.ts new file mode 100644 index 0000000..c71b2eb --- /dev/null +++ b/src/app/search/searchPages/simple/searchResearchResults.module.ts @@ -0,0 +1,26 @@ +import {NgModule} from '@angular/core'; +import {CommonModule} from '@angular/common'; +import {FormsModule} from '@angular/forms'; + +import {SearchResearchResultsRoutingModule} from './searchResearchResults-routing.module'; +import {MonitorSearchResearchResultsComponent} from './searchResearchResults.component'; +import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; +import {SearchResearchResultsModule} from "../../../openaireLibrary/searchPages/searchResearchResults.module"; +import {SearchInputModule} from "../../../openaireLibrary/sharedComponents/search-input/search-input.module"; + +@NgModule({ + imports: [ + CommonModule, FormsModule, + SearchResearchResultsRoutingModule, SearchResearchResultsModule, SearchInputModule + + ], + declarations: [ + MonitorSearchResearchResultsComponent + ], + providers: [PreviousRouteRecorder], + exports: [ + MonitorSearchResearchResultsComponent + ] +}) +export class MonitorSearchResearchResultsModule { +} diff --git a/src/app/shared/customFilter.service.ts b/src/app/shared/customFilter.service.ts new file mode 100644 index 0000000..b55b184 --- /dev/null +++ b/src/app/shared/customFilter.service.ts @@ -0,0 +1,48 @@ +import {Injectable} from "@angular/core"; +import {HttpClient} from "@angular/common/http"; +import {BehaviorSubject, from, Observable, Subscriber} from "rxjs"; +import {SearchCustomFilter} from "../openaireLibrary/searchPages/searchUtils/searchUtils.class"; + + +@Injectable({ + providedIn: "root" +}) +export class CustomFilterService { + + private customFilterSubject: BehaviorSubject = null; + private promise: Promise; + private sub; + + constructor(private http: HttpClient) { + this.customFilterSubject = new BehaviorSubject(null); + } + + ngOnDestroy() { + this.clearSubscriptions(); + } + + clearSubscriptions() { + if (this.sub instanceof Subscriber) { + this.sub.unsubscribe(); + } + } + + async getCustomFilterAsync() { + if (this.promise) { + await this.promise; + this.promise = null; + } + this.clearSubscriptions(); + return this.customFilterSubject.getValue(); + } + + + getCustomFilterAsObservable(): Observable { + return this.customFilterSubject.asObservable(); + } + + setCustomFilter(customFilter: SearchCustomFilter) { + this.customFilterSubject.next(customFilter); + } + +} diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 53804ba..0e31584 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -14,7 +14,6 @@ let props: EnvProperties = { piwikSiteId: "407", enablePiwikTrack:false, piwikBaseUrl: 'https://beta.analytics.openaire.eu/piwik.php?idsite=', - } export let properties: EnvProperties = { ...common, ...commonDev, ...props