[Library|Trunk]

- Filters issue with quick filter: revert to previous code, value should be url encoded
- Custom Filter: always Show the value of the custom filter
- update message for link in explore portal
- Search pages - add indexUpdateDate, update link to index info




git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@59971 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2020-11-26 14:33:37 +00:00
parent c94f78dfee
commit 8d4198caca
3 changed files with 58 additions and 25 deletions

View File

@ -1,9 +1,10 @@
<ng-template #selected_filters_pills>
<div class="uk-grid uk-grid-small uk-text-small" uk-grid>
<ng-container *ngIf="customFilterEnabled && customFilter && refineFields.indexOf(customFilter.queryFieldName) ==
-1 ">
<ng-container *ngIf="customFilter && ((customFilterEnabled &&
refineFields.indexOf(customFilter.queryFieldName) ==
-1) ||customFilter.isHiddenFilter)">
<span class="uk-grid-margin">
<span class="selectedFilterLabel uk-disabled ">
<span class="selectedFilterLabel customFilterLabel">
<span class="">{{customFilter.valueName}}</span>
</span>
</span>
@ -55,8 +56,10 @@
</ng-container>
<ng-container *ngFor="let filter of filters ">
<ng-container *ngIf="filter.countSelectedValues > 0">
<span *ngFor="let value of getSelectedValues(filter); let i = index; let end = last; "
[title]="'Remove '+value.name" (click)="removeFilter(value, filter) "
<ng-container *ngFor="let value of getSelectedValues(filter); let i = index; let end = last; ">
<span *ngIf="!customFilter || (customFilter.isHiddenFilter && customFilter.valueId != value.id)"
[title]="'Remove '+value.name"
(click)="removeFilter(value, filter) "
[class]="((disableForms || disableRefineForms) ? 'uk-disabled' : 'clickable') + ' uk-grid-margin'">
<!-- if no grid on the div above, remove it and move class 'selectedFilterLabel' on top span -->
<span class="selectedFilterLabel ">
@ -76,6 +79,7 @@
</a>
</span>
</span>
</ng-container>
</ng-container>
</ng-container>
</div>
@ -95,7 +99,7 @@
</a>
</div>
<div *ngIf="selectedRangeFilters+selectedFilters + selectedTypesNum > 0 || (customFilter && customFilter.selected
== true)"
== true || customFilter.isHiddenFilter)"
class="uk-margin-small-top uk-margin-medium-bottom">
<ng-container *ngTemplateOutlet="selected_filters_pills; context: {}"></ng-container>
</div>
@ -291,10 +295,15 @@
Do you want to see results only for {{customFilter.valueName}}? <a
(click)="addCustomFilter();">Click here</a>.
</div>
<div *ngIf="openaireLink && (searchUtils.totalResults > 0 || !loadPaging )"><a
class="uk-margin-top uk-button uk-button-text"
<div *ngIf="openaireLink && (searchUtils.totalResults > 0 || !loadPaging )" class="uk-alert uk-text-center ">
<span *ngIf="customFilter">The following results are related to <span class="portal-color"
>{{customFilter.valueName}}</span>.</span>
Are you interested to view more results? Visit
<a
class="uk-margin-top uk-link"
[href]="openaireLink+this.routerHelper.createQueryParamsString(this.parameterNames, this.parameterValues)"
target="_blank">Results in OpenAIRE</a></div>
target="_blank"> OpenAIRE - Explore</a>.
</div>
<div class="uk-align-center uk-margin-remove-bottom">
<div
*ngIf="(results && searchUtils.totalResults > 0) || (!loadPaging && oldTotalResults > 0 && searchUtils.status == errorCodes.LOADING)"
@ -384,12 +393,28 @@
[isDisabled]="disableForms || disableRefineForms">
</search-paging>
</div>
<div *ngIf=" searchUtils.status !==
errorCodes.LOADING" class="uk-margin-small-top uk-grid uk-child-width-1-2">
<!-- Last Index Info-->
<div class="">
<img src="assets/common-assets/graph.svg" style="opacity: 0.4">
<span class="uk-margin-small-left uk-text-baseline uk-text-muted">Powered by <a href="https://graph.openaire.eu" class="graph-color">OpenAIRE Research Graph</a></span>
</div>
<div class="uk-text-right">
<span *ngIf="indexUpdateDate" class="uk-text-baseline uk-text-muted">
<a *ngIf="properties.showLastIndexInformationLink && lastIndex"
class="uk-link"
[href]="properties.lastIndexInformationLink" target="_blank">
Last update
</a><span *ngIf="!(properties.showLastIndexInformationLink && lastIndex) ">
Last update
</span>
of records in OpenAIRE: {{indexUpdateDate | date: 'MMM dd, yyyy'}}
</span>
</div>
</div>
<a *ngIf="properties.showLastIndexInformationLink && lastIndex && searchUtils.status !== errorCodes.LOADING"
class="last_index_info uk-button-text uk-button"
[href]="properties.lastIndexInformationLink" target="_blank">
Last index information
</a>
</div>
<!-- </ng-template>-->
<!-- <div class="uk-visible@m uk-margin-top uk-width-1-5">-->

View File

@ -23,6 +23,7 @@ import {HelperFunctions} from "../../utils/HelperFunctions.class";
import {properties} from "../../../../environments/environment";
import {AlertModal} from "../../utils/modal/alert";
import {Subscriber} from "rxjs";
import {IndexInfoService} from "../../utils/indexInfo.service";
declare var UIkit: any;
@ -123,6 +124,7 @@ export class NewSearchPageComponent {
@ViewChild('removeCustomFilter') removeCustomFilter: AlertModal;
currentValueToRemove;
currentFilterToRemove;
public indexUpdateDate: Date;
constructor(private route: ActivatedRoute,
private location: Location,
private _meta: Meta,
@ -131,7 +133,7 @@ export class NewSearchPageComponent {
private router: Router,
private seoService: SEOService,
private helper: HelperService,
private cdr:ChangeDetectorRef) {
private cdr:ChangeDetectorRef, private indexInfoService: IndexInfoService) {
}
ngOnInit() {
@ -179,6 +181,13 @@ export class NewSearchPageComponent {
this.breadcrumbs.push({name: "Advanced Search", route: null});
}
//console.log(this.filters)
if (typeof document !== 'undefined') {
this.subscriptions.push(this.indexInfoService.getLastIndexDate(this.properties).subscribe(lastIndexUpdate => {
if (lastIndexUpdate) {
this.indexUpdateDate = new Date(lastIndexUpdate);
}
}));
}
}
private getPageContents() {
@ -1297,7 +1306,7 @@ public static createRangeFilterQuery(rangeField,selectedFromValue, selectedToVal
if (filter.countSelectedValues > 0) {
for (let value of filter.values) {
if (value.selected == true) {
filterLimits += ((filterLimits.length == 0) ? '' : ',') + '"' + (value.id) + '"';
filterLimits += ((filterLimits.length == 0) ? '' : ',') + '"' + StringUtils.URIEncode(value.id) + '"';
}
}
if (filterLimits.length > 0) {

View File

@ -244,8 +244,12 @@ export class SearchFilterComponent implements OnInit, OnChanges{
}
getParams(filter:Filter, value:Value){
let params = Object.assign({}, this.queryParams);
let isValueSelected = true;
if(params[filter.filterId] && this.checkIfValueIndexOf(params[filter.filterId].split(','),value.id)==-1) {
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) {
//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) {
@ -257,14 +261,9 @@ export class SearchFilterComponent implements OnInit, OnChanges{
if(values.length == 0){
delete params[filter.filterId];
}
isValueSelected = false;
} else{
} else if(!qf){
//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;
params[filter.filterId] = '"' + encodeURIComponent(value.id) + '"' ;
}
delete params['page'];
return params;