[Library| Trunk]

-Mock admin tool responce set: 
	Portal class: initiate a mock class object, based on the disabled entities and pages
	method to set it in the subject of configuration service
-Add property useHelpTexts, add don't allow requests for helptexts when it is set to false
-Fix issue with filter: when QF is selected and try to select/unselect the filter


Aggregator:
-navbar: remove topbar for aggregators

	


git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@59966 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2020-11-25 17:12:31 +00:00
parent f2ff8cfe8a
commit 2b90952d2a
9 changed files with 219 additions and 34 deletions

View File

@ -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";

View File

@ -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;

View File

@ -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(){

View File

@ -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;
}

View File

@ -50,7 +50,7 @@
<div>
<div class="uk-panel" id="module-0">
<ul class="uk-nav uk-nav-default">
<li *ngIf="(['explore','connect','monitor','provide','develop','aggregator']).indexOf(portal)!=-1"
<li *ngIf="(['explore','connect','monitor','provide','develop']).indexOf(portal)!=-1"
class="uk-nav-header uk-parent">
Dashboards
<ul class="uk-nav-sub">
@ -120,7 +120,7 @@
</div>
</div>
</div>
<div *ngIf="(['explore','connect','monitor','provide','develop', 'aggregator']).indexOf(portal)!=-1"
<div *ngIf="(['explore','connect','monitor','provide','develop']).indexOf(portal)!=-1"
class="tm-toolbar custom-{{portal}}-toolbar uk-visible@m">
<div class="uk-container uk-flex uk-flex-middle uk-container-expand">
<div class="uk-margin-auto-left">

View File

@ -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<any>((resolve => {
this.communityInformation.next(communityInformation);
resolve();
}));
}
public initCommunityInformation(properties:EnvProperties, community:string) {
if(community == null) return;

View File

@ -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;
}

View File

@ -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);
}
}
}

View File

@ -63,6 +63,7 @@ export interface EnvProperties {
monitorServiceAPIURL?: string;
adminToolsAPIURL?: string;
adminToolsCommunity?: string;
useHelpTexts?:boolean;
contextsAPI?: string;
communityAPI?: string;
communitiesAPI?: string;