[angular-16-irish-monitor | DONE | CHANGED ] Search pages (projects, organizations, datasources ) Custom Filter accept single or an array of Custom filters

This commit is contained in:
argirok 2023-11-13 13:46:42 +02:00
parent 62d4ab1a36
commit 1ff833ed8a
3 changed files with 30 additions and 9 deletions

View File

@ -49,8 +49,15 @@ import {properties} from "../../../environments/environment";
export class SearchDataProvidersComponent {
private errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
@Input() customFilter:SearchCustomFilter= null;
@Input() tableViewLink;
@Input() customFilters: SearchCustomFilter[] = null;
@Input()
set customFilter(customFilter: SearchCustomFilter | SearchCustomFilter[]) {
if(!Array.isArray(customFilter)) {
this.customFilters = [customFilter];
}else{
this.customFilters = customFilter;
}
} @Input() tableViewLink;
@Input() searchForm: SearchForm = {class: 'search-form', dark: true};
public results =[];
public filters =[];
@ -143,7 +150,7 @@ export class SearchDataProvidersComponent {
this.searchPage.keywordFields = this.searchFields.DEPOSIT_DATASOURCE_KEYWORD_FIELDS;
this.searchPage.usedBy = "deposit";
}
this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, [], this.fieldIdsMap,this.customFilter,params, this.entityType);
this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, [], this.fieldIdsMap,this.customFilters,params, this.entityType);
if(refine) {
this._getFilters(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(params), this.searchUtils.page, 0, true, this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
} else {

View File

@ -61,8 +61,15 @@ export class SearchOrganizationsComponent {
public loadPaging: boolean = true;
public oldTotalResults: number = 0;
public pagingLimit: number = 0;
@Input() customFilter:SearchCustomFilter= null;
public refineFields: string[] = this.searchFields.ORGANIZATION_REFINE_FIELDS;
@Input() customFilters: SearchCustomFilter[] = null;
@Input()
set customFilter(customFilter: SearchCustomFilter | SearchCustomFilter[]) {
if(!Array.isArray(customFilter)) {
this.customFilters = [customFilter];
}else{
this.customFilters = customFilter;
}
} public refineFields: string[] = this.searchFields.ORGANIZATION_REFINE_FIELDS;
@ViewChild(NewSearchPageComponent, { static: true }) searchPage: NewSearchPageComponent;
@Input() simpleView: boolean = true;
@Input() simpleSearchLink: string = "";
@ -127,7 +134,7 @@ export class SearchOrganizationsComponent {
// this.searchPage.fieldIdsMap = this.fieldIdsMap;
// this.searchPage.customFilter = this.customFilter;
// this.searchPage.getSelectedFiltersFromUrl(params);
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.customFilters,params, "organization");
if(refine) {
this._getFilters(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, 0, true, this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
} else {

View File

@ -45,8 +45,15 @@ import {properties} from "../../../environments/environment";
export class SearchProjectsComponent {
private errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
@Input() customFilter: SearchCustomFilter = null;
@Input() searchForm: SearchForm = {class: 'search-form', dark: true};
@Input() customFilters: SearchCustomFilter[] = null;
@Input()
set customFilter(customFilter: SearchCustomFilter | SearchCustomFilter[]) {
if(!Array.isArray(customFilter)) {
this.customFilters = [customFilter];
}else{
this.customFilters = customFilter;
}
} @Input() searchForm: SearchForm = {class: 'search-form', dark: true};
public results = [];
public filters = [];
public rangeFilters: RangeFilter[] = [];
@ -128,7 +135,7 @@ export class SearchProjectsComponent {
this.searchPage.fieldIds = this.fieldIds;
this.selectedFields = [];
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.customFilters, params, "project");
if (refine) {
this._getFilters(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, 0, "", true, this.searchPage.getSearchAPIQueryForRangeFields(params) + this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
} else {