Merge Angular 16 Irish Monitor to develop #33
|
@ -71,7 +71,15 @@ export class SearchResearchResultsComponent {
|
|||
public loadPaging: boolean = true;
|
||||
public oldTotalResults: number = 0;
|
||||
@Input() openaireLink: string = null;
|
||||
@Input() customFilter: SearchCustomFilter = null;
|
||||
@Input() customFilters: SearchCustomFilter[] = null;
|
||||
@Input()
|
||||
set customFilter(customFilter: SearchCustomFilter | SearchCustomFilter[]) {
|
||||
if(!Array.isArray(customFilter)) {
|
||||
this.customFilters = [customFilter];
|
||||
}else{
|
||||
this.customFilters = customFilter;
|
||||
}
|
||||
}
|
||||
public pagingLimit: number = 0;
|
||||
properties: EnvProperties = properties;
|
||||
public openaireEntities = OpenaireEntities;
|
||||
|
@ -167,7 +175,7 @@ export class SearchResearchResultsComponent {
|
|||
}
|
||||
this.selectedFields = [];
|
||||
|
||||
this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, this.rangeFields, this.fieldIdsMap,this.customFilter,params, this.resultType, this.quickFilter);
|
||||
this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, this.rangeFields, this.fieldIdsMap,this.customFilters,params, this.resultType, this.quickFilter);
|
||||
if(refine) {
|
||||
this._getFilters(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, 0, "", true, this.searchPage.getSearchAPIQueryForRangeFields(params)+this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
|
||||
} else {
|
||||
|
|
|
@ -4,13 +4,15 @@
|
|||
<div [class.uk-invisible]="list.children.length === 0" class="uk-position-relative">
|
||||
<div class="uk-slider-container">
|
||||
<ul #list class="uk-slider-items uk-grid uk-grid-small uk-margin-small-right uk-flex-nowrap" style="padding-bottom: 1px">
|
||||
<ng-container *ngIf="customFilter && (customFilter.isHiddenFilter)">
|
||||
<ng-container *ngFor="let customFilter of customFilters">
|
||||
<ng-container *ngIf="customFilter.isHiddenFilter">
|
||||
<li class="uk-flex uk-flex-middle">
|
||||
<span class="uk-label uk-label-secondary uk-text-truncate">
|
||||
{{customFilter.valueName}}
|
||||
</span>
|
||||
</li>
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
<ng-container *ngIf="resultTypes && resultTypes.countSelectedValues > 0">
|
||||
<ng-container *ngFor="let type of resultTypes.values; let i = index;">
|
||||
<ng-container *ngIf="type.selected">
|
||||
|
@ -42,7 +44,7 @@
|
|||
<ng-container *ngFor="let filter of filters ">
|
||||
<ng-container *ngIf="filter.countSelectedValues > 0">
|
||||
<ng-container *ngFor="let value of getSelectedValues(filter); let i = index; let end = last; ">
|
||||
<li *ngIf="!customFilter || (customFilter.isHiddenFilter && customFilter.valueId != value.id)"
|
||||
<li *ngIf="!customFilters || (customFilters[0].isHiddenFilter && customFilters[0].valueId != value.id)"
|
||||
class="">
|
||||
<span class="uk-label uk-label-primary uk-flex uk-flex-middle">
|
||||
<span
|
||||
|
@ -176,12 +178,12 @@
|
|||
</div>
|
||||
|
||||
<!-- TODO - Clean up -->
|
||||
<div *ngIf="!includeOnlyResultsAndFilter" [class]="usedBy != 'deposit' && usedBy != 'orcid' && (!customFilter || customFilter.queryFieldName != 'communityId') ?
|
||||
<div *ngIf="!includeOnlyResultsAndFilter" [class]="usedBy != 'deposit' && usedBy != 'orcid' && (!customFilters || customFilters[0].queryFieldName != 'communityId') ?
|
||||
(stickyForm?'':' ') :
|
||||
(+ (stickyForm?'':' uk-section') +' uk-padding-remove-bottom uk-padding-remove-top ' +
|
||||
((usedBy == 'deposit' || usedBy == 'orcid') ? ' uk-padding-remove-top ' : ' '))"
|
||||
[attr.uk-sticky]="((stickyForm || (simpleView && mobile))?'{offset:100;start:90;cls-active:uk-active uk-sticky-below;cls-inactive:uk-sticky '+
|
||||
(usedBy != 'deposit' && usedBy != 'orcid' && (!customFilter || customFilter.queryFieldName != 'communityId') ?
|
||||
(usedBy != 'deposit' && usedBy != 'orcid' && (!customFilters || customFilters[0].queryFieldName != 'communityId') ?
|
||||
' uk-position-relative ' :(' uk-section ' ))+'}':null)">
|
||||
<div class="uk-background-norepeat uk-background-bottom-center" [ngClass]="searchForm.class">
|
||||
<div class="uk-width-1-1">
|
||||
|
@ -207,7 +209,7 @@
|
|||
[advancedSearchLinkParameters]="this.routerHelper.createQueryParams(this.parameterNames, this.parameterValues)"
|
||||
[simpleView]="simpleView" [formPlaceholderText]="formPlaceholderText" [isMobile]="mobile"
|
||||
[resultTypes]="resultTypes" [quickFilter]="quickFilter" [entitiesSelection]="entitiesSelection"
|
||||
[showSwitchSearchLink]="showSwitchSearchLink" [customFilter]="customFilter"
|
||||
[showSwitchSearchLink]="showSwitchSearchLink" [customFilter]="customFilters[0]"
|
||||
>
|
||||
</advanced-search-form>
|
||||
</div>
|
||||
|
@ -270,12 +272,13 @@
|
|||
</div>
|
||||
<div class="uk-width-expand@m uk-with-1-1@s">
|
||||
<div [class.uk-padding-small]="mobile" class="uk-padding-remove-vertical">
|
||||
|
||||
<!-- Related results for Custom Filter Alert -->
|
||||
<div *ngIf="openaireLink && (searchUtils.totalResults > 0 || !loadPaging )"
|
||||
class="uk-alert uk-margin-small-top ">
|
||||
<span *ngIf="customFilter">The following results are related to <span class="uk-text-primary uk-text-bold"
|
||||
<ng-container *ngFor="let customFilter of customFilters">
|
||||
<span *ngIf="customFilter.showFilterMessage">The following results are related to <span class="uk-text-primary uk-text-bold"
|
||||
>{{customFilter.valueName}}</span>.</span>
|
||||
</ng-container>
|
||||
Are you interested to view more results? Visit
|
||||
<a
|
||||
class="uk-margin-top uk-link"
|
||||
|
|
|
@ -69,7 +69,15 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges {
|
|||
@Input() loadPaging: boolean = true;
|
||||
@Input() oldTotalResults: number = 0;
|
||||
@Input() openaireLink: string;
|
||||
@Input() customFilter: SearchCustomFilter;
|
||||
@Input() customFilters: SearchCustomFilter[] = null;
|
||||
@Input()
|
||||
set customFilter(customFilter: SearchCustomFilter | SearchCustomFilter[]) {
|
||||
if(!Array.isArray(customFilter)) {
|
||||
this.customFilters = [customFilter];
|
||||
}else{
|
||||
this.customFilters = customFilter;
|
||||
}
|
||||
}
|
||||
@Input() sort: boolean = true;
|
||||
@Input() sortedByChanged: string = "";
|
||||
@Input() searchForm: SearchForm = {class: 'search-form', dark: true};
|
||||
|
@ -216,14 +224,14 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges {
|
|||
}
|
||||
|
||||
private getPageContents() {
|
||||
this.subscriptions.push(this.helper.getPageHelpContents(this.properties, (this.customFilter && this.customFilter.queryFieldName == "communityId") ? this.customFilter.valueId : this.properties.adminToolsCommunity, this.router.url).subscribe(contents => {
|
||||
this.subscriptions.push(this.helper.getPageHelpContents(this.properties, (this.customFilters && this.customFilters[0].queryFieldName == "communityId") ? this.customFilters[0].valueId : this.properties.adminToolsCommunity, this.router.url).subscribe(contents => {
|
||||
this.pageContents = contents;
|
||||
}));
|
||||
|
||||
}
|
||||
|
||||
private getDivContents() {
|
||||
this.subscriptions.push(this.helper.getDivHelpContents(this.properties, (this.customFilter && this.customFilter.queryFieldName == "communityId") ? this.customFilter.valueId : this.properties.adminToolsCommunity, this.router.url).subscribe(contents => {
|
||||
this.subscriptions.push(this.helper.getDivHelpContents(this.properties, (this.customFilters && this.customFilters[0].queryFieldName == "communityId") ? this.customFilters[0].valueId : this.properties.adminToolsCommunity, this.router.url).subscribe(contents => {
|
||||
this.divContents = contents;
|
||||
}));
|
||||
}
|
||||
|
@ -450,8 +458,12 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges {
|
|||
*/
|
||||
public checkSelectedFilters(filters: Filter[]) {
|
||||
this.filters = filters;
|
||||
if (this.customFilter && !this.customFilter.isHiddenFilter) {
|
||||
this.customFilter.selected = null;
|
||||
if (this.customFilters) {
|
||||
for (let customFilter of this.customFilters) {
|
||||
if (!customFilter.isHiddenFilter) {
|
||||
customFilter.selected = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (var i = 0; i < filters.length; i++) {
|
||||
var filter: Filter = filters[i];
|
||||
|
@ -467,8 +479,10 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges {
|
|||
|
||||
}
|
||||
}
|
||||
if (this.customFilter) {
|
||||
this.customFilter.selected = this.customFilter.queryFieldName == filter.filterId && values.indexOf(StringUtils.quote(this.customFilter.valueId)) != -1;
|
||||
if (this.customFilters) {
|
||||
for (let customFilter of this.customFilters) {
|
||||
customFilter.selected = customFilter.queryFieldName == filter.filterId && values.indexOf(StringUtils.quote(customFilter.valueId)) != -1;
|
||||
}
|
||||
}
|
||||
// } else if (this.quickFilter && this.quickFilter.filterId == filter.filterId && this.quickFilter.selected) {
|
||||
// for (let filterValue of filter.values) {
|
||||
|
@ -488,11 +502,6 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges {
|
|||
// this.quickFilter.filter = filter;
|
||||
// }
|
||||
}
|
||||
if (this.parameterNames.indexOf("cf") != -1 && this.parameterValues[this.parameterNames.indexOf("cf")] == "true") {
|
||||
this.customFilter.selected = true;
|
||||
} else if (this.customFilter && this.customFilter.selected == null) {
|
||||
this.customFilter.selected = false;
|
||||
}
|
||||
this.filterFilterValues(this.filters);
|
||||
if (!this.includeOnlyResultsAndFilter) {
|
||||
this.updateMeta(this.pageTitle);
|
||||
|
@ -1057,8 +1066,12 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges {
|
|||
allFqs += fq;
|
||||
}
|
||||
}
|
||||
if (this.customFilter && (this.customFilter.isHiddenFilter)) {
|
||||
allFqs += "&fq=" + StringUtils.URIEncode(this.customFilter.queryFieldName + " exact " + StringUtils.quote((this.customFilter.valueId)));
|
||||
if (this.customFilters) {
|
||||
for (let customFilter of this.customFilters) {
|
||||
if (customFilter.isHiddenFilter) {
|
||||
allFqs += "&fq=" + StringUtils.URIEncode(customFilter.queryFieldName + " exact " + StringUtils.quote((customFilter.valueId)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* if (this.quickFilter && this.entityType == "result") {
|
||||
|
|
|
@ -27,10 +27,12 @@ export class SearchCustomFilter{
|
|||
valueName:string; // Greece
|
||||
isHiddenFilter:boolean;
|
||||
selected:boolean;
|
||||
constructor( fieldName:string, queryFieldName:string, valueId:string, valueName:string ){
|
||||
showFilterMessage:boolean;
|
||||
constructor( fieldName:string, queryFieldName:string, valueId:string, valueName:string, showFilterMessage:boolean = true ){
|
||||
if(valueId == "test" && properties.environment == "development"){
|
||||
valueId = "covid-19";
|
||||
}
|
||||
this.showFilterMessage = showFilterMessage;
|
||||
this.isHiddenFilter = true;
|
||||
this.fieldName = fieldName;
|
||||
this.queryFieldName = queryFieldName;
|
||||
|
|
Loading…
Reference in New Issue