diff --git a/searchPages/searchResearchResults.module.ts b/searchPages/searchResearchResults.module.ts index a0cbfd43..07a6cf5e 100644 --- a/searchPages/searchResearchResults.module.ts +++ b/searchPages/searchResearchResults.module.ts @@ -3,7 +3,6 @@ import {CommonModule} from '@angular/common'; import {FormsModule} from '@angular/forms'; import {SearchResearchResultsServiceModule} from '../services/searchResearchResultsService.module'; -import {IsRouteEnabled} from '../error/isRouteEnabled.guard'; import {SearchResearchResultsComponent} from "./searchResearchResults.component"; import {NewSearchPageModule} from "./searchUtils/newSearchPage.module"; diff --git a/searchPages/searchUtils/entitiesSelection.component.ts b/searchPages/searchUtils/entitiesSelection.component.ts index bc28587a..9c8a4052 100644 --- a/searchPages/searchUtils/entitiesSelection.component.ts +++ b/searchPages/searchUtils/entitiesSelection.component.ts @@ -103,7 +103,7 @@ export class EntitiesSelectionComponent { ngOnInit() { this.show = 0; if (this.properties) { - if((this.customFilter && this.customFilter.queryFieldName == "communityId") || (this.properties.adminToolsCommunity !== "monitor" && this.properties.adminToolsPortalType !=='aggregator')) { + if((this.customFilter && this.customFilter.queryFieldName == "communityId") || (this.properties.adminToolsCommunity !== "monitor" )) { //this.config.getCommunityInformation(this.properties, (this.customFilter && this.customFilter.queryFieldName == "communityId") ? this.customFilter.valueId : this.properties.adminToolsCommunity).subscribe(data => { this.subs.push(this.config.communityInformationState.subscribe(data => { if(data) { @@ -176,17 +176,6 @@ export class EntitiesSelectionComponent { this.show = 3;*/ this.show = 1; this.disableSelect = true; - }else if(this.properties.adminToolsPortalType =='aggregator'){ - this.showResearchOutcomes = true; - this.showPublications = true; - this.showDatasets = true; - this.showSoftware = true; - this.showOther = true; - this.showProjects = true; - this.showOrganizations = true; - this.showDataProviders = true; - this.showAll = true; - this.show = 5; } else { this.showResearchOutcomes = true; this.showPublications = true; diff --git a/searchPages/searchUtils/quick-selections.component.ts b/searchPages/searchUtils/quick-selections.component.ts index 1b4ba9d3..9c9919d3 100644 --- a/searchPages/searchUtils/quick-selections.component.ts +++ b/searchPages/searchUtils/quick-selections.component.ts @@ -92,9 +92,9 @@ export class QuickSelectionsComponent { this.queryParams = Object.assign({}, params); this.initializeFilters(); })); - - if(this.properties && !this.initialized) { - if(this.properties.adminToolsCommunity !== "monitor" && this.properties.adminToolsPortalType !== "aggregator" ) { + //Allow all types + /* if(this.properties && !this.initialized) { + if(this.properties.adminToolsCommunity !== "monitor") { this.subs.push(this.config.communityInformationState.subscribe(data => { if(data) { var showEntity = {}; @@ -117,7 +117,7 @@ export class QuickSelectionsComponent { this.showEntities = true; this.initializeFilters(); })); - } else { + } else {*/ this.showPublications = true; this.showDatasets = true; this.showSoftware = true; @@ -125,11 +125,11 @@ export class QuickSelectionsComponent { this.showEntities = true; this.initialized = true; this.initializeFilters(); - } + /*} }else{ this.initializeFilters(); - } + }*/ } initializeFilters(){ diff --git a/searchPages/searchUtils/searchFilter.component.ts b/searchPages/searchUtils/searchFilter.component.ts index 9510c118..221f0ecb 100644 --- a/searchPages/searchUtils/searchFilter.component.ts +++ b/searchPages/searchUtils/searchFilter.component.ts @@ -244,12 +244,8 @@ export class SearchFilterComponent implements OnInit, OnChanges{ } getParams(filter:Filter, value:Value){ let params = Object.assign({}, this.queryParams); - let qf=false; - if(this.quickFilter && this.quickFilter.filterId == filter.filterId && this.quickFilter.selected && value.id == this.quickFilter.value){ - params['qf']="false"; - qf=true; - } - if(params[filter.filterId] && this.checkIfValueIndexOf(params[filter.filterId].split(','),value.id)==-1 && !qf) { + let isValueSelected = true; + if(params[filter.filterId] && this.checkIfValueIndexOf(params[filter.filterId].split(','),value.id)==-1) { //has other values of this filter --> add this value params[filter.filterId] = params[filter.filterId] + ',' + '"' + encodeURIComponent(value.id) + '"'; }else if(params[filter.filterId] && this.checkIfValueIndexOf(params[filter.filterId].split(','),value.id)!=-1) { @@ -261,10 +257,15 @@ export class SearchFilterComponent implements OnInit, OnChanges{ if(values.length == 0){ delete params[filter.filterId]; } - } else if(!qf){ + isValueSelected = false; + } else{ //has no filter, no value --> add the value params[filter.filterId] = '"' + encodeURIComponent(value.id) + '"' ; } + //if it is the Quick filter set the if selected or not + if(this.quickFilter && this.quickFilter.filterId == filter.filterId && value.id == this.quickFilter.value){ + params['qf']=isValueSelected; + } delete params['page']; return params; } diff --git a/sharedComponents/navigationBar.component.html b/sharedComponents/navigationBar.component.html index 8c0df456..05b69fdf 100644 --- a/sharedComponents/navigationBar.component.html +++ b/sharedComponents/navigationBar.component.html @@ -50,7 +50,7 @@
-
diff --git a/utils/configuration/configuration.service.ts b/utils/configuration/configuration.service.ts index 60c98984..74d34033 100644 --- a/utils/configuration/configuration.service.ts +++ b/utils/configuration/configuration.service.ts @@ -1,6 +1,6 @@ import {Injectable, OnDestroy} from '@angular/core'; import {HttpClient} from "@angular/common/http"; -import {BehaviorSubject, from, Observable, Subscription} from 'rxjs'; +import {BehaviorSubject, from, Observable, of, Subscription} from 'rxjs'; import {map} from 'rxjs/operators'; import {EnvProperties} from "../properties/env-properties"; import {Portal} from "../entities/adminTool/portal"; @@ -34,6 +34,12 @@ export class ConfigurationService{ //.map(res => res.json()); } + public initStaticCommunityInformation(communityInformation: Portal) { + this.promise = new Promise((resolve => { + this.communityInformation.next(communityInformation); + resolve(); + })); + } public initCommunityInformation(properties:EnvProperties, community:string) { if(community == null) return; diff --git a/utils/entities/adminTool/portal.ts b/utils/entities/adminTool/portal.ts index 27187a0d..9a4f64b3 100644 --- a/utils/entities/adminTool/portal.ts +++ b/utils/entities/adminTool/portal.ts @@ -1,7 +1,7 @@ import {Page} from './page'; import {Entity} from './entity'; -export interface Portal { +export class Portal { _id: string; pid: string; name: string; @@ -9,9 +9,189 @@ export interface Portal { piwik:number; entities: string[] | Entity[]; pages: string[] | Page[]; + + private static getmockPortalInfo():any{ + return { + "pid": "", + "name": "", + "type": "", + "pages": [ + //deposit + { + "route": "/participate/deposit/search", + "isEnabled": true + }, + { + "route": "/participate/deposit/learn-how", + "isEnabled": true + }, + //home + { + "route": "/", + "isEnabled": true + }, + //claims + { + "route": "/participate/claim", + "isEnabled": true, + + }, + { + "route": "/myclaims", + "isEnabled": true, + }, + { + "route": "/claims", + "isEnabled": true, + }, + { + "route": "/participate/direct-claim", + "isEnabled": true + }, + // /advanced search + { + "route": "/search/advanced/dataproviders", + "isEnabled": true + }, + { + "route": "/search/advanced/organizations", + "isEnabled": true + }, + { + "route": "/search/advanced/projects", + "isEnabled": true + }, + { + "route": "/search/advanced/research-outcomes", + "isEnabled": true + }, + //search all + + { + "route": "/search/find", + "isEnabled": true + }, + //simple search + { + "route": "/search/find/dataproviders", + "isEnabled": true + }, + + { + "route": "/search/find/organizations", + "isEnabled": true + }, + + { + "route": "/search/find/projects", + "isEnabled": true + }, + + { + "route": "/search/find/research-outcomes", + "isEnabled": true + }, + //landing + { + "route": "/search/dataprovider", + "isEnabled": true + }, + + { + "route": "/search/organization", + "isEnabled": true, + }, + { + "route": "/search/other", + "isEnabled": true, + }, + { + "route": "/search/project", + "isEnabled": true + }, + { + "route": "/project-report", + "isEnabled": true + }, + { + "route": "/search/publication", + "isEnabled": true + }, + { + "route": "/search/dataset", + "isEnabled": true + }, + { + "route": "/search/content-providers", + "isEnabled": true + }, + { + "route": "/search/software", + "isEnabled": true + }, + { + "route": "/search/organization", + "isEnabled": true + } + ], + "entities": [ + { + "pid": "publication", + "isEnabled": true + }, + { + "pid": "dataset", + "isEnabled": true + }, + { + "pid": "software", + "isEnabled": true + }, + { + "pid": "project", + "isEnabled": true + }, + { + "pid": "organization", + "isEnabled": true + }, + { + "pid": "datasource", + "isEnabled": true + }, + { + "pid": "orp", + "isEnabled": true + } + ], + };; + }; + + public static getMockCommunityInfo(disabledEntities:string[],disabledPages:string[]): any { + let communityInfo = Object.assign({}, Portal.getmockPortalInfo()); + for(let disabledPage of disabledPages) { + for (var i = 0; i < communityInfo.pages.length; i++) { + if (communityInfo.pages[i].route == disabledPage) { + communityInfo.pages.splice(i, 1); + break; + } + } + } + for(let disableEntity of disabledEntities){ + for (var i = 0; i < communityInfo.entities.length; i++) { + if (communityInfo.entities[i].pid == disableEntity) { + communityInfo.entities.splice(i, 1); + break; + } + } + } + + return communityInfo; + } } export interface CheckPortal { community: Portal; checked: boolean; } + diff --git a/utils/helper/helper.service.ts b/utils/helper/helper.service.ts index 1ef9929b..cfeb3b8a 100644 --- a/utils/helper/helper.service.ts +++ b/utils/helper/helper.service.ts @@ -3,6 +3,7 @@ import {HttpClient} from "@angular/common/http"; import {EnvProperties} from '../properties/env-properties'; +import {of} from "rxjs"; @Injectable() export class HelperService { @@ -33,20 +34,28 @@ export class HelperService { if(!communityId) { communityId = 'openaire'; } - let page_route: string = router.split('?')[0].substring(0); - let url = properties.adminToolsAPIURL; - url += '/'+properties.adminToolsPortalType+'/' + communityId + '/pagehelpcontent/grouped?active=true&page='+page_route; - return this.http.get((properties.useLongCache)? (properties.cacheUrl+encodeURIComponent(url)): url); + if(typeof properties.useHelpTexts == "undefined" || properties.useHelpTexts) { + let page_route: string = router.split('?')[0].substring(0); + let url = properties.adminToolsAPIURL; + url += '/' + properties.adminToolsPortalType + '/' + communityId + '/pagehelpcontent/grouped?active=true&page=' + page_route; + return this.http.get((properties.useLongCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url); + }else { + return of(null); + } } getDivHelpContents(properties:EnvProperties, communityId:string, router: string):any { if(!communityId) { communityId = 'openaire'; } + if(typeof properties.useHelpTexts == "undefined" || properties.useHelpTexts) { let page_route: string = router.split('?')[0].substring(0); let url = properties.adminToolsAPIURL; url += '/'+properties.adminToolsPortalType+'/' + communityId + '/divhelpcontent/grouped?active=true&page='+page_route; return this.http.get((properties.useLongCache)? (properties.cacheUrl+encodeURIComponent(url)): url); + }else { + return of(null); + } } } diff --git a/utils/properties/env-properties.ts b/utils/properties/env-properties.ts index 1c81bf14..3104229a 100644 --- a/utils/properties/env-properties.ts +++ b/utils/properties/env-properties.ts @@ -63,6 +63,7 @@ export interface EnvProperties { monitorServiceAPIURL?: string; adminToolsAPIURL?: string; adminToolsCommunity?: string; + useHelpTexts?:boolean; contextsAPI?: string; communityAPI?: string; communitiesAPI?: string;