[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 {
|
||||
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=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=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;
|
||||
}
|
||||
var refine = true;
|
||||
if (
|
||||
(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) {
|
||||
if (params['page'] != undefined && this.filters && !firstLoad && this.searchUtils.page != +params['page']) {
|
||||
refine = false;
|
||||
this.searchUtils.status = this.errorCodes.DONE;
|
||||
}
|
||||
|
||||
let page = (params['page']=== undefined)?0:+params['page'];
|
||||
this.searchUtils.page = ( page < 1 ) ? 1 : page;
|
||||
if (params['size'] != undefined && this.filters && !firstLoad && this.searchUtils.size != params['size']) {
|
||||
refine = false;
|
||||
}
|
||||
|
||||
this.searchUtils.size = (params['size']=== undefined)?10:+params['size'];
|
||||
if(this.searchUtils.size != 5 && this.searchUtils.size != 10 && this.searchUtils.size != 20 && this.searchUtils.size != 50) {
|
||||
this.searchUtils.size = 10;
|
||||
}
|
||||
let page = (params['page']=== undefined)?0:+params['page'];
|
||||
this.searchUtils.page = ( page < 1 ) ? 1 : page;
|
||||
|
||||
this.searchPage.fieldIds = this.fieldIds;
|
||||
this.selectedFields =[];
|
||||
if(this.type == "deposit"){
|
||||
this.searchPage.keywordFields = this.searchFields.DEPOSIT_DATASOURCE_KEYWORD_FIELDS;
|
||||
this.searchPage.usedBy = "deposit";
|
||||
}
|
||||
// console.log(this.refineFields)
|
||||
this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, [], this.fieldIdsMap,this.customFilter,params, "dataprovider");
|
||||
if(refine && (this.type == "all" || this.type == "deposit")) {
|
||||
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;
|
||||
}
|
||||
this.getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, this.searchUtils.size, refine, this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
|
||||
firstLoad = false;
|
||||
this.searchUtils.size = (params['size']=== undefined)?10:+params['size'];
|
||||
if(this.searchUtils.size != 5 && this.searchUtils.size != 10 && this.searchUtils.size != 20 && this.searchUtils.size != 50) {
|
||||
this.searchUtils.size = 10;
|
||||
}
|
||||
|
||||
this.searchPage.fieldIds = this.fieldIds;
|
||||
this.selectedFields =[];
|
||||
if(this.type == "deposit"){
|
||||
this.searchPage.keywordFields = this.searchFields.DEPOSIT_DATASOURCE_KEYWORD_FIELDS;
|
||||
this.searchPage.usedBy = "deposit";
|
||||
}
|
||||
// console.log(this.refineFields)
|
||||
this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, [], this.fieldIdsMap,this.customFilter,params, "dataprovider");
|
||||
if(refine && (this.type == "all" || this.type == "deposit")) {
|
||||
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() {
|
||||
|
@ -244,7 +237,10 @@ export class SearchDataProvidersComponent {
|
|||
this.filters = this.searchPage.prepareFiltersToShow(this.filters, this.searchUtils.totalResults);
|
||||
this.searchUtils.refineStatus = this.errorCodes.DONE;
|
||||
}
|
||||
// this.searchPage.updateBaseUrlWithParameters();
|
||||
|
||||
this.searchPage.hideFilters = false;
|
||||
|
||||
// this.searchPage.updateBaseUrlWithParameters();
|
||||
//var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.searchUtils.status = this.errorCodes.DONE;
|
||||
if(this.searchUtils.totalResults == 0 ){
|
||||
|
@ -287,7 +283,7 @@ export class SearchDataProvidersComponent {
|
|||
//this.searchPage.closeLoading();
|
||||
this.disableForms = false;
|
||||
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;
|
||||
}
|
||||
var refine = true;
|
||||
if (
|
||||
(
|
||||
this.searchUtils.page != ((params['page'] === undefined) ? 1 : +params['page'])
|
||||
&& (this.searchUtils.page == 1 || params['page'])
|
||||
)
|
||||
&& this.filters && !firstLoad) {
|
||||
if (params['page'] != undefined && this.filters && !firstLoad && this.searchUtils.page != +params['page']) {
|
||||
refine = false;
|
||||
}
|
||||
|
||||
if (
|
||||
(
|
||||
this.searchUtils.size != ((params['size'] === undefined) ? 10 : +params['size'])
|
||||
&& (this.searchUtils.size == 10 || params['size'])
|
||||
)
|
||||
&& this.filters && !firstLoad) {
|
||||
if (params['size'] != undefined && this.filters && !firstLoad && this.searchUtils.size != params['size']) {
|
||||
refine = false;
|
||||
this.searchUtils.status = this.errorCodes.DONE;
|
||||
}
|
||||
|
||||
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");
|
||||
if(refine) {
|
||||
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));
|
||||
firstLoad = false;
|
||||
|
@ -223,7 +214,10 @@ export class SearchOrganizationsComponent {
|
|||
if(!refine) {
|
||||
this.searchPage.buildPageURLParameters(this.filters, [],false);
|
||||
}
|
||||
// this.searchPage.updateBaseUrlWithParameters();
|
||||
|
||||
this.searchPage.hideFilters = false;
|
||||
|
||||
// this.searchPage.updateBaseUrlWithParameters();
|
||||
//var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.searchUtils.status = this.errorCodes.DONE;
|
||||
if(this.searchUtils.totalResults == 0 ){
|
||||
|
@ -267,7 +261,7 @@ export class SearchOrganizationsComponent {
|
|||
//this.searchPage.closeLoading();
|
||||
this.disableForms = false;
|
||||
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;
|
||||
}
|
||||
var refine = true;
|
||||
if (
|
||||
(
|
||||
this.searchUtils.page != ((params['page'] === undefined) ? 1 : +params['page'])
|
||||
&& (this.searchUtils.page == 1 || params['page'])
|
||||
)
|
||||
&& this.filters && !firstLoad
|
||||
) {
|
||||
if (params['page'] != undefined && this.filters && !firstLoad && this.searchUtils.page != +params['page']) {
|
||||
refine = false;
|
||||
this.searchUtils.status = this.errorCodes.DONE;
|
||||
}
|
||||
|
||||
if (
|
||||
(
|
||||
this.searchUtils.sortBy != ((params['sortBy'] === undefined) ? "" : params['sortBy'])
|
||||
&& (this.searchUtils.sortBy == "" || params['sortBy'])
|
||||
)
|
||||
&& this.filters && !firstLoad
|
||||
) {
|
||||
if (params['size'] != undefined && this.filters && !firstLoad && this.searchUtils.size != params['size']) {
|
||||
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'];
|
||||
|
@ -160,6 +134,8 @@ export class SearchProjectsComponent {
|
|||
this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, this.rangeFields, this.fieldIdsMap,this.customFilter,params, "project");
|
||||
if(refine) {
|
||||
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));
|
||||
firstLoad = false;
|
||||
|
@ -242,6 +218,8 @@ export class SearchProjectsComponent {
|
|||
this.searchPage.buildPageURLParameters(this.filters, this.rangeFilters, false);
|
||||
}
|
||||
|
||||
this.searchPage.hideFilters = false;
|
||||
|
||||
//var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.searchUtils.status = this.errorCodes.DONE;
|
||||
if(this.searchUtils.totalResults == 0 ){
|
||||
|
@ -285,7 +263,7 @@ export class SearchProjectsComponent {
|
|||
//this.searchPage.closeLoading();
|
||||
this.disableForms = false;
|
||||
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;
|
||||
}
|
||||
var refine = true;
|
||||
if (
|
||||
(
|
||||
this.searchUtils.page != ((params['page'] === undefined) ? 1 : +params['page'])
|
||||
&& (this.searchUtils.page == 1 || params['page'])
|
||||
)
|
||||
&& this.filters && !firstLoad
|
||||
) {
|
||||
if (params['page'] != undefined && this.filters && !firstLoad && this.searchUtils.page != +params['page']) {
|
||||
refine = false;
|
||||
this.searchUtils.status = this.errorCodes.DONE;
|
||||
}
|
||||
|
||||
if (
|
||||
(
|
||||
this.searchUtils.sortBy != ((params['sortBy'] === undefined) ? "" : params['sortBy'])
|
||||
&& (this.searchUtils.sortBy == "" || params['sortBy'])
|
||||
)
|
||||
&& this.filters && !firstLoad
|
||||
) {
|
||||
if (params['sortBy'] != undefined && this.filters && !firstLoad && this.searchUtils.sortBy != params['sortBy']) {
|
||||
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
|
||||
) {
|
||||
if (params['size'] != undefined && this.filters && !firstLoad && this.searchUtils.size != params['size']) {
|
||||
refine = false;
|
||||
this.searchUtils.status = this.errorCodes.DONE;
|
||||
}
|
||||
|
||||
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);
|
||||
if(refine) {
|
||||
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));
|
||||
firstLoad = false;
|
||||
|
@ -243,6 +224,8 @@ export class SearchResearchResultsComponent {
|
|||
this.searchPage.buildPageURLParameters(this.filters, this.rangeFilters, false);
|
||||
}
|
||||
|
||||
this.searchPage.hideFilters = false;
|
||||
|
||||
this.searchUtils.status = this.errorCodes.DONE;
|
||||
if (this.searchUtils.totalResults == 0) {
|
||||
this.searchUtils.status = this.errorCodes.NONE;
|
||||
|
@ -283,7 +266,7 @@ export class SearchResearchResultsComponent {
|
|||
//this.searchPage.closeLoading();
|
||||
this.disableForms = false;
|
||||
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils})
|
||||
|
||||
this.searchPage.hideFilters = false;
|
||||
}
|
||||
));
|
||||
}
|
||||
|
|
|
@ -83,8 +83,9 @@
|
|||
<ng-template #filters_column>
|
||||
<div class="uk-width-1-1 uk-margin-top">
|
||||
<div class="uk-grid uk-flex uk-flex-bottom">
|
||||
<h5 *ngIf="(selectedRangeFilters+selectedFilters + selectedTypesNum > 0) || (filters.length > 0 && (results.length > 0 || disableForms))"
|
||||
class="uk-text-bold">
|
||||
<!-- *ngIf="(selectedRangeFilters+selectedFilters + selectedTypesNum > 0)
|
||||
|| (filters.length > 0 && (results.length > 0 || disableForms))"-->
|
||||
<h5 class="uk-text-bold">
|
||||
Filters
|
||||
</h5>
|
||||
<a *ngIf="(selectedRangeFilters+selectedFilters + selectedTypesNum)>1" (click)="clearFilters()"
|
||||
|
@ -97,12 +98,11 @@
|
|||
<ng-container *ngTemplateOutlet="selected_filters_pills; context: {}"></ng-container>
|
||||
</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">
|
||||
<span class="loading-gif uk-align-center" ></span>
|
||||
</div>
|
||||
|
||||
<div *ngIf="searchUtils.refineStatus == errorCodes.DONE && filters.length === 0 && results.length > 0" class="uk-margin-top">
|
||||
<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>
|
||||
<ul *ngIf="!showUnknownFilters"
|
||||
|
@ -260,16 +260,20 @@
|
|||
|
||||
</div>
|
||||
<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;
|
||||
else elseGridBlock"
|
||||
class="'uk-animation-fade uk-margin-top uk-width-1-1" role="alert">
|
||||
<span class="loading-gif uk-align-center" ></span>
|
||||
</div>
|
||||
<div>
|
||||
<ng-template #elseGridBlock>
|
||||
|
||||
<div *ngIf="showRefine && !properties.isDashboard" class="uk-width-1-4@m search-filters uk-visible@m">
|
||||
<!-- <div *ngIf="searchUtils.status == errorCodes.LOADING && filters.length == 0;-->
|
||||
<!-- else elseGridBlock"-->
|
||||
<!-- class="'uk-animation-fade uk-margin-top uk-width-1-1" role="alert">-->
|
||||
<!-- <span class="loading-gif uk-align-center" ></span>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div>-->
|
||||
<!-- <ng-template #elseGridBlock>-->
|
||||
<div *ngIf="showRefine && !properties.isDashboard
|
||||
&& (results.length > 0
|
||||
|| (!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>
|
||||
</div>
|
||||
<div class="uk-width-expand@m uk-with-1-1@s">
|
||||
|
@ -381,12 +385,12 @@
|
|||
Last index information
|
||||
</a>
|
||||
</div>
|
||||
</ng-template>
|
||||
<!-- </ng-template>-->
|
||||
<!-- <div class="uk-visible@m uk-margin-top uk-width-1-5">-->
|
||||
<!-- <search-download [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults" ></search-download>-->
|
||||
<!-- </div>-->
|
||||
<!-- <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"
|
||||
[texts]="pageContents['bottom']"></helper>
|
||||
|
@ -420,3 +424,4 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -30,7 +30,6 @@ declare var UIkit: any;
|
|||
})
|
||||
export class NewSearchPageComponent {
|
||||
@ViewChild('offcanvas_element') offcanvasElement: ElementRef;
|
||||
|
||||
@Input() piwikSiteId = null;
|
||||
@Input() hasPrefix: boolean = true;
|
||||
@Input() pageTitle = "";
|
||||
|
@ -108,6 +107,9 @@ export class NewSearchPageComponent {
|
|||
@Input() entitiesSelection:boolean = true;
|
||||
@Input() showAdvancedSearchLink:boolean = true;
|
||||
|
||||
// on 1st load, do not show filters until results query returns.
|
||||
public hideFilters: boolean = true;
|
||||
|
||||
//Dashboard
|
||||
filterToggle = false;
|
||||
customFilterEnabled:boolean = false;
|
||||
|
@ -485,6 +487,13 @@ export class NewSearchPageComponent {
|
|||
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
|
||||
*/
|
||||
|
@ -1165,13 +1174,13 @@ public static createRangeFilterQuery(rangeField,selectedFromValue, selectedToVal
|
|||
this.parameterValues.push(StringUtils.URIEncode(this.selectedFields[i].value));
|
||||
}
|
||||
}
|
||||
if (includePage && this.searchUtils.page != 1) {
|
||||
if (includePage) {
|
||||
this.parameterNames.push("page");
|
||||
this.parameterValues.push("" + this.searchUtils.page);
|
||||
}
|
||||
|
||||
//if (this.searchUtils.size != this.resultsPerPage) {
|
||||
if (this.resultsPerPageChanged && this.resultsPerPageChanged != this.resultsPerPage) {
|
||||
if (this.resultsPerPageChanged) {
|
||||
this.parameterNames.push("size");
|
||||
//this.parameterValues.push("" + this.searchUtils.size);
|
||||
this.parameterValues.push("" + this.resultsPerPageChanged);
|
||||
|
|
|
@ -9,47 +9,10 @@
|
|||
<div aria-expanded="false">
|
||||
<div>
|
||||
<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)"
|
||||
class="uk-animation-fade filterItem searchFilterItem uk-text-small">
|
||||
<div title = "{{value.name}}">
|
||||
<label *ngIf="filter.filterType == 'checkbox' || filter.filterType == 'radio'"
|
||||
[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>
|
||||
<ng-container *ngTemplateOutlet="input_label; context: {filter: filter, value: value}"></ng-container>
|
||||
</div>
|
||||
</div>
|
||||
</ng-container>
|
||||
|
@ -93,45 +56,10 @@
|
|||
|
||||
<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">
|
||||
<!-- <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)">
|
||||
<div *ngIf="filterKeywords(value.name)" title = "{{value.name}}"
|
||||
class="uk-animation-fade filterItem searchFilterItem uk-text-small">
|
||||
<label *ngIf="filter.filterType == 'checkbox' || filter.filterType == 'radio'">
|
||||
<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>
|
||||
<ng-container *ngTemplateOutlet="input_label; context: {filter: filter, value: value}"></ng-container>
|
||||
</div>
|
||||
</ng-container>
|
||||
</div>
|
||||
|
@ -144,3 +72,20 @@
|
|||
</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