Merge Angular 16 Irish Monitor to develop #33

Merged
k.triantafyllou merged 151 commits from angular-16-irish-monitor into develop 2024-02-13 09:32:41 +01:00
4 changed files with 51 additions and 25 deletions
Showing only changes of commit 62d4ab1a36 - Show all commits

View File

@ -71,7 +71,15 @@ export class SearchResearchResultsComponent {
public loadPaging: boolean = true; public loadPaging: boolean = true;
public oldTotalResults: number = 0; public oldTotalResults: number = 0;
@Input() openaireLink: string = null; @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; public pagingLimit: number = 0;
properties: EnvProperties = properties; properties: EnvProperties = properties;
public openaireEntities = OpenaireEntities; public openaireEntities = OpenaireEntities;
@ -167,7 +175,7 @@ export class SearchResearchResultsComponent {
} }
this.selectedFields = []; 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) { if(refine) {
this._getFilters(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, 0, "", true, this.searchPage.getSearchAPIQueryForRangeFields(params)+this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad)); this._getFilters(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, 0, "", true, this.searchPage.getSearchAPIQueryForRangeFields(params)+this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
} else { } else {

View File

@ -4,13 +4,15 @@
<div [class.uk-invisible]="list.children.length === 0" class="uk-position-relative"> <div [class.uk-invisible]="list.children.length === 0" class="uk-position-relative">
<div class="uk-slider-container"> <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"> <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"> <li class="uk-flex uk-flex-middle">
<span class="uk-label uk-label-secondary uk-text-truncate"> <span class="uk-label uk-label-secondary uk-text-truncate">
{{customFilter.valueName}} {{customFilter.valueName}}
</span> </span>
</li> </li>
</ng-container> </ng-container>
</ng-container>
<ng-container *ngIf="resultTypes && resultTypes.countSelectedValues > 0"> <ng-container *ngIf="resultTypes && resultTypes.countSelectedValues > 0">
<ng-container *ngFor="let type of resultTypes.values; let i = index;"> <ng-container *ngFor="let type of resultTypes.values; let i = index;">
<ng-container *ngIf="type.selected"> <ng-container *ngIf="type.selected">
@ -42,7 +44,7 @@
<ng-container *ngFor="let filter of filters "> <ng-container *ngFor="let filter of filters ">
<ng-container *ngIf="filter.countSelectedValues > 0"> <ng-container *ngIf="filter.countSelectedValues > 0">
<ng-container *ngFor="let value of getSelectedValues(filter); let i = index; let end = last; "> <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=""> class="">
<span class="uk-label uk-label-primary uk-flex uk-flex-middle"> <span class="uk-label uk-label-primary uk-flex uk-flex-middle">
<span <span
@ -176,12 +178,12 @@
</div> </div>
<!-- TODO - Clean up --> <!-- 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?'':' ') :
(+ (stickyForm?'':' uk-section') +' uk-padding-remove-bottom uk-padding-remove-top ' + (+ (stickyForm?'':' uk-section') +' uk-padding-remove-bottom uk-padding-remove-top ' +
((usedBy == 'deposit' || usedBy == 'orcid') ? ' 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 '+ [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)"> ' uk-position-relative ' :(' uk-section ' ))+'}':null)">
<div class="uk-background-norepeat uk-background-bottom-center" [ngClass]="searchForm.class"> <div class="uk-background-norepeat uk-background-bottom-center" [ngClass]="searchForm.class">
<div class="uk-width-1-1"> <div class="uk-width-1-1">
@ -207,7 +209,7 @@
[advancedSearchLinkParameters]="this.routerHelper.createQueryParams(this.parameterNames, this.parameterValues)" [advancedSearchLinkParameters]="this.routerHelper.createQueryParams(this.parameterNames, this.parameterValues)"
[simpleView]="simpleView" [formPlaceholderText]="formPlaceholderText" [isMobile]="mobile" [simpleView]="simpleView" [formPlaceholderText]="formPlaceholderText" [isMobile]="mobile"
[resultTypes]="resultTypes" [quickFilter]="quickFilter" [entitiesSelection]="entitiesSelection" [resultTypes]="resultTypes" [quickFilter]="quickFilter" [entitiesSelection]="entitiesSelection"
[showSwitchSearchLink]="showSwitchSearchLink" [customFilter]="customFilter" [showSwitchSearchLink]="showSwitchSearchLink" [customFilter]="customFilters[0]"
> >
</advanced-search-form> </advanced-search-form>
</div> </div>
@ -270,12 +272,13 @@
</div> </div>
<div class="uk-width-expand@m uk-with-1-1@s"> <div class="uk-width-expand@m uk-with-1-1@s">
<div [class.uk-padding-small]="mobile" class="uk-padding-remove-vertical"> <div [class.uk-padding-small]="mobile" class="uk-padding-remove-vertical">
<!-- Related results for Custom Filter Alert --> <!-- Related results for Custom Filter Alert -->
<div *ngIf="openaireLink && (searchUtils.totalResults > 0 || !loadPaging )" <div *ngIf="openaireLink && (searchUtils.totalResults > 0 || !loadPaging )"
class="uk-alert uk-margin-small-top "> 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> >{{customFilter.valueName}}</span>.</span>
</ng-container>
Are you interested to view more results? Visit Are you interested to view more results? Visit
<a <a
class="uk-margin-top uk-link" class="uk-margin-top uk-link"

View File

@ -69,7 +69,15 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges {
@Input() loadPaging: boolean = true; @Input() loadPaging: boolean = true;
@Input() oldTotalResults: number = 0; @Input() oldTotalResults: number = 0;
@Input() openaireLink: string; @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() sort: boolean = true;
@Input() sortedByChanged: string = ""; @Input() sortedByChanged: string = "";
@Input() searchForm: SearchForm = {class: 'search-form', dark: true}; @Input() searchForm: SearchForm = {class: 'search-form', dark: true};
@ -216,14 +224,14 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges {
} }
private getPageContents() { 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; this.pageContents = contents;
})); }));
} }
private getDivContents() { 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; this.divContents = contents;
})); }));
} }
@ -450,8 +458,12 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges {
*/ */
public checkSelectedFilters(filters: Filter[]) { public checkSelectedFilters(filters: Filter[]) {
this.filters = filters; this.filters = filters;
if (this.customFilter && !this.customFilter.isHiddenFilter) { if (this.customFilters) {
this.customFilter.selected = null; for (let customFilter of this.customFilters) {
if (!customFilter.isHiddenFilter) {
customFilter.selected = null;
}
}
} }
for (var i = 0; i < filters.length; i++) { for (var i = 0; i < filters.length; i++) {
var filter: Filter = filters[i]; var filter: Filter = filters[i];
@ -467,8 +479,10 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges {
} }
} }
if (this.customFilter) { if (this.customFilters) {
this.customFilter.selected = this.customFilter.queryFieldName == filter.filterId && values.indexOf(StringUtils.quote(this.customFilter.valueId)) != -1; 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) { // } else if (this.quickFilter && this.quickFilter.filterId == filter.filterId && this.quickFilter.selected) {
// for (let filterValue of filter.values) { // for (let filterValue of filter.values) {
@ -488,11 +502,6 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges {
// this.quickFilter.filter = filter; // 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); this.filterFilterValues(this.filters);
if (!this.includeOnlyResultsAndFilter) { if (!this.includeOnlyResultsAndFilter) {
this.updateMeta(this.pageTitle); this.updateMeta(this.pageTitle);
@ -1057,8 +1066,12 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges {
allFqs += fq; allFqs += fq;
} }
} }
if (this.customFilter && (this.customFilter.isHiddenFilter)) { if (this.customFilters) {
allFqs += "&fq=" + StringUtils.URIEncode(this.customFilter.queryFieldName + " exact " + StringUtils.quote((this.customFilter.valueId))); 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") { /* if (this.quickFilter && this.entityType == "result") {

View File

@ -27,10 +27,12 @@ export class SearchCustomFilter{
valueName:string; // Greece valueName:string; // Greece
isHiddenFilter:boolean; isHiddenFilter:boolean;
selected: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"){ if(valueId == "test" && properties.environment == "development"){
valueId = "covid-19"; valueId = "covid-19";
} }
this.showFilterMessage = showFilterMessage;
this.isHiddenFilter = true; this.isHiddenFilter = true;
this.fieldName = fieldName; this.fieldName = fieldName;
this.queryFieldName = queryFieldName; this.queryFieldName = queryFieldName;