[Trunk | Library]:
1. newSearchPage.component.html: In search pages show warning message when there is an error (e.g. timeout) getting refine filters. (do not hide message for not available filters when existingFiltersWithValues > 0 - when there are filters created by url) 2. searchResearchResults.component.ts & searchProjects.component.ts & searchOrganizations.component.ts & searchDataProviders.component.ts: a. Set refine to true when there was an error in the previous refine query (searchPage.searchUtils.refineStatus != this.errorCodes.DONE). b. When there is an error getting refine filters, call searchPage.prepareFiltersToShow([], 0) (and prepareRangeFiltersToShow() for results and projects). git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@60992 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
3d7a6e7260
commit
ea1795becc
|
@ -51,9 +51,9 @@ import {properties} from "../../../environments/environment";
|
|||
export class SearchDataProvidersComponent {
|
||||
private errorCodes: ErrorCodes;
|
||||
private errorMessages: ErrorMessagesComponent;
|
||||
@Input() piwikSiteId = null;
|
||||
@Input() customFilter:SearchCustomFilter= null;
|
||||
@Input() tableViewLink;
|
||||
@Input() piwikSiteId = null;
|
||||
@Input() customFilter:SearchCustomFilter= null;
|
||||
@Input() tableViewLink;
|
||||
public results =[];
|
||||
public filters =[];
|
||||
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
|
||||
|
@ -119,12 +119,15 @@ export class SearchDataProvidersComponent {
|
|||
this.oldTotalResults = this.searchUtils.totalResults;
|
||||
}
|
||||
var refine = true;
|
||||
if (params['page'] != undefined && this.filters && !firstLoad && this.searchUtils.page != +params['page']) {
|
||||
refine = false;
|
||||
}
|
||||
if(this.searchPage.searchUtils.refineStatus == this.errorCodes.DONE) {
|
||||
|
||||
if (params['size'] != undefined && this.filters && !firstLoad && this.searchUtils.size != params['size']) {
|
||||
refine = false;
|
||||
if (params['page'] != undefined && this.filters && !firstLoad && this.searchUtils.page != +params['page']) {
|
||||
refine = false;
|
||||
}
|
||||
|
||||
if (params['size'] != undefined && this.filters && !firstLoad && this.searchUtils.size != params['size']) {
|
||||
refine = false;
|
||||
}
|
||||
}
|
||||
|
||||
let page = (params['page']=== undefined)?0:+params['page'];
|
||||
|
@ -183,7 +186,9 @@ export class SearchDataProvidersComponent {
|
|||
this.filtersReturned(refine, filters, totalResults, page);
|
||||
},
|
||||
err => {
|
||||
this.handleError("Error getting organizations: ", err);
|
||||
this.filters = this.searchPage.prepareFiltersToShow([], 0);
|
||||
|
||||
this.handleError("Error getting refine filters for content providers: ", err);
|
||||
this.searchUtils.refineStatus = this.errorMessages.getErrorCode(err.status);
|
||||
|
||||
this.disableRefineForms = false;
|
||||
|
|
|
@ -46,7 +46,7 @@ export class SearchOrganizationsComponent {
|
|||
private errorCodes: ErrorCodes;
|
||||
private errorMessages: ErrorMessagesComponent;
|
||||
properties:EnvProperties;
|
||||
@Input() piwikSiteId = null;
|
||||
@Input() piwikSiteId = null;
|
||||
public results =[];
|
||||
public filters =[];
|
||||
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
|
||||
|
@ -111,12 +111,14 @@ export class SearchOrganizationsComponent {
|
|||
this.oldTotalResults = this.searchUtils.totalResults;
|
||||
}
|
||||
var refine = true;
|
||||
if (params['page'] != undefined && this.filters && !firstLoad && this.searchUtils.page != +params['page']) {
|
||||
refine = false;
|
||||
}
|
||||
if(this.searchPage.searchUtils.refineStatus == this.errorCodes.DONE) {
|
||||
if (params['page'] != undefined && this.filters && !firstLoad && this.searchUtils.page != +params['page']) {
|
||||
refine = false;
|
||||
}
|
||||
|
||||
if (params['size'] != undefined && this.filters && !firstLoad && this.searchUtils.size != params['size']) {
|
||||
refine = false;
|
||||
if (params['size'] != undefined && this.filters && !firstLoad && this.searchUtils.size != params['size']) {
|
||||
refine = false;
|
||||
}
|
||||
}
|
||||
|
||||
let page = (params['page']=== undefined)?1:+params['page'];
|
||||
|
@ -169,7 +171,9 @@ export class SearchOrganizationsComponent {
|
|||
this.filtersReturned(refine, filters, totalResults, page);
|
||||
},
|
||||
err => {
|
||||
this.handleError("Error getting organizations: ", err);
|
||||
this.filters = this.searchPage.prepareFiltersToShow([], 0);
|
||||
|
||||
this.handleError("Error getting refine filters for organizations: ", err);
|
||||
this.searchUtils.refineStatus = this.errorMessages.getErrorCode(err.status);
|
||||
|
||||
this.disableRefineForms = false;
|
||||
|
|
|
@ -113,14 +113,15 @@ export class SearchProjectsComponent {
|
|||
this.oldTotalResults = this.searchUtils.totalResults;
|
||||
}
|
||||
var refine = true;
|
||||
if (params['page'] != undefined && this.filters && !firstLoad && this.searchUtils.page != +params['page']) {
|
||||
refine = false;
|
||||
}
|
||||
if(this.searchPage.searchUtils.refineStatus == this.errorCodes.DONE) {
|
||||
if (params['page'] != undefined && this.filters && !firstLoad && this.searchUtils.page != +params['page']) {
|
||||
refine = false;
|
||||
}
|
||||
|
||||
if (params['size'] != undefined && this.filters && !firstLoad && this.searchUtils.size != params['size']) {
|
||||
refine = false;
|
||||
if (params['size'] != undefined && this.filters && !firstLoad && this.searchUtils.size != params['size']) {
|
||||
refine = false;
|
||||
}
|
||||
}
|
||||
|
||||
let page = (params['page']=== undefined)?1:+params['page'];
|
||||
this.searchUtils.page = ( page <= 0 ) ? 1 : page;
|
||||
|
||||
|
@ -168,7 +169,10 @@ export class SearchProjectsComponent {
|
|||
|
||||
},
|
||||
err => {
|
||||
this.handleError("Error getting projects: ", err);
|
||||
this.filters = this.searchPage.prepareFiltersToShow([], 0);
|
||||
this.rangeFilters = this.searchPage.prepareRangeFiltersToShow();
|
||||
|
||||
this.handleError("Error getting refine filters for projects: ", err);
|
||||
this.searchUtils.refineStatus = this.errorMessages.getErrorCode(err.status);
|
||||
|
||||
this.disableRefineForms = false;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {Component, EventEmitter, Input, OnChanges, Output, SimpleChanges, ViewChild} from '@angular/core';
|
||||
import {Component, EventEmitter, Input, Output, ViewChild} from '@angular/core';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {AdvancedField, Filter} from './searchUtils/searchHelperClasses.class';
|
||||
import {SearchResearchResultsService} from '../services/searchResearchResults.service';
|
||||
|
@ -142,16 +142,18 @@ export class SearchResearchResultsComponent {
|
|||
this.oldTotalResults = this.searchUtils.totalResults;
|
||||
}
|
||||
var refine = true;
|
||||
if (params['page'] != undefined && this.filters && !firstLoad && this.searchUtils.page != +params['page']) {
|
||||
refine = false;
|
||||
}
|
||||
if(this.searchPage.searchUtils.refineStatus == this.errorCodes.DONE) {
|
||||
if (params['page'] != undefined && this.filters && !firstLoad && this.searchUtils.page != +params['page']) {
|
||||
refine = false;
|
||||
}
|
||||
|
||||
if (params['sortBy'] != undefined && this.filters && !firstLoad && this.searchUtils.sortBy != params['sortBy']) {
|
||||
refine = false;
|
||||
}
|
||||
if (params['sortBy'] != undefined && this.filters && !firstLoad && this.searchUtils.sortBy != params['sortBy']) {
|
||||
refine = false;
|
||||
}
|
||||
|
||||
if (params['size'] != undefined && this.filters && !firstLoad && this.searchUtils.size != params['size']) {
|
||||
refine = false;
|
||||
if (params['size'] != undefined && this.filters && !firstLoad && this.searchUtils.size != params['size']) {
|
||||
refine = false;
|
||||
}
|
||||
}
|
||||
|
||||
let page = (params['page'] === undefined) ? 1 : +params['page'];
|
||||
|
@ -246,7 +248,10 @@ export class SearchResearchResultsComponent {
|
|||
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils})
|
||||
},
|
||||
err => {
|
||||
this.handleError("Error getting " + this.getEntityName(this.resultType, true, true), err);
|
||||
this.filters = this.searchPage.prepareFiltersToShow([], 0);
|
||||
this.rangeFilters = this.searchPage.prepareRangeFiltersToShow();
|
||||
|
||||
this.handleError("Error getting refine filters for " + this.getEntityName(this.resultType, true, true), err);
|
||||
this.searchUtils.refineStatus = this.errorMessages.getErrorCode(err.status);
|
||||
|
||||
this.disableRefineForms = false;
|
||||
|
|
|
@ -108,8 +108,10 @@
|
|||
class="'uk-animation-fade uk-margin-top uk-width-1-1" role="alert">
|
||||
<span class="loading-gif uk-align-center" ></span>
|
||||
</div>
|
||||
<div *ngIf="searchUtils.refineStatus != errorCodes.LOADING && existingFiltersWithValues === 0 && results.length > 0" class="uk-margin-top">
|
||||
<span class="uk-text-meta">No filters available</span>
|
||||
<div *ngIf="searchUtils.refineStatus != errorCodes.LOADING && searchUtils.refineStatus != errorCodes.DONE && results.length > 0"
|
||||
class="uk-margin-top uk-text-meta">
|
||||
<span *ngIf="searchUtils.refineStatus == errorCodes.NONE">No filters available</span>
|
||||
<span *ngIf="searchUtils.refineStatus != errorCodes.NONE" class="uk-text-warning">Filters temporarily unavailable. Please try again later.</span>
|
||||
</div>
|
||||
<ul *ngIf="!showUnknownFilters"
|
||||
[class]="'uk-list uk-list-divider' + (selectedRangeFilters == 0 && selectedFilters == 0 ? ' uk-margin-small-top' : '')">
|
||||
|
|
Loading…
Reference in New Issue