[Aggregator|Trunk]

Get custom filter from aggregators class
	use one aggregator as the default one



git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-aggregator-portal/trunk@56072 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2019-06-13 12:40:03 +00:00
parent a2daeed004
commit f9f4df43c3
20 changed files with 267 additions and 117 deletions

View File

@ -9,6 +9,7 @@ import { OpenaireErrorPageComponent } from './error/errorPage.component';
const routes: Routes = [
{ path: '', loadChildren: './home/home.module#HomeModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: ':id', loadChildren: './home/home.module#HomeModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'search/publication', loadChildren: './landingPages/publication/libPublication.module#LibPublicationModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'search/dataset', loadChildren: './landingPages/dataset/libDataset.module#LibDatasetModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'search/software', loadChildren: './landingPages/software/libSoftware.module#LibSoftwareModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
@ -34,8 +35,8 @@ const routes: Routes = [
{ path: 'search/advanced/dataproviders', loadChildren: './searchPages/advanced/advancedSearchDataProviders.module#LibAdvancedSearchDataProvidersModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'search/advanced/projects', loadChildren: './searchPages/advanced/advancedSearchProjects.module#LibAdvancedSearchProjectsModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'project-report', loadChildren: './landingPages/htmlProjectReport/libHtmlProjectReport.module#LibHtmlProjectReportModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'reload', loadChildren: './reload/libReload.module#LibReloadModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'user-info', loadChildren: './login/libUser.module#LibUserModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
// { path: 'reload', loadChildren: './reload/libReload.module#LibReloadModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
// { path: 'user-info', loadChildren: './login/libUser.module#LibUserModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'error', component: OpenaireErrorPageComponent, resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: '**',pathMatch: 'full',component: OpenaireErrorPageComponent, resolve: { envSpecific: EnvironmentSpecificResolver }}
];

View File

@ -5,6 +5,7 @@ import {EnvProperties} from './openaireLibrary/utils/properties/env-properties';
import {MenuItem, RootMenuItem} from './openaireLibrary/sharedComponents/menu';
import {EnvironmentSpecificService} from './openaireLibrary/utils/properties/environment-specific.service';
import {HelperFunctions} from "./openaireLibrary/utils/HelperFunctions.class";
import {FilterInfo, PortalAggregators} from "./utils/aggregators";
@Component({
//changeDetection: ChangeDetectionStrategy.Default,
@ -14,10 +15,9 @@ import {HelperFunctions} from "./openaireLibrary/utils/HelperFunctions.class";
`],
template: `
<navbar *ngIf="properties" portal="aggregator" [environment]=properties.environment [onlyTop]=false
<navbar *ngIf="properties" portal="aggregator" [properties]=properties [onlyTop]=false
[communityId]="properties.adminToolsCommunity" [menuItems]=menuItems
[APIUrl]="properties.adminToolsAPIURL" [logInUrl]="properties.loginUrl"
[logOutUrl]="properties.logoutUrl" [cookieDomain]="properties.cookieDomain" [userMenu]="false" [community]="community" [showCommunityName]="true"></navbar>
[userMenu]="false" [community]="community" [showCommunityName]="true"></navbar>
<div class="custom-main-content">
<main>
<router-outlet></router-outlet>
@ -33,7 +33,7 @@ import {HelperFunctions} from "./openaireLibrary/utils/HelperFunctions.class";
ratio="1"><polyline fill="none" stroke="#000" stroke-width="1.03" points="7 4 13 10 7 16"></polyline></svg>
</span></a>
</cookie-law>
<bottom *ngIf="isClient && properties" [environment]=properties.environment></bottom>
<bottom *ngIf="isClient && properties" [properties]=properties></bottom>
`
@ -54,14 +54,16 @@ export class AppComponent {
]
}
];
community = {id: "CA", name: "Canada Aggregator", logoUrl:"assets/common-assets/logo-small-aggregator.png"};
community = null;
properties: EnvProperties;
constructor(private route: ActivatedRoute, private propertiesService: EnvironmentSpecificService,
private router: Router) {
router.events.forEach((event) => {
if (event instanceof NavigationStart) {
HelperFunctions.scroll();
}
@ -69,6 +71,13 @@ export class AppComponent {
}
ngOnInit() {
let id = this.router.url;
console.log("Id is:"+id);
let agg:FilterInfo = PortalAggregators.getFilterInfoByMenuId(id);
if(agg){
this.community = {id: agg.menuId, name: agg.title, logoUrl:agg.logoUrl};
}
if (typeof document !== 'undefined') {
try {

View File

@ -1,26 +1,23 @@
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { SharedModule } from './shared/shared.module';
import { BrowserModule } from '@angular/platform-browser';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { APP_BASE_HREF, CommonModule } from '@angular/common';
import { HttpClientModule } from '@angular/common/http';
import { RouterModule } from '@angular/router';
import { AppComponent } from './app.component';
import {NgModule} from '@angular/core';
import {SharedModule} from './shared/shared.module';
import {BrowserModule} from '@angular/platform-browser';
import {NoopAnimationsModule} from '@angular/platform-browser/animations';
import {CommonModule} from '@angular/common';
import {HttpClientModule} from '@angular/common/http';
import {AppComponent} from './app.component';
import {NavigationBarModule} from './openaireLibrary/sharedComponents/navigationBar.module';
import { CookieLawModule } from './openaireLibrary/sharedComponents/cookie-law/cookie-law.module';
import {CookieLawModule} from './openaireLibrary/sharedComponents/cookie-law/cookie-law.module';
import {BottomModule} from './openaireLibrary/sharedComponents/bottom.module';
import {FeedbackModule} from './openaireLibrary/sharedComponents/feedback/feedback.module';
import { EnvironmentSpecificResolver} from './openaireLibrary/utils/properties/environmentSpecificResolver';
//import { EnvironmentSpecificService, REQUEST_TOKEN} from './openaireLibrary/utils/properties/environment-specific.service';
import {EnvironmentSpecificResolver} from './openaireLibrary/utils/properties/environmentSpecificResolver';
import {ErrorModule} from './openaireLibrary/error/error.module';
import { ErrorModule} from './openaireLibrary/error/error.module';
import { OpenaireErrorPageComponent } from './error/errorPage.component';
import { AppRoutingModule } from './app-routing.module';
import {OpenaireErrorPageComponent} from './error/errorPage.component';
import {AppRoutingModule} from './app-routing.module';
import {AggregatorNavBarComponent} from "./utils/aggregatorNavBar.component";
@NgModule({
@ -29,7 +26,7 @@ import { AppRoutingModule } from './app-routing.module';
NoopAnimationsModule,
CommonModule,
HttpClientModule,
ErrorModule,
ErrorModule,
NavigationBarModule, FeedbackModule, BottomModule,
CookieLawModule,
BrowserModule.withServerTransition({appId: 'my-app'}),
@ -38,14 +35,10 @@ NavigationBarModule, FeedbackModule, BottomModule,
declarations: [ AppComponent, OpenaireErrorPageComponent],
exports: [ AppComponent ],
providers:[
/*{
provide: REQUEST_TOKEN,
useClass: EnvironmentSpecificService
},*/
EnvironmentSpecificResolver
],
bootstrap: [AppComponent]
})
//
export class AppModule {}

View File

@ -1,5 +1,5 @@
<!--<aggNavbar></aggNavbar>-->
<div class="image-front-topbar uk-section-secondary uk-section-overlap uk-position-relative uk-preserve-color" uk-scrollspy="{&quot;target&quot;:&quot;[uk-scrollspy-class]&quot;,&quot;cls&quot;:&quot;uk-animation-fade&quot;,&quot;delay&quot;:false}" tm-header-transparent="light" tm-header-transparent-placeholder="">
<div style=" min-height: calc(7.89999px + 60vh);"

View File

@ -23,6 +23,7 @@ import {SearchCustomFilter} from "../openaireLibrary/searchPages/searchUtils/sea
import {StringUtils} from "../openaireLibrary/utils/string-utils.class";
import {SearchSoftwareService} from "../openaireLibrary/services/searchSoftware.service";
import {SearchOrpsService} from "../openaireLibrary/services/searchOrps.service";
import {FilterInfo, PortalAggregators} from "../utils/aggregators";
@Component({
selector: 'home',
@ -65,7 +66,7 @@ export class HomeComponent {
public subProjects;
public subOrg;
public subDataPr;
customFilter:SearchCustomFilter= new SearchCustomFilter();
customFilter:SearchCustomFilter= null;
constructor(
private route: ActivatedRoute,
@ -81,19 +82,24 @@ export class HomeComponent {
private location: Location, private _piwikService: PiwikService,
private config: ConfigurationService, private _meta: Meta, private _title: Title, private seoService: SEOService
) {
let id = this.route.snapshot.paramMap.get('id');
console.log(id);
let agg:FilterInfo = PortalAggregators.getFilterInfoByMenuId(id);
this.customFilter = PortalAggregators.getSearchCustomFilterByAggregator(agg);
let description = "openAIRE, open access, publications, research results, European commission, search";
let description = "openAIRE explore, open access, publications, research results, European commission, search";
let title = "OpenAIRE | Explore";
let title = "OpenAIRE | "+agg.title;
this._title.setTitle(title);
this._meta.updateTag({content: description}, "name='description'");
this._meta.updateTag({content: description}, "property='og:description'");
this._meta.updateTag({content: title}, "property='og:title'");
this.customFilter.set("Country", "country", "CA" , "Canada");
// this.customFilter.setValues("Country", "country", "CA" , "Canada");
}
public ngOnInit() {
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
@ -168,7 +174,7 @@ export class HomeComponent {
}
private getNumbers() {
let refineQuery = null
let refineQuery = null;
if(this.customFilter){
refineQuery= "&fq="+StringUtils.URIEncode(this.customFilter.queryFieldName + " exact " + StringUtils.quote((this.customFilter.valueId )));
}

View File

@ -26,6 +26,7 @@ import { SEOServiceModule } from '../openaireLibrary/sharedComponents/SEO/SEOSer
import {ErrorMessagesModule} from '../openaireLibrary/utils/errorMessages.module';
import {SoftwareServiceModule} from "../openaireLibrary/services/softwareService.module";
import {OrpsServiceModule} from "../openaireLibrary/services/orpsService.module";
// import {AggregatorNavBarComponent} from "../utils/aggregatorNavBar.component";
@NgModule({
imports: [
@ -39,16 +40,16 @@ import {OrpsServiceModule} from "../openaireLibrary/services/orpsService.module"
HomeRoutingModule,
HelperModule,
ErrorMessagesModule,
Schema2jsonldModule, SEOServiceModule
Schema2jsonldModule, SEOServiceModule,
],
declarations: [
HomeComponent
HomeComponent//, AggregatorNavBarComponent
],
providers:[
FreeGuard, PreviousRouteRecorder, ConfigurationService
],
exports: [
HomeComponent
HomeComponent//, AggregatorNavBarComponent
]
})
export class HomeModule { }

View File

@ -1,5 +1,7 @@
import {Component} from '@angular/core';
import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/searchUtils.class";
import {ActivatedRoute} from "@angular/router";
import {FilterInfo, PortalAggregators} from "../../utils/aggregators";
@Component({
@ -12,12 +14,15 @@ import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/
})
export class OpenaireAdvancedSearchDatasetsComponent {
customFilter:SearchCustomFilter= new SearchCustomFilter();
constructor () {
this.customFilter.set("Country", "country", "CA" , "Canada");
}
ngOnInit() {
customFilter:SearchCustomFilter= null;
constructor(private route: ActivatedRoute) {
}
ngOnInit() {
let id = this.route.snapshot.paramMap.get('id');
let agg: FilterInfo = PortalAggregators.getFilterInfoByMenuId(id);
this.customFilter = PortalAggregators.getSearchCustomFilterByAggregator(agg);
}
}

View File

@ -1,5 +1,7 @@
import {Component} from '@angular/core';
import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/searchUtils.class";
import {ActivatedRoute} from "@angular/router";
import {FilterInfo, PortalAggregators} from "../../utils/aggregators";
@Component({
@ -13,11 +15,14 @@ import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/
export class OpenaireAdvancedSearchOrganizationsComponent {
customFilter:SearchCustomFilter= new SearchCustomFilter();
constructor () {
this.customFilter.set("Country", "country", "CA" , "Canada");
}
ngOnInit() {
customFilter:SearchCustomFilter= null;
constructor(private route: ActivatedRoute) {
}
ngOnInit() {
let id = this.route.snapshot.paramMap.get('id');
let agg: FilterInfo = PortalAggregators.getFilterInfoByMenuId(id);
this.customFilter = PortalAggregators.getSearchCustomFilterByAggregator(agg);
}
}

View File

@ -1,5 +1,7 @@
import {Component} from '@angular/core';
import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/searchUtils.class";
import {ActivatedRoute} from "@angular/router";
import {FilterInfo, PortalAggregators} from "../../utils/aggregators";
@Component({
@ -12,12 +14,15 @@ import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/
})
export class OpenaireAdvancedSearchOrpsComponent {
customFilter:SearchCustomFilter= new SearchCustomFilter();
constructor () {
this.customFilter.set("Country", "country", "CA" , "Canada");
}
ngOnInit() {
customFilter:SearchCustomFilter= null;
constructor(private route: ActivatedRoute) {
}
ngOnInit() {
let id = this.route.snapshot.paramMap.get('id');
let agg: FilterInfo = PortalAggregators.getFilterInfoByMenuId(id);
this.customFilter = PortalAggregators.getSearchCustomFilterByAggregator(agg);
}
}

View File

@ -1,5 +1,7 @@
import {Component} from '@angular/core';
import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/searchUtils.class";
import {ActivatedRoute} from "@angular/router";
import {FilterInfo, PortalAggregators} from "../../utils/aggregators";
@Component({
@ -11,11 +13,14 @@ import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/
})
export class OpenaireAdvancedSearchPublicationsComponent {
customFilter:SearchCustomFilter= new SearchCustomFilter();
constructor () {
this.customFilter.set("Country", "country", "CA" , "Canada");
}
ngOnInit() {
customFilter:SearchCustomFilter= null;
constructor(private route: ActivatedRoute) {
}
ngOnInit() {
let id = this.route.snapshot.paramMap.get('id');
let agg: FilterInfo = PortalAggregators.getFilterInfoByMenuId(id);
this.customFilter = PortalAggregators.getSearchCustomFilterByAggregator(agg);
}
}

View File

@ -1,5 +1,7 @@
import {Component} from '@angular/core';
import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/searchUtils.class";
import {ActivatedRoute} from "@angular/router";
import {FilterInfo, PortalAggregators} from "../../utils/aggregators";
@Component({
selector: 'openaire-advanced-search-software',
@ -12,11 +14,14 @@ import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/
export class OpenaireAdvancedSearchSoftwareComponent {
customFilter:SearchCustomFilter= new SearchCustomFilter();
constructor () {
this.customFilter.set("Country", "country", "CA" , "Canada");
}
ngOnInit() {
customFilter:SearchCustomFilter= null;
constructor(private route: ActivatedRoute) {
}
ngOnInit() {
let id = this.route.snapshot.paramMap.get('id');
let agg: FilterInfo = PortalAggregators.getFilterInfoByMenuId(id);
this.customFilter = PortalAggregators.getSearchCustomFilterByAggregator(agg);
}
}

View File

@ -1,6 +1,7 @@
import {Component, ViewChild, ElementRef} from '@angular/core';
import {Component} from '@angular/core';
import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/searchUtils.class";
import {ActivatedRoute} from "@angular/router";
import {FilterInfo, PortalAggregators} from "../../utils/aggregators";
@Component({
selector: 'openaire-search-find',
@ -10,7 +11,7 @@ import {ActivatedRoute} from "@angular/router";
`,
})
export class OpenaireSearchComponent{
customFilter:SearchCustomFilter= new SearchCustomFilter();
customFilter:SearchCustomFilter= null;
constructor ( private route: ActivatedRoute ) {
@ -18,26 +19,11 @@ export class OpenaireSearchComponent{
ngOnInit() {
let id = this.route.snapshot.paramMap.get('id');
if(id && id.length > 0){
this.customFilter.set("Country", "country", id , "");
}else{
this.customFilter.set("Country", "country", "CA" , "Canada");
}
let agg:FilterInfo = PortalAggregators.getFilterInfoByMenuId(id);
this.customFilter = PortalAggregators.getSearchCustomFilterByAggregator(agg);
this.route.data
.subscribe((data: { envSpecific: any }) => {
// this.piwikSiteId = PiwikHelper.siteIDs[communityId];
// if(communityId){
// this.connectCommunityId = communityId
// }else{
// this.route.queryParams.subscribe(data => {
//
// if(data['communityId'] && data['communityId']!=""){
// this.connectCommunityId = data['communityId'];
// this.piwikSiteId = PiwikHelper.siteIDs[this.connectCommunityId];
// }
// });
// }
});
}

View File

@ -1,5 +1,7 @@
import {Component} from '@angular/core';
import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/searchUtils.class";
import {ActivatedRoute} from "@angular/router";
import {FilterInfo, PortalAggregators} from "../../utils/aggregators";
@Component({
selector: 'openaire-search-datasets',
@ -11,13 +13,14 @@ import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/
})
export class OpenaireSearchDatasetsComponent {
customFilter: SearchCustomFilter = new SearchCustomFilter();
customFilter: SearchCustomFilter = null;
constructor ( private route: ActivatedRoute ) {
constructor() {
this.customFilter.set("Country", "country", "CA", "Canada");
}
ngOnInit() {
let id = this.route.snapshot.paramMap.get('id');
let agg:FilterInfo = PortalAggregators.getFilterInfoByMenuId(id);
this.customFilter = PortalAggregators.getSearchCustomFilterByAggregator(agg);
}
}

View File

@ -1,5 +1,7 @@
import {Component, Input, ViewChild} from '@angular/core';
import {Component} from '@angular/core';
import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/searchUtils.class";
import {ActivatedRoute} from "@angular/router";
import {FilterInfo, PortalAggregators} from "../../utils/aggregators";
@Component({
selector: 'openaire-search-organizations',
@ -12,11 +14,13 @@ import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/
})
export class OpenaireSearchOrganizationsComponent {
customFilter:SearchCustomFilter= new SearchCustomFilter();
constructor () {
this.customFilter.set("Country", "country", "CA" , "Canada");
}
ngOnInit() {
customFilter:SearchCustomFilter= null;
constructor ( private route: ActivatedRoute ) {
}
ngOnInit() {
let id = this.route.snapshot.paramMap.get('id');
let agg:FilterInfo = PortalAggregators.getFilterInfoByMenuId(id);
this.customFilter = PortalAggregators.getSearchCustomFilterByAggregator(agg);
}
}

View File

@ -1,5 +1,7 @@
import {Component, Input, ViewChild} from '@angular/core';
import {Component} from '@angular/core';
import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/searchUtils.class";
import {ActivatedRoute} from "@angular/router";
import {FilterInfo, PortalAggregators} from "../../utils/aggregators";
@Component({
selector: 'openaire-search-orps',
@ -11,11 +13,15 @@ import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/
})
export class OpenaireSearchOrpsComponent {
customFilter:SearchCustomFilter= new SearchCustomFilter();
constructor () {
this.customFilter.set("Country", "country", "CA" , "Canada");
}
ngOnInit() {
customFilter: SearchCustomFilter = null;
constructor(private route: ActivatedRoute) {
}
ngOnInit() {
let id = this.route.snapshot.paramMap.get('id');
let agg: FilterInfo = PortalAggregators.getFilterInfoByMenuId(id);
this.customFilter = PortalAggregators.getSearchCustomFilterByAggregator(agg);
}
}

View File

@ -1,11 +1,11 @@
import {Component, Input, ViewChild} from '@angular/core';
import {Component} from '@angular/core';
import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/searchUtils.class";
import {ActivatedRoute} from "@angular/router";
import {FilterInfo, PortalAggregators} from "../../utils/aggregators";
@Component({
selector: 'openaire-search-publications',
template: `
template: `
<search-publications [customFilter]="customFilter">
</search-publications>
@ -13,19 +13,13 @@ import {ActivatedRoute} from "@angular/router";
})
export class OpenaireSearchPublicationsComponent {
customFilter:SearchCustomFilter= new SearchCustomFilter();
customFilter:SearchCustomFilter= null;
constructor ( private route: ActivatedRoute ) {
}
ngOnInit() {
let id = this.route.snapshot.paramMap.get('id');
if(id && id.length > 0){
this.customFilter.set("Country", "country", id , "");
}else{
this.customFilter.set("Country", "country", "CA" , "Canada");
}
let agg:FilterInfo = PortalAggregators.getFilterInfoByMenuId(id);
this.customFilter = PortalAggregators.getSearchCustomFilterByAggregator(agg);
}
}

View File

@ -1,5 +1,7 @@
import {Component} from '@angular/core';
import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/searchUtils.class";
import {FilterInfo, PortalAggregators} from "../../utils/aggregators";
import {ActivatedRoute} from "@angular/router";
@Component({
selector: 'openaire-search-software',
@ -11,12 +13,14 @@ import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/
})
export class OpenaireSearchSoftwareComponent {
customFilter:SearchCustomFilter= new SearchCustomFilter();
constructor () {
this.customFilter.set("Country", "country", "CA" , "Canada");
customFilter:SearchCustomFilter= null;
constructor ( private route: ActivatedRoute ) {
}
ngOnInit() {
let id = this.route.snapshot.paramMap.get('id');
let agg:FilterInfo = PortalAggregators.getFilterInfoByMenuId(id);
this.customFilter = PortalAggregators.getSearchCustomFilterByAggregator(agg);
}
}

View File

@ -0,0 +1,63 @@
import {Component} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import "rxjs/add/observable/zip";
import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties';
import {FilterInfo, PortalAggregators} from "../utils/aggregators";
import {MenuItem, RootMenuItem} from "../openaireLibrary/sharedComponents/menu";
@Component({
selector: 'aggNavbar',
templateUrl: `
<navbar *ngIf="properties" portal="aggregator" [environment]=properties.environment [onlyTop]=false
[communityId]="properties.adminToolsCommunity" [menuItems]=menuItems
[APIUrl]="properties.adminToolsAPIURL" [logInUrl]="properties.loginUrl"
[logOutUrl]="properties.logoutUrl" [cookieDomain]="properties.cookieDomain" [userMenu]="false" [community]="community" [showCommunityName]="true"></navbar>
`,
})
export class AggregatorNavBarComponent {
properties: EnvProperties;
menuItems: RootMenuItem [] = [
{rootItem: new MenuItem("home", "Home", "", "/", false, [], null, {}), items: []},
{
rootItem: new MenuItem("search", "Search", "", "/search/find", false, [], ["/search/find"], {}),
items: [new MenuItem("", "Publications", "", "/search/find/publications", false, ["publication"], ["/search/find/publications"], {}),
new MenuItem("", "Research Data", "", "/search/find/datasets", false, ["dataset"], ["/search/find/datasets"], {}),
new MenuItem("", "Software", "", "/search/find/software", false, ["software"], ["/search/find/software"], {}),
new MenuItem("", "Other Research Products", "", "/search/find/other", false, ["orp"], ["/search/find/other"], {}),
// new MenuItem("", "Projects", "", "/search/find/projects/", false, ["project"], ["/search/find/projects"], {}),
// new MenuItem("", "Content Providers", "", "/search/find/dataproviders", false, ["datasource"], ["/search/find/dataproviders"], {}),
new MenuItem("", "Organizations", "", "/search/find/organizations/", false, ["organization"], ["/search/find/organizations"], {})
]
}
];
community = {id: "CA", name: "Canada Aggregator", logoUrl:"assets/common-assets/logo-small-aggregator.png"};
constructor(
private route: ActivatedRoute,
) {
let id = this.route.snapshot.paramMap.get('id');
console.log(id);
let agg:FilterInfo = PortalAggregators.getFilterInfoByMenuId(id);
// this.customFilter = PortalAggregators.getSearchCustomFilterByAggregator(agg);
// console.log(this.customFilter);
}
public ngOnInit() {
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
});
}
}

View File

@ -0,0 +1,55 @@
import {SearchCustomFilter} from "../openaireLibrary/searchPages/searchUtils/searchUtils.class";
export class FilterInfo {
menuId: string;
title: string;
logoUrl: string;
fieldName: string; //Country
queryFieldName: string; //country
valueId: string; //gr
valueName: string; // Greece
constructor(menuId: string, title: string, logoUrl: string, fieldName: string, queryFieldName: string, valueId: string, valueName: string) {
this.menuId = menuId;
this.title = title;
this.logoUrl = logoUrl;
this.fieldName = fieldName;
this.queryFieldName = queryFieldName;
this.valueId = valueId;
this.valueName = valueName;
}
}
export class PortalAggregators {
static list: FilterInfo[] = [
new FilterInfo("canada", "Canadian Aggregator", "assets/common-assets/logo-small-aggregator.png", "Country", "country", "CA", "Canada"),
new FilterInfo("italy", "Italian Aggregator", "assets/common-assets/logo-small-aggregator.png", "Country", "country", "IT", "Italy"),
new FilterInfo("greece", "Greek Aggregator", "assets/common-assets/logo-small-aggregator.png", "Country", "country", "GR", "Greece"),
];
static defaultAggregator: FilterInfo = PortalAggregators.list[0];
public static getList(): FilterInfo[] {
return PortalAggregators.list;
}
public static getFilterInfoByMenuId(menuId: string): FilterInfo {
for (let agg of this.getList()) {
if (agg.menuId == menuId) {
return agg;
}
}
return PortalAggregators.defaultAggregator;
}
public static getSearchCustomFilterByAggregator(agg: FilterInfo): SearchCustomFilter {
let filter:SearchCustomFilter = null;
if(agg) {
filter = new SearchCustomFilter(agg.fieldName, agg.queryFieldName, agg.valueId, agg.valueName);
}
return filter;
}
}

View File

@ -14,7 +14,7 @@
"**/*.spec.ts"
],
// Add "angularCompilerOptions" with the AppServerModule you wrote
// set as the "entryModule".
// setValues as the "entryModule".
"angularCompilerOptions": {
"entryModule": "app/app.server.module#AppServerModule"
}