[Trunk | Library]:
1. cache-interceptor.service.ts: Added query for refine projects with hidden filters as cachable (to be removed when bug with hidden filters is solved). 2. searchResearchResults.component.ts & searchProjects.component.ts & searchDataProviders.component.ts & searchOrganizations.component.ts: a. [Bug fix - r59155] Update checks for refine query - Do not call refine query when page, results per page, sortBy change. b. Set refineStatus to DONE when no refine query. c. Set new field "searchPage.hideFilters" to false when results return - used only for 1st load (do not show filters, until results return). 3. newSearchPage.component: a. Show "Filters" label always. b. Check if there are filters with method "get existingFiltersWithValues()" instead of "filters.length" (cases where filters > 0, but values = 0). c. Show filters column when "!hideFilters" and there are filters (refine or selected) or when there are results. d. Add in url parameters for "page" and "resultsPerPageChanged" even when they are set to default value (need to separate navigation via menu with no params). 4. searchFilter.component.html: Add "<ng-template #input_label>" for checkboxes and radio buttons in filters (used also in view all part). git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@59163 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
794d565547
commit
8b9ceb091b
|
@ -8,7 +8,10 @@ import { properties } from "../../environments/environment";
|
||||||
})
|
})
|
||||||
export class CacheInterceptorService implements HttpInterceptor {
|
export class CacheInterceptorService implements HttpInterceptor {
|
||||||
cachingRequests = [
|
cachingRequests = [
|
||||||
|
// Remove 2 following lines when bug with hidden refine filters is solved.
|
||||||
"/resources2/?format=json&refine=true&fields=resultbestaccessright&fields=relfunder&fields=relfundinglevel0_id&fields=relproject&fields=instancetypename&fields=resultlanguagename&fields=community&fields=resulthostingdatasource&&fq=resultbestaccessright exact \"Open Access\"&type=results&page=0&size=0",
|
"/resources2/?format=json&refine=true&fields=resultbestaccessright&fields=relfunder&fields=relfundinglevel0_id&fields=relproject&fields=instancetypename&fields=resultlanguagename&fields=community&fields=resulthostingdatasource&&fq=resultbestaccessright exact \"Open Access\"&type=results&page=0&size=0",
|
||||||
|
"/resources2/?format=json&refine=true&fields=funder&fields=fundinglevel0_id&fields=projectstartyear&fields=projectendyear&fields=projectecsc39&&type=projects&page=0&size=0",
|
||||||
|
|
||||||
"/resources2/?format=json&refine=true&fields=resultbestaccessright&fields=relfunder&fields=instancetypename&fields=resultlanguagename&fields=community&fields=resulthostingdatasource&&type=results&page=0&size=0",
|
"/resources2/?format=json&refine=true&fields=resultbestaccessright&fields=relfunder&fields=instancetypename&fields=resultlanguagename&fields=community&fields=resulthostingdatasource&&type=results&page=0&size=0",
|
||||||
"/resources2/?format=json&refine=true&fields=resultbestaccessright&fields=relfunder&fields=relfundinglevel0_id&fields=relproject&fields=instancetypename&fields=resultlanguagename&fields=community&fields=resulthostingdatasource&&fq=resultbestaccessright%20exact%20%22Open%20Access%22&fq=relfunder%20exact%20%22ec__________%3A%3AEC%7C%7CEuropean%20Commission%7C%7CEC%22&type=results&page=0&size=0",
|
"/resources2/?format=json&refine=true&fields=resultbestaccessright&fields=relfunder&fields=relfundinglevel0_id&fields=relproject&fields=instancetypename&fields=resultlanguagename&fields=community&fields=resulthostingdatasource&&fq=resultbestaccessright%20exact%20%22Open%20Access%22&fq=relfunder%20exact%20%22ec__________%3A%3AEC%7C%7CEuropean%20Commission%7C%7CEC%22&type=results&page=0&size=0",
|
||||||
|
|
||||||
|
|
|
@ -120,46 +120,39 @@ export class SearchDataProvidersComponent {
|
||||||
this.oldTotalResults = this.searchUtils.totalResults;
|
this.oldTotalResults = this.searchUtils.totalResults;
|
||||||
}
|
}
|
||||||
var refine = true;
|
var refine = true;
|
||||||
if (
|
if (params['page'] != undefined && this.filters && !firstLoad && this.searchUtils.page != +params['page']) {
|
||||||
(this.searchUtils.page != ((params['page'] === undefined) ? 1 : +params['page'])
|
|
||||||
&& (this.searchUtils.page == 1 || params['page']))
|
|
||||||
&& this.filters && !firstLoad
|
|
||||||
) {
|
|
||||||
refine = false;
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
(
|
|
||||||
this.searchUtils.size != ((params['size'] === undefined) ? 10 : +params['size'])
|
|
||||||
&& (this.searchUtils.size == 10 || params['size'])
|
|
||||||
)
|
|
||||||
&& this.filters && !firstLoad) {
|
|
||||||
refine = false;
|
refine = false;
|
||||||
this.searchUtils.status = this.errorCodes.DONE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let page = (params['page']=== undefined)?0:+params['page'];
|
if (params['size'] != undefined && this.filters && !firstLoad && this.searchUtils.size != params['size']) {
|
||||||
this.searchUtils.page = ( page < 1 ) ? 1 : page;
|
refine = false;
|
||||||
|
}
|
||||||
|
|
||||||
this.searchUtils.size = (params['size']=== undefined)?10:+params['size'];
|
let page = (params['page']=== undefined)?0:+params['page'];
|
||||||
if(this.searchUtils.size != 5 && this.searchUtils.size != 10 && this.searchUtils.size != 20 && this.searchUtils.size != 50) {
|
this.searchUtils.page = ( page < 1 ) ? 1 : page;
|
||||||
this.searchUtils.size = 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.searchPage.fieldIds = this.fieldIds;
|
this.searchUtils.size = (params['size']=== undefined)?10:+params['size'];
|
||||||
this.selectedFields =[];
|
if(this.searchUtils.size != 5 && this.searchUtils.size != 10 && this.searchUtils.size != 20 && this.searchUtils.size != 50) {
|
||||||
if(this.type == "deposit"){
|
this.searchUtils.size = 10;
|
||||||
this.searchPage.keywordFields = this.searchFields.DEPOSIT_DATASOURCE_KEYWORD_FIELDS;
|
}
|
||||||
this.searchPage.usedBy = "deposit";
|
|
||||||
}
|
this.searchPage.fieldIds = this.fieldIds;
|
||||||
// console.log(this.refineFields)
|
this.selectedFields =[];
|
||||||
this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, [], this.fieldIdsMap,this.customFilter,params, "dataprovider");
|
if(this.type == "deposit"){
|
||||||
if(refine && (this.type == "all" || this.type == "deposit")) {
|
this.searchPage.keywordFields = this.searchFields.DEPOSIT_DATASOURCE_KEYWORD_FIELDS;
|
||||||
this._getFilters(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, 0, true, this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
|
this.searchPage.usedBy = "deposit";
|
||||||
} else if(refine) { // static filters
|
}
|
||||||
this.searchUtils.refineStatus = this.errorCodes.LOADING;
|
// console.log(this.refineFields)
|
||||||
}
|
this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, [], this.fieldIdsMap,this.customFilter,params, "dataprovider");
|
||||||
this.getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, this.searchUtils.size, refine, this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
|
if(refine && (this.type == "all" || this.type == "deposit")) {
|
||||||
firstLoad = false;
|
this._getFilters(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, 0, true, this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
|
||||||
|
} else if(refine) { // static filters
|
||||||
|
this.searchUtils.refineStatus = this.errorCodes.LOADING;
|
||||||
|
} else {
|
||||||
|
this.searchUtils.refineStatus = this.errorCodes.DONE;
|
||||||
|
}
|
||||||
|
this.getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, this.searchUtils.size, refine, this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
|
||||||
|
firstLoad = false;
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
|
@ -244,7 +237,10 @@ export class SearchDataProvidersComponent {
|
||||||
this.filters = this.searchPage.prepareFiltersToShow(this.filters, this.searchUtils.totalResults);
|
this.filters = this.searchPage.prepareFiltersToShow(this.filters, this.searchUtils.totalResults);
|
||||||
this.searchUtils.refineStatus = this.errorCodes.DONE;
|
this.searchUtils.refineStatus = this.errorCodes.DONE;
|
||||||
}
|
}
|
||||||
// this.searchPage.updateBaseUrlWithParameters();
|
|
||||||
|
this.searchPage.hideFilters = false;
|
||||||
|
|
||||||
|
// this.searchPage.updateBaseUrlWithParameters();
|
||||||
//var errorCodes:ErrorCodes = new ErrorCodes();
|
//var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.searchUtils.status = this.errorCodes.DONE;
|
this.searchUtils.status = this.errorCodes.DONE;
|
||||||
if(this.searchUtils.totalResults == 0 ){
|
if(this.searchUtils.totalResults == 0 ){
|
||||||
|
@ -287,7 +283,7 @@ export class SearchDataProvidersComponent {
|
||||||
//this.searchPage.closeLoading();
|
//this.searchPage.closeLoading();
|
||||||
this.disableForms = false;
|
this.disableForms = false;
|
||||||
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils});
|
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils});
|
||||||
|
this.searchPage.hideFilters = false;
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,23 +110,12 @@ export class SearchOrganizationsComponent {
|
||||||
this.oldTotalResults = this.searchUtils.totalResults;
|
this.oldTotalResults = this.searchUtils.totalResults;
|
||||||
}
|
}
|
||||||
var refine = true;
|
var refine = true;
|
||||||
if (
|
if (params['page'] != undefined && this.filters && !firstLoad && this.searchUtils.page != +params['page']) {
|
||||||
(
|
|
||||||
this.searchUtils.page != ((params['page'] === undefined) ? 1 : +params['page'])
|
|
||||||
&& (this.searchUtils.page == 1 || params['page'])
|
|
||||||
)
|
|
||||||
&& this.filters && !firstLoad) {
|
|
||||||
refine = false;
|
refine = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (params['size'] != undefined && this.filters && !firstLoad && this.searchUtils.size != params['size']) {
|
||||||
(
|
|
||||||
this.searchUtils.size != ((params['size'] === undefined) ? 10 : +params['size'])
|
|
||||||
&& (this.searchUtils.size == 10 || params['size'])
|
|
||||||
)
|
|
||||||
&& this.filters && !firstLoad) {
|
|
||||||
refine = false;
|
refine = false;
|
||||||
this.searchUtils.status = this.errorCodes.DONE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let page = (params['page']=== undefined)?1:+params['page'];
|
let page = (params['page']=== undefined)?1:+params['page'];
|
||||||
|
@ -146,6 +135,8 @@ export class SearchOrganizationsComponent {
|
||||||
this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, [], this.fieldIdsMap,this.customFilter,params, "organization");
|
this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, [], this.fieldIdsMap,this.customFilter,params, "organization");
|
||||||
if(refine) {
|
if(refine) {
|
||||||
this._getFilters(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, 0, true, this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
|
this._getFilters(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, 0, true, this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
|
||||||
|
} else {
|
||||||
|
this.searchUtils.refineStatus = this.errorCodes.DONE;
|
||||||
}
|
}
|
||||||
this.getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, this.searchUtils.size, refine, this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
|
this.getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, this.searchUtils.size, refine, this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
|
||||||
firstLoad = false;
|
firstLoad = false;
|
||||||
|
@ -223,7 +214,10 @@ export class SearchOrganizationsComponent {
|
||||||
if(!refine) {
|
if(!refine) {
|
||||||
this.searchPage.buildPageURLParameters(this.filters, [],false);
|
this.searchPage.buildPageURLParameters(this.filters, [],false);
|
||||||
}
|
}
|
||||||
// this.searchPage.updateBaseUrlWithParameters();
|
|
||||||
|
this.searchPage.hideFilters = false;
|
||||||
|
|
||||||
|
// this.searchPage.updateBaseUrlWithParameters();
|
||||||
//var errorCodes:ErrorCodes = new ErrorCodes();
|
//var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.searchUtils.status = this.errorCodes.DONE;
|
this.searchUtils.status = this.errorCodes.DONE;
|
||||||
if(this.searchUtils.totalResults == 0 ){
|
if(this.searchUtils.totalResults == 0 ){
|
||||||
|
@ -267,7 +261,7 @@ export class SearchOrganizationsComponent {
|
||||||
//this.searchPage.closeLoading();
|
//this.searchPage.closeLoading();
|
||||||
this.disableForms = false;
|
this.disableForms = false;
|
||||||
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils});
|
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils});
|
||||||
|
this.searchPage.hideFilters = false;
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,38 +113,12 @@ export class SearchProjectsComponent {
|
||||||
this.oldTotalResults = this.searchUtils.totalResults;
|
this.oldTotalResults = this.searchUtils.totalResults;
|
||||||
}
|
}
|
||||||
var refine = true;
|
var refine = true;
|
||||||
if (
|
if (params['page'] != undefined && this.filters && !firstLoad && this.searchUtils.page != +params['page']) {
|
||||||
(
|
|
||||||
this.searchUtils.page != ((params['page'] === undefined) ? 1 : +params['page'])
|
|
||||||
&& (this.searchUtils.page == 1 || params['page'])
|
|
||||||
)
|
|
||||||
&& this.filters && !firstLoad
|
|
||||||
) {
|
|
||||||
refine = false;
|
refine = false;
|
||||||
this.searchUtils.status = this.errorCodes.DONE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (params['size'] != undefined && this.filters && !firstLoad && this.searchUtils.size != params['size']) {
|
||||||
(
|
|
||||||
this.searchUtils.sortBy != ((params['sortBy'] === undefined) ? "" : params['sortBy'])
|
|
||||||
&& (this.searchUtils.sortBy == "" || params['sortBy'])
|
|
||||||
)
|
|
||||||
&& this.filters && !firstLoad
|
|
||||||
) {
|
|
||||||
refine = false;
|
refine = false;
|
||||||
|
|
||||||
this.searchUtils.status = this.errorCodes.DONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
|
||||||
(
|
|
||||||
this.searchUtils.size != ((params['size'] === undefined) ? 10 : +params['size'])
|
|
||||||
&& (this.searchUtils.size == 10 || params['size'])
|
|
||||||
)
|
|
||||||
&& this.filters && !firstLoad
|
|
||||||
) {
|
|
||||||
refine = false;
|
|
||||||
this.searchUtils.status = this.errorCodes.DONE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let page = (params['page']=== undefined)?1:+params['page'];
|
let page = (params['page']=== undefined)?1:+params['page'];
|
||||||
|
@ -160,6 +134,8 @@ export class SearchProjectsComponent {
|
||||||
this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, this.rangeFields, this.fieldIdsMap,this.customFilter,params, "project");
|
this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, this.rangeFields, this.fieldIdsMap,this.customFilter,params, "project");
|
||||||
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 {
|
||||||
|
this.searchUtils.refineStatus = this.errorCodes.DONE;
|
||||||
}
|
}
|
||||||
this.getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, this.searchUtils.size, refine, this.searchPage.getSearchAPIQueryForRangeFields(params)+this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
|
this.getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, this.searchUtils.size, refine, this.searchPage.getSearchAPIQueryForRangeFields(params)+this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
|
||||||
firstLoad = false;
|
firstLoad = false;
|
||||||
|
@ -242,6 +218,8 @@ export class SearchProjectsComponent {
|
||||||
this.searchPage.buildPageURLParameters(this.filters, this.rangeFilters, false);
|
this.searchPage.buildPageURLParameters(this.filters, this.rangeFilters, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.searchPage.hideFilters = false;
|
||||||
|
|
||||||
//var errorCodes:ErrorCodes = new ErrorCodes();
|
//var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.searchUtils.status = this.errorCodes.DONE;
|
this.searchUtils.status = this.errorCodes.DONE;
|
||||||
if(this.searchUtils.totalResults == 0 ){
|
if(this.searchUtils.totalResults == 0 ){
|
||||||
|
@ -285,7 +263,7 @@ export class SearchProjectsComponent {
|
||||||
//this.searchPage.closeLoading();
|
//this.searchPage.closeLoading();
|
||||||
this.disableForms = false;
|
this.disableForms = false;
|
||||||
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils})
|
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils})
|
||||||
|
this.searchPage.hideFilters = false;
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,37 +118,16 @@ export class SearchResearchResultsComponent {
|
||||||
this.oldTotalResults = this.searchUtils.totalResults;
|
this.oldTotalResults = this.searchUtils.totalResults;
|
||||||
}
|
}
|
||||||
var refine = true;
|
var refine = true;
|
||||||
if (
|
if (params['page'] != undefined && this.filters && !firstLoad && this.searchUtils.page != +params['page']) {
|
||||||
(
|
|
||||||
this.searchUtils.page != ((params['page'] === undefined) ? 1 : +params['page'])
|
|
||||||
&& (this.searchUtils.page == 1 || params['page'])
|
|
||||||
)
|
|
||||||
&& this.filters && !firstLoad
|
|
||||||
) {
|
|
||||||
refine = false;
|
refine = false;
|
||||||
this.searchUtils.status = this.errorCodes.DONE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (params['sortBy'] != undefined && this.filters && !firstLoad && this.searchUtils.sortBy != params['sortBy']) {
|
||||||
(
|
|
||||||
this.searchUtils.sortBy != ((params['sortBy'] === undefined) ? "" : params['sortBy'])
|
|
||||||
&& (this.searchUtils.sortBy == "" || params['sortBy'])
|
|
||||||
)
|
|
||||||
&& this.filters && !firstLoad
|
|
||||||
) {
|
|
||||||
refine = false;
|
refine = false;
|
||||||
this.searchUtils.status = this.errorCodes.DONE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (params['size'] != undefined && this.filters && !firstLoad && this.searchUtils.size != params['size']) {
|
||||||
(
|
|
||||||
this.searchUtils.size != ((params['size'] === undefined) ? 10 : +params['size'])
|
|
||||||
&& (this.searchUtils.size == 10 || params['size'])
|
|
||||||
)
|
|
||||||
&& this.filters && !firstLoad
|
|
||||||
) {
|
|
||||||
refine = false;
|
refine = false;
|
||||||
this.searchUtils.status = this.errorCodes.DONE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let page = (params['page'] === undefined) ? 1 : +params['page'];
|
let page = (params['page'] === undefined) ? 1 : +params['page'];
|
||||||
|
@ -167,6 +146,8 @@ export class SearchResearchResultsComponent {
|
||||||
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.customFilter,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 {
|
||||||
|
this.searchUtils.refineStatus = this.errorCodes.DONE;
|
||||||
}
|
}
|
||||||
this._getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, this.searchUtils.size, this.searchUtils.sortBy, refine, this.searchPage.getSearchAPIQueryForRangeFields(params) + this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
|
this._getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, this.searchUtils.size, this.searchUtils.sortBy, refine, this.searchPage.getSearchAPIQueryForRangeFields(params) + this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
|
||||||
firstLoad = false;
|
firstLoad = false;
|
||||||
|
@ -243,6 +224,8 @@ export class SearchResearchResultsComponent {
|
||||||
this.searchPage.buildPageURLParameters(this.filters, this.rangeFilters, false);
|
this.searchPage.buildPageURLParameters(this.filters, this.rangeFilters, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.searchPage.hideFilters = false;
|
||||||
|
|
||||||
this.searchUtils.status = this.errorCodes.DONE;
|
this.searchUtils.status = this.errorCodes.DONE;
|
||||||
if (this.searchUtils.totalResults == 0) {
|
if (this.searchUtils.totalResults == 0) {
|
||||||
this.searchUtils.status = this.errorCodes.NONE;
|
this.searchUtils.status = this.errorCodes.NONE;
|
||||||
|
@ -283,7 +266,7 @@ export class SearchResearchResultsComponent {
|
||||||
//this.searchPage.closeLoading();
|
//this.searchPage.closeLoading();
|
||||||
this.disableForms = false;
|
this.disableForms = false;
|
||||||
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils})
|
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils})
|
||||||
|
this.searchPage.hideFilters = false;
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,8 +83,9 @@
|
||||||
<ng-template #filters_column>
|
<ng-template #filters_column>
|
||||||
<div class="uk-width-1-1 uk-margin-top">
|
<div class="uk-width-1-1 uk-margin-top">
|
||||||
<div class="uk-grid uk-flex uk-flex-bottom">
|
<div class="uk-grid uk-flex uk-flex-bottom">
|
||||||
<h5 *ngIf="(selectedRangeFilters+selectedFilters + selectedTypesNum > 0) || (filters.length > 0 && (results.length > 0 || disableForms))"
|
<!-- *ngIf="(selectedRangeFilters+selectedFilters + selectedTypesNum > 0)
|
||||||
class="uk-text-bold">
|
|| (filters.length > 0 && (results.length > 0 || disableForms))"-->
|
||||||
|
<h5 class="uk-text-bold">
|
||||||
Filters
|
Filters
|
||||||
</h5>
|
</h5>
|
||||||
<a *ngIf="(selectedRangeFilters+selectedFilters + selectedTypesNum)>1" (click)="clearFilters()"
|
<a *ngIf="(selectedRangeFilters+selectedFilters + selectedTypesNum)>1" (click)="clearFilters()"
|
||||||
|
@ -97,12 +98,11 @@
|
||||||
<ng-container *ngTemplateOutlet="selected_filters_pills; context: {}"></ng-container>
|
<ng-container *ngTemplateOutlet="selected_filters_pills; context: {}"></ng-container>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="searchUtils.refineStatus == errorCodes.LOADING && filters.length === 0"
|
<div *ngIf="searchUtils.refineStatus == errorCodes.LOADING && existingFiltersWithValues === 0"
|
||||||
class="'uk-animation-fade uk-margin-top uk-width-1-1" role="alert">
|
class="'uk-animation-fade uk-margin-top uk-width-1-1" role="alert">
|
||||||
<span class="loading-gif uk-align-center" ></span>
|
<span class="loading-gif uk-align-center" ></span>
|
||||||
</div>
|
</div>
|
||||||
|
<div *ngIf="searchUtils.refineStatus != errorCodes.LOADING && existingFiltersWithValues === 0 && results.length > 0" class="uk-margin-top">
|
||||||
<div *ngIf="searchUtils.refineStatus == errorCodes.DONE && filters.length === 0 && results.length > 0" class="uk-margin-top">
|
|
||||||
<span class="uk-text-meta">No filters available</span>
|
<span class="uk-text-meta">No filters available</span>
|
||||||
</div>
|
</div>
|
||||||
<ul *ngIf="!showUnknownFilters"
|
<ul *ngIf="!showUnknownFilters"
|
||||||
|
@ -260,16 +260,20 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="uk-grid helper-grid uk-padding-small uk-padding-remove-vertical uk-margin-large-bottom">
|
<div class="uk-grid helper-grid uk-padding-small uk-padding-remove-vertical uk-margin-large-bottom">
|
||||||
<!-- && searchUtils.refineStatus == errorCodes.LOADING-->
|
<!-- <div *ngIf="searchUtils.status == errorCodes.LOADING && filters.length == 0;-->
|
||||||
<div *ngIf="searchUtils.status == errorCodes.LOADING && filters.length == 0;
|
<!-- else elseGridBlock"-->
|
||||||
else elseGridBlock"
|
<!-- class="'uk-animation-fade uk-margin-top uk-width-1-1" role="alert">-->
|
||||||
class="'uk-animation-fade uk-margin-top uk-width-1-1" role="alert">
|
<!-- <span class="loading-gif uk-align-center" ></span>-->
|
||||||
<span class="loading-gif uk-align-center" ></span>
|
<!-- </div>-->
|
||||||
</div>
|
<!-- <div>-->
|
||||||
<div>
|
<!-- <ng-template #elseGridBlock>-->
|
||||||
<ng-template #elseGridBlock>
|
<div *ngIf="showRefine && !properties.isDashboard
|
||||||
|
&& (results.length > 0
|
||||||
<div *ngIf="showRefine && !properties.isDashboard" class="uk-width-1-4@m search-filters uk-visible@m">
|
|| (!hideFilters &&
|
||||||
|
(existingFiltersWithValues > 0 || (selectedRangeFilters + selectedFilters + selectedTypesNum) > 0)
|
||||||
|
)
|
||||||
|
)"
|
||||||
|
class="uk-width-1-4@m search-filters uk-visible@m">
|
||||||
<ng-container *ngTemplateOutlet="filters_column; context: {}"></ng-container>
|
<ng-container *ngTemplateOutlet="filters_column; context: {}"></ng-container>
|
||||||
</div>
|
</div>
|
||||||
<div class="uk-width-expand@m uk-with-1-1@s">
|
<div class="uk-width-expand@m uk-with-1-1@s">
|
||||||
|
@ -381,12 +385,12 @@
|
||||||
Last index information
|
Last index information
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</ng-template>
|
<!-- </ng-template>-->
|
||||||
<!-- <div class="uk-visible@m uk-margin-top uk-width-1-5">-->
|
<!-- <div class="uk-visible@m uk-margin-top uk-width-1-5">-->
|
||||||
<!-- <search-download [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults" ></search-download>-->
|
<!-- <search-download [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults" ></search-download>-->
|
||||||
<!-- </div>-->
|
<!-- </div>-->
|
||||||
<!-- <helper *ngIf="searchUtils.totalResults > csvLimit" class="uk-margin-top helper-left-right uk-visible@m" position="right"></helper> -->
|
<!-- <helper *ngIf="searchUtils.totalResults > csvLimit" class="uk-margin-top helper-left-right uk-visible@m" position="right"></helper> -->
|
||||||
</div>
|
<!-- </div>-->
|
||||||
|
|
||||||
<helper *ngIf="pageContents && pageContents['bottom'] && pageContents['bottom'].length > 0"
|
<helper *ngIf="pageContents && pageContents['bottom'] && pageContents['bottom'].length > 0"
|
||||||
[texts]="pageContents['bottom']"></helper>
|
[texts]="pageContents['bottom']"></helper>
|
||||||
|
@ -420,3 +424,4 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
|
@ -30,7 +30,6 @@ declare var UIkit: any;
|
||||||
})
|
})
|
||||||
export class NewSearchPageComponent {
|
export class NewSearchPageComponent {
|
||||||
@ViewChild('offcanvas_element') offcanvasElement: ElementRef;
|
@ViewChild('offcanvas_element') offcanvasElement: ElementRef;
|
||||||
|
|
||||||
@Input() piwikSiteId = null;
|
@Input() piwikSiteId = null;
|
||||||
@Input() hasPrefix: boolean = true;
|
@Input() hasPrefix: boolean = true;
|
||||||
@Input() pageTitle = "";
|
@Input() pageTitle = "";
|
||||||
|
@ -108,6 +107,9 @@ export class NewSearchPageComponent {
|
||||||
@Input() entitiesSelection:boolean = true;
|
@Input() entitiesSelection:boolean = true;
|
||||||
@Input() showAdvancedSearchLink:boolean = true;
|
@Input() showAdvancedSearchLink:boolean = true;
|
||||||
|
|
||||||
|
// on 1st load, do not show filters until results query returns.
|
||||||
|
public hideFilters: boolean = true;
|
||||||
|
|
||||||
//Dashboard
|
//Dashboard
|
||||||
filterToggle = false;
|
filterToggle = false;
|
||||||
customFilterEnabled:boolean = false;
|
customFilterEnabled:boolean = false;
|
||||||
|
@ -485,6 +487,13 @@ export class NewSearchPageComponent {
|
||||||
return this.rangeFilters;
|
return this.rangeFilters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get existingFiltersWithValues() {
|
||||||
|
if(this.filters.length == 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return this.filters.some(filter => (filter.values && filter.values.length > 0));
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For Funder filters - if funder selected
|
* For Funder filters - if funder selected
|
||||||
*/
|
*/
|
||||||
|
@ -1165,13 +1174,13 @@ public static createRangeFilterQuery(rangeField,selectedFromValue, selectedToVal
|
||||||
this.parameterValues.push(StringUtils.URIEncode(this.selectedFields[i].value));
|
this.parameterValues.push(StringUtils.URIEncode(this.selectedFields[i].value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (includePage && this.searchUtils.page != 1) {
|
if (includePage) {
|
||||||
this.parameterNames.push("page");
|
this.parameterNames.push("page");
|
||||||
this.parameterValues.push("" + this.searchUtils.page);
|
this.parameterValues.push("" + this.searchUtils.page);
|
||||||
}
|
}
|
||||||
|
|
||||||
//if (this.searchUtils.size != this.resultsPerPage) {
|
//if (this.searchUtils.size != this.resultsPerPage) {
|
||||||
if (this.resultsPerPageChanged && this.resultsPerPageChanged != this.resultsPerPage) {
|
if (this.resultsPerPageChanged) {
|
||||||
this.parameterNames.push("size");
|
this.parameterNames.push("size");
|
||||||
//this.parameterValues.push("" + this.searchUtils.size);
|
//this.parameterValues.push("" + this.searchUtils.size);
|
||||||
this.parameterValues.push("" + this.resultsPerPageChanged);
|
this.parameterValues.push("" + this.resultsPerPageChanged);
|
||||||
|
|
|
@ -9,47 +9,10 @@
|
||||||
<div aria-expanded="false">
|
<div aria-expanded="false">
|
||||||
<div>
|
<div>
|
||||||
<ng-container>
|
<ng-container>
|
||||||
<!-- <div *ngFor = "let value of getSelectedValues(filter,'num')" class="uk-animation-fade filterItem searchFilterItem uk-text-small">-->
|
|
||||||
<!-- <div title = "{{value.name}}">-->
|
|
||||||
<!-- <ng-container *ngIf="filter.filterType == 'checkbox' || filter.filterType == 'radio'">-->
|
|
||||||
<!-- <input *ngIf="filter.filterType == 'checkbox'" [(ngModel)]="value.selected" type="checkbox" (ngModelChange)="filterChange(value.selected)" />-->
|
|
||||||
<!-- <input *ngIf="filter.filterType == 'radio'" type="radio" (click)="uniqueFilterChange(value)"-->
|
|
||||||
<!-- [name]=filter.filterId checked/>-->
|
|
||||||
<!-- {{' '+_formatName(value)}}-->
|
|
||||||
<!-- <span *ngIf = "showResultCount === true" >-->
|
|
||||||
<!-- {{' ('+(value.number|number)+')'}}</span>-->
|
|
||||||
<!-- </ng-container>-->
|
|
||||||
<!-- </div>-->
|
|
||||||
<!-- </div>-->
|
|
||||||
|
|
||||||
<!-- <div *ngFor = "let value of getNotSelectedValues(filter,'num').slice(0,(!addShowMore?getNotSelectedValues(filter,'num').length:filterValuesNum-getSelectedValues(filter,'num').length))" class = "uk-animation-fade filterItem searchFilterItem uk-text-small">-->
|
|
||||||
<!-- <div title = "{{value.name}}" [class]="(isDisabled || (showResultCount && value.number === 0))?'uk-text-muted':''" >-->
|
|
||||||
<!-- <input *ngIf="filter.filterType == 'checkbox'" [disabled]="isDisabled || (showResultCount && value.number === 0)" [(ngModel)]="value.selected" type="checkbox" (ngModelChange)="filterChange(value.selected)" />-->
|
|
||||||
<!-- <input *ngIf="filter.filterType == 'radio'" [disabled]="isDisabled || (showResultCount && value.number === 0)" type="radio" (click)="uniqueFilterChange(value)"-->
|
|
||||||
<!-- [name]=filter.filterId value=false />-->
|
|
||||||
<!-- {{' '+ _formatName(value) }}-->
|
|
||||||
<!-- <span *ngIf = "showResultCount === true" [class]="(isDisabled || value.number === 0)?'uk-text-muted':''" >-->
|
|
||||||
<!-- {{' ('+(value.number|number)+')'}}-->
|
|
||||||
<!-- </span>-->
|
|
||||||
<!-- </div>-->
|
|
||||||
<!-- </div>-->
|
|
||||||
|
|
||||||
<div *ngFor="let value of getSelectedAndTopValues(filter, filterValuesNum)"
|
<div *ngFor="let value of getSelectedAndTopValues(filter, filterValuesNum)"
|
||||||
class="uk-animation-fade filterItem searchFilterItem uk-text-small">
|
class="uk-animation-fade filterItem searchFilterItem uk-text-small">
|
||||||
<div title = "{{value.name}}">
|
<div title = "{{value.name}}">
|
||||||
<label *ngIf="filter.filterType == 'checkbox' || filter.filterType == 'radio'"
|
<ng-container *ngTemplateOutlet="input_label; context: {filter: filter, value: value}"></ng-container>
|
||||||
[class]="(isDisabled || (showResultCount && value.number === 0)) ? 'uk-disabled' : ''">
|
|
||||||
<!-- [disabled]="isDisabled || (showResultCount && value.number === 0)"-->
|
|
||||||
<input *ngIf="filter.filterType == 'checkbox'" type="checkbox" class="uk-checkbox"
|
|
||||||
[(ngModel)]="value.selected" (ngModelChange)="filterChange(value.selected)" />
|
|
||||||
<input *ngIf="filter.filterType == 'radio'" type="radio" class="uk-radio"
|
|
||||||
[name]="filter.filterId" [value]="value.id" [(ngModel)]="filter.radioValue"
|
|
||||||
(ngModelChange)="uniqueFilterChange(value)"/>
|
|
||||||
{{' '+_formatName(value)}}
|
|
||||||
<span *ngIf = "showResultCount === true" >
|
|
||||||
{{' ('+(value.number|number)+')'}}
|
|
||||||
</span>
|
|
||||||
</label>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
@ -93,45 +56,10 @@
|
||||||
|
|
||||||
<div class="uk-overflow-auto uk-height-max-small uk-padding-remove
|
<div class="uk-overflow-auto uk-height-max-small uk-padding-remove
|
||||||
uk-margin-small-left uk-margin-small-right uk-margin-small-top uk-width-1-1">
|
uk-margin-small-left uk-margin-small-right uk-margin-small-top uk-width-1-1">
|
||||||
<!-- <ng-container *ngFor = "let value of getSelectedValues(filter, sortBy)">-->
|
|
||||||
<!-- <div *ngIf="filterKeywords(value.name)" class = "uk-animation-fade filterItem searchFilterItem">-->
|
|
||||||
|
|
||||||
<!-- <div title = "{{value.name}}">-->
|
|
||||||
<!-- <input *ngIf="filter.filterType == 'checkbox'" [disabled]="isDisabled" [(ngModel)]="value.selected" type="checkbox" (ngModelChange)="filterChange(value.selected)" />-->
|
|
||||||
<!-- <input *ngIf="filter.filterType == 'radio'" [disabled]="isDisabled" type="radio" (click)="uniqueFilterChange(value)"-->
|
|
||||||
<!-- [name]=filter.filterId checked/>-->
|
|
||||||
<!-- {{' ' + _formatName(value) + ' '}}-->
|
|
||||||
<!-- <span class="filterNumber" *ngIf = "showResultCount === true" > ({{value.number|number}})</span>-->
|
|
||||||
<!-- </div>-->
|
|
||||||
|
|
||||||
<!-- </div>-->
|
|
||||||
<!-- </ng-container>-->
|
|
||||||
|
|
||||||
<!-- <ng-container *ngFor = "let value of getNotSelectedValues(filter, sortBy)">-->
|
|
||||||
<!-- <div *ngIf="filterKeywords(value.name)" class = "uk-animation-fade filterItem searchFilterItem">-->
|
|
||||||
|
|
||||||
<!-- <div title = "{{value.name}}">-->
|
|
||||||
<!-- <input *ngIf="filter.filterType == 'checkbox'" [disabled]="isDisabled" [(ngModel)]="value.selected" type="checkbox" (ngModelChange)="filterChange(value.selected)" />-->
|
|
||||||
<!-- <input *ngIf="filter.filterType == 'radio'" [disabled]="isDisabled" type="radio" (click)="uniqueFilterChange(value)"-->
|
|
||||||
<!-- [name]=filter.filterId value=false />-->
|
|
||||||
<!-- {{' ' + _formatName(value) + ' '}}-->
|
|
||||||
<!-- <span *ngIf = "showResultCount === true" > ({{value.number|number}})</span>-->
|
|
||||||
<!-- </div>-->
|
|
||||||
<!-- </div>-->
|
|
||||||
<!-- </ng-container>-->
|
|
||||||
<ng-container *ngFor="let value of sort(filter.values)">
|
<ng-container *ngFor="let value of sort(filter.values)">
|
||||||
<div *ngIf="filterKeywords(value.name)" title = "{{value.name}}"
|
<div *ngIf="filterKeywords(value.name)" title = "{{value.name}}"
|
||||||
class="uk-animation-fade filterItem searchFilterItem uk-text-small">
|
class="uk-animation-fade filterItem searchFilterItem uk-text-small">
|
||||||
<label *ngIf="filter.filterType == 'checkbox' || filter.filterType == 'radio'">
|
<ng-container *ngTemplateOutlet="input_label; context: {filter: filter, value: value}"></ng-container>
|
||||||
<input *ngIf="filter.filterType == 'checkbox'" type="checkbox" class="uk-checkbox"
|
|
||||||
[(ngModel)]="value.selected" (ngModelChange)="filterChange(value.selected)" />
|
|
||||||
<input *ngIf="filter.filterType == 'radio'" type="radio" class="uk-radio"
|
|
||||||
[disabled]="isDisabled || (showResultCount && value.number === 0)"
|
|
||||||
[name]="value.id" [value]="true" [(ngModel)]="value.selected" (click)="uniqueFilterChange(value)"/>
|
|
||||||
{{' '+_formatName(value)}}
|
|
||||||
<span *ngIf = "showResultCount === true" >
|
|
||||||
{{' ('+(value.number|number)+')'}}</span>
|
|
||||||
</label>
|
|
||||||
</div>
|
</div>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</div>
|
</div>
|
||||||
|
@ -144,3 +72,20 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<ng-template #input_label let-filter="filter" let-value="value">
|
||||||
|
<label *ngIf="filter.filterType == 'checkbox' || filter.filterType == 'radio'"
|
||||||
|
[class]="(isDisabled || (showResultCount && value.number === 0)) ? 'uk-disabled' : ''">
|
||||||
|
<input *ngIf="filter.filterType == 'checkbox'" type="checkbox" class="uk-checkbox"
|
||||||
|
[disabled]="isDisabled || (showResultCount && value.number === 0)"
|
||||||
|
[(ngModel)]="value.selected" (ngModelChange)="filterChange(value.selected)" />
|
||||||
|
<input *ngIf="filter.filterType == 'radio'" type="radio" class="uk-radio"
|
||||||
|
[disabled]="isDisabled || (showResultCount && value.number === 0)"
|
||||||
|
[name]="filter.filterId" [value]="value.id" [(ngModel)]="filter.radioValue"
|
||||||
|
(ngModelChange)="uniqueFilterChange(value)"/>
|
||||||
|
{{' '+_formatName(value)}}
|
||||||
|
<span *ngIf = "showResultCount === true" >
|
||||||
|
{{' ('+(value.number|number)+')'}}
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
</ng-template>
|
||||||
|
|
Loading…
Reference in New Issue