Add searchForm input in all search pages
This commit is contained in:
parent
73b6704124
commit
d17f9b4d5c
|
@ -59,7 +59,7 @@ import {properties} from "../../../environments/environment";
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<search-dataproviders [simpleView]="true" type="deposit" simpleSearchLink="/participate/deposit/search" [includeOnlyResultsAndFilter]="true" >
|
<search-dataproviders [simpleView]="true" [searchForm]="{class: null, dark: false}" type="deposit" simpleSearchLink="/participate/deposit/search" [includeOnlyResultsAndFilter]="true" >
|
||||||
</search-dataproviders>
|
</search-dataproviders>
|
||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
|
|
|
@ -8,7 +8,7 @@ import {SearchFields} from '../utils/properties/searchFields';
|
||||||
import {SearchCustomFilter, SearchUtilsClass} from './searchUtils/searchUtils.class';
|
import {SearchCustomFilter, SearchUtilsClass} from './searchUtils/searchUtils.class';
|
||||||
|
|
||||||
import {EnvProperties} from '../utils/properties/env-properties';
|
import {EnvProperties} from '../utils/properties/env-properties';
|
||||||
import {NewSearchPageComponent} from "./searchUtils/newSearchPage.component";
|
import {NewSearchPageComponent, SearchForm} from "./searchUtils/newSearchPage.component";
|
||||||
import {DatasourcesHelperClass} from "./searchUtils/datasourcesHelper.class";
|
import {DatasourcesHelperClass} from "./searchUtils/datasourcesHelper.class";
|
||||||
import {properties} from "../../../environments/environment";
|
import {properties} from "../../../environments/environment";
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ import {properties} from "../../../environments/environment";
|
||||||
[openaireLink]=openaireLink
|
[openaireLink]=openaireLink
|
||||||
[includeOnlyResultsAndFilter]="includeOnlyResultsAndFilter"
|
[includeOnlyResultsAndFilter]="includeOnlyResultsAndFilter"
|
||||||
[piwikSiteId]=piwikSiteId [hasPrefix]="hasPrefix"
|
[piwikSiteId]=piwikSiteId [hasPrefix]="hasPrefix"
|
||||||
[searchForm]="{class: '', dark: false}"
|
[searchForm]="searchForm"
|
||||||
[entitiesSelection]="type=='all'" [showSwitchSearchLink]="showSwitchSearchLink"
|
[entitiesSelection]="type=='all'" [showSwitchSearchLink]="showSwitchSearchLink"
|
||||||
[filters]="filters"
|
[filters]="filters"
|
||||||
[simpleView]="simpleView" formPlaceholderText="Search by name, description, subject..."
|
[simpleView]="simpleView" formPlaceholderText="Search by name, description, subject..."
|
||||||
|
@ -53,6 +53,7 @@ export class SearchDataProvidersComponent {
|
||||||
@Input() piwikSiteId = null;
|
@Input() piwikSiteId = null;
|
||||||
@Input() customFilter:SearchCustomFilter= null;
|
@Input() customFilter:SearchCustomFilter= null;
|
||||||
@Input() tableViewLink;
|
@Input() tableViewLink;
|
||||||
|
@Input() searchForm: SearchForm = {class: 'search-form', dark: true};
|
||||||
public results =[];
|
public results =[];
|
||||||
public filters =[];
|
public filters =[];
|
||||||
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
|
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
|
||||||
|
|
|
@ -7,7 +7,7 @@ import {ErrorMessagesComponent} from '../utils/errorMessages.component';
|
||||||
import {SearchFields} from '../utils/properties/searchFields';
|
import {SearchFields} from '../utils/properties/searchFields';
|
||||||
import {SearchCustomFilter, SearchUtilsClass} from './searchUtils/searchUtils.class';
|
import {SearchCustomFilter, SearchUtilsClass} from './searchUtils/searchUtils.class';
|
||||||
import {EnvProperties} from '../utils/properties/env-properties';
|
import {EnvProperties} from '../utils/properties/env-properties';
|
||||||
import {NewSearchPageComponent} from "./searchUtils/newSearchPage.component";
|
import {NewSearchPageComponent, SearchForm} from "./searchUtils/newSearchPage.component";
|
||||||
import {properties} from "../../../environments/environment";
|
import {properties} from "../../../environments/environment";
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@ import {properties} from "../../../environments/environment";
|
||||||
[openaireLink]=openaireLink
|
[openaireLink]=openaireLink
|
||||||
[piwikSiteId]=piwikSiteId [hasPrefix]="hasPrefix"
|
[piwikSiteId]=piwikSiteId [hasPrefix]="hasPrefix"
|
||||||
[includeOnlyResultsAndFilter]="includeOnlyResultsAndFilter"
|
[includeOnlyResultsAndFilter]="includeOnlyResultsAndFilter"
|
||||||
|
[searchForm]="searchForm"
|
||||||
[sort]="false"
|
[sort]="false"
|
||||||
[filters]="filters"
|
[filters]="filters"
|
||||||
[simpleView]="simpleView" formPlaceholderText="Search by organization name..."
|
[simpleView]="simpleView" formPlaceholderText="Search by organization name..."
|
||||||
|
@ -46,6 +47,7 @@ export class SearchOrganizationsComponent {
|
||||||
private errorMessages: ErrorMessagesComponent;
|
private errorMessages: ErrorMessagesComponent;
|
||||||
properties:EnvProperties;
|
properties:EnvProperties;
|
||||||
@Input() piwikSiteId = null;
|
@Input() piwikSiteId = null;
|
||||||
|
@Input() searchForm: SearchForm = {class: 'search-form', dark: true};
|
||||||
public results =[];
|
public results =[];
|
||||||
public filters =[];
|
public filters =[];
|
||||||
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
|
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
|
||||||
|
|
|
@ -7,7 +7,7 @@ import {ErrorMessagesComponent} from '../utils/errorMessages.component';
|
||||||
import {SearchFields} from '../utils/properties/searchFields';
|
import {SearchFields} from '../utils/properties/searchFields';
|
||||||
import {SearchCustomFilter, SearchUtilsClass} from './searchUtils/searchUtils.class';
|
import {SearchCustomFilter, SearchUtilsClass} from './searchUtils/searchUtils.class';
|
||||||
import {EnvProperties} from '../utils/properties/env-properties';
|
import {EnvProperties} from '../utils/properties/env-properties';
|
||||||
import {NewSearchPageComponent} from "./searchUtils/newSearchPage.component";
|
import {NewSearchPageComponent, SearchForm} from "./searchUtils/newSearchPage.component";
|
||||||
import {RangeFilter} from "../utils/rangeFilter/rangeFilterHelperClasses.class";
|
import {RangeFilter} from "../utils/rangeFilter/rangeFilterHelperClasses.class";
|
||||||
import {properties} from "../../../environments/environment";
|
import {properties} from "../../../environments/environment";
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@ import {properties} from "../../../environments/environment";
|
||||||
[oldTotalResults]="oldTotalResults"
|
[oldTotalResults]="oldTotalResults"
|
||||||
[openaireLink]=openaireLink
|
[openaireLink]=openaireLink
|
||||||
[piwikSiteId]=piwikSiteId [hasPrefix]="hasPrefix"
|
[piwikSiteId]=piwikSiteId [hasPrefix]="hasPrefix"
|
||||||
|
[searchForm]="searchForm"
|
||||||
[includeOnlyResultsAndFilter]="includeOnlyResultsAndFilter"
|
[includeOnlyResultsAndFilter]="includeOnlyResultsAndFilter"
|
||||||
[filters]="filters"
|
[filters]="filters"
|
||||||
[rangeFilters]="rangeFilters" [rangeFields]="rangeFields"
|
[rangeFilters]="rangeFilters" [rangeFields]="rangeFields"
|
||||||
|
@ -40,25 +41,26 @@ import {properties} from "../../../environments/environment";
|
||||||
</new-search-page>
|
</new-search-page>
|
||||||
|
|
||||||
`
|
`
|
||||||
})
|
})
|
||||||
|
|
||||||
export class SearchProjectsComponent {
|
export class SearchProjectsComponent {
|
||||||
private errorCodes: ErrorCodes;
|
private errorCodes: ErrorCodes;
|
||||||
private errorMessages: ErrorMessagesComponent;
|
private errorMessages: ErrorMessagesComponent;
|
||||||
@Input() piwikSiteId = null;
|
@Input() piwikSiteId = null;
|
||||||
@Input() customFilter:SearchCustomFilter= null;
|
@Input() customFilter: SearchCustomFilter = null;
|
||||||
public results =[];
|
@Input() searchForm: SearchForm = {class: 'search-form', dark: true};
|
||||||
public filters =[];
|
public results = [];
|
||||||
|
public filters = [];
|
||||||
public rangeFilters: RangeFilter[] = [];
|
public rangeFilters: RangeFilter[] = [];
|
||||||
|
|
||||||
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
|
public searchUtils: SearchUtilsClass = new SearchUtilsClass();
|
||||||
public searchFields:SearchFields = new SearchFields();
|
public searchFields: SearchFields = new SearchFields();
|
||||||
|
|
||||||
public fieldIds: string[] = this.searchFields.PROJECT_ADVANCED_FIELDS;
|
public fieldIds: string[] = this.searchFields.PROJECT_ADVANCED_FIELDS;
|
||||||
public fieldIdsMap = this.searchFields.PROJECT_FIELDS;
|
public fieldIdsMap = this.searchFields.PROJECT_FIELDS;
|
||||||
public rangeFields:string[][] = this.searchFields.PROJECT_RANGE_FIELDS;
|
public rangeFields: string[][] = this.searchFields.PROJECT_RANGE_FIELDS;
|
||||||
public selectedFields:AdvancedField[] = [];
|
public selectedFields: AdvancedField[] = [];
|
||||||
properties:EnvProperties;
|
properties: EnvProperties;
|
||||||
|
|
||||||
public resourcesQuery = "(oaftype exact project)";
|
public resourcesQuery = "(oaftype exact project)";
|
||||||
public csvParams: string;
|
public csvParams: string;
|
||||||
|
@ -69,7 +71,7 @@ export class SearchProjectsComponent {
|
||||||
public pagingLimit: number = 0;
|
public pagingLimit: number = 0;
|
||||||
public isPiwikEnabled;
|
public isPiwikEnabled;
|
||||||
public refineFields: string[] = this.searchFields.PROJECT_REFINE_FIELDS;
|
public refineFields: string[] = this.searchFields.PROJECT_REFINE_FIELDS;
|
||||||
@ViewChild(NewSearchPageComponent, { static: true }) searchPage: NewSearchPageComponent;
|
@ViewChild(NewSearchPageComponent, {static: true}) searchPage: NewSearchPageComponent;
|
||||||
@Input() simpleView: boolean = true;
|
@Input() simpleView: boolean = true;
|
||||||
@Input() simpleSearchLink: string = "";
|
@Input() simpleSearchLink: string = "";
|
||||||
advancedSearchLink: string = "";
|
advancedSearchLink: string = "";
|
||||||
|
@ -77,14 +79,14 @@ export class SearchProjectsComponent {
|
||||||
@Input() openaireLink: string;
|
@Input() openaireLink: string;
|
||||||
@Input() includeOnlyResultsAndFilter: boolean = false;
|
@Input() includeOnlyResultsAndFilter: boolean = false;
|
||||||
@Output() searchPageUpdates = new EventEmitter();
|
@Output() searchPageUpdates = new EventEmitter();
|
||||||
@Input() showSwitchSearchLink:boolean = true;
|
@Input() showSwitchSearchLink: boolean = true;
|
||||||
@Input() showBreadcrumb: boolean = false;
|
@Input() showBreadcrumb: boolean = false;
|
||||||
subs: any[] = [];
|
subs: any[] = [];
|
||||||
searchResultsSub: any;
|
searchResultsSub: any;
|
||||||
searchFiltersSub: any;
|
searchFiltersSub: any;
|
||||||
|
|
||||||
constructor (private route: ActivatedRoute, private _searchProjectsService: SearchProjectsService ) {
|
constructor(private route: ActivatedRoute, private _searchProjectsService: SearchProjectsService) {
|
||||||
this.results =[];
|
this.results = [];
|
||||||
this.errorCodes = new ErrorCodes();
|
this.errorCodes = new ErrorCodes();
|
||||||
this.errorMessages = new ErrorMessagesComponent();
|
this.errorMessages = new ErrorMessagesComponent();
|
||||||
this.searchUtils.status = this.errorCodes.LOADING;
|
this.searchUtils.status = this.errorCodes.LOADING;
|
||||||
|
@ -93,12 +95,12 @@ export class SearchProjectsComponent {
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
|
||||||
this.properties= properties;
|
this.properties = properties;
|
||||||
if (!this.simpleSearchLink) {
|
if (!this.simpleSearchLink) {
|
||||||
this.simpleSearchLink = this.properties.searchLinkToProjects;
|
this.simpleSearchLink = this.properties.searchLinkToProjects;
|
||||||
}
|
}
|
||||||
this.advancedSearchLink = this.properties.searchLinkToAdvancedProjects;
|
this.advancedSearchLink = this.properties.searchLinkToAdvancedProjects;
|
||||||
this.searchUtils.baseUrl = (this.simpleView)?this.simpleSearchLink:this.advancedSearchLink;
|
this.searchUtils.baseUrl = (this.simpleView) ? this.simpleSearchLink : this.advancedSearchLink;
|
||||||
this.pagingLimit = properties.pagingLimit;
|
this.pagingLimit = properties.pagingLimit;
|
||||||
this.isPiwikEnabled = properties.enablePiwikTrack;
|
this.isPiwikEnabled = properties.enablePiwikTrack;
|
||||||
|
|
||||||
|
@ -107,12 +109,12 @@ export class SearchProjectsComponent {
|
||||||
|
|
||||||
this.subs.push(this.route.queryParams.subscribe(params => {
|
this.subs.push(this.route.queryParams.subscribe(params => {
|
||||||
this.loadPaging = true;
|
this.loadPaging = true;
|
||||||
if(params['page'] && this.searchUtils.page != params['page']) {
|
if (params['page'] && this.searchUtils.page != params['page']) {
|
||||||
this.loadPaging = false;
|
this.loadPaging = false;
|
||||||
this.oldTotalResults = this.searchUtils.totalResults;
|
this.oldTotalResults = this.searchUtils.totalResults;
|
||||||
}
|
}
|
||||||
var refine = true;
|
var refine = true;
|
||||||
if(this.searchPage.searchUtils.refineStatus == this.errorCodes.DONE) {
|
if (this.searchPage.searchUtils.refineStatus == this.errorCodes.DONE) {
|
||||||
if (params['page'] != undefined && this.filters && !firstLoad && this.searchUtils.page != +params['page']) {
|
if (params['page'] != undefined && this.filters && !firstLoad && this.searchUtils.page != +params['page']) {
|
||||||
refine = false;
|
refine = false;
|
||||||
}
|
}
|
||||||
|
@ -121,28 +123,29 @@ export class SearchProjectsComponent {
|
||||||
refine = false;
|
refine = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let page = (params['page']=== undefined)?1:+params['page'];
|
let page = (params['page'] === undefined) ? 1 : +params['page'];
|
||||||
this.searchUtils.page = ( page <= 0 ) ? 1 : page;
|
this.searchUtils.page = (page <= 0) ? 1 : page;
|
||||||
|
|
||||||
this.searchUtils.validateSize(params['size']);
|
this.searchUtils.validateSize(params['size']);
|
||||||
|
|
||||||
this.searchPage.fieldIds = this.fieldIds;
|
this.searchPage.fieldIds = this.fieldIds;
|
||||||
this.selectedFields = [];
|
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.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 {
|
} else {
|
||||||
this.searchUtils.refineStatus = this.errorCodes.DONE;
|
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;
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
if(this.searchResultsSub) {
|
if (this.searchResultsSub) {
|
||||||
this.searchResultsSub.unsubscribe();
|
this.searchResultsSub.unsubscribe();
|
||||||
}
|
}
|
||||||
if(this.searchFiltersSub) {
|
if (this.searchFiltersSub) {
|
||||||
this.searchFiltersSub.unsubscribe();
|
this.searchFiltersSub.unsubscribe();
|
||||||
}
|
}
|
||||||
for (let sub of this.subs) {
|
for (let sub of this.subs) {
|
||||||
|
@ -154,8 +157,12 @@ export class SearchProjectsComponent {
|
||||||
if (page <= this.pagingLimit || this.searchUtils.refineStatus == this.errorCodes.LOADING) {
|
if (page <= this.pagingLimit || this.searchUtils.refineStatus == this.errorCodes.LOADING) {
|
||||||
this.searchUtils.refineStatus = this.errorCodes.LOADING;
|
this.searchUtils.refineStatus = this.errorCodes.LOADING;
|
||||||
this.disableRefineForms = true;
|
this.disableRefineForms = true;
|
||||||
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils});
|
this.searchPageUpdates.emit({
|
||||||
this.searchFiltersSub = this._searchProjectsService.advancedSearchProjects(parameters, page, size, this.properties,(refine) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery)
|
disableForms: this.disableForms,
|
||||||
|
disableRefineForms: this.disableRefineForms,
|
||||||
|
searchUtils: this.searchUtils
|
||||||
|
});
|
||||||
|
this.searchFiltersSub = this._searchProjectsService.advancedSearchProjects(parameters, page, size, this.properties, (refine) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery)
|
||||||
//.switchMap(
|
//.switchMap(
|
||||||
.subscribe(
|
.subscribe(
|
||||||
data => {
|
data => {
|
||||||
|
@ -172,7 +179,11 @@ export class SearchProjectsComponent {
|
||||||
this.searchUtils.refineStatus = this.errorMessages.getErrorCode(err.status);
|
this.searchUtils.refineStatus = this.errorMessages.getErrorCode(err.status);
|
||||||
|
|
||||||
this.disableRefineForms = false;
|
this.disableRefineForms = 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
|
||||||
|
})
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -186,7 +197,7 @@ export class SearchProjectsComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.searchUtils.refineStatus = this.errorCodes.DONE;
|
this.searchUtils.refineStatus = this.errorCodes.DONE;
|
||||||
if(totalResults == 0) {
|
if (totalResults == 0) {
|
||||||
this.searchUtils.refineStatus = this.errorCodes.NONE;
|
this.searchUtils.refineStatus = this.errorCodes.NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,7 +212,7 @@ export class SearchProjectsComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.searchUtils.refineStatus != this.errorCodes.DONE && this.searchUtils.status != this.searchUtils.refineStatus) {
|
if (this.searchUtils.refineStatus != this.errorCodes.DONE && this.searchUtils.status != this.searchUtils.refineStatus) {
|
||||||
if (this.searchResultsSub) {
|
if (this.searchResultsSub) {
|
||||||
this.searchResultsSub.unsubscribe();
|
this.searchResultsSub.unsubscribe();
|
||||||
}
|
}
|
||||||
|
@ -209,14 +220,18 @@ export class SearchProjectsComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.disableRefineForms = false;
|
this.disableRefineForms = 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
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
public getResults(parameters:string, page: number, size: number, refine: boolean, refineFieldsFilterQuery = null){
|
public getResults(parameters: string, page: number, size: number, refine: boolean, refineFieldsFilterQuery = null) {
|
||||||
if(page > this.pagingLimit) {
|
if (page > this.pagingLimit) {
|
||||||
size=0;
|
size = 0;
|
||||||
}
|
}
|
||||||
if(page <= this.pagingLimit || this.searchUtils.status == this.errorCodes.LOADING) {
|
if (page <= this.pagingLimit || this.searchUtils.status == this.errorCodes.LOADING) {
|
||||||
// if(parameters!= null && parameters != '' ) {
|
// if(parameters!= null && parameters != '' ) {
|
||||||
// this.csvParams ="&fq=( "+this.resourcesQuery + "and (" + parameters + "))";
|
// this.csvParams ="&fq=( "+this.resourcesQuery + "and (" + parameters + "))";
|
||||||
// }else{
|
// }else{
|
||||||
|
@ -226,18 +241,22 @@ export class SearchProjectsComponent {
|
||||||
//
|
//
|
||||||
// //var errorCodes:ErrorCodes = new ErrorCodes();
|
// //var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
|
|
||||||
this.csvParams = (parameters ? ("&fq=("+parameters) : "") + (parameters ? ")" : "");
|
this.csvParams = (parameters ? ("&fq=(" + parameters) : "") + (parameters ? ")" : "");
|
||||||
this.csvParams += (refineFieldsFilterQuery ? refineFieldsFilterQuery : "");
|
this.csvParams += (refineFieldsFilterQuery ? refineFieldsFilterQuery : "");
|
||||||
|
|
||||||
this.searchUtils.status = this.errorCodes.LOADING;
|
this.searchUtils.status = this.errorCodes.LOADING;
|
||||||
//this.searchPage.openLoading();
|
//this.searchPage.openLoading();
|
||||||
this.disableForms = true;
|
this.disableForms = true;
|
||||||
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.results = [];
|
this.results = [];
|
||||||
this.searchUtils.totalResults = 0;
|
this.searchUtils.totalResults = 0;
|
||||||
|
|
||||||
//console.info("Advanced Search for Publications: Execute search query "+parameters);
|
//console.info("Advanced Search for Publications: Execute search query "+parameters);
|
||||||
this.searchResultsSub = this._searchProjectsService.advancedSearchProjects(parameters, page, size, this.properties,null, this.searchPage.getFields(), refineFieldsFilterQuery).subscribe(
|
this.searchResultsSub = this._searchProjectsService.advancedSearchProjects(parameters, page, size, this.properties, null, this.searchPage.getFields(), refineFieldsFilterQuery).subscribe(
|
||||||
//this._searchProjectsService.advancedSearchProjects(parameters, page, size, this.properties,(refine) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery).subscribe(
|
//this._searchProjectsService.advancedSearchProjects(parameters, page, size, this.properties,(refine) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery).subscribe(
|
||||||
data => {
|
data => {
|
||||||
let totalResults = data[0];
|
let totalResults = data[0];
|
||||||
|
@ -265,7 +284,11 @@ 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;
|
this.searchPage.hideFilters = false;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -275,7 +298,7 @@ export class SearchProjectsComponent {
|
||||||
public resultsReturned(refine: boolean, results: any, totalResults, page: number) {
|
public resultsReturned(refine: boolean, results: any, totalResults, page: number) {
|
||||||
this.searchUtils.totalResults = totalResults;
|
this.searchUtils.totalResults = totalResults;
|
||||||
this.results = results;
|
this.results = results;
|
||||||
if(!refine) {
|
if (!refine) {
|
||||||
this.searchPage.buildPageURLParameters(this.filters, this.rangeFilters, false);
|
this.searchPage.buildPageURLParameters(this.filters, this.rangeFilters, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -298,18 +321,22 @@ export class SearchProjectsComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.searchUtils.status != this.errorCodes.DONE && this.searchUtils.refineStatus != this.searchUtils.status) {
|
if (this.searchUtils.status != this.errorCodes.DONE && this.searchUtils.refineStatus != this.searchUtils.status) {
|
||||||
if(this.searchFiltersSub) {
|
if (this.searchFiltersSub) {
|
||||||
this.searchFiltersSub.unsubscribe();
|
this.searchFiltersSub.unsubscribe();
|
||||||
}
|
}
|
||||||
this.filtersReturned(refine, [], totalResults, page);
|
this.filtersReturned(refine, [], totalResults, page);
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
private handleError(message: string, error) {
|
private handleError(message: string, error) {
|
||||||
console.error("Projects advanced Search Page: "+message, error);
|
console.error("Projects advanced Search Page: " + message, error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ import {ErrorMessagesComponent} from '../utils/errorMessages.component';
|
||||||
import {SearchFields} from '../utils/properties/searchFields';
|
import {SearchFields} from '../utils/properties/searchFields';
|
||||||
import {SearchCustomFilter, SearchUtilsClass} from './searchUtils/searchUtils.class';
|
import {SearchCustomFilter, SearchUtilsClass} from './searchUtils/searchUtils.class';
|
||||||
import {EnvProperties} from '../utils/properties/env-properties';
|
import {EnvProperties} from '../utils/properties/env-properties';
|
||||||
import {NewSearchPageComponent} from "./searchUtils/newSearchPage.component";
|
import {NewSearchPageComponent, SearchForm} from "./searchUtils/newSearchPage.component";
|
||||||
import {RangeFilter} from "../utils/rangeFilter/rangeFilterHelperClasses.class";
|
import {RangeFilter} from "../utils/rangeFilter/rangeFilterHelperClasses.class";
|
||||||
import {properties} from "../../../environments/environment";
|
import {properties} from "../../../environments/environment";
|
||||||
import {ContextsService} from "../claims/claim-utils/service/contexts.service";
|
import {ContextsService} from "../claims/claim-utils/service/contexts.service";
|
||||||
|
@ -31,6 +31,7 @@ import {ContextsService} from "../claims/claim-utils/service/contexts.service";
|
||||||
[oldTotalResults]="oldTotalResults"
|
[oldTotalResults]="oldTotalResults"
|
||||||
[openaireLink]=openaireLink
|
[openaireLink]=openaireLink
|
||||||
[piwikSiteId]=piwikSiteId [hasPrefix]="hasPrefix"
|
[piwikSiteId]=piwikSiteId [hasPrefix]="hasPrefix"
|
||||||
|
[searchForm]="searchForm"
|
||||||
[filters]="filters" [quickFilter]="quickFilter"
|
[filters]="filters" [quickFilter]="quickFilter"
|
||||||
[rangeFilters]="rangeFilters" [rangeFields]="rangeFields"
|
[rangeFilters]="rangeFilters" [rangeFields]="rangeFields"
|
||||||
[simpleView]="simpleView" formPlaceholderText="Search by title, author, abstract, DOI, orcid..."
|
[simpleView]="simpleView" formPlaceholderText="Search by title, author, abstract, DOI, orcid..."
|
||||||
|
@ -39,7 +40,6 @@ import {ContextsService} from "../claims/claim-utils/service/contexts.service";
|
||||||
[stickyForm]="stickyForm"
|
[stickyForm]="stickyForm"
|
||||||
>
|
>
|
||||||
</new-search-page>
|
</new-search-page>
|
||||||
|
|
||||||
`
|
`
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -53,6 +53,7 @@ export class SearchResearchResultsComponent {
|
||||||
private errorMessages: ErrorMessagesComponent;
|
private errorMessages: ErrorMessagesComponent;
|
||||||
@Input() piwikSiteId = properties.piwikSiteId;
|
@Input() piwikSiteId = properties.piwikSiteId;
|
||||||
@Input() hasPrefix: boolean = true;
|
@Input() hasPrefix: boolean = true;
|
||||||
|
@Input() searchForm: SearchForm = {class: 'search-form', dark: true};
|
||||||
public results = [];
|
public results = [];
|
||||||
public filters = [];
|
public filters = [];
|
||||||
public rangeFilters: RangeFilter[] = [];
|
public rangeFilters: RangeFilter[] = [];
|
||||||
|
|
|
@ -26,6 +26,11 @@ import {Subscriber} from "rxjs";
|
||||||
import {IndexInfoService} from "../../utils/indexInfo.service";
|
import {IndexInfoService} from "../../utils/indexInfo.service";
|
||||||
import { Option } from '../../sharedComponents/input/input.component';
|
import { Option } from '../../sharedComponents/input/input.component';
|
||||||
|
|
||||||
|
export interface SearchForm {
|
||||||
|
class: string,
|
||||||
|
dark: boolean
|
||||||
|
}
|
||||||
|
|
||||||
declare var UIkit: any;
|
declare var UIkit: any;
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -59,10 +64,7 @@ export class NewSearchPageComponent {
|
||||||
@Input() customFilter: SearchCustomFilter;
|
@Input() customFilter: SearchCustomFilter;
|
||||||
@Input() sort: boolean = true;
|
@Input() sort: boolean = true;
|
||||||
@Input() sortedByChanged: string = "";
|
@Input() sortedByChanged: string = "";
|
||||||
@Input() searchForm = {
|
@Input() searchForm: SearchForm = {class: 'search-form', dark: true};
|
||||||
class: 'search-form',
|
|
||||||
dark: true
|
|
||||||
};
|
|
||||||
//From simple:
|
//From simple:
|
||||||
@Input() rangeFilters: RangeFilter[] = [];
|
@Input() rangeFilters: RangeFilter[] = [];
|
||||||
@Input() rangeFields: string[][] = [];
|
@Input() rangeFields: string[][] = [];
|
||||||
|
|
|
@ -17,7 +17,7 @@ import {ClickEvent} from "../../utils/click/click-outside-or-esc.directive";
|
||||||
@Component({
|
@Component({
|
||||||
selector: '[search-input]',
|
selector: '[search-input]',
|
||||||
template: `
|
template: `
|
||||||
<div class="uk-flex uk-flex-right uk-width-1-1">
|
<div *ngIf="initialized" class="uk-flex uk-flex-right uk-width-1-1">
|
||||||
<div #searchInput click-outside-or-esc (clickOutside)="click($event)" class="search-input" [class.collapsed]="hidden" [ngClass]="searchInputClass">
|
<div #searchInput click-outside-or-esc (clickOutside)="click($event)" class="search-input" [class.collapsed]="hidden" [ngClass]="searchInputClass">
|
||||||
<div class="uk-flex uk-flex-middle">
|
<div class="uk-flex uk-flex-middle">
|
||||||
<div class="uk-width-expand">
|
<div class="uk-width-expand">
|
||||||
|
@ -53,6 +53,7 @@ export class SearchInputComponent implements OnInit {
|
||||||
@ViewChild('searchInput') searchInput: ElementRef;
|
@ViewChild('searchInput') searchInput: ElementRef;
|
||||||
@ViewChild('input') input: InputComponent;
|
@ViewChild('input') input: InputComponent;
|
||||||
public expanded: boolean = true;
|
public expanded: boolean = true;
|
||||||
|
public initialized: boolean = false;
|
||||||
|
|
||||||
constructor(private cdr: ChangeDetectorRef) {
|
constructor(private cdr: ChangeDetectorRef) {
|
||||||
}
|
}
|
||||||
|
@ -75,6 +76,7 @@ export class SearchInputComponent implements OnInit {
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.expanded = !this.expandable;
|
this.expanded = !this.expandable;
|
||||||
|
this.initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
expand(value: boolean) {
|
expand(value: boolean) {
|
||||||
|
|
Loading…
Reference in New Issue