[Library|Trunk]

Search Pages:

        Change scroll behaviour after query is submitted. Scroll under form if filters or page changes, scroll to top when keyword changes
        Hide filters and range filters when there are no results
        Autocomplete for Result type vocabulary: combine publications and dataset vocabularies: 

Filters:
 Results: 
        Remove Collected From Filter "collectedfrom","collectedfrom"    
        Project appears when funder is selected
Repositories: add Collected From Filter "collectedfromname"



git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@58739 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2020-05-21 13:17:28 +00:00
parent 3c476e39f9
commit 0f7349ce6f
7 changed files with 42 additions and 18 deletions

View File

@ -83,7 +83,7 @@
<div class="uk-position-relative">
<div [class]="'uk-container '+(customFilter && customFilter.queryFieldName ==
'communityId'?' uk-margin-large-bottom ':'uk-margin-large-top')+
(entityType === 'community' ||entityType === 'funder'?' uk-position-relative':'')">
(entityType === 'community' ||entityType === 'funder'?' uk-position-relative':'')" id="searchForm">
<advanced-search-form
[entityType] = "entityType"
[fieldIds]="fieldIds"

View File

@ -19,6 +19,7 @@ import {RefineResultsUtils} from "../../services/servicesUtils/refineResults.cla
import {RangeFilter} from "../../utils/rangeFilter/rangeFilterHelperClasses.class";
import {ZenodoInformationClass} from "../../deposit/utils/zenodoInformation.class";
import {Breadcrumb} from "../../utils/breadcrumbs/breadcrumbs.component";
import {HelperFunctions} from "../../utils/HelperFunctions.class";
declare var UIkit: any;
@ -126,7 +127,11 @@ export class NewSearchPageComponent {
this.piwiksub = this._piwikService.trackView(this.properties, this.pageTitle, this.piwikSiteId).subscribe();
}
});
this.route.queryParams.subscribe(params => {
if (params['page'] && params['page']!=1) {
HelperFunctions.scrollToId("searchForm");
}
});
var description = "Openaire, search, repositories, open access, type, content provider, funder, project, " + this.pageTitle;
this.updateTitle(this.pageTitle);
@ -205,7 +210,7 @@ export class NewSearchPageComponent {
// this.clearKeywords();
}
goTo(page: number = 1) {
goTo(page: number = 1, scroll:boolean = true) {
if(this.offcanvasElement) {
UIkit.offcanvas(this.offcanvasElement.nativeElement).hide();
}
@ -213,6 +218,9 @@ export class NewSearchPageComponent {
this.searchUtils.page = page;
this.buildPageURLParameters(this.filters, this.rangeFilters, true);
this.router.navigate([this.searchUtils.baseUrl], {queryParams: this.routerHelper.createQueryParams(this.parameterNames, this.parameterValues)});
if(scroll) {
HelperFunctions.scrollToId("searchForm");
}
/* Code For Piwik*/
if (typeof localStorage !== 'undefined') {
//console.log("In PreviousRouteRecorder : "+this.router.url );
@ -226,7 +234,7 @@ export class NewSearchPageComponent {
queryChanged() {
this.goTo(1);
this.goTo(1, false);
}
@ -254,8 +262,9 @@ export class NewSearchPageComponent {
*/
public getSelectedFilters(): string[] {
var selected: string[] = [];
for (var i = 0; i < this.filters.length; i++) {
var filter: Filter = this.filters[i];
var filters= (this.filters.length > 0)?this.filters:this.URLCreatedFilters;
for (var i = 0; i < filters.length; i++) {
var filter: Filter = filters[i];
if (filter.countSelectedValues > 0) {
selected.push(filter.filterId);
}
@ -1332,6 +1341,9 @@ public static createRangeFilterQuery(rangeField,selectedFromValue, selectedToVal
} else if (totalResults != 0) {
this.showUnknownFilters = false;
this.filters = filters;
}else if((this.URLCreatedFilters.length == 0 && totalResults == 0)){
this.showUnknownFilters = true;
this.filters = filters;
}
this.buildPageURLParameters(this.URLCreatedFilters, this.URLCreatedRangeFilters, true);
//this.checkSelectedRangeFilters(this.rangeFilters);

View File

@ -1,6 +1,6 @@
<div *ngIf= "filter.values.length >0" class="uk-margin-small-bottom">
<div class="uk-margin-small-top uk-margin-bottom uk-grid uk-flex uk-flex-bottom">
<h5 class="uk-margin-bottom-remove">{{_formatTitle(filter.title,filter.values.length)}}</h5>
<h5 class="uk-margin-bottom-remove" title = "{{filter.title}}">{{_formatTitle(filter.title,filter.values.length)}}</h5>
<a *ngIf="filter.countSelectedValues>0" (click)="clearFilter()" class="portal-link">
Clear
</a>

View File

@ -1,11 +1,19 @@
export class HelperFunctions {
public static scroll() {
HelperFunctions.scrollTo(0,0);
}
public static scrollTo(x,y) {
if (typeof document !== 'undefined') {
window.scrollTo(0, 0);
window.scrollTo(x,y);
}
}
public static scrollToId(elementId:string) {
if (typeof document !== 'undefined' && document.getElementById(elementId)) {
document.getElementById(elementId).scrollIntoView();
}
}
public static isTiny(url: string) {
return (url.indexOf('tinyurl.com') !== -1);
}

View File

@ -8,11 +8,13 @@ export class SearchFields {
public RESULT_RANGE_FIELDS = [
["resultacceptanceyear", "resultacceptanceyear"]
];
// Remove Collected From Filter "collectedfrom","collectedfrom"
public RESULT_REFINE_FIELDS = [
"relfunder",
"relfundinglevel0_id","relfundinglevel1_id","relfundinglevel2_id",
"relproject",
"resultbestaccessright", "instancetypename", "resultlanguagename", "community","resulthostingdatasource","collectedfrom" ];
"resultbestaccessright", "instancetypename", "resultlanguagename", "community","resulthostingdatasource" ];
public RESULT_ADVANCED_FIELDS:string[] = ["q","resulttitle","resultauthor", "authorid","resultdescription","resultsubject","resultpublisher",
"resultbestaccessright","community","collectedfromdatasourceid","resulthostingdatasourceid", "resultdateofacceptance",
@ -82,9 +84,9 @@ export class SearchFields {
};
//DATAPROVIDERS
// add Collected From Filter "collectedfromname"
public DATASOURCE_REFINE_FIELDS:string[] = ["datasourcetypeuiname", "datasourceodlanguages", "datasourceodcontenttypes",
"datasourcecompatibilityname", "country"];
"datasourcecompatibilityname", "country", "collectedfromname"];
public DATASOURCE_ADVANCED_FIELDS:string[] = ["q", "datasourceofficialname",
"datasourceenglishname","datasourceodsubjects", "datasourcetypename","datasourceodlanguages",
"datasourceodcontenttypes", "datasourcecompatibilityname","relorganizationid", "collectedfromdatasourceid"];
@ -102,6 +104,7 @@ export class SearchFields {
["datasourcecompatibilityid"]:{name:"Compatibility Level", type:"refine", param:"compatibility", operator: "cm", equalityOperator: " exact ", filterType: null},
["datasourcecompatibilityname"]:{name:"Compatibility Level", type:"vocabulary", param:"compatibility", operator: "cm", equalityOperator: " exact ", filterType: "checkbox"},
["relorganizationid"]:{name:"Organization", type:"entity", param:"organization", operator: "og", equalityOperator: " exact ", filterType: null},
["collectedfromname"]:{name:"Collected from", type:"entity", param:"collectedFrom", operator: "cl", equalityOperator: " exact ", filterType: "checkbox"},
["collectedfromdatasourceid"]:{name:"Collected from Content Provider", type:"entity", param:"collectedFrom", operator: "cl", equalityOperator: " exact ", filterType: null},
["country"]:{name:"Country", type:"vocabulary", param:"country", operator: "cu", equalityOperator: "=", filterType: "checkbox"}
};
@ -154,11 +157,11 @@ export class SearchFields {
// };
//add project field depending on funder
public HIDDEN_FIELDS:string[] = ["fundinglevel0_id","fundinglevel1_id","fundinglevel2_id",
"relfundinglevel0_id","relfundinglevel1_id","relfundinglevel2_id"];
"relfundinglevel0_id","relfundinglevel1_id","relfundinglevel2_id", "relproject"];
public DEPENDENT_FIELDS: { [key:string]:string } = {["fundinglevel0_id"]:"funder",
public DEPENDENT_FIELDS: { [key:string]:string } = {["relproject"]:"relfunder", ["fundinglevel0_id"]:"funder",
["fundinglevel1_id"]:"fundinglevel0_id", ["fundinglevel2_id"]:"fundinglevel1_id", ["relfundinglevel0_id"]:"relfunder",
["relfundinglevel1_id"]:"relfundinglevel0_id", ["relfundinglevel2_id"]:"relfundinglevel1_id"};

View File

@ -1,8 +1,8 @@
import {Injectable} from '@angular/core';
import {Http, Response} from '@angular/http';
import {HttpClient, HttpErrorResponse} from "@angular/common/http";
import {Observable, throwError, of} from 'rxjs';
import {AutoCompleteValue} from '../../searchPages/searchUtils/searchHelperClasses.class';
import 'rxjs/add/observable/zip';
import {EnvProperties} from '../properties/env-properties';
import {catchError, map} from "rxjs/operators";
@ -35,7 +35,8 @@ export class ISVocabulariesService {
} else if (field == "type" && (entity == "software" || entity == "other")) {
return of([]);
} else if (field == "type" && entity == "result" ) {
return Observable.zip(this.getVocabularyFromService("dnet:publication_resource.json", properties),this.getVocabularyFromService("dnet:dataCite_resource.json", properties));
} else if (field == "access" && (entity == "publication" || entity == "dataset" || entity == "software" || entity == "other" || entity == "result")) {
// file= "accessMode.json";
// return this.getVocabularyFromFile(file);

View File

@ -99,8 +99,8 @@ export class StaticAutoCompleteComponent implements OnChanges{
// this.afterListFetchedActions();
this.sub = this._vocabulariesService.getVocabularyByType(this.vocabularyId, this.entityName, this.properties).subscribe(
data => {
this.list = data;
this.afterListFetchedActions();
this.list = (this.vocabularyId=="type" && this.entityName == "result" && data.length == 2)?data[0].concat(data[1]):data;
this.afterListFetchedActions();
},
err => {