correcting bug with paging in search pages + advanced pages, use SearchUtilsClass, show paging in advanced, correcting issue with paging base url in advanced

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@44587 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2016-11-21 13:21:31 +00:00
parent b43bf3934b
commit 206bc1e73b
17 changed files with 300 additions and 300 deletions

View File

@ -7,6 +7,7 @@ import {SearchResult} from '../../utils/entities/searchResult';
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties';
import {AdvancedSearchPageComponent} from '../searchUtils/advancedSearchPage.component';
import {SearchFields} from '../../utils/properties/searchFields';
import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
@ -14,10 +15,9 @@ import {SearchFields} from '../../utils/properties/searchFields';
selector: 'advanced-search-dataprovider',
template: `
<advanced-search-page pageTitle="Advanced Search Data Providers" entityType="dataprovider"
[(results)] = "results" [(totalResults)] = "totalResults"
[(page)] = "page" [(size)] = "size" [baseUrl] = "baseUrl"
[(results)] = "results" [(totalResults)] = "totalResults" [baseUrl] = "baseUrl"
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
[(status)] = "status"
[(searchUtils)] = "searchUtils"
(queryChange)="queryChanged($event)">
</advanced-search-page>
@ -28,9 +28,11 @@ export class AdvancedSearchDataProvidersComponent {
private results =[];
private filters =[];
private totalResults:number = 0 ;
private page :number = 1;
private size :number = 10;
public status:number;
// private page :number = 1;
// private size :number = 10;
// public status:number;
private searchUtils:SearchUtilsClass = new SearchUtilsClass();
private baseUrl: string;
private searchFields:SearchFields = new SearchFields();
@ -45,7 +47,7 @@ export class AdvancedSearchDataProvidersComponent {
this.results =[];
var errorCodes:ErrorCodes = new ErrorCodes();
this.status =errorCodes.LOADING;
this.searchUtils.size =errorCodes.LOADING;
this.baseUrl = OpenaireProperties.getLinkToSearchAdvancedPublications();
@ -53,15 +55,15 @@ export class AdvancedSearchDataProvidersComponent {
}
ngOnInit() {
var errorCodes:ErrorCodes = new ErrorCodes();
this.status =errorCodes.LOADING;
this.searchUtils.size =errorCodes.LOADING;
this.sub = this.route.queryParams.subscribe(params => {
let page = (params['page']=== undefined)?1:+params['page'];
this.page = ( page <= 0 ) ? 1 : page;
this.searchUtils.page = ( page <= 0 ) ? 1 : page;
this.searchPage.fieldIds = this.fieldIds;
this.searchPage.selectedFields = this.selectedFields;
this.searchPage.fieldIdsMap = this.fieldIdsMap;
this.searchPage.getSelectedFiltersFromUrl(params);
this.getResults(this.searchPage.createQueryParameters(), this.page, this.size);
this.getResults(this.searchPage.createQueryParameters(), this.searchUtils.page, this.searchUtils.size);
});
}
@ -71,7 +73,7 @@ export class AdvancedSearchDataProvidersComponent {
sub: any;
public getResults(parameters:string, page: number, size: number){
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.LOADING;
this.searchUtils.status = errorCodes.LOADING;
console.info("Advanced Search Publications: Execute search query "+parameters);
this._searchDataProvidersService.searchDataproviders(parameters, null, page, size, []).subscribe(
data => {
@ -80,9 +82,9 @@ export class AdvancedSearchDataProvidersComponent {
this.results = data[1];
this.searchPage.updateBaseUrlWithParameters();
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.DONE;
this.searchUtils.status = errorCodes.DONE;
if(this.totalResults == 0 ){
this.status = errorCodes.NONE;
this.searchUtils.status = errorCodes.NONE;
}
},
err => {
@ -90,10 +92,10 @@ export class AdvancedSearchDataProvidersComponent {
console.info("error");
//TODO check erros (service not available, bad request)
// if( ){
// this.status = ErrorCodes.ERROR;
// this.searchUtils.status = errorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.NOT_AVAILABLE;
this.searchUtils.status = errorCodes.NOT_AVAILABLE;
}
);
}
@ -103,7 +105,7 @@ export class AdvancedSearchDataProvidersComponent {
private queryChanged($event) {
var parameters = $event.value;
this.getResults(parameters, this.page,this.size);
this.getResults(parameters, this.searchUtils.page,this.searchUtils.size);
console.info("queryChanged: Execute search query "+parameters);
}

View File

@ -7,7 +7,7 @@ import {SearchResult} from '../../utils/entities/searchResult';
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties';
import {AdvancedSearchPageComponent} from '../searchUtils/advancedSearchPage.component';
import {SearchFields} from '../../utils/properties/searchFields';
import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
@Component({
@ -15,9 +15,8 @@ import {SearchFields} from '../../utils/properties/searchFields';
template: `
<advanced-search-page pageTitle="Advanced Search Datasets" entityType="dataset"
[(results)] = "results" [(totalResults)] = "totalResults"
[(page)] = "page" [(size)] = "size" [baseUrl] = "baseUrl"
[(searchUtils)] = "searchUtils" [baseUrl] = "baseUrl"
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
[(status)] = "status"
(queryChange)="queryChanged($event)">
</advanced-search-page>
@ -28,9 +27,11 @@ export class AdvancedSearchDatasetsComponent {
private results =[];
private filters =[];
private totalResults:number = 0 ;
private page :number = 1;
private size :number = 10;
public status:number;
// private page :number = 1;
// private size :number = 10;
// public status:number;
private searchUtils:SearchUtilsClass = new SearchUtilsClass();
private baseUrl: string;
private searchFields:SearchFields = new SearchFields();
@ -45,7 +46,7 @@ export class AdvancedSearchDatasetsComponent {
this.results =[];
var errorCodes:ErrorCodes = new ErrorCodes();
this.status =errorCodes.LOADING;
this.searchUtils.size =errorCodes.LOADING;
this.baseUrl = OpenaireProperties.getLinkToSearchAdvancedPublications();
@ -53,15 +54,15 @@ export class AdvancedSearchDatasetsComponent {
}
ngOnInit() {
var errorCodes:ErrorCodes = new ErrorCodes();
this.status =errorCodes.LOADING;
this.searchUtils.size =errorCodes.LOADING;
this.sub = this.route.queryParams.subscribe(params => {
let page = (params['page']=== undefined)?1:+params['page'];
this.page = ( page <= 0 ) ? 1 : page;
this.searchUtils.page = ( page <= 0 ) ? 1 : page;
this.searchPage.fieldIds = this.fieldIds;
this.searchPage.selectedFields = this.selectedFields;
this.searchPage.fieldIdsMap = this.fieldIdsMap;
this.searchPage.getSelectedFiltersFromUrl(params);
this.getResults(this.searchPage.createQueryParameters(), this.page, this.size);
this.getResults(this.searchPage.createQueryParameters(), this.searchUtils.page, this.searchUtils.size);
});
}
@ -71,7 +72,7 @@ export class AdvancedSearchDatasetsComponent {
sub: any;
public getResults(parameters:string, page: number, size: number){
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.LOADING;
this.searchUtils.status = errorCodes.LOADING;
console.info("Advanced Search Datasets: Execute search query "+parameters);
this._searchDatasetsService.searchDatasets(parameters, null, page, size, []).subscribe(
data => {
@ -80,9 +81,9 @@ export class AdvancedSearchDatasetsComponent {
this.results = data[1];
this.searchPage.updateBaseUrlWithParameters();
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.DONE;
this.searchUtils.status = errorCodes.DONE;
if(this.totalResults == 0 ){
this.status = errorCodes.NONE;
this.searchUtils.status = errorCodes.NONE;
}
},
err => {
@ -90,10 +91,10 @@ export class AdvancedSearchDatasetsComponent {
console.info("error");
//TODO check erros (service not available, bad request)
// if( ){
// this.status = ErrorCodes.ERROR;
// this.searchUtils.status = errorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.NOT_AVAILABLE;
this.searchUtils.status = errorCodes.NOT_AVAILABLE;
}
);
}
@ -103,7 +104,7 @@ export class AdvancedSearchDatasetsComponent {
private queryChanged($event) {
var parameters = $event.value;
this.getResults(parameters, this.page,this.size);
this.getResults(parameters, this.searchUtils.page,this.searchUtils.size);
console.info("queryChanged: Execute search query "+parameters);
}

View File

@ -7,7 +7,7 @@ import {SearchResult} from '../../utils/entities/searchResult';
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties';
import {AdvancedSearchPageComponent} from '../searchUtils/advancedSearchPage.component';
import {SearchFields} from '../../utils/properties/searchFields';
import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
@Component({
@ -15,9 +15,8 @@ import {SearchFields} from '../../utils/properties/searchFields';
template: `
<advanced-search-page pageTitle="Advanced Search Organizations" entityType="dataset"
[(results)] = "results" [(totalResults)] = "totalResults"
[(page)] = "page" [(size)] = "size" [baseUrl] = "baseUrl"
[(searchUtils)] = "searchUtils" [baseUrl] = "baseUrl"
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
[(status)] = "status"
(queryChange)="queryChanged($event)">
</advanced-search-page>
@ -28,9 +27,11 @@ export class AdvancedSearchOrganizationsComponent {
private results =[];
private filters =[];
private totalResults:number = 0 ;
private page :number = 1;
private size :number = 10;
public status:number;
// private page :number = 1;
// private size :number = 10;
// public status:number;
private searchUtils:SearchUtilsClass = new SearchUtilsClass();
private baseUrl: string;
private searchFields:SearchFields = new SearchFields();
@ -45,7 +46,7 @@ export class AdvancedSearchOrganizationsComponent {
this.results =[];
var errorCodes:ErrorCodes = new ErrorCodes();
this.status =errorCodes.LOADING;
this.searchUtils.size =errorCodes.LOADING;
this.baseUrl = OpenaireProperties.getLinkToSearchAdvancedPublications();
@ -53,15 +54,15 @@ export class AdvancedSearchOrganizationsComponent {
}
ngOnInit() {
var errorCodes:ErrorCodes = new ErrorCodes();
this.status =errorCodes.LOADING;
this.searchUtils.size =errorCodes.LOADING;
this.sub = this.route.queryParams.subscribe(params => {
let page = (params['page']=== undefined)?1:+params['page'];
this.page = ( page <= 0 ) ? 1 : page;
this.searchUtils.page = ( page <= 0 ) ? 1 : page;
this.searchPage.fieldIds = this.fieldIds;
this.searchPage.selectedFields = this.selectedFields;
this.searchPage.fieldIdsMap = this.fieldIdsMap;
this.searchPage.getSelectedFiltersFromUrl(params);
this.getResults(this.searchPage.createQueryParameters(), this.page, this.size);
this.getResults(this.searchPage.createQueryParameters(), this.searchUtils.page, this.searchUtils.size);
});
}
@ -71,7 +72,7 @@ export class AdvancedSearchOrganizationsComponent {
sub: any;
public getResults(parameters:string, page: number, size: number){
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.LOADING;
this.searchUtils.status = errorCodes.LOADING;
console.info("Advanced Search Organizations: Execute search query "+parameters);
this._searchOrganizationsService.searchOrganizations(parameters, null, page, size, []).subscribe(
data => {
@ -80,9 +81,9 @@ export class AdvancedSearchOrganizationsComponent {
this.results = data[1];
this.searchPage.updateBaseUrlWithParameters();
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.DONE;
this.searchUtils.status = errorCodes.DONE;
if(this.totalResults == 0 ){
this.status = errorCodes.NONE;
this.searchUtils.status = errorCodes.NONE;
}
},
err => {
@ -90,10 +91,10 @@ export class AdvancedSearchOrganizationsComponent {
console.info("error");
//TODO check erros (service not available, bad request)
// if( ){
// this.status = ErrorCodes.ERROR;
// this.searchUtils.status = errorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.NOT_AVAILABLE;
this.searchUtils.status = errorCodes.NOT_AVAILABLE;
}
);
}
@ -103,7 +104,7 @@ export class AdvancedSearchOrganizationsComponent {
private queryChanged($event) {
var parameters = $event.value;
this.getResults(parameters, this.page,this.size);
this.getResults(parameters, this.searchUtils.page,this.searchUtils.size);
console.info("queryChanged: Execute search query "+parameters);
}

View File

@ -7,7 +7,7 @@ import {SearchResult} from '../../utils/entities/searchResult';
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties';
import {AdvancedSearchPageComponent} from '../searchUtils/advancedSearchPage.component';
import {SearchFields} from '../../utils/properties/searchFields';
import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
@Component({
@ -15,9 +15,8 @@ import {SearchFields} from '../../utils/properties/searchFields';
template: `
<advanced-search-page pageTitle="Advanced Search People" entityType="dataset"
[(results)] = "results" [(totalResults)] = "totalResults"
[(page)] = "page" [(size)] = "size" [baseUrl] = "baseUrl"
[(searchUtils)] = "searchUtils" [baseUrl] = "baseUrl"
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
[(status)] = "status"
(queryChange)="queryChanged($event)">
</advanced-search-page>
@ -28,9 +27,11 @@ export class AdvancedSearchPeopleComponent {
private results =[];
private filters =[];
private totalResults:number = 0 ;
private page :number = 1;
private size :number = 10;
public status:number;
// private page :number = 1;
// private size :number = 10;
// public status:number;
private searchUtils:SearchUtilsClass = new SearchUtilsClass();
private baseUrl: string;
private searchFields:SearchFields = new SearchFields();
@ -45,7 +46,7 @@ export class AdvancedSearchPeopleComponent {
this.results =[];
var errorCodes:ErrorCodes = new ErrorCodes();
this.status =errorCodes.LOADING;
this.searchUtils.size =errorCodes.LOADING;
this.baseUrl = OpenaireProperties.getLinkToSearchAdvancedPublications();
@ -53,15 +54,15 @@ export class AdvancedSearchPeopleComponent {
}
ngOnInit() {
var errorCodes:ErrorCodes = new ErrorCodes();
this.status =errorCodes.LOADING;
this.searchUtils.size =errorCodes.LOADING;
this.sub = this.route.queryParams.subscribe(params => {
let page = (params['page']=== undefined)?1:+params['page'];
this.page = ( page <= 0 ) ? 1 : page;
this.searchUtils.page = ( page <= 0 ) ? 1 : page;
this.searchPage.fieldIds = this.fieldIds;
this.searchPage.selectedFields = this.selectedFields;
this.searchPage.fieldIdsMap = this.fieldIdsMap;
this.searchPage.getSelectedFiltersFromUrl(params);
this.getResults(this.searchPage.createQueryParameters(), this.page, this.size);
this.getResults(this.searchPage.createQueryParameters(), this.searchUtils.page, this.searchUtils.size);
});
}
@ -71,7 +72,7 @@ export class AdvancedSearchPeopleComponent {
sub: any;
public getResults(parameters:string, page: number, size: number){
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.LOADING;
this.searchUtils.status = errorCodes.LOADING;
console.info("Advanced Search People: Execute search query "+parameters);
this._searchPeopleService.searchPeople(parameters, null, page, size, []).subscribe(
data => {
@ -80,9 +81,9 @@ export class AdvancedSearchPeopleComponent {
this.results = data[1];
this.searchPage.updateBaseUrlWithParameters();
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.DONE;
this.searchUtils.status = errorCodes.DONE;
if(this.totalResults == 0 ){
this.status = errorCodes.NONE;
this.searchUtils.status = errorCodes.NONE;
}
},
err => {
@ -90,10 +91,10 @@ export class AdvancedSearchPeopleComponent {
console.info("error");
//TODO check erros (service not available, bad request)
// if( ){
// this.status = ErrorCodes.ERROR;
// this.searchUtils.status = errorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.NOT_AVAILABLE;
this.searchUtils.status = errorCodes.NOT_AVAILABLE;
}
);
}
@ -103,7 +104,7 @@ export class AdvancedSearchPeopleComponent {
private queryChanged($event) {
var parameters = $event.value;
this.getResults(parameters, this.page,this.size);
this.getResults(parameters, this.searchUtils.page,this.searchUtils.size);
console.info("queryChanged: Execute search query "+parameters);
}

View File

@ -7,17 +7,15 @@ import {SearchResult} from '../../utils/entities/searchResult';
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties';
import {AdvancedSearchPageComponent} from '../searchUtils/advancedSearchPage.component';
import {SearchFields} from '../../utils/properties/searchFields';
import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
@Component({
selector: 'advanced-search-projects',
template: `
<advanced-search-page pageTitle="Advanced Search Projects" entityType="project"
[(results)] = "results" [(totalResults)] = "totalResults"
[(page)] = "page" [(size)] = "size" [baseUrl] = "baseUrl"
[(searchUtils)] = "searchUtils" [baseUrl] = "baseUrl"
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
[(status)] = "status"
(queryChange)="queryChanged($event)">
</advanced-search-page>
@ -28,9 +26,11 @@ export class AdvancedSearchProjectsComponent {
private results =[];
private filters =[];
private totalResults:number = 0 ;
private page :number = 1;
private size :number = 10;
public status:number;
// private page :number = 1;
// private size :number = 10;
// public status:number;
private searchUtils:SearchUtilsClass = new SearchUtilsClass();
private baseUrl: string;
private searchFields:SearchFields = new SearchFields();
@ -45,7 +45,7 @@ export class AdvancedSearchProjectsComponent {
this.results =[];
var errorCodes:ErrorCodes = new ErrorCodes();
this.status =errorCodes.LOADING;
this.searchUtils.size =errorCodes.LOADING;
this.baseUrl = OpenaireProperties.getLinkToSearchAdvancedPublications();
@ -53,15 +53,15 @@ export class AdvancedSearchProjectsComponent {
}
ngOnInit() {
var errorCodes:ErrorCodes = new ErrorCodes();
this.status =errorCodes.LOADING;
this.searchUtils.size =errorCodes.LOADING;
this.sub = this.route.queryParams.subscribe(params => {
let page = (params['page']=== undefined)?1:+params['page'];
this.page = ( page <= 0 ) ? 1 : page;
this.searchUtils.page = ( page <= 0 ) ? 1 : page;
this.searchPage.fieldIds = this.fieldIds;
this.searchPage.selectedFields = this.selectedFields;
this.searchPage.fieldIdsMap = this.fieldIdsMap;
this.searchPage.getSelectedFiltersFromUrl(params);
this.getResults(this.searchPage.createQueryParameters(), this.page, this.size);
this.getResults(this.searchPage.createQueryParameters(), this.searchUtils.page, this.searchUtils.size);
});
}
@ -71,7 +71,7 @@ export class AdvancedSearchProjectsComponent {
sub: any;
public getResults(parameters:string, page: number, size: number){
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.LOADING;
this.searchUtils.status = errorCodes.LOADING;
console.info("Advanced Search Publications: Execute search query "+parameters);
this._searchProjectsService.searchProjects(parameters, null, page, size, []).subscribe(
data => {
@ -80,9 +80,9 @@ export class AdvancedSearchProjectsComponent {
this.results = data[1];
this.searchPage.updateBaseUrlWithParameters();
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.DONE;
this.searchUtils.status = errorCodes.DONE;
if(this.totalResults == 0 ){
this.status = errorCodes.NONE;
this.searchUtils.status = errorCodes.NONE;
}
},
err => {
@ -90,10 +90,10 @@ export class AdvancedSearchProjectsComponent {
console.info("error");
//TODO check erros (service not available, bad request)
// if( ){
// this.status = ErrorCodes.ERROR;
// this.searchUtils.status = errorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.NOT_AVAILABLE;
this.searchUtils.status = errorCodes.NOT_AVAILABLE;
}
);
}
@ -103,7 +103,7 @@ export class AdvancedSearchProjectsComponent {
private queryChanged($event) {
var parameters = $event.value;
this.getResults(parameters, this.page,this.size);
this.getResults(parameters, this.searchUtils.page,this.searchUtils.size);
console.info("queryChanged: Execute search query "+parameters);
}

View File

@ -7,7 +7,7 @@ import {SearchResult} from '../../utils/entities/searchResult';
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties';
import {AdvancedSearchPageComponent} from '../searchUtils/advancedSearchPage.component';
import {SearchFields} from '../../utils/properties/searchFields';
import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
@Component({
@ -15,9 +15,8 @@ import {SearchFields} from '../../utils/properties/searchFields';
template: `
<advanced-search-page pageTitle="Advanced Search Publications" entityType="publication"
[(results)] = "results" [(totalResults)] = "totalResults"
[(page)] = "page" [(size)] = "size" [baseUrl] = "baseUrl"
[(searchUtils)] = "searchUtils" [baseUrl] = "baseUrl"
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
[(status)] = "status"
(queryChange)="queryChanged($event)">
</advanced-search-page>
@ -28,9 +27,8 @@ export class AdvancedSearchPublicationsComponent {
private results =[];
private filters =[];
private totalResults:number = 0 ;
private page :number = 1;
private size :number = 10;
public status:number;
private searchUtils:SearchUtilsClass = new SearchUtilsClass();
private baseUrl: string;
private searchFields:SearchFields = new SearchFields();
@ -45,7 +43,7 @@ export class AdvancedSearchPublicationsComponent {
this.results =[];
var errorCodes:ErrorCodes = new ErrorCodes();
this.status =errorCodes.LOADING;
this.searchUtils.status =errorCodes.LOADING;
this.baseUrl = OpenaireProperties.getLinkToSearchAdvancedPublications();
@ -53,15 +51,15 @@ export class AdvancedSearchPublicationsComponent {
}
ngOnInit() {
var errorCodes:ErrorCodes = new ErrorCodes();
this.status =errorCodes.LOADING;
this.searchUtils.status =errorCodes.LOADING;
this.sub = this.route.queryParams.subscribe(params => {
let page = (params['page']=== undefined)?1:+params['page'];
this.page = ( page <= 0 ) ? 1 : page;
this.searchUtils.page = ( page <= 0 ) ? 1 : page;
this.searchPage.fieldIds = this.fieldIds;
this.searchPage.selectedFields = this.selectedFields;
this.searchPage.fieldIdsMap = this.fieldIdsMap;
this.searchPage.getSelectedFiltersFromUrl(params);
this.getResults(this.searchPage.createQueryParameters(), this.page, this.size);
this.getResults(this.searchPage.createQueryParameters(), this.searchUtils.page, this.searchUtils.size);
});
}
@ -71,7 +69,7 @@ export class AdvancedSearchPublicationsComponent {
sub: any;
public getResults(parameters:string, page: number, size: number){
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.LOADING;
this.searchUtils.status = errorCodes.LOADING;
console.info("Advanced Search Publications: Execute search query "+parameters);
this._searchPublicationsService.searchPublications(parameters, null, page, size, []).subscribe(
data => {
@ -80,9 +78,9 @@ export class AdvancedSearchPublicationsComponent {
this.results = data[1];
this.searchPage.updateBaseUrlWithParameters();
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.DONE;
this.searchUtils.status = errorCodes.DONE;
if(this.totalResults == 0 ){
this.status = errorCodes.NONE;
this.searchUtils.status = errorCodes.NONE;
}
},
err => {
@ -90,10 +88,10 @@ export class AdvancedSearchPublicationsComponent {
console.info("error");
//TODO check erros (service not available, bad request)
// if( ){
// this.status = ErrorCodes.ERROR;
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.NOT_AVAILABLE;
this.searchUtils.status = errorCodes.NOT_AVAILABLE;
}
);
}
@ -103,7 +101,7 @@ export class AdvancedSearchPublicationsComponent {
private queryChanged($event) {
var parameters = $event.value;
this.getResults(parameters, this.page,this.size);
this.getResults(parameters, this.searchUtils.page,this.searchUtils.size);
console.info("queryChanged: Execute search query "+parameters);
}

View File

@ -8,14 +8,15 @@ import {SearchResult} from '../../utils/entities/searchResult';
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties';
import {SearchFields} from '../../utils/properties/searchFields';
import {SearchPageComponent } from '../searchUtils/searchPage.component';
import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
@Component({
selector: 'search-dataproviders',
template: `
<search-page pageTitle="Compatible Dataproviders" type="datasource" [(filters)] = "filters"
[(results)] = "results" [(totalResults)] = "totalResults" [(keyword)] = "keyword"
[(page)] = "page" [(size)] = "size" [(status)] = "status" [baseUrl] = "baseUrl" [showResultCount]=false (queryChange)="queryChanged($event)" >
[(results)] = "results" [(totalResults)] = "totalResults" [(searchUtils)] = "searchUtils"
[baseUrl] = "baseUrl" [showResultCount]=false (queryChange)="queryChanged($event)" >
</search-page>
<!--table-view [(datasources)] = results></table-view-->
@ -27,10 +28,7 @@ export class SearchCompatibleDataprovidersComponent {
private filters =[];
public totalResults:number = 0 ;
private baseUrl:string;
public status:number;
private keyword = '';
private page :number = 1;
private size :number = 10;
private searchUtils:SearchUtilsClass = new SearchUtilsClass();
private sub: any; private subResults: any;
private _location:Location;
private searchFields:SearchFields = new SearchFields();
@ -44,7 +42,7 @@ export class SearchCompatibleDataprovidersComponent {
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) {
var errorCodes:ErrorCodes = new ErrorCodes();
this.status =errorCodes.LOADING;
this.searchUtils.status =errorCodes.LOADING;
this.baseUrl = OpenaireProperties.getLinkToSearchDataProviders();
for(var i = 0; i < this._prefixQueryFields.length; i++ ){
for(var j =0; j < this._prefixQueryFields[i].values.length; j++){
@ -61,11 +59,11 @@ export class SearchCompatibleDataprovidersComponent {
this.searchPage.indexIdsMap = this.indexIdsMap;
this.searchPage.fieldIdsMap = this.fieldIdsMap;
this.sub = this.route.queryParams.subscribe(params => {
this.keyword = (params['keyword']?params['keyword']:'');
this.page = (params['page']=== undefined)?1:+params['page'];
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
this.filters = this.createFilters();
var queryParameters = this.searchPage.getIndexQueryParametersFromUrl(params);
this._getResults(queryParameters, false, this.page, this.size);
this._getResults(queryParameters, false, this.searchUtils.page, this.searchUtils.size);
});
}
@ -86,19 +84,19 @@ export class SearchCompatibleDataprovidersComponent {
this.searchPage.checkSelectedFilters(this.filters);
this.searchPage.updateBaseUrlWithParameters(this.filters);
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.DONE;
this.searchUtils.status = errorCodes.DONE;
if(this.totalResults == 0 ){
this.status = errorCodes.NONE;
this.searchUtils.status = errorCodes.NONE;
}
},
err => {
console.error(err);
//TODO check erros (service not available, bad request)
// if( ){
// this.status = ErrorCodes.ERROR;
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.ERROR;
this.searchUtils.status = errorCodes.ERROR;
}
);
}
@ -110,7 +108,7 @@ export class SearchCompatibleDataprovidersComponent {
var parameters = $event.index;
console.info("queryChanged: Execute search query "+parameters);
this._getResults(parameters, false, this.page, this.size);
this._getResults(parameters, false, this.searchUtils.page, this.searchUtils.size);
}
private createFilters():Filter[] {
var filter_names=["Type","Compatibility Level"];

View File

@ -8,14 +8,16 @@ import {SearchResult} from '../../utils/entities/searchResult';
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties';
import {SearchFields} from '../../utils/properties/searchFields';
import {SearchPageComponent } from '../searchUtils/searchPage.component';
import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
@Component({
selector: 'search-entity-registries',
template: `
<search-page pageTitle="Entity Registries" type="datasource" [(filters)] = "filters"
[(results)] = "results" [(totalResults)] = "totalResults" [(keyword)] = "keyword"
[(page)] = "page" [(size)] = "size" [(status)] = "status" [baseUrl] = "baseUrl" [showResultCount]=false (queryChange)="queryChanged($event)" >
[(results)] = "results" [(totalResults)] = "totalResults" [(searchUtils)] = "searchUtils"
[baseUrl] = "baseUrl" [showResultCount]=false (queryChange)="queryChanged($event)" >
</search-page>
`
@ -26,10 +28,7 @@ export class SearchEntityRegistriesComponent {
private filters =[];
public totalResults:number = 0 ;
private baseUrl:string;
public status:number;
private keyword = '';
private page :number = 1;
private size :number = 10;
private searchUtils:SearchUtilsClass = new SearchUtilsClass();
private sub: any; private subResults: any;
private _location:Location;
private searchFields:SearchFields = new SearchFields();
@ -44,7 +43,7 @@ export class SearchEntityRegistriesComponent {
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) {
var errorCodes:ErrorCodes = new ErrorCodes();
this.status =errorCodes.LOADING;
this.searchUtils.status =errorCodes.LOADING;
this.baseUrl = OpenaireProperties.getLinkToSearchDataProviders();
for(var i = 0; i < this._prefixQueryFields.length; i++ ){
for(var j =0; j < this._prefixQueryFields[i].values.length; j++){
@ -61,12 +60,12 @@ export class SearchEntityRegistriesComponent {
this.searchPage.indexIdsMap = this.indexIdsMap;
this.searchPage.fieldIdsMap = this.fieldIdsMap;
this.sub = this.route.queryParams.subscribe(params => {
this.keyword = (params['keyword']?params['keyword']:'');
this.page = (params['page']=== undefined)?1:+params['page'];
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
this.filters = this.createFilters();
var queryParameters = this.searchPage.getIndexQueryParametersFromUrl(params);
this._getResults(queryParameters, false, this.page, this.size);
this._getResults(queryParameters, false, this.searchUtils.page, this.searchUtils.size);
});
}
@ -86,19 +85,19 @@ export class SearchEntityRegistriesComponent {
this.searchPage.checkSelectedFilters(this.filters);
this.searchPage.updateBaseUrlWithParameters(this.filters);
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.DONE;
this.searchUtils.status = errorCodes.DONE;
if(this.totalResults == 0 ){
this.status = errorCodes.NONE;
this.searchUtils.status = errorCodes.NONE;
}
},
err => {
console.error(err);
//TODO check erros (service not available, bad request)
// if( ){
// this.status = ErrorCodes.ERROR;
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.ERROR;
this.searchUtils.status = errorCodes.ERROR;
}
);
}
@ -109,7 +108,7 @@ export class SearchEntityRegistriesComponent {
private queryChanged($event) {
var parameters = $event.index;
console.info("queryChanged: Execute search query "+parameters);
this._getResults(parameters, false, this.page, this.size);
this._getResults(parameters, false, this.searchUtils.page, this.searchUtils.size);
}
private createFilters():Filter[] {
var filter_names=["Type","Compatibility Level"];

View File

@ -8,14 +8,14 @@ import {OpenaireProperties, ErrorCodes} from '../utils/properties/openaireProper
import {SearchFields} from '../utils/properties/searchFields';
import {SearchPageComponent } from './searchUtils/searchPage.component';
import {ExportCSVComponent} from '../utils/exportCSV.component';
import {SearchUtilsClass } from './searchUtils/searchUtils.class';
@Component({
selector: 'search-dataproviders',
template: `
<search-page pageTitle="Search Dataproviders" type="datasource" [(filters)] = "filters"
[(results)] = "results" [(totalResults)] = "totalResults" [(keyword)] = "keyword"
[(page)] = "page" [(size)] = "size" [(status)] = "status" [baseUrl] = "baseUrl"
[(results)] = "results" [(totalResults)] = "totalResults" [(searchUtils)] = "searchUtils" [baseUrl] = "baseUrl"
(queryChange)="queryChanged($event)" (downloadClick)="downloadClicked($event)">
</search-page>
@ -26,10 +26,7 @@ export class SearchDataprovidersComponent {
private filters =[];
public totalResults:number = 0 ;
private baseUrl:string;
public status:number;
private keyword = '';
private page :number = 1;
private size :number = 10;
private searchUtils:SearchUtilsClass = new SearchUtilsClass();
private sub: any; private subResults: any;
private _location:Location;
private searchFields:SearchFields = new SearchFields();
@ -45,7 +42,7 @@ export class SearchDataprovidersComponent {
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) {
var errorCodes:ErrorCodes = new ErrorCodes();
this.status =errorCodes.LOADING;
this.searchUtils.status =errorCodes.LOADING;
this.baseUrl = OpenaireProperties.getLinkToSearchDataProviders();
}
@ -55,12 +52,12 @@ export class SearchDataprovidersComponent {
this.searchPage.fieldIdsMap = this.fieldIdsMap;
this.sub = this.route.queryParams.subscribe(params => {
this.keyword = (params['keyword']?params['keyword']:'');
this.page = (params['page']=== undefined)?1:+params['page'];
console.info("PAGE init = "+this.page);
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
console.info("PAGE init = "+this.searchUtils.page);
var queryParameters = this.searchPage.getQueryParametersFromUrl(params);
this._getResults(queryParameters, true, this.page, this.size);
this._getResults(queryParameters, true, this.searchUtils.page, this.searchUtils.size);
});
}
@ -91,10 +88,10 @@ console.info("PAGE init = "+this.page);
console.error(err);
//TODO check erros (service not available, bad request)
// if( ){
// this.status = ErrorCodes.ERROR;
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.ERROR;
this.searchUtils.status = errorCodes.ERROR;
}
);
}
@ -113,15 +110,15 @@ console.info("PAGE init = "+this.page);
console.error(err);
//TODO check erros (service not available, bad request)
// if( ){
// this.status = ErrorCodes.ERROR;
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.ERROR;
this.searchUtils.status = errorCodes.ERROR;
}
);
}
public getResultsForDeposit(id:string, type:string, page: number, size: number){
public getResultsForDeposit(id:string, type:string, page: number, size: number){
if(id != "") {
@ -132,19 +129,19 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number){
this.results = data[1];
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.DONE;
this.searchUtils.status = errorCodes.DONE;
if(this.totalResults == 0 ){
this.status = errorCodes.NONE;
this.searchUtils.status = errorCodes.NONE;
}
},
err => {
console.error(err);
//TODO check erros (service not available, bad request)
// if( ){
// this.status = ErrorCodes.ERROR;
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.ERROR;
this.searchUtils.status = errorCodes.ERROR;
}
);
}
@ -165,19 +162,19 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number){
this.results = data[1];
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.DONE;
this.searchUtils.status = errorCodes.DONE;
if(this.totalResults == 0 ){
this.status = errorCodes.NONE;
this.searchUtils.status = errorCodes.NONE;
}
},
err => {
console.error(err);
//TODO check erros (service not available, bad request)
// if( ){
// this.status = ErrorCodes.ERROR;
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.ERROR;
this.searchUtils.status = errorCodes.ERROR;
}
);
}
@ -188,7 +185,7 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number){
if(keyword.length > 0){
parameters = "q=" + keyword + "&op=and";
}
this._getResults(parameters,refine,page,size);
this._getResults(parameters,refine,page,this.searchUtils.size);
}
private _getResults(parameters:string,refine:boolean, page: number, size: number){
if(!refine && !this.searchPage){
@ -204,19 +201,19 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number){
// this.filters = this.searchPage.checkSelectedFilters(data[2]);
this.searchPage.updateBaseUrlWithParameters(this.filters);
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.DONE;
this.searchUtils.status = errorCodes.DONE;
if(this.totalResults == 0 ){
this.status = errorCodes.NONE;
this.searchUtils.status = errorCodes.NONE;
}
},
err => {
console.error(err);
//TODO check erros (service not available, bad request)
// if( ){
// this.status = ErrorCodes.ERROR;
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.ERROR;
this.searchUtils.status = errorCodes.ERROR;
}
);
}
@ -227,8 +224,8 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number){
private queryChanged($event) {
var parameters = $event.value;
console.info("PAGE queryChanged = "+this.page);
this._getResults(parameters, true, this.page, this.size);
console.info("PAGE queryChanged = "+this.searchUtils.page);
this._getResults(parameters, true, this.searchUtils.page, this.searchUtils.size);
}
private downloadClicked($event) {
@ -245,19 +242,19 @@ console.info("PAGE queryChanged = "+this.page);
ExportCSVComponent.downloadCSV(this.CSV, "dataproviders.csv");
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.DONE;
this.searchUtils.status = errorCodes.DONE;
if(this.totalResults == 0 ){
this.status = errorCodes.NONE;
this.searchUtils.status = errorCodes.NONE;
}
},
err => {
console.error(err);
//TODO check erros (service not available, bad request)
// if( ){
// this.status = ErrorCodes.ERROR;
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.ERROR;
this.searchUtils.status = errorCodes.ERROR;
}
);
/*

View File

@ -8,13 +8,15 @@ import {SearchResult} from '../utils/entities/searchResult';
import {OpenaireProperties, ErrorCodes} from '../utils/properties/openaireProperties';
import {SearchFields} from '../utils/properties/searchFields';
import {SearchPageComponent } from './searchUtils/searchPage.component';
import {SearchUtilsClass } from './searchUtils/searchUtils.class';
@Component({
selector: 'search-datasets',
template: `
<search-page pageTitle="Search Datasets" type="datasource" [(filters)] = "filters"
[(results)] = "results" [(totalResults)] = "totalResults" [(keyword)] = "keyword"
[(page)] = "page" [(size)] = "size" [(status)] = "status" [baseUrl] = "baseUrl" (queryChange)="queryChanged($event)" >
[(results)] = "results" [(totalResults)] = "totalResults" [(searchUtils)] = "searchUtils"
[baseUrl] = "baseUrl" (queryChange)="queryChanged($event)" >
</search-page>
`
@ -25,10 +27,8 @@ export class SearchDatasetsComponent {
private filters: Filter[] =[];
public totalResults:number = 0 ;
private baseUrl:string;
public status:number;
private keyword = '';
private page :number = 1;
private size :number = 10;
private searchUtils:SearchUtilsClass = new SearchUtilsClass();
private sub: any;
private subResults: any;
private searchFields:SearchFields = new SearchFields();
@ -43,7 +43,7 @@ export class SearchDatasetsComponent {
constructor (private route: ActivatedRoute, private _searchDatasetsService: SearchDatasetsService ) {
var errorCodes:ErrorCodes = new ErrorCodes();
this.status =errorCodes.LOADING;
this.searchUtils.status =errorCodes.LOADING;
this.baseUrl = OpenaireProperties.getLinkToSearchDatasets();
}
@ -54,12 +54,12 @@ export class SearchDatasetsComponent {
this.searchPage.fieldIdsMap = this.fieldIdsMap;
this.sub = this.route.queryParams.subscribe(params => {
this.keyword = (params['keyword']?params['keyword']:'');
this.page = (params['page']=== undefined)?1:+params['page'];
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
// this.getRefineResults();
//this.getResults(this.keyword, this.page, this.size, "searchPage");
//this.getResults(this.searchUtils.keyword, this.searchUtils.page, this.searchUtils.size, "searchPage");
var queryParameters = this.searchPage.getQueryParametersFromUrl(params);
this._getResults(queryParameters, true, this.page, this.size);
this._getResults(queryParameters, true, this.searchUtils.page, this.searchUtils.size);
});
}
@ -92,19 +92,19 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number)
this.results = data[1];
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.DONE;
this.searchUtils.status = errorCodes.DONE;
if(this.totalResults == 0 ){
this.status = errorCodes.NONE;
this.searchUtils.status = errorCodes.NONE;
}
},
err => {
console.error(err);
//TODO check erros (service not available, bad request)
// if( ){
// this.status = ErrorCodes.ERROR;
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.ERROR;
this.searchUtils.status = errorCodes.ERROR;
}
);
}
@ -127,19 +127,19 @@ public getResultsForDataproviders(id:string, resultsFrom:string, page: number, s
this.results = data[1];
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.DONE;
this.searchUtils.status = errorCodes.DONE;
if(this.totalResults == 0 ){
this.status = errorCodes.NONE;
this.searchUtils.status = errorCodes.NONE;
}
},
err => {
console.error(err);
//TODO check erros (service not available, bad request)
// if( ){
// this.status = ErrorCodes.ERROR;
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.ERROR;
this.searchUtils.status = errorCodes.ERROR;
}
);
}
@ -165,19 +165,19 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number
this.searchPage.checkSelectedFilters(this.filters);
this.searchPage.updateBaseUrlWithParameters(this.filters);
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.DONE;
this.searchUtils.status = errorCodes.DONE;
if(this.totalResults == 0 ){
this.status = errorCodes.NONE;
this.searchUtils.status = errorCodes.NONE;
}
},
err => {
console.error(err);
//TODO check erros (service not available, bad request)
// if( ){
// this.status = ErrorCodes.ERROR;
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.ERROR;
this.searchUtils.status = errorCodes.ERROR;
}
);
}
@ -190,7 +190,7 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number
private queryChanged($event) {
var parameters = $event.value;
//this.getResults(parameters, this.page, this.size, "searchPage");
this._getResults(parameters, true, this.page, this.size);
//this.getResults(parameters, this.searchUtils.page, this.searchUtils.size, "searchPage");
this._getResults(parameters, true, this.searchUtils.page, this.searchUtils.size);
}
}

View File

@ -7,13 +7,15 @@ import {SearchResult} from '../utils/entities/searchResult';
import {OpenaireProperties, ErrorCodes} from '../utils/properties/openaireProperties';
import {SearchFields} from '../utils/properties/searchFields';
import {SearchPageComponent } from './searchUtils/searchPage.component';
import {SearchUtilsClass } from './searchUtils/searchUtils.class';
@Component({
selector: 'search-organizations',
template: `
<search-page pageTitle="Search Organizations" type="datasource" [(filters)] = "filters"
[(results)] = "results" [(totalResults)] = "totalResults" [(keyword)] = "keyword"
[(page)] = "page" [(size)] = "size" [(status)] = "status" [baseUrl] = "baseUrl" (queryChange)="queryChanged($event)" >
[(results)] = "results" [(totalResults)] = "totalResults" [(searchUtils)] = "searchUtils"
[baseUrl] = "baseUrl" (queryChange)="queryChanged($event)" >
</search-page>
`
@ -24,10 +26,7 @@ export class SearchOrganizationsComponent {
private filters =[];
public totalResults:number = 0 ;
private baseUrl:string;
public status:number;
private keyword = '';
private page :number = 1;
private size :number = 10;
private searchUtils:SearchUtilsClass = new SearchUtilsClass();
private sub: any;
private subResults: any;
private searchFields:SearchFields = new SearchFields();
@ -42,7 +41,7 @@ export class SearchOrganizationsComponent {
constructor (private route: ActivatedRoute, private _searchOrganizationsService: SearchOrganizationsService ) {
var errorCodes:ErrorCodes = new ErrorCodes();
this.status =errorCodes.LOADING;
this.searchUtils.status =errorCodes.LOADING;
this.baseUrl = OpenaireProperties.getLinkToSearchOrganizations();
}
@ -53,11 +52,11 @@ export class SearchOrganizationsComponent {
this.searchPage.fieldIdsMap = this.fieldIdsMap;
this.sub = this.route.queryParams.subscribe(params => {
this.keyword = (params['keyword']?params['keyword']:'');
this.page = (params['page']=== undefined)?1:+params['page'];
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
var queryParameters = this.searchPage.getQueryParametersFromUrl(params);
this._getResults(queryParameters, true, this.page, this.size);
this._getResults(queryParameters, true, this.searchUtils.page, this.searchUtils.size);
});
}
@ -76,7 +75,7 @@ export class SearchOrganizationsComponent {
if(keyword.length > 0){
parameters = "q=" + keyword + "&op=and";
}
this._getResults(parameters,refine,page,size);
this._getResults(parameters,refine,page,this.searchUtils.size);
}
private _getResults(parameters:string,refine:boolean, page: number, size: number){
@ -92,19 +91,19 @@ export class SearchOrganizationsComponent {
this.searchPage.checkSelectedFilters(this.filters);
this.searchPage.updateBaseUrlWithParameters(this.filters);
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.DONE;
this.searchUtils.status = errorCodes.DONE;
if(this.totalResults == 0 ){
this.status = errorCodes.NONE;
this.searchUtils.status = errorCodes.NONE;
}
},
err => {
console.error(err);
//TODO check erros (service not available, bad request)
// if( ){
// this.status = ErrorCodes.ERROR;
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.ERROR;
this.searchUtils.status = errorCodes.ERROR;
}
);
}
@ -113,6 +112,6 @@ export class SearchOrganizationsComponent {
private queryChanged($event) {
var parameters = $event.value;
console.info("queryChanged: Execute search query "+parameters);
this._getResults(parameters, true, this.page, this.size);
this._getResults(parameters, true, this.searchUtils.page, this.searchUtils.size);
}
}

View File

@ -9,13 +9,15 @@ import {SearchResult} from '../utils/entities/searchResult';
import {OpenaireProperties, ErrorCodes} from '../utils/properties/openaireProperties';
import {SearchFields} from '../utils/properties/searchFields';
import {SearchPageComponent } from './searchUtils/searchPage.component';
import {SearchUtilsClass } from './searchUtils/searchUtils.class';
@Component({
selector: 'search-people',
template: `
<search-page pageTitle="Search People" type="people" [(filters)] = "filters"
[(results)] = "results" [(totalResults)] = "totalResults" [(keyword)] = "keyword"
[(page)] = "page" [(size)] = "size" [(status)] = "status" [baseUrl] = "baseUrl" (queryChange)="queryChanged($event)" [showRefine]=false >
[(results)] = "results" [(totalResults)] = "totalResults"
[(searchUtils)] = "searchUtils" [baseUrl] = "baseUrl" (queryChange)="queryChanged($event)" [showRefine]=false >
</search-page>
`
@ -25,11 +27,8 @@ export class SearchPeopleComponent {
public results =[];
private filters =[];
public totalResults:number = 0 ;
public status:number;
private baseUrl:string;
private keyword = '';
private page :number = 1;
private size :number = 10;
private searchUtils:SearchUtilsClass = new SearchUtilsClass();
private sub: any;
private _location:Location;
private refineFields = [];
@ -41,7 +40,7 @@ export class SearchPeopleComponent {
//this.results =[];
//this.filters =[];
var errorCodes:ErrorCodes = new ErrorCodes();
this.status =errorCodes.LOADING;
this.searchUtils.status =errorCodes.LOADING;
this.baseUrl = OpenaireProperties.getLinkToSearchPeople();
//get refine field filters from url parameters
if(!this.searchPage){
@ -52,8 +51,8 @@ export class SearchPeopleComponent {
private ngOnInit() {
this.searchPage.refineFields = this.refineFields; //TODO make it work as a directive
this.sub = this.route.queryParams.subscribe(params => {
this.keyword = (params['keyword']?params['keyword']:'');
this.page = (params['page']=== undefined)?1:+params['page'];
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
for(var i=0; i<5 ; i++){
var values = [];
for(var j=0; j<10 ; j++){
@ -91,7 +90,7 @@ export class SearchPeopleComponent {
});
var filter1:Filter = {title: "MYtitle"+i, filterId: "MYfilter_"+i, originalFilterId: "MYfilter_"+i, values : values, countSelectedValues:0, "filterOperator": 'or'}
this.filters.push(filter1);
this.getResults(this.keyword, true, this.page, this.size);
this.getResults(this.searchUtils.keyword, true, this.searchUtils.page, this.searchUtils.size);
}
@ -118,18 +117,18 @@ export class SearchPeopleComponent {
this.sub.unsubscribe();
}
/*
public getResults(parameters:string, page: number, size: number){
public getResults(parameters:string, page: number, searchUtils.size: number){
console.info("getResults: Execute search query "+parameters);
this._searchPeopleService.searchPeople(parameters, page, size).subscribe(
this._searchPeopleService.searchPeople(parameters, page, searchUtils.size).subscribe(
data => {
this.totalResults = data[0];
console.info("search People total="+this.totalResults);
this.results = data[1];
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.DONE;
this.searchUtils.status = errorCodes.DONE;
if(this.totalResults == 0 ){
this.status = errorCodes.NONE;
this.searchUtils.status = errorCodes.NONE;
}
},
err => {
@ -137,10 +136,10 @@ export class SearchPeopleComponent {
console.info("error");
//TODO check erros (service not available, bad request)
// if( ){
// this.status = ErrorCodes.ERROR;
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.NOT_AVAILABLE;
this.searchUtils.status = errorCodes.NOT_AVAILABLE;
}
);
}
@ -151,7 +150,7 @@ public getResults(keyword:string,refine:boolean, page: number, size: number){
if(keyword.length > 0){
parameters = "q=" + keyword + "&op=and";
}
this._getResults(parameters,refine,page,size);
this._getResults(parameters,refine,page,this.searchUtils.size);
}
private _getResults(parameters:string,refine:boolean, page: number, size: number){
@ -163,19 +162,19 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number
this.filters = this.searchPage.checkSelectedFilters(data[2]);
this.searchPage.updateBaseUrlWithParameters(this.filters);
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.DONE;
this.searchUtils.status = errorCodes.DONE;
if(this.totalResults == 0 ){
this.status = errorCodes.NONE;
this.searchUtils.status = errorCodes.NONE;
}
},
err => {
console.error(err);
//TODO check erros (service not available, bad request)
// if( ){
// this.status = ErrorCodes.ERROR;
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.ERROR;
this.searchUtils.status = errorCodes.ERROR;
}
);
}
@ -187,7 +186,7 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number
private queryChanged($event) {
var parameters = $event.value;
console.info("queryChanged: Execute search query "+parameters);
this._getResults(parameters, true, this.page, this.size);
this._getResults(parameters, true, this.searchUtils.page, this.searchUtils.size);
}

View File

@ -7,13 +7,16 @@ import {SearchResult} from '../utils/entities/searchResult';
import {OpenaireProperties, ErrorCodes} from '../utils/properties/openaireProperties';
import {SearchFields} from '../utils/properties/searchFields';
import {SearchPageComponent } from './searchUtils/searchPage.component';
import {SearchUtilsClass } from './searchUtils/searchUtils.class';
@Component({
selector: 'search-projects',
template: `
<search-page pageTitle="Search Projects" type="project" [(filters)] = "filters"
[(results)] = "results" [(totalResults)] = "totalResults" [(keyword)] = "keyword"
[(page)] = "page" [(size)] = "size" [(status)] = "status" [baseUrl] = "baseUrl" (queryChange)="queryChanged($event)" >
[(results)] = "results" [(totalResults)] = "totalResults"
[(searchUtils)] = "searchUtils"
[baseUrl] = "baseUrl" (queryChange)="queryChanged($event)" >
</search-page>
`
@ -22,11 +25,8 @@ export class SearchProjectsComponent {
public results =[];
private filters: Filter[] =[];
public totalResults:number = 0 ;
public status:number;
private baseUrl:string;
private keyword = '';
private page :number = 1;
private size :number = 10;
private searchUtils:SearchUtilsClass = new SearchUtilsClass();
private sub: any;
private subResults: any;
private searchFields:SearchFields = new SearchFields();
@ -42,7 +42,7 @@ export class SearchProjectsComponent {
console.info(" constructor SearchProjectsComponent "+this.refineFields.length);
var errorCodes:ErrorCodes = new ErrorCodes();
this.status =errorCodes.LOADING;
this.searchUtils.status =errorCodes.LOADING;
this.baseUrl = OpenaireProperties.getLinkToSearchProjects();
}
@ -57,13 +57,13 @@ export class SearchProjectsComponent {
this.sub = this.route.queryParams.subscribe(params => {
//get keyword from url parameters
this.keyword = (params['keyword']?params['keyword']:'');
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
//get page from url parameters
this.page = (params['page']=== undefined)?1:+params['page'];
this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
var queryParameters = this.searchPage.getQueryParametersFromUrl(params);
this._getResults(queryParameters, true, this.page, this.size);
this._getResults(queryParameters, true, this.searchUtils.page, this.searchUtils.size);
});
}
@ -81,7 +81,7 @@ export class SearchProjectsComponent {
if(keyword.length > 0){
parameters = "q=" + keyword + "&op=and";
}
this._getResults(parameters,refine,page,size);
this._getResults(parameters,refine,page,this.searchUtils.size);
}
private _getResults(parameters:string,refine:boolean, page: number, size: number){
if(!refine && !this.searchPage){
@ -97,19 +97,19 @@ export class SearchProjectsComponent {
// this.filters = this.searchPage.checkSelectedFilters(data[2]);
this.searchPage.updateBaseUrlWithParameters(this.filters);
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.DONE;
this.searchUtils.status = errorCodes.DONE;
if(this.totalResults == 0 ){
this.status = errorCodes.NONE;
this.searchUtils.status = errorCodes.NONE;
}
},
err => {
console.error(err);
//TODO check erros (service not available, bad request)
// if( ){
// this.status = ErrorCodes.ERROR;
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.ERROR;
this.searchUtils.status = errorCodes.ERROR;
}
);
}
@ -118,7 +118,7 @@ export class SearchProjectsComponent {
private queryChanged($event) {
this.urlParams = undefined;
var parameters = $event.value;
this._getResults(parameters, true, this.page, this.size);
this._getResults(parameters, true, this.searchUtils.page, this.searchUtils.size);
}
}

View File

@ -9,14 +9,15 @@ import {SearchResult} from '../utils/entities/searchResult';
import {OpenaireProperties, ErrorCodes} from '../utils/properties/openaireProperties';
import {SearchFields} from '../utils/properties/searchFields';
import {SearchPageComponent } from './searchUtils/searchPage.component';
import {SearchUtilsClass} from './searchUtils/searchUtils.class';
@Component({
selector: 'search-publications',
template: `
<search-page pageTitle="Search Publications" type="publication" [(filters)] = "filters"
[(results)] = "results" [(totalResults)] = "totalResults" [(keyword)] = "keyword"
[(page)] = "page" [(size)] = "size" [(status)] = "status" [baseUrl] = "baseUrl" (queryChange)="queryChanged($event)" >
[(results)] = "results" [(totalResults)] = "totalResults"
[(searchUtils)] = "searchUtils" [baseUrl] = "baseUrl" (queryChange)="queryChanged($event)" >
</search-page>
`
@ -26,11 +27,9 @@ export class SearchPublicationsComponent {
public results =[];
private filters =[];
public totalResults:number = 0 ;
public status:number;
private baseUrl:string;
private keyword = '';
private page :number = 1;
private size :number = 10;
private searchUtils:SearchUtilsClass = new SearchUtilsClass();
private sub: any;
private subResults: any;
private searchFields:SearchFields = new SearchFields();
@ -43,7 +42,7 @@ export class SearchPublicationsComponent {
constructor (private route: ActivatedRoute, private _searchPublicationsService: SearchPublicationsService ) {
var errorCodes:ErrorCodes = new ErrorCodes();
this.status =errorCodes.LOADING;
this.searchUtils.status =errorCodes.LOADING;
this.baseUrl = OpenaireProperties.getLinkToSearchPublications();
}
@ -54,10 +53,10 @@ export class SearchPublicationsComponent {
this.searchPage.fieldIdsMap = this.fieldIdsMap;
this.sub = this.route.queryParams.subscribe(params => {
this.keyword = (params['keyword']?params['keyword']:'');
this.page = (params['page']=== undefined)?1:+params['page'];
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
var queryParameters = this.searchPage.getQueryParametersFromUrl(params);
this._getResults(queryParameters, true, this.page, this.size);
this._getResults(queryParameters, true, this.searchUtils.page, this.searchUtils.size);
});
}
@ -112,19 +111,19 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number)
this.results = data[1];
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.DONE;
this.searchUtils.status = errorCodes.DONE;
if(this.totalResults == 0 ){
this.status = errorCodes.NONE;
this.searchUtils.status = errorCodes.NONE;
}
},
err => {
console.error(err);
//TODO check erros (service not available, bad request)
// if( ){
// this.status = ErrorCodes.ERROR;
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.ERROR;
this.searchUtils.status = errorCodes.ERROR;
}
);
}
@ -147,19 +146,19 @@ public getResultsForDataproviders(id:string, resultsFrom:string, page: number, s
this.results = data[1];
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.DONE;
this.searchUtils.status = errorCodes.DONE;
if(this.totalResults == 0 ){
this.status = errorCodes.NONE;
this.searchUtils.status = errorCodes.NONE;
}
},
err => {
console.error(err);
//TODO check erros (service not available, bad request)
// if( ){
// this.status = ErrorCodes.ERROR;
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.ERROR;
this.searchUtils.status = errorCodes.ERROR;
}
);
}
@ -185,19 +184,19 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number
this.searchPage.checkSelectedFilters(this.filters);
this.searchPage.updateBaseUrlWithParameters(this.filters);
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.DONE;
this.searchUtils.status = errorCodes.DONE;
if(this.totalResults == 0 ){
this.status = errorCodes.NONE;
this.searchUtils.status = errorCodes.NONE;
}
},
err => {
console.error(err);
//TODO check erros (service not available, bad request)
// if( ){
// this.status = ErrorCodes.ERROR;
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.status = errorCodes.ERROR;
this.searchUtils.status = errorCodes.ERROR;
}
);
}
@ -207,7 +206,8 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number
private queryChanged($event) {
var parameters = $event.value;
console.info("queryChanged: Execute search query "+parameters);
this._getResults(parameters, true, this.page, this.size);
console.info("Search Pubs::page "+this.searchUtils.page);
this._getResults(parameters, true, this.searchUtils.page, this.searchUtils.size);
}

View File

@ -4,6 +4,7 @@ import {Location} from '@angular/common';
import {Filter, Value,AdvancedField} from '../searchUtils/searchHelperClasses.class';
import {SearchResult} from '../../utils/entities/searchResult';
import {SearchFields} from '../../utils/properties/searchFields';
import {SearchUtilsClass} from './searchUtils.class';
@Component({
selector: 'advanced-search-page',
@ -34,12 +35,12 @@ import {SearchFields} from '../../utils/properties/searchFields';
[(selectedFields)]="selectedFields"
(queryChange)="queryChanged($event)">
</advanced-search-form>
<div class="text-right" *ngIf="results && results.length>= size">
<search-paging [(page)] = "page" [(size)] = "size" [(results)] = "results" [(baseUrl)] = "baseURLWithParameters" [(totalResults)] = "totalResults" ></search-paging>
<!--div class="text-right" *ngIf="results && results.length>= size"-->
<search-paging [(page)] = "searchUtils.page" [(size)] = "searchUtils.size" [(results)] = "results" [(baseUrl)] = "baseURLWithParameters" [(totalResults)] = "totalResults" ></search-paging>
</div>
<!--/div-->
<div>
<search-result [results]="results" [status]=status [page]="page"></search-result>
<search-result [results]="results" [status]=searchUtils.status [page]="searchUtils.page"></search-result>
</div>
<!--/div>
</div-->
@ -52,14 +53,12 @@ export class AdvancedSearchPageComponent {
@Input() pageTitle = "";
@Input() results = [];
@Input() entityType;
@Input() page:number = 1;
@Input() size: number = 10;
@Input() searchUtils:SearchUtilsClass = new SearchUtilsClass();
@Input() totalResults: number = 0;
@Input() fieldIds: string[];
@Input() fieldIdsMap:{ [key:string]:{ name:string, operator:string, type:string, indexField:string }} ;
@Input() selectedFields:AdvancedField[];
@Input() baseUrl:string = '';
@Input() status: number;
@Input() simpleSearchUrl: string;
private baseURLWithParameters:string = '';
@ -119,10 +118,10 @@ export class AdvancedSearchPageComponent {
"&"+this.fieldIdsMap[this.fieldIds[i]].operator+"="+fields[this.fieldIds[i]].operators.join()
}
}
if(includePage && this.page != 1){
params += "&page="+this.page;
if(includePage && this.searchUtils.page != 1){
params += "&page="+this.searchUtils.page;
}
return params;
return '?'+params;
}
public createQueryParameters(){
var params="";
@ -145,7 +144,7 @@ export class AdvancedSearchPageComponent {
goTo(page:number = 1){
console.info("goto");
//console.info("keyword: "+this.keyword);
this.page = page;
this.searchUtils.page = page;
var urlParameters = this.createUrlParameters(true);
var queryParameters = this.createQueryParameters();
this.location.go(location.pathname,urlParameters);
@ -160,8 +159,8 @@ export class AdvancedSearchPageComponent {
this.goTo(1);
}
pageChanged($event) {
this.page = +$event.value;
this.goTo(this.page);
this.searchUtils.page = +$event.value;
this.goTo(this.searchUtils.page);
}
/*
* Update the url with proper parameters. This is used as base url in Paging Component

View File

@ -4,13 +4,14 @@ import {Location} from '@angular/common';
import { Filter, Value} from './searchHelperClasses.class';
import {SearchResult} from '../../utils/entities/searchResult';
import {SearchFields} from '../../utils/properties/searchFields';
import {SearchUtilsClass} from './searchUtils.class';
@Component({
selector: 'search-page',
template: `
<div class="container">
<div class="page-header">
<div class="searchUtils.page-header">
<h1>{{pageTitle}}</h1>
</div>
<div>
@ -18,7 +19,7 @@ import {SearchFields} from '../../utils/properties/searchFields';
<div class="row row-offcanvas row-offcanvas-right">
<div class="col-xs-12 col-sm-10 text-center col-md-offset-1 ">
<search-form [(keyword)]="keyword" (keywordChange)="keywordChanged($event)"></search-form>
<search-form [(keyword)]="searchUtils.keyword" (keywordChange)="keywordChanged($event)"></search-form>
<div>
<span *ngFor="let filter of filters " >
<span *ngIf = "filter.countSelectedValues > 0"> {{filter.title}}: </span>
@ -40,16 +41,16 @@ import {SearchFields} from '../../utils/properties/searchFields';
<div class="col-xs-12 col-sm-9 " >
<search-download [totalResults]="totalResults" (downloadClick)="downloadClicked($event)"></search-download>
<search-paging [(page)] = "page" [(size)] = "size" [(results)] = "results" [(baseUrl)] = "baseURLWithParameters" [(totalResults)] = "totalResults" ></search-paging>
<search-result [results]="results" [totalResults]="totalResults" [status]=status [page]="page"></search-result>
<search-paging [(page)] = "searchUtils.page" [(size)] = "searchUtils.size" [(results)] = "results" [(baseUrl)] = "baseURLWithParameters" [(totalResults)] = "totalResults" ></search-paging>
<search-result [results]="results" [totalResults]="totalResults" [status]=searchUtils.status [page]="searchUtils.page"></search-result>
</div>
</div>
</div>
<div *ngIf="!showRefine" >
<search-form [(keyword)]="keyword" (keywordChange)="keywordChanged($event)"></search-form>
<search-paging [(page)] = "page" [(size)] = "size" [(results)] = "results" [(baseUrl)] = "baseURLWithParameters" [(totalResults)] = "totalResults" ></search-paging>
<search-result [results]="results" [totalResults]="totalResults" [status]=status [page]="page"></search-result>
<search-form [(keyword)]="searchUtils.keyword" (keywordChange)="keywordChanged($event)"></search-form>
<search-paging [(page)] = "searchUtils.page" [(size)] = "searchUtils.size" [(results)] = "results" [(baseUrl)] = "baseURLWithParameters" [(totalResults)] = "totalResults" ></search-paging>
<search-result [results]="results" [totalResults]="totalResults" [status]=searchUtils.status [page]="searchUtils.page"></search-result>
</div>
</div>
@ -62,11 +63,8 @@ export class SearchPageComponent {
@Input() results = [];
@Input() filters = [];
@Input() type;
@Input() page:number = 1;
@Input() size: number = 10;
@Input() status: number;
@Input() searchUtils:SearchUtilsClass = new SearchUtilsClass();
@Input() totalResults: number = 0;
@Input() keyword: string = '';
@Output() queryChange = new EventEmitter();
@Output() downloadClick = new EventEmitter();
@Input() baseUrl:string = '';
@ -183,11 +181,11 @@ export class SearchPageComponent {
allLimits+=((filterLimits.length == 0 )?'':"&" +filter.filterId + '='+ filterLimits) ;
}
}
if(this.keyword.length > 0 ){
allLimits+='&keyword=' + this.keyword;
if(this.searchUtils.keyword.length > 0 ){
allLimits+='&keyword=' + this.searchUtils.keyword;
}
if(this.page != 1 && includePage){
allLimits+=((allLimits.length == 0)?'':'&') + 'page=' + this.page;
if(this.searchUtils.page != 1 && includePage){
allLimits+=((allLimits.length == 0)?'':'&') + 'page=' + this.searchUtils.page;
}
return allLimits;
}
@ -212,7 +210,7 @@ export class SearchPageComponent {
}
}
return (this.keyword.length > 0?'q='+this.keyword+"&op=and":'')+allLimits;
return (this.searchUtils.keyword.length > 0?'q='+this.searchUtils.keyword+"&op=and":'')+allLimits;
}
private createIndexQueryParameters(filters:Filter[]){
var allLimits="";
@ -232,7 +230,7 @@ export class SearchPageComponent {
allLimits += filterLimits;
}
}
allLimits += (this.keyword && this.keyword.length > 0?' and '+this.keyword+' ':'');
allLimits += (this.searchUtils.keyword && this.searchUtils.keyword.length > 0?' and '+this.searchUtils.keyword+' ':'');
return allLimits;
}
//
@ -244,7 +242,7 @@ export class SearchPageComponent {
break;
}
}
if(this.keyword.length > 0 ){
if(this.searchUtils.keyword.length > 0 ){
filtered = true;
}
return filtered;
@ -260,8 +258,8 @@ export class SearchPageComponent {
filter.countSelectedValues = 0;
}
}
if(this.keyword.length > 0 ){
this.keyword ='';
if(this.searchUtils.keyword.length > 0 ){
this.searchUtils.keyword ='';
}
this.location.go(location.pathname);
this.goTo(1);
@ -271,8 +269,8 @@ export class SearchPageComponent {
value.selected = false;
}
goTo(page:number = 1){
this.page = page;
console.info("PAGE goto = "+this.page);
this.searchUtils.page = page;
console.info("searchUtils.page goto = "+this.searchUtils.page);
this.queryParameters = new Map<string,string>();
var urlParameters = this.createUrlParameters(this.filters,true);
console.info("urlParams : "+urlParameters);
@ -282,6 +280,7 @@ export class SearchPageComponent {
var indexQuery = this.createIndexQueryParameters(this.filters);
this.location.go(location.pathname,urlParameters);
console.info("SearchPAGE::page "+this.searchUtils.page);
this.queryChange.emit({
value: queryParameters,
@ -294,7 +293,7 @@ export class SearchPageComponent {
this.goTo(1);
}
keywordChanged($event) {
this.keyword = $event.value;
this.searchUtils.keyword = $event.value;
this.goTo(1);
}

View File

@ -0,0 +1,7 @@
export class SearchUtilsClass{
page:number = 1;
size:number = 10;
status:number = 1;
keyword:string = "";
}