create fos/sdg components to call library components in order to use extra parameters, update submodules

This commit is contained in:
Alex Martzios 2022-11-03 15:55:45 +02:00
parent fc8c98935b
commit c42450c633
8 changed files with 131 additions and 3 deletions

View File

@ -96,11 +96,11 @@ const routes: Routes = [
},
{
path: 'sdgs',
loadChildren: () => import('./openaireLibrary/sdg/sdg.module').then(m => m.SdgModule)
loadChildren: () => import('./sdg/sdg.module').then(m => m.LibSdgModule)
},
{
path: 'fields-of-science',
loadChildren: () => import('./openaireLibrary/fos/fos.module').then(m => m.FosModule), data: {extraOffset: 100}
loadChildren: () => import('./fos/fos.module').then(m => m.LibFosModule), data: {extraOffset: 100}
},
{path: 'user-info', loadChildren: () => import('./login/libUser.module').then(m => m.LibUserModule)},
{path: 'error', component: OpenaireErrorPageComponent}

View File

@ -0,0 +1,17 @@
import {NgModule} from "@angular/core";
import {RouterModule} from "@angular/router";
import {PreviousRouteRecorder} from "../openaireLibrary/utils/piwik/previousRouteRecorder.guard";
import {AggregatorFosComponent} from "./fos.component";
@NgModule({
imports: [
RouterModule.forChild([
{
path: '',
component: AggregatorFosComponent,
canDeactivate: [PreviousRouteRecorder]
}
])
]
})
export class LibFosRoutingModule { }

View File

@ -0,0 +1,16 @@
import {Component} from "@angular/core";
import {properties} from "../../environments/environment";
@Component({
selector: 'aggregator-fos',
template: `
<fos [piwikSiteId]="piwikSiteId"></fos>
`
})
export class AggregatorFosComponent {
piwikSiteId = properties.piwikSiteId;
constructor() {
}
}

26
src/app/fos/fos.module.ts Normal file
View File

@ -0,0 +1,26 @@
import {CommonModule} from "@angular/common";
import {NgModule} from "@angular/core";
import {PreviousRouteRecorder} from "../openaireLibrary/utils/piwik/previousRouteRecorder.guard";
import {LibFosRoutingModule} from "./fos-routing.module";
import {FosRoutingModule} from "../openaireLibrary/fos/fos-routing.module";
import {FosModule} from "../openaireLibrary/fos/fos.module";
import {AggregatorFosComponent} from "./fos.component";
@NgModule({
imports: [
CommonModule,
LibFosRoutingModule,
FosRoutingModule,
FosModule
],
declarations: [
AggregatorFosComponent
],
exports: [
AggregatorFosComponent
],
providers: [
PreviousRouteRecorder
]
})
export class LibFosModule { }

@ -1 +1 @@
Subproject commit 3bd6a28c1b90980135c04d6d4b52714357fa1853
Subproject commit 510d48d9bf9b45b33c7be68aeeb47695e1d56905

View File

@ -0,0 +1,17 @@
import {NgModule} from "@angular/core";
import {RouterModule} from "@angular/router";
import {PreviousRouteRecorder} from "../openaireLibrary/utils/piwik/previousRouteRecorder.guard";
import {AggregatorSdgComponent} from "./sdg.component";
@NgModule({
imports: [
RouterModule.forChild([
{
path: '',
component: AggregatorSdgComponent,
canDeactivate: [PreviousRouteRecorder]
}
])
]
})
export class LibSdgRoutingModule { }

View File

@ -0,0 +1,26 @@
import {Component} from "@angular/core";
import {properties} from "../../environments/environment";
import {ConnectHelper} from "../openaireLibrary/connect/connectHelper";
import {SearchCustomFilter} from "../openaireLibrary/searchPages/searchUtils/searchUtils.class";
import {AggregatorInfo, PortalAggregators} from "../utils/aggregators";
@Component({
selector: 'aggregator-sdg',
template: `
<sdg [piwikSiteId]="piwikSiteId" [customFilter]="customFilter"></sdg>
`
})
export class AggregatorSdgComponent {
piwikSiteId = properties.piwikSiteId;
aggregatorId;
aggregator: AggregatorInfo;
customFilter: SearchCustomFilter = null;
constructor() {
this.aggregatorId = ConnectHelper.getCommunityFromDomain(properties.domain);
this.aggregator = PortalAggregators.getFilterInfoByMenuId(this.aggregatorId);
this.customFilter = PortalAggregators.getSearchCustomFilterByAggregator(this.aggregator);
}
public ngOnInit() {}
}

26
src/app/sdg/sdg.module.ts Normal file
View File

@ -0,0 +1,26 @@
import {CommonModule} from "@angular/common";
import {NgModule} from "@angular/core";
import {PreviousRouteRecorder} from "../openaireLibrary/utils/piwik/previousRouteRecorder.guard";
import {LibSdgRoutingModule} from "./sdg-routing.module";
import {SdgRoutingModule} from "../openaireLibrary/sdg/sdg-routing.module";
import {SdgModule} from "../openaireLibrary/sdg/sdg.module";
import {AggregatorSdgComponent} from "./sdg.component";
@NgModule({
imports: [
CommonModule,
LibSdgRoutingModule,
SdgRoutingModule,
SdgModule
],
declarations: [
AggregatorSdgComponent
],
exports: [
AggregatorSdgComponent
],
providers: [
PreviousRouteRecorder
]
})
export class LibSdgModule { }