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:
parent
b43bf3934b
commit
206bc1e73b
|
@ -7,6 +7,7 @@ import {SearchResult} from '../../utils/entities/searchResult';
|
||||||
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties';
|
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties';
|
||||||
import {AdvancedSearchPageComponent} from '../searchUtils/advancedSearchPage.component';
|
import {AdvancedSearchPageComponent} from '../searchUtils/advancedSearchPage.component';
|
||||||
import {SearchFields} from '../../utils/properties/searchFields';
|
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',
|
selector: 'advanced-search-dataprovider',
|
||||||
template: `
|
template: `
|
||||||
<advanced-search-page pageTitle="Advanced Search Data Providers" entityType="dataprovider"
|
<advanced-search-page pageTitle="Advanced Search Data Providers" entityType="dataprovider"
|
||||||
[(results)] = "results" [(totalResults)] = "totalResults"
|
[(results)] = "results" [(totalResults)] = "totalResults" [baseUrl] = "baseUrl"
|
||||||
[(page)] = "page" [(size)] = "size" [baseUrl] = "baseUrl"
|
|
||||||
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
|
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
|
||||||
[(status)] = "status"
|
[(searchUtils)] = "searchUtils"
|
||||||
(queryChange)="queryChanged($event)">
|
(queryChange)="queryChanged($event)">
|
||||||
</advanced-search-page>
|
</advanced-search-page>
|
||||||
|
|
||||||
|
@ -28,9 +28,11 @@ export class AdvancedSearchDataProvidersComponent {
|
||||||
private results =[];
|
private results =[];
|
||||||
private filters =[];
|
private filters =[];
|
||||||
private totalResults:number = 0 ;
|
private totalResults:number = 0 ;
|
||||||
private page :number = 1;
|
// private page :number = 1;
|
||||||
private size :number = 10;
|
// private size :number = 10;
|
||||||
public status:number;
|
// public status:number;
|
||||||
|
private searchUtils:SearchUtilsClass = new SearchUtilsClass();
|
||||||
|
|
||||||
private baseUrl: string;
|
private baseUrl: string;
|
||||||
private searchFields:SearchFields = new SearchFields();
|
private searchFields:SearchFields = new SearchFields();
|
||||||
|
|
||||||
|
@ -45,7 +47,7 @@ export class AdvancedSearchDataProvidersComponent {
|
||||||
|
|
||||||
this.results =[];
|
this.results =[];
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status =errorCodes.LOADING;
|
this.searchUtils.size =errorCodes.LOADING;
|
||||||
this.baseUrl = OpenaireProperties.getLinkToSearchAdvancedPublications();
|
this.baseUrl = OpenaireProperties.getLinkToSearchAdvancedPublications();
|
||||||
|
|
||||||
|
|
||||||
|
@ -53,15 +55,15 @@ export class AdvancedSearchDataProvidersComponent {
|
||||||
}
|
}
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status =errorCodes.LOADING;
|
this.searchUtils.size =errorCodes.LOADING;
|
||||||
this.sub = this.route.queryParams.subscribe(params => {
|
this.sub = this.route.queryParams.subscribe(params => {
|
||||||
let page = (params['page']=== undefined)?1:+params['page'];
|
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.fieldIds = this.fieldIds;
|
||||||
this.searchPage.selectedFields = this.selectedFields;
|
this.searchPage.selectedFields = this.selectedFields;
|
||||||
this.searchPage.fieldIdsMap = this.fieldIdsMap;
|
this.searchPage.fieldIdsMap = this.fieldIdsMap;
|
||||||
this.searchPage.getSelectedFiltersFromUrl(params);
|
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;
|
sub: any;
|
||||||
public getResults(parameters:string, page: number, size: number){
|
public getResults(parameters:string, page: number, size: number){
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status = errorCodes.LOADING;
|
this.searchUtils.status = errorCodes.LOADING;
|
||||||
console.info("Advanced Search Publications: Execute search query "+parameters);
|
console.info("Advanced Search Publications: Execute search query "+parameters);
|
||||||
this._searchDataProvidersService.searchDataproviders(parameters, null, page, size, []).subscribe(
|
this._searchDataProvidersService.searchDataproviders(parameters, null, page, size, []).subscribe(
|
||||||
data => {
|
data => {
|
||||||
|
@ -80,9 +82,9 @@ export class AdvancedSearchDataProvidersComponent {
|
||||||
this.results = data[1];
|
this.results = data[1];
|
||||||
this.searchPage.updateBaseUrlWithParameters();
|
this.searchPage.updateBaseUrlWithParameters();
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status = errorCodes.DONE;
|
this.searchUtils.status = errorCodes.DONE;
|
||||||
if(this.totalResults == 0 ){
|
if(this.totalResults == 0 ){
|
||||||
this.status = errorCodes.NONE;
|
this.searchUtils.status = errorCodes.NONE;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
|
@ -90,10 +92,10 @@ export class AdvancedSearchDataProvidersComponent {
|
||||||
console.info("error");
|
console.info("error");
|
||||||
//TODO check erros (service not available, bad request)
|
//TODO check erros (service not available, bad request)
|
||||||
// if( ){
|
// if( ){
|
||||||
// this.status = ErrorCodes.ERROR;
|
// this.searchUtils.status = errorCodes.ERROR;
|
||||||
// }
|
// }
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
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) {
|
private queryChanged($event) {
|
||||||
var parameters = $event.value;
|
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);
|
console.info("queryChanged: Execute search query "+parameters);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ import {SearchResult} from '../../utils/entities/searchResult';
|
||||||
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties';
|
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties';
|
||||||
import {AdvancedSearchPageComponent} from '../searchUtils/advancedSearchPage.component';
|
import {AdvancedSearchPageComponent} from '../searchUtils/advancedSearchPage.component';
|
||||||
import {SearchFields} from '../../utils/properties/searchFields';
|
import {SearchFields} from '../../utils/properties/searchFields';
|
||||||
|
import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -15,9 +15,8 @@ import {SearchFields} from '../../utils/properties/searchFields';
|
||||||
template: `
|
template: `
|
||||||
<advanced-search-page pageTitle="Advanced Search Datasets" entityType="dataset"
|
<advanced-search-page pageTitle="Advanced Search Datasets" entityType="dataset"
|
||||||
[(results)] = "results" [(totalResults)] = "totalResults"
|
[(results)] = "results" [(totalResults)] = "totalResults"
|
||||||
[(page)] = "page" [(size)] = "size" [baseUrl] = "baseUrl"
|
[(searchUtils)] = "searchUtils" [baseUrl] = "baseUrl"
|
||||||
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
|
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
|
||||||
[(status)] = "status"
|
|
||||||
(queryChange)="queryChanged($event)">
|
(queryChange)="queryChanged($event)">
|
||||||
</advanced-search-page>
|
</advanced-search-page>
|
||||||
|
|
||||||
|
@ -28,9 +27,11 @@ export class AdvancedSearchDatasetsComponent {
|
||||||
private results =[];
|
private results =[];
|
||||||
private filters =[];
|
private filters =[];
|
||||||
private totalResults:number = 0 ;
|
private totalResults:number = 0 ;
|
||||||
private page :number = 1;
|
// private page :number = 1;
|
||||||
private size :number = 10;
|
// private size :number = 10;
|
||||||
public status:number;
|
// public status:number;
|
||||||
|
private searchUtils:SearchUtilsClass = new SearchUtilsClass();
|
||||||
|
|
||||||
private baseUrl: string;
|
private baseUrl: string;
|
||||||
private searchFields:SearchFields = new SearchFields();
|
private searchFields:SearchFields = new SearchFields();
|
||||||
|
|
||||||
|
@ -45,7 +46,7 @@ export class AdvancedSearchDatasetsComponent {
|
||||||
|
|
||||||
this.results =[];
|
this.results =[];
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status =errorCodes.LOADING;
|
this.searchUtils.size =errorCodes.LOADING;
|
||||||
this.baseUrl = OpenaireProperties.getLinkToSearchAdvancedPublications();
|
this.baseUrl = OpenaireProperties.getLinkToSearchAdvancedPublications();
|
||||||
|
|
||||||
|
|
||||||
|
@ -53,15 +54,15 @@ export class AdvancedSearchDatasetsComponent {
|
||||||
}
|
}
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status =errorCodes.LOADING;
|
this.searchUtils.size =errorCodes.LOADING;
|
||||||
this.sub = this.route.queryParams.subscribe(params => {
|
this.sub = this.route.queryParams.subscribe(params => {
|
||||||
let page = (params['page']=== undefined)?1:+params['page'];
|
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.fieldIds = this.fieldIds;
|
||||||
this.searchPage.selectedFields = this.selectedFields;
|
this.searchPage.selectedFields = this.selectedFields;
|
||||||
this.searchPage.fieldIdsMap = this.fieldIdsMap;
|
this.searchPage.fieldIdsMap = this.fieldIdsMap;
|
||||||
this.searchPage.getSelectedFiltersFromUrl(params);
|
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;
|
sub: any;
|
||||||
public getResults(parameters:string, page: number, size: number){
|
public getResults(parameters:string, page: number, size: number){
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status = errorCodes.LOADING;
|
this.searchUtils.status = errorCodes.LOADING;
|
||||||
console.info("Advanced Search Datasets: Execute search query "+parameters);
|
console.info("Advanced Search Datasets: Execute search query "+parameters);
|
||||||
this._searchDatasetsService.searchDatasets(parameters, null, page, size, []).subscribe(
|
this._searchDatasetsService.searchDatasets(parameters, null, page, size, []).subscribe(
|
||||||
data => {
|
data => {
|
||||||
|
@ -80,9 +81,9 @@ export class AdvancedSearchDatasetsComponent {
|
||||||
this.results = data[1];
|
this.results = data[1];
|
||||||
this.searchPage.updateBaseUrlWithParameters();
|
this.searchPage.updateBaseUrlWithParameters();
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status = errorCodes.DONE;
|
this.searchUtils.status = errorCodes.DONE;
|
||||||
if(this.totalResults == 0 ){
|
if(this.totalResults == 0 ){
|
||||||
this.status = errorCodes.NONE;
|
this.searchUtils.status = errorCodes.NONE;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
|
@ -90,10 +91,10 @@ export class AdvancedSearchDatasetsComponent {
|
||||||
console.info("error");
|
console.info("error");
|
||||||
//TODO check erros (service not available, bad request)
|
//TODO check erros (service not available, bad request)
|
||||||
// if( ){
|
// if( ){
|
||||||
// this.status = ErrorCodes.ERROR;
|
// this.searchUtils.status = errorCodes.ERROR;
|
||||||
// }
|
// }
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
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) {
|
private queryChanged($event) {
|
||||||
var parameters = $event.value;
|
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);
|
console.info("queryChanged: Execute search query "+parameters);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ import {SearchResult} from '../../utils/entities/searchResult';
|
||||||
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties';
|
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties';
|
||||||
import {AdvancedSearchPageComponent} from '../searchUtils/advancedSearchPage.component';
|
import {AdvancedSearchPageComponent} from '../searchUtils/advancedSearchPage.component';
|
||||||
import {SearchFields} from '../../utils/properties/searchFields';
|
import {SearchFields} from '../../utils/properties/searchFields';
|
||||||
|
import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -15,9 +15,8 @@ import {SearchFields} from '../../utils/properties/searchFields';
|
||||||
template: `
|
template: `
|
||||||
<advanced-search-page pageTitle="Advanced Search Organizations" entityType="dataset"
|
<advanced-search-page pageTitle="Advanced Search Organizations" entityType="dataset"
|
||||||
[(results)] = "results" [(totalResults)] = "totalResults"
|
[(results)] = "results" [(totalResults)] = "totalResults"
|
||||||
[(page)] = "page" [(size)] = "size" [baseUrl] = "baseUrl"
|
[(searchUtils)] = "searchUtils" [baseUrl] = "baseUrl"
|
||||||
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
|
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
|
||||||
[(status)] = "status"
|
|
||||||
(queryChange)="queryChanged($event)">
|
(queryChange)="queryChanged($event)">
|
||||||
</advanced-search-page>
|
</advanced-search-page>
|
||||||
|
|
||||||
|
@ -28,9 +27,11 @@ export class AdvancedSearchOrganizationsComponent {
|
||||||
private results =[];
|
private results =[];
|
||||||
private filters =[];
|
private filters =[];
|
||||||
private totalResults:number = 0 ;
|
private totalResults:number = 0 ;
|
||||||
private page :number = 1;
|
// private page :number = 1;
|
||||||
private size :number = 10;
|
// private size :number = 10;
|
||||||
public status:number;
|
// public status:number;
|
||||||
|
private searchUtils:SearchUtilsClass = new SearchUtilsClass();
|
||||||
|
|
||||||
private baseUrl: string;
|
private baseUrl: string;
|
||||||
private searchFields:SearchFields = new SearchFields();
|
private searchFields:SearchFields = new SearchFields();
|
||||||
|
|
||||||
|
@ -45,7 +46,7 @@ export class AdvancedSearchOrganizationsComponent {
|
||||||
|
|
||||||
this.results =[];
|
this.results =[];
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status =errorCodes.LOADING;
|
this.searchUtils.size =errorCodes.LOADING;
|
||||||
this.baseUrl = OpenaireProperties.getLinkToSearchAdvancedPublications();
|
this.baseUrl = OpenaireProperties.getLinkToSearchAdvancedPublications();
|
||||||
|
|
||||||
|
|
||||||
|
@ -53,15 +54,15 @@ export class AdvancedSearchOrganizationsComponent {
|
||||||
}
|
}
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status =errorCodes.LOADING;
|
this.searchUtils.size =errorCodes.LOADING;
|
||||||
this.sub = this.route.queryParams.subscribe(params => {
|
this.sub = this.route.queryParams.subscribe(params => {
|
||||||
let page = (params['page']=== undefined)?1:+params['page'];
|
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.fieldIds = this.fieldIds;
|
||||||
this.searchPage.selectedFields = this.selectedFields;
|
this.searchPage.selectedFields = this.selectedFields;
|
||||||
this.searchPage.fieldIdsMap = this.fieldIdsMap;
|
this.searchPage.fieldIdsMap = this.fieldIdsMap;
|
||||||
this.searchPage.getSelectedFiltersFromUrl(params);
|
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;
|
sub: any;
|
||||||
public getResults(parameters:string, page: number, size: number){
|
public getResults(parameters:string, page: number, size: number){
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status = errorCodes.LOADING;
|
this.searchUtils.status = errorCodes.LOADING;
|
||||||
console.info("Advanced Search Organizations: Execute search query "+parameters);
|
console.info("Advanced Search Organizations: Execute search query "+parameters);
|
||||||
this._searchOrganizationsService.searchOrganizations(parameters, null, page, size, []).subscribe(
|
this._searchOrganizationsService.searchOrganizations(parameters, null, page, size, []).subscribe(
|
||||||
data => {
|
data => {
|
||||||
|
@ -80,9 +81,9 @@ export class AdvancedSearchOrganizationsComponent {
|
||||||
this.results = data[1];
|
this.results = data[1];
|
||||||
this.searchPage.updateBaseUrlWithParameters();
|
this.searchPage.updateBaseUrlWithParameters();
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status = errorCodes.DONE;
|
this.searchUtils.status = errorCodes.DONE;
|
||||||
if(this.totalResults == 0 ){
|
if(this.totalResults == 0 ){
|
||||||
this.status = errorCodes.NONE;
|
this.searchUtils.status = errorCodes.NONE;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
|
@ -90,10 +91,10 @@ export class AdvancedSearchOrganizationsComponent {
|
||||||
console.info("error");
|
console.info("error");
|
||||||
//TODO check erros (service not available, bad request)
|
//TODO check erros (service not available, bad request)
|
||||||
// if( ){
|
// if( ){
|
||||||
// this.status = ErrorCodes.ERROR;
|
// this.searchUtils.status = errorCodes.ERROR;
|
||||||
// }
|
// }
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
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) {
|
private queryChanged($event) {
|
||||||
var parameters = $event.value;
|
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);
|
console.info("queryChanged: Execute search query "+parameters);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ import {SearchResult} from '../../utils/entities/searchResult';
|
||||||
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties';
|
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties';
|
||||||
import {AdvancedSearchPageComponent} from '../searchUtils/advancedSearchPage.component';
|
import {AdvancedSearchPageComponent} from '../searchUtils/advancedSearchPage.component';
|
||||||
import {SearchFields} from '../../utils/properties/searchFields';
|
import {SearchFields} from '../../utils/properties/searchFields';
|
||||||
|
import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -15,9 +15,8 @@ import {SearchFields} from '../../utils/properties/searchFields';
|
||||||
template: `
|
template: `
|
||||||
<advanced-search-page pageTitle="Advanced Search People" entityType="dataset"
|
<advanced-search-page pageTitle="Advanced Search People" entityType="dataset"
|
||||||
[(results)] = "results" [(totalResults)] = "totalResults"
|
[(results)] = "results" [(totalResults)] = "totalResults"
|
||||||
[(page)] = "page" [(size)] = "size" [baseUrl] = "baseUrl"
|
[(searchUtils)] = "searchUtils" [baseUrl] = "baseUrl"
|
||||||
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
|
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
|
||||||
[(status)] = "status"
|
|
||||||
(queryChange)="queryChanged($event)">
|
(queryChange)="queryChanged($event)">
|
||||||
</advanced-search-page>
|
</advanced-search-page>
|
||||||
|
|
||||||
|
@ -28,9 +27,11 @@ export class AdvancedSearchPeopleComponent {
|
||||||
private results =[];
|
private results =[];
|
||||||
private filters =[];
|
private filters =[];
|
||||||
private totalResults:number = 0 ;
|
private totalResults:number = 0 ;
|
||||||
private page :number = 1;
|
// private page :number = 1;
|
||||||
private size :number = 10;
|
// private size :number = 10;
|
||||||
public status:number;
|
// public status:number;
|
||||||
|
private searchUtils:SearchUtilsClass = new SearchUtilsClass();
|
||||||
|
|
||||||
private baseUrl: string;
|
private baseUrl: string;
|
||||||
private searchFields:SearchFields = new SearchFields();
|
private searchFields:SearchFields = new SearchFields();
|
||||||
|
|
||||||
|
@ -45,7 +46,7 @@ export class AdvancedSearchPeopleComponent {
|
||||||
|
|
||||||
this.results =[];
|
this.results =[];
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status =errorCodes.LOADING;
|
this.searchUtils.size =errorCodes.LOADING;
|
||||||
this.baseUrl = OpenaireProperties.getLinkToSearchAdvancedPublications();
|
this.baseUrl = OpenaireProperties.getLinkToSearchAdvancedPublications();
|
||||||
|
|
||||||
|
|
||||||
|
@ -53,15 +54,15 @@ export class AdvancedSearchPeopleComponent {
|
||||||
}
|
}
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status =errorCodes.LOADING;
|
this.searchUtils.size =errorCodes.LOADING;
|
||||||
this.sub = this.route.queryParams.subscribe(params => {
|
this.sub = this.route.queryParams.subscribe(params => {
|
||||||
let page = (params['page']=== undefined)?1:+params['page'];
|
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.fieldIds = this.fieldIds;
|
||||||
this.searchPage.selectedFields = this.selectedFields;
|
this.searchPage.selectedFields = this.selectedFields;
|
||||||
this.searchPage.fieldIdsMap = this.fieldIdsMap;
|
this.searchPage.fieldIdsMap = this.fieldIdsMap;
|
||||||
this.searchPage.getSelectedFiltersFromUrl(params);
|
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;
|
sub: any;
|
||||||
public getResults(parameters:string, page: number, size: number){
|
public getResults(parameters:string, page: number, size: number){
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status = errorCodes.LOADING;
|
this.searchUtils.status = errorCodes.LOADING;
|
||||||
console.info("Advanced Search People: Execute search query "+parameters);
|
console.info("Advanced Search People: Execute search query "+parameters);
|
||||||
this._searchPeopleService.searchPeople(parameters, null, page, size, []).subscribe(
|
this._searchPeopleService.searchPeople(parameters, null, page, size, []).subscribe(
|
||||||
data => {
|
data => {
|
||||||
|
@ -80,9 +81,9 @@ export class AdvancedSearchPeopleComponent {
|
||||||
this.results = data[1];
|
this.results = data[1];
|
||||||
this.searchPage.updateBaseUrlWithParameters();
|
this.searchPage.updateBaseUrlWithParameters();
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status = errorCodes.DONE;
|
this.searchUtils.status = errorCodes.DONE;
|
||||||
if(this.totalResults == 0 ){
|
if(this.totalResults == 0 ){
|
||||||
this.status = errorCodes.NONE;
|
this.searchUtils.status = errorCodes.NONE;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
|
@ -90,10 +91,10 @@ export class AdvancedSearchPeopleComponent {
|
||||||
console.info("error");
|
console.info("error");
|
||||||
//TODO check erros (service not available, bad request)
|
//TODO check erros (service not available, bad request)
|
||||||
// if( ){
|
// if( ){
|
||||||
// this.status = ErrorCodes.ERROR;
|
// this.searchUtils.status = errorCodes.ERROR;
|
||||||
// }
|
// }
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
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) {
|
private queryChanged($event) {
|
||||||
var parameters = $event.value;
|
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);
|
console.info("queryChanged: Execute search query "+parameters);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,17 +7,15 @@ import {SearchResult} from '../../utils/entities/searchResult';
|
||||||
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties';
|
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties';
|
||||||
import {AdvancedSearchPageComponent} from '../searchUtils/advancedSearchPage.component';
|
import {AdvancedSearchPageComponent} from '../searchUtils/advancedSearchPage.component';
|
||||||
import {SearchFields} from '../../utils/properties/searchFields';
|
import {SearchFields} from '../../utils/properties/searchFields';
|
||||||
|
import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'advanced-search-projects',
|
selector: 'advanced-search-projects',
|
||||||
template: `
|
template: `
|
||||||
<advanced-search-page pageTitle="Advanced Search Projects" entityType="project"
|
<advanced-search-page pageTitle="Advanced Search Projects" entityType="project"
|
||||||
[(results)] = "results" [(totalResults)] = "totalResults"
|
[(results)] = "results" [(totalResults)] = "totalResults"
|
||||||
[(page)] = "page" [(size)] = "size" [baseUrl] = "baseUrl"
|
[(searchUtils)] = "searchUtils" [baseUrl] = "baseUrl"
|
||||||
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
|
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
|
||||||
[(status)] = "status"
|
|
||||||
(queryChange)="queryChanged($event)">
|
(queryChange)="queryChanged($event)">
|
||||||
</advanced-search-page>
|
</advanced-search-page>
|
||||||
|
|
||||||
|
@ -28,9 +26,11 @@ export class AdvancedSearchProjectsComponent {
|
||||||
private results =[];
|
private results =[];
|
||||||
private filters =[];
|
private filters =[];
|
||||||
private totalResults:number = 0 ;
|
private totalResults:number = 0 ;
|
||||||
private page :number = 1;
|
// private page :number = 1;
|
||||||
private size :number = 10;
|
// private size :number = 10;
|
||||||
public status:number;
|
// public status:number;
|
||||||
|
private searchUtils:SearchUtilsClass = new SearchUtilsClass();
|
||||||
|
|
||||||
private baseUrl: string;
|
private baseUrl: string;
|
||||||
private searchFields:SearchFields = new SearchFields();
|
private searchFields:SearchFields = new SearchFields();
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ export class AdvancedSearchProjectsComponent {
|
||||||
|
|
||||||
this.results =[];
|
this.results =[];
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status =errorCodes.LOADING;
|
this.searchUtils.size =errorCodes.LOADING;
|
||||||
this.baseUrl = OpenaireProperties.getLinkToSearchAdvancedPublications();
|
this.baseUrl = OpenaireProperties.getLinkToSearchAdvancedPublications();
|
||||||
|
|
||||||
|
|
||||||
|
@ -53,15 +53,15 @@ export class AdvancedSearchProjectsComponent {
|
||||||
}
|
}
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status =errorCodes.LOADING;
|
this.searchUtils.size =errorCodes.LOADING;
|
||||||
this.sub = this.route.queryParams.subscribe(params => {
|
this.sub = this.route.queryParams.subscribe(params => {
|
||||||
let page = (params['page']=== undefined)?1:+params['page'];
|
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.fieldIds = this.fieldIds;
|
||||||
this.searchPage.selectedFields = this.selectedFields;
|
this.searchPage.selectedFields = this.selectedFields;
|
||||||
this.searchPage.fieldIdsMap = this.fieldIdsMap;
|
this.searchPage.fieldIdsMap = this.fieldIdsMap;
|
||||||
this.searchPage.getSelectedFiltersFromUrl(params);
|
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;
|
sub: any;
|
||||||
public getResults(parameters:string, page: number, size: number){
|
public getResults(parameters:string, page: number, size: number){
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status = errorCodes.LOADING;
|
this.searchUtils.status = errorCodes.LOADING;
|
||||||
console.info("Advanced Search Publications: Execute search query "+parameters);
|
console.info("Advanced Search Publications: Execute search query "+parameters);
|
||||||
this._searchProjectsService.searchProjects(parameters, null, page, size, []).subscribe(
|
this._searchProjectsService.searchProjects(parameters, null, page, size, []).subscribe(
|
||||||
data => {
|
data => {
|
||||||
|
@ -80,9 +80,9 @@ export class AdvancedSearchProjectsComponent {
|
||||||
this.results = data[1];
|
this.results = data[1];
|
||||||
this.searchPage.updateBaseUrlWithParameters();
|
this.searchPage.updateBaseUrlWithParameters();
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status = errorCodes.DONE;
|
this.searchUtils.status = errorCodes.DONE;
|
||||||
if(this.totalResults == 0 ){
|
if(this.totalResults == 0 ){
|
||||||
this.status = errorCodes.NONE;
|
this.searchUtils.status = errorCodes.NONE;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
|
@ -90,10 +90,10 @@ export class AdvancedSearchProjectsComponent {
|
||||||
console.info("error");
|
console.info("error");
|
||||||
//TODO check erros (service not available, bad request)
|
//TODO check erros (service not available, bad request)
|
||||||
// if( ){
|
// if( ){
|
||||||
// this.status = ErrorCodes.ERROR;
|
// this.searchUtils.status = errorCodes.ERROR;
|
||||||
// }
|
// }
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
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) {
|
private queryChanged($event) {
|
||||||
var parameters = $event.value;
|
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);
|
console.info("queryChanged: Execute search query "+parameters);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ import {SearchResult} from '../../utils/entities/searchResult';
|
||||||
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties';
|
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties';
|
||||||
import {AdvancedSearchPageComponent} from '../searchUtils/advancedSearchPage.component';
|
import {AdvancedSearchPageComponent} from '../searchUtils/advancedSearchPage.component';
|
||||||
import {SearchFields} from '../../utils/properties/searchFields';
|
import {SearchFields} from '../../utils/properties/searchFields';
|
||||||
|
import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -15,9 +15,8 @@ import {SearchFields} from '../../utils/properties/searchFields';
|
||||||
template: `
|
template: `
|
||||||
<advanced-search-page pageTitle="Advanced Search Publications" entityType="publication"
|
<advanced-search-page pageTitle="Advanced Search Publications" entityType="publication"
|
||||||
[(results)] = "results" [(totalResults)] = "totalResults"
|
[(results)] = "results" [(totalResults)] = "totalResults"
|
||||||
[(page)] = "page" [(size)] = "size" [baseUrl] = "baseUrl"
|
[(searchUtils)] = "searchUtils" [baseUrl] = "baseUrl"
|
||||||
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
|
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
|
||||||
[(status)] = "status"
|
|
||||||
(queryChange)="queryChanged($event)">
|
(queryChange)="queryChanged($event)">
|
||||||
</advanced-search-page>
|
</advanced-search-page>
|
||||||
|
|
||||||
|
@ -28,9 +27,8 @@ export class AdvancedSearchPublicationsComponent {
|
||||||
private results =[];
|
private results =[];
|
||||||
private filters =[];
|
private filters =[];
|
||||||
private totalResults:number = 0 ;
|
private totalResults:number = 0 ;
|
||||||
private page :number = 1;
|
private searchUtils:SearchUtilsClass = new SearchUtilsClass();
|
||||||
private size :number = 10;
|
|
||||||
public status:number;
|
|
||||||
private baseUrl: string;
|
private baseUrl: string;
|
||||||
private searchFields:SearchFields = new SearchFields();
|
private searchFields:SearchFields = new SearchFields();
|
||||||
|
|
||||||
|
@ -45,7 +43,7 @@ export class AdvancedSearchPublicationsComponent {
|
||||||
|
|
||||||
this.results =[];
|
this.results =[];
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status =errorCodes.LOADING;
|
this.searchUtils.status =errorCodes.LOADING;
|
||||||
this.baseUrl = OpenaireProperties.getLinkToSearchAdvancedPublications();
|
this.baseUrl = OpenaireProperties.getLinkToSearchAdvancedPublications();
|
||||||
|
|
||||||
|
|
||||||
|
@ -53,15 +51,15 @@ export class AdvancedSearchPublicationsComponent {
|
||||||
}
|
}
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status =errorCodes.LOADING;
|
this.searchUtils.status =errorCodes.LOADING;
|
||||||
this.sub = this.route.queryParams.subscribe(params => {
|
this.sub = this.route.queryParams.subscribe(params => {
|
||||||
let page = (params['page']=== undefined)?1:+params['page'];
|
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.fieldIds = this.fieldIds;
|
||||||
this.searchPage.selectedFields = this.selectedFields;
|
this.searchPage.selectedFields = this.selectedFields;
|
||||||
this.searchPage.fieldIdsMap = this.fieldIdsMap;
|
this.searchPage.fieldIdsMap = this.fieldIdsMap;
|
||||||
this.searchPage.getSelectedFiltersFromUrl(params);
|
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;
|
sub: any;
|
||||||
public getResults(parameters:string, page: number, size: number){
|
public getResults(parameters:string, page: number, size: number){
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status = errorCodes.LOADING;
|
this.searchUtils.status = errorCodes.LOADING;
|
||||||
console.info("Advanced Search Publications: Execute search query "+parameters);
|
console.info("Advanced Search Publications: Execute search query "+parameters);
|
||||||
this._searchPublicationsService.searchPublications(parameters, null, page, size, []).subscribe(
|
this._searchPublicationsService.searchPublications(parameters, null, page, size, []).subscribe(
|
||||||
data => {
|
data => {
|
||||||
|
@ -80,9 +78,9 @@ export class AdvancedSearchPublicationsComponent {
|
||||||
this.results = data[1];
|
this.results = data[1];
|
||||||
this.searchPage.updateBaseUrlWithParameters();
|
this.searchPage.updateBaseUrlWithParameters();
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status = errorCodes.DONE;
|
this.searchUtils.status = errorCodes.DONE;
|
||||||
if(this.totalResults == 0 ){
|
if(this.totalResults == 0 ){
|
||||||
this.status = errorCodes.NONE;
|
this.searchUtils.status = errorCodes.NONE;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
|
@ -90,10 +88,10 @@ export class AdvancedSearchPublicationsComponent {
|
||||||
console.info("error");
|
console.info("error");
|
||||||
//TODO check erros (service not available, bad request)
|
//TODO check erros (service not available, bad request)
|
||||||
// if( ){
|
// if( ){
|
||||||
// this.status = ErrorCodes.ERROR;
|
// this.searchUtils.status = ErrorCodes.ERROR;
|
||||||
// }
|
// }
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
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) {
|
private queryChanged($event) {
|
||||||
var parameters = $event.value;
|
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);
|
console.info("queryChanged: Execute search query "+parameters);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,14 +8,15 @@ import {SearchResult} from '../../utils/entities/searchResult';
|
||||||
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties';
|
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties';
|
||||||
import {SearchFields} from '../../utils/properties/searchFields';
|
import {SearchFields} from '../../utils/properties/searchFields';
|
||||||
import {SearchPageComponent } from '../searchUtils/searchPage.component';
|
import {SearchPageComponent } from '../searchUtils/searchPage.component';
|
||||||
|
import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'search-dataproviders',
|
selector: 'search-dataproviders',
|
||||||
template: `
|
template: `
|
||||||
|
|
||||||
<search-page pageTitle="Compatible Dataproviders" type="datasource" [(filters)] = "filters"
|
<search-page pageTitle="Compatible Dataproviders" type="datasource" [(filters)] = "filters"
|
||||||
[(results)] = "results" [(totalResults)] = "totalResults" [(keyword)] = "keyword"
|
[(results)] = "results" [(totalResults)] = "totalResults" [(searchUtils)] = "searchUtils"
|
||||||
[(page)] = "page" [(size)] = "size" [(status)] = "status" [baseUrl] = "baseUrl" [showResultCount]=false (queryChange)="queryChanged($event)" >
|
[baseUrl] = "baseUrl" [showResultCount]=false (queryChange)="queryChanged($event)" >
|
||||||
</search-page>
|
</search-page>
|
||||||
<!--table-view [(datasources)] = results></table-view-->
|
<!--table-view [(datasources)] = results></table-view-->
|
||||||
|
|
||||||
|
@ -27,10 +28,7 @@ export class SearchCompatibleDataprovidersComponent {
|
||||||
private filters =[];
|
private filters =[];
|
||||||
public totalResults:number = 0 ;
|
public totalResults:number = 0 ;
|
||||||
private baseUrl:string;
|
private baseUrl:string;
|
||||||
public status:number;
|
private searchUtils:SearchUtilsClass = new SearchUtilsClass();
|
||||||
private keyword = '';
|
|
||||||
private page :number = 1;
|
|
||||||
private size :number = 10;
|
|
||||||
private sub: any; private subResults: any;
|
private sub: any; private subResults: any;
|
||||||
private _location:Location;
|
private _location:Location;
|
||||||
private searchFields:SearchFields = new SearchFields();
|
private searchFields:SearchFields = new SearchFields();
|
||||||
|
@ -44,7 +42,7 @@ export class SearchCompatibleDataprovidersComponent {
|
||||||
|
|
||||||
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) {
|
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) {
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status =errorCodes.LOADING;
|
this.searchUtils.status =errorCodes.LOADING;
|
||||||
this.baseUrl = OpenaireProperties.getLinkToSearchDataProviders();
|
this.baseUrl = OpenaireProperties.getLinkToSearchDataProviders();
|
||||||
for(var i = 0; i < this._prefixQueryFields.length; i++ ){
|
for(var i = 0; i < this._prefixQueryFields.length; i++ ){
|
||||||
for(var j =0; j < this._prefixQueryFields[i].values.length; j++){
|
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.indexIdsMap = this.indexIdsMap;
|
||||||
this.searchPage.fieldIdsMap = this.fieldIdsMap;
|
this.searchPage.fieldIdsMap = this.fieldIdsMap;
|
||||||
this.sub = this.route.queryParams.subscribe(params => {
|
this.sub = this.route.queryParams.subscribe(params => {
|
||||||
this.keyword = (params['keyword']?params['keyword']:'');
|
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
|
||||||
this.page = (params['page']=== undefined)?1:+params['page'];
|
this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
|
||||||
this.filters = this.createFilters();
|
this.filters = this.createFilters();
|
||||||
var queryParameters = this.searchPage.getIndexQueryParametersFromUrl(params);
|
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.checkSelectedFilters(this.filters);
|
||||||
this.searchPage.updateBaseUrlWithParameters(this.filters);
|
this.searchPage.updateBaseUrlWithParameters(this.filters);
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status = errorCodes.DONE;
|
this.searchUtils.status = errorCodes.DONE;
|
||||||
if(this.totalResults == 0 ){
|
if(this.totalResults == 0 ){
|
||||||
this.status = errorCodes.NONE;
|
this.searchUtils.status = errorCodes.NONE;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
//TODO check erros (service not available, bad request)
|
//TODO check erros (service not available, bad request)
|
||||||
// if( ){
|
// if( ){
|
||||||
// this.status = ErrorCodes.ERROR;
|
// this.searchUtils.status = ErrorCodes.ERROR;
|
||||||
// }
|
// }
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
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;
|
var parameters = $event.index;
|
||||||
console.info("queryChanged: Execute search query "+parameters);
|
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[] {
|
private createFilters():Filter[] {
|
||||||
var filter_names=["Type","Compatibility Level"];
|
var filter_names=["Type","Compatibility Level"];
|
||||||
|
|
|
@ -8,14 +8,16 @@ import {SearchResult} from '../../utils/entities/searchResult';
|
||||||
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties';
|
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties';
|
||||||
import {SearchFields} from '../../utils/properties/searchFields';
|
import {SearchFields} from '../../utils/properties/searchFields';
|
||||||
import {SearchPageComponent } from '../searchUtils/searchPage.component';
|
import {SearchPageComponent } from '../searchUtils/searchPage.component';
|
||||||
|
import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'search-entity-registries',
|
selector: 'search-entity-registries',
|
||||||
template: `
|
template: `
|
||||||
|
|
||||||
<search-page pageTitle="Entity Registries" type="datasource" [(filters)] = "filters"
|
<search-page pageTitle="Entity Registries" type="datasource" [(filters)] = "filters"
|
||||||
[(results)] = "results" [(totalResults)] = "totalResults" [(keyword)] = "keyword"
|
[(results)] = "results" [(totalResults)] = "totalResults" [(searchUtils)] = "searchUtils"
|
||||||
[(page)] = "page" [(size)] = "size" [(status)] = "status" [baseUrl] = "baseUrl" [showResultCount]=false (queryChange)="queryChanged($event)" >
|
[baseUrl] = "baseUrl" [showResultCount]=false (queryChange)="queryChanged($event)" >
|
||||||
</search-page>
|
</search-page>
|
||||||
|
|
||||||
`
|
`
|
||||||
|
@ -26,10 +28,7 @@ export class SearchEntityRegistriesComponent {
|
||||||
private filters =[];
|
private filters =[];
|
||||||
public totalResults:number = 0 ;
|
public totalResults:number = 0 ;
|
||||||
private baseUrl:string;
|
private baseUrl:string;
|
||||||
public status:number;
|
private searchUtils:SearchUtilsClass = new SearchUtilsClass();
|
||||||
private keyword = '';
|
|
||||||
private page :number = 1;
|
|
||||||
private size :number = 10;
|
|
||||||
private sub: any; private subResults: any;
|
private sub: any; private subResults: any;
|
||||||
private _location:Location;
|
private _location:Location;
|
||||||
private searchFields:SearchFields = new SearchFields();
|
private searchFields:SearchFields = new SearchFields();
|
||||||
|
@ -44,7 +43,7 @@ export class SearchEntityRegistriesComponent {
|
||||||
|
|
||||||
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) {
|
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) {
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status =errorCodes.LOADING;
|
this.searchUtils.status =errorCodes.LOADING;
|
||||||
this.baseUrl = OpenaireProperties.getLinkToSearchDataProviders();
|
this.baseUrl = OpenaireProperties.getLinkToSearchDataProviders();
|
||||||
for(var i = 0; i < this._prefixQueryFields.length; i++ ){
|
for(var i = 0; i < this._prefixQueryFields.length; i++ ){
|
||||||
for(var j =0; j < this._prefixQueryFields[i].values.length; j++){
|
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.indexIdsMap = this.indexIdsMap;
|
||||||
this.searchPage.fieldIdsMap = this.fieldIdsMap;
|
this.searchPage.fieldIdsMap = this.fieldIdsMap;
|
||||||
this.sub = this.route.queryParams.subscribe(params => {
|
this.sub = this.route.queryParams.subscribe(params => {
|
||||||
this.keyword = (params['keyword']?params['keyword']:'');
|
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
|
||||||
this.page = (params['page']=== undefined)?1:+params['page'];
|
this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
|
||||||
this.filters = this.createFilters();
|
this.filters = this.createFilters();
|
||||||
|
|
||||||
var queryParameters = this.searchPage.getIndexQueryParametersFromUrl(params);
|
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.checkSelectedFilters(this.filters);
|
||||||
this.searchPage.updateBaseUrlWithParameters(this.filters);
|
this.searchPage.updateBaseUrlWithParameters(this.filters);
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status = errorCodes.DONE;
|
this.searchUtils.status = errorCodes.DONE;
|
||||||
if(this.totalResults == 0 ){
|
if(this.totalResults == 0 ){
|
||||||
this.status = errorCodes.NONE;
|
this.searchUtils.status = errorCodes.NONE;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
//TODO check erros (service not available, bad request)
|
//TODO check erros (service not available, bad request)
|
||||||
// if( ){
|
// if( ){
|
||||||
// this.status = ErrorCodes.ERROR;
|
// this.searchUtils.status = ErrorCodes.ERROR;
|
||||||
// }
|
// }
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status = errorCodes.ERROR;
|
this.searchUtils.status = errorCodes.ERROR;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -109,7 +108,7 @@ export class SearchEntityRegistriesComponent {
|
||||||
private queryChanged($event) {
|
private queryChanged($event) {
|
||||||
var parameters = $event.index;
|
var parameters = $event.index;
|
||||||
console.info("queryChanged: Execute search query "+parameters);
|
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[] {
|
private createFilters():Filter[] {
|
||||||
var filter_names=["Type","Compatibility Level"];
|
var filter_names=["Type","Compatibility Level"];
|
||||||
|
|
|
@ -8,14 +8,14 @@ import {OpenaireProperties, ErrorCodes} from '../utils/properties/openaireProper
|
||||||
import {SearchFields} from '../utils/properties/searchFields';
|
import {SearchFields} from '../utils/properties/searchFields';
|
||||||
import {SearchPageComponent } from './searchUtils/searchPage.component';
|
import {SearchPageComponent } from './searchUtils/searchPage.component';
|
||||||
import {ExportCSVComponent} from '../utils/exportCSV.component';
|
import {ExportCSVComponent} from '../utils/exportCSV.component';
|
||||||
|
import {SearchUtilsClass } from './searchUtils/searchUtils.class';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'search-dataproviders',
|
selector: 'search-dataproviders',
|
||||||
template: `
|
template: `
|
||||||
|
|
||||||
<search-page pageTitle="Search Dataproviders" type="datasource" [(filters)] = "filters"
|
<search-page pageTitle="Search Dataproviders" type="datasource" [(filters)] = "filters"
|
||||||
[(results)] = "results" [(totalResults)] = "totalResults" [(keyword)] = "keyword"
|
[(results)] = "results" [(totalResults)] = "totalResults" [(searchUtils)] = "searchUtils" [baseUrl] = "baseUrl"
|
||||||
[(page)] = "page" [(size)] = "size" [(status)] = "status" [baseUrl] = "baseUrl"
|
|
||||||
(queryChange)="queryChanged($event)" (downloadClick)="downloadClicked($event)">
|
(queryChange)="queryChanged($event)" (downloadClick)="downloadClicked($event)">
|
||||||
</search-page>
|
</search-page>
|
||||||
|
|
||||||
|
@ -26,10 +26,7 @@ export class SearchDataprovidersComponent {
|
||||||
private filters =[];
|
private filters =[];
|
||||||
public totalResults:number = 0 ;
|
public totalResults:number = 0 ;
|
||||||
private baseUrl:string;
|
private baseUrl:string;
|
||||||
public status:number;
|
private searchUtils:SearchUtilsClass = new SearchUtilsClass();
|
||||||
private keyword = '';
|
|
||||||
private page :number = 1;
|
|
||||||
private size :number = 10;
|
|
||||||
private sub: any; private subResults: any;
|
private sub: any; private subResults: any;
|
||||||
private _location:Location;
|
private _location:Location;
|
||||||
private searchFields:SearchFields = new SearchFields();
|
private searchFields:SearchFields = new SearchFields();
|
||||||
|
@ -45,7 +42,7 @@ export class SearchDataprovidersComponent {
|
||||||
|
|
||||||
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) {
|
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) {
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status =errorCodes.LOADING;
|
this.searchUtils.status =errorCodes.LOADING;
|
||||||
this.baseUrl = OpenaireProperties.getLinkToSearchDataProviders();
|
this.baseUrl = OpenaireProperties.getLinkToSearchDataProviders();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,12 +52,12 @@ export class SearchDataprovidersComponent {
|
||||||
this.searchPage.fieldIdsMap = this.fieldIdsMap;
|
this.searchPage.fieldIdsMap = this.fieldIdsMap;
|
||||||
|
|
||||||
this.sub = this.route.queryParams.subscribe(params => {
|
this.sub = this.route.queryParams.subscribe(params => {
|
||||||
this.keyword = (params['keyword']?params['keyword']:'');
|
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
|
||||||
this.page = (params['page']=== undefined)?1:+params['page'];
|
this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
|
||||||
console.info("PAGE init = "+this.page);
|
console.info("PAGE init = "+this.searchUtils.page);
|
||||||
|
|
||||||
var queryParameters = this.searchPage.getQueryParametersFromUrl(params);
|
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);
|
console.error(err);
|
||||||
//TODO check erros (service not available, bad request)
|
//TODO check erros (service not available, bad request)
|
||||||
// if( ){
|
// if( ){
|
||||||
// this.status = ErrorCodes.ERROR;
|
// this.searchUtils.status = ErrorCodes.ERROR;
|
||||||
// }
|
// }
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status = errorCodes.ERROR;
|
this.searchUtils.status = errorCodes.ERROR;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -113,10 +110,10 @@ console.info("PAGE init = "+this.page);
|
||||||
console.error(err);
|
console.error(err);
|
||||||
//TODO check erros (service not available, bad request)
|
//TODO check erros (service not available, bad request)
|
||||||
// if( ){
|
// if( ){
|
||||||
// this.status = ErrorCodes.ERROR;
|
// this.searchUtils.status = ErrorCodes.ERROR;
|
||||||
// }
|
// }
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status = errorCodes.ERROR;
|
this.searchUtils.status = errorCodes.ERROR;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -132,19 +129,19 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number){
|
||||||
this.results = data[1];
|
this.results = data[1];
|
||||||
|
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status = errorCodes.DONE;
|
this.searchUtils.status = errorCodes.DONE;
|
||||||
if(this.totalResults == 0 ){
|
if(this.totalResults == 0 ){
|
||||||
this.status = errorCodes.NONE;
|
this.searchUtils.status = errorCodes.NONE;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
//TODO check erros (service not available, bad request)
|
//TODO check erros (service not available, bad request)
|
||||||
// if( ){
|
// if( ){
|
||||||
// this.status = ErrorCodes.ERROR;
|
// this.searchUtils.status = ErrorCodes.ERROR;
|
||||||
// }
|
// }
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
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];
|
this.results = data[1];
|
||||||
|
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status = errorCodes.DONE;
|
this.searchUtils.status = errorCodes.DONE;
|
||||||
if(this.totalResults == 0 ){
|
if(this.totalResults == 0 ){
|
||||||
this.status = errorCodes.NONE;
|
this.searchUtils.status = errorCodes.NONE;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
//TODO check erros (service not available, bad request)
|
//TODO check erros (service not available, bad request)
|
||||||
// if( ){
|
// if( ){
|
||||||
// this.status = ErrorCodes.ERROR;
|
// this.searchUtils.status = ErrorCodes.ERROR;
|
||||||
// }
|
// }
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
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){
|
if(keyword.length > 0){
|
||||||
parameters = "q=" + keyword + "&op=and";
|
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){
|
private _getResults(parameters:string,refine:boolean, page: number, size: number){
|
||||||
if(!refine && !this.searchPage){
|
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.filters = this.searchPage.checkSelectedFilters(data[2]);
|
||||||
this.searchPage.updateBaseUrlWithParameters(this.filters);
|
this.searchPage.updateBaseUrlWithParameters(this.filters);
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status = errorCodes.DONE;
|
this.searchUtils.status = errorCodes.DONE;
|
||||||
if(this.totalResults == 0 ){
|
if(this.totalResults == 0 ){
|
||||||
this.status = errorCodes.NONE;
|
this.searchUtils.status = errorCodes.NONE;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
//TODO check erros (service not available, bad request)
|
//TODO check erros (service not available, bad request)
|
||||||
// if( ){
|
// if( ){
|
||||||
// this.status = ErrorCodes.ERROR;
|
// this.searchUtils.status = ErrorCodes.ERROR;
|
||||||
// }
|
// }
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
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) {
|
private queryChanged($event) {
|
||||||
var parameters = $event.value;
|
var parameters = $event.value;
|
||||||
console.info("PAGE queryChanged = "+this.page);
|
console.info("PAGE queryChanged = "+this.searchUtils.page);
|
||||||
this._getResults(parameters, true, this.page, this.size);
|
this._getResults(parameters, true, this.searchUtils.page, this.searchUtils.size);
|
||||||
}
|
}
|
||||||
|
|
||||||
private downloadClicked($event) {
|
private downloadClicked($event) {
|
||||||
|
@ -245,19 +242,19 @@ console.info("PAGE queryChanged = "+this.page);
|
||||||
ExportCSVComponent.downloadCSV(this.CSV, "dataproviders.csv");
|
ExportCSVComponent.downloadCSV(this.CSV, "dataproviders.csv");
|
||||||
|
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status = errorCodes.DONE;
|
this.searchUtils.status = errorCodes.DONE;
|
||||||
if(this.totalResults == 0 ){
|
if(this.totalResults == 0 ){
|
||||||
this.status = errorCodes.NONE;
|
this.searchUtils.status = errorCodes.NONE;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
//TODO check erros (service not available, bad request)
|
//TODO check erros (service not available, bad request)
|
||||||
// if( ){
|
// if( ){
|
||||||
// this.status = ErrorCodes.ERROR;
|
// this.searchUtils.status = ErrorCodes.ERROR;
|
||||||
// }
|
// }
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status = errorCodes.ERROR;
|
this.searchUtils.status = errorCodes.ERROR;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -8,13 +8,15 @@ import {SearchResult} from '../utils/entities/searchResult';
|
||||||
import {OpenaireProperties, ErrorCodes} from '../utils/properties/openaireProperties';
|
import {OpenaireProperties, ErrorCodes} from '../utils/properties/openaireProperties';
|
||||||
import {SearchFields} from '../utils/properties/searchFields';
|
import {SearchFields} from '../utils/properties/searchFields';
|
||||||
import {SearchPageComponent } from './searchUtils/searchPage.component';
|
import {SearchPageComponent } from './searchUtils/searchPage.component';
|
||||||
|
import {SearchUtilsClass } from './searchUtils/searchUtils.class';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'search-datasets',
|
selector: 'search-datasets',
|
||||||
template: `
|
template: `
|
||||||
|
|
||||||
<search-page pageTitle="Search Datasets" type="datasource" [(filters)] = "filters"
|
<search-page pageTitle="Search Datasets" type="datasource" [(filters)] = "filters"
|
||||||
[(results)] = "results" [(totalResults)] = "totalResults" [(keyword)] = "keyword"
|
[(results)] = "results" [(totalResults)] = "totalResults" [(searchUtils)] = "searchUtils"
|
||||||
[(page)] = "page" [(size)] = "size" [(status)] = "status" [baseUrl] = "baseUrl" (queryChange)="queryChanged($event)" >
|
[baseUrl] = "baseUrl" (queryChange)="queryChanged($event)" >
|
||||||
</search-page>
|
</search-page>
|
||||||
|
|
||||||
`
|
`
|
||||||
|
@ -25,10 +27,8 @@ export class SearchDatasetsComponent {
|
||||||
private filters: Filter[] =[];
|
private filters: Filter[] =[];
|
||||||
public totalResults:number = 0 ;
|
public totalResults:number = 0 ;
|
||||||
private baseUrl:string;
|
private baseUrl:string;
|
||||||
public status:number;
|
|
||||||
private keyword = '';
|
private searchUtils:SearchUtilsClass = new SearchUtilsClass();
|
||||||
private page :number = 1;
|
|
||||||
private size :number = 10;
|
|
||||||
private sub: any;
|
private sub: any;
|
||||||
private subResults: any;
|
private subResults: any;
|
||||||
private searchFields:SearchFields = new SearchFields();
|
private searchFields:SearchFields = new SearchFields();
|
||||||
|
@ -43,7 +43,7 @@ export class SearchDatasetsComponent {
|
||||||
constructor (private route: ActivatedRoute, private _searchDatasetsService: SearchDatasetsService ) {
|
constructor (private route: ActivatedRoute, private _searchDatasetsService: SearchDatasetsService ) {
|
||||||
|
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status =errorCodes.LOADING;
|
this.searchUtils.status =errorCodes.LOADING;
|
||||||
this.baseUrl = OpenaireProperties.getLinkToSearchDatasets();
|
this.baseUrl = OpenaireProperties.getLinkToSearchDatasets();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -54,12 +54,12 @@ export class SearchDatasetsComponent {
|
||||||
this.searchPage.fieldIdsMap = this.fieldIdsMap;
|
this.searchPage.fieldIdsMap = this.fieldIdsMap;
|
||||||
|
|
||||||
this.sub = this.route.queryParams.subscribe(params => {
|
this.sub = this.route.queryParams.subscribe(params => {
|
||||||
this.keyword = (params['keyword']?params['keyword']:'');
|
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
|
||||||
this.page = (params['page']=== undefined)?1:+params['page'];
|
this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
|
||||||
// this.getRefineResults();
|
// 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);
|
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];
|
this.results = data[1];
|
||||||
|
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status = errorCodes.DONE;
|
this.searchUtils.status = errorCodes.DONE;
|
||||||
if(this.totalResults == 0 ){
|
if(this.totalResults == 0 ){
|
||||||
this.status = errorCodes.NONE;
|
this.searchUtils.status = errorCodes.NONE;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
//TODO check erros (service not available, bad request)
|
//TODO check erros (service not available, bad request)
|
||||||
// if( ){
|
// if( ){
|
||||||
// this.status = ErrorCodes.ERROR;
|
// this.searchUtils.status = ErrorCodes.ERROR;
|
||||||
// }
|
// }
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
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];
|
this.results = data[1];
|
||||||
|
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status = errorCodes.DONE;
|
this.searchUtils.status = errorCodes.DONE;
|
||||||
if(this.totalResults == 0 ){
|
if(this.totalResults == 0 ){
|
||||||
this.status = errorCodes.NONE;
|
this.searchUtils.status = errorCodes.NONE;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
//TODO check erros (service not available, bad request)
|
//TODO check erros (service not available, bad request)
|
||||||
// if( ){
|
// if( ){
|
||||||
// this.status = ErrorCodes.ERROR;
|
// this.searchUtils.status = ErrorCodes.ERROR;
|
||||||
// }
|
// }
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
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.checkSelectedFilters(this.filters);
|
||||||
this.searchPage.updateBaseUrlWithParameters(this.filters);
|
this.searchPage.updateBaseUrlWithParameters(this.filters);
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status = errorCodes.DONE;
|
this.searchUtils.status = errorCodes.DONE;
|
||||||
if(this.totalResults == 0 ){
|
if(this.totalResults == 0 ){
|
||||||
this.status = errorCodes.NONE;
|
this.searchUtils.status = errorCodes.NONE;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
//TODO check erros (service not available, bad request)
|
//TODO check erros (service not available, bad request)
|
||||||
// if( ){
|
// if( ){
|
||||||
// this.status = ErrorCodes.ERROR;
|
// this.searchUtils.status = ErrorCodes.ERROR;
|
||||||
// }
|
// }
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
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) {
|
private queryChanged($event) {
|
||||||
var parameters = $event.value;
|
var parameters = $event.value;
|
||||||
//this.getResults(parameters, this.page, this.size, "searchPage");
|
//this.getResults(parameters, this.searchUtils.page, this.searchUtils.size, "searchPage");
|
||||||
this._getResults(parameters, true, this.page, this.size);
|
this._getResults(parameters, true, this.searchUtils.page, this.searchUtils.size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,13 +7,15 @@ import {SearchResult} from '../utils/entities/searchResult';
|
||||||
import {OpenaireProperties, ErrorCodes} from '../utils/properties/openaireProperties';
|
import {OpenaireProperties, ErrorCodes} from '../utils/properties/openaireProperties';
|
||||||
import {SearchFields} from '../utils/properties/searchFields';
|
import {SearchFields} from '../utils/properties/searchFields';
|
||||||
import {SearchPageComponent } from './searchUtils/searchPage.component';
|
import {SearchPageComponent } from './searchUtils/searchPage.component';
|
||||||
|
import {SearchUtilsClass } from './searchUtils/searchUtils.class';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'search-organizations',
|
selector: 'search-organizations',
|
||||||
template: `
|
template: `
|
||||||
|
|
||||||
<search-page pageTitle="Search Organizations" type="datasource" [(filters)] = "filters"
|
<search-page pageTitle="Search Organizations" type="datasource" [(filters)] = "filters"
|
||||||
[(results)] = "results" [(totalResults)] = "totalResults" [(keyword)] = "keyword"
|
[(results)] = "results" [(totalResults)] = "totalResults" [(searchUtils)] = "searchUtils"
|
||||||
[(page)] = "page" [(size)] = "size" [(status)] = "status" [baseUrl] = "baseUrl" (queryChange)="queryChanged($event)" >
|
[baseUrl] = "baseUrl" (queryChange)="queryChanged($event)" >
|
||||||
</search-page>
|
</search-page>
|
||||||
|
|
||||||
`
|
`
|
||||||
|
@ -24,10 +26,7 @@ export class SearchOrganizationsComponent {
|
||||||
private filters =[];
|
private filters =[];
|
||||||
public totalResults:number = 0 ;
|
public totalResults:number = 0 ;
|
||||||
private baseUrl:string;
|
private baseUrl:string;
|
||||||
public status:number;
|
private searchUtils:SearchUtilsClass = new SearchUtilsClass();
|
||||||
private keyword = '';
|
|
||||||
private page :number = 1;
|
|
||||||
private size :number = 10;
|
|
||||||
private sub: any;
|
private sub: any;
|
||||||
private subResults: any;
|
private subResults: any;
|
||||||
private searchFields:SearchFields = new SearchFields();
|
private searchFields:SearchFields = new SearchFields();
|
||||||
|
@ -42,7 +41,7 @@ export class SearchOrganizationsComponent {
|
||||||
constructor (private route: ActivatedRoute, private _searchOrganizationsService: SearchOrganizationsService ) {
|
constructor (private route: ActivatedRoute, private _searchOrganizationsService: SearchOrganizationsService ) {
|
||||||
|
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status =errorCodes.LOADING;
|
this.searchUtils.status =errorCodes.LOADING;
|
||||||
this.baseUrl = OpenaireProperties.getLinkToSearchOrganizations();
|
this.baseUrl = OpenaireProperties.getLinkToSearchOrganizations();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -53,11 +52,11 @@ export class SearchOrganizationsComponent {
|
||||||
this.searchPage.fieldIdsMap = this.fieldIdsMap;
|
this.searchPage.fieldIdsMap = this.fieldIdsMap;
|
||||||
|
|
||||||
this.sub = this.route.queryParams.subscribe(params => {
|
this.sub = this.route.queryParams.subscribe(params => {
|
||||||
this.keyword = (params['keyword']?params['keyword']:'');
|
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
|
||||||
this.page = (params['page']=== undefined)?1:+params['page'];
|
this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
|
||||||
|
|
||||||
var queryParameters = this.searchPage.getQueryParametersFromUrl(params);
|
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){
|
if(keyword.length > 0){
|
||||||
parameters = "q=" + keyword + "&op=and";
|
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){
|
private _getResults(parameters:string,refine:boolean, page: number, size: number){
|
||||||
|
|
||||||
|
@ -92,19 +91,19 @@ export class SearchOrganizationsComponent {
|
||||||
this.searchPage.checkSelectedFilters(this.filters);
|
this.searchPage.checkSelectedFilters(this.filters);
|
||||||
this.searchPage.updateBaseUrlWithParameters(this.filters);
|
this.searchPage.updateBaseUrlWithParameters(this.filters);
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status = errorCodes.DONE;
|
this.searchUtils.status = errorCodes.DONE;
|
||||||
if(this.totalResults == 0 ){
|
if(this.totalResults == 0 ){
|
||||||
this.status = errorCodes.NONE;
|
this.searchUtils.status = errorCodes.NONE;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
//TODO check erros (service not available, bad request)
|
//TODO check erros (service not available, bad request)
|
||||||
// if( ){
|
// if( ){
|
||||||
// this.status = ErrorCodes.ERROR;
|
// this.searchUtils.status = ErrorCodes.ERROR;
|
||||||
// }
|
// }
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status = errorCodes.ERROR;
|
this.searchUtils.status = errorCodes.ERROR;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -113,6 +112,6 @@ export class SearchOrganizationsComponent {
|
||||||
private queryChanged($event) {
|
private queryChanged($event) {
|
||||||
var parameters = $event.value;
|
var parameters = $event.value;
|
||||||
console.info("queryChanged: Execute search query "+parameters);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,13 +9,15 @@ import {SearchResult} from '../utils/entities/searchResult';
|
||||||
import {OpenaireProperties, ErrorCodes} from '../utils/properties/openaireProperties';
|
import {OpenaireProperties, ErrorCodes} from '../utils/properties/openaireProperties';
|
||||||
import {SearchFields} from '../utils/properties/searchFields';
|
import {SearchFields} from '../utils/properties/searchFields';
|
||||||
import {SearchPageComponent } from './searchUtils/searchPage.component';
|
import {SearchPageComponent } from './searchUtils/searchPage.component';
|
||||||
|
import {SearchUtilsClass } from './searchUtils/searchUtils.class';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'search-people',
|
selector: 'search-people',
|
||||||
template: `
|
template: `
|
||||||
|
|
||||||
<search-page pageTitle="Search People" type="people" [(filters)] = "filters"
|
<search-page pageTitle="Search People" type="people" [(filters)] = "filters"
|
||||||
[(results)] = "results" [(totalResults)] = "totalResults" [(keyword)] = "keyword"
|
[(results)] = "results" [(totalResults)] = "totalResults"
|
||||||
[(page)] = "page" [(size)] = "size" [(status)] = "status" [baseUrl] = "baseUrl" (queryChange)="queryChanged($event)" [showRefine]=false >
|
[(searchUtils)] = "searchUtils" [baseUrl] = "baseUrl" (queryChange)="queryChanged($event)" [showRefine]=false >
|
||||||
</search-page>
|
</search-page>
|
||||||
|
|
||||||
`
|
`
|
||||||
|
@ -25,11 +27,8 @@ export class SearchPeopleComponent {
|
||||||
public results =[];
|
public results =[];
|
||||||
private filters =[];
|
private filters =[];
|
||||||
public totalResults:number = 0 ;
|
public totalResults:number = 0 ;
|
||||||
public status:number;
|
|
||||||
private baseUrl:string;
|
private baseUrl:string;
|
||||||
private keyword = '';
|
private searchUtils:SearchUtilsClass = new SearchUtilsClass();
|
||||||
private page :number = 1;
|
|
||||||
private size :number = 10;
|
|
||||||
private sub: any;
|
private sub: any;
|
||||||
private _location:Location;
|
private _location:Location;
|
||||||
private refineFields = [];
|
private refineFields = [];
|
||||||
|
@ -41,7 +40,7 @@ export class SearchPeopleComponent {
|
||||||
//this.results =[];
|
//this.results =[];
|
||||||
//this.filters =[];
|
//this.filters =[];
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status =errorCodes.LOADING;
|
this.searchUtils.status =errorCodes.LOADING;
|
||||||
this.baseUrl = OpenaireProperties.getLinkToSearchPeople();
|
this.baseUrl = OpenaireProperties.getLinkToSearchPeople();
|
||||||
//get refine field filters from url parameters
|
//get refine field filters from url parameters
|
||||||
if(!this.searchPage){
|
if(!this.searchPage){
|
||||||
|
@ -52,8 +51,8 @@ export class SearchPeopleComponent {
|
||||||
private ngOnInit() {
|
private ngOnInit() {
|
||||||
this.searchPage.refineFields = this.refineFields; //TODO make it work as a directive
|
this.searchPage.refineFields = this.refineFields; //TODO make it work as a directive
|
||||||
this.sub = this.route.queryParams.subscribe(params => {
|
this.sub = this.route.queryParams.subscribe(params => {
|
||||||
this.keyword = (params['keyword']?params['keyword']:'');
|
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
|
||||||
this.page = (params['page']=== undefined)?1:+params['page'];
|
this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
|
||||||
for(var i=0; i<5 ; i++){
|
for(var i=0; i<5 ; i++){
|
||||||
var values = [];
|
var values = [];
|
||||||
for(var j=0; j<10 ; j++){
|
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'}
|
var filter1:Filter = {title: "MYtitle"+i, filterId: "MYfilter_"+i, originalFilterId: "MYfilter_"+i, values : values, countSelectedValues:0, "filterOperator": 'or'}
|
||||||
this.filters.push(filter1);
|
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();
|
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);
|
console.info("getResults: Execute search query "+parameters);
|
||||||
|
|
||||||
this._searchPeopleService.searchPeople(parameters, page, size).subscribe(
|
this._searchPeopleService.searchPeople(parameters, page, searchUtils.size).subscribe(
|
||||||
data => {
|
data => {
|
||||||
this.totalResults = data[0];
|
this.totalResults = data[0];
|
||||||
console.info("search People total="+this.totalResults);
|
console.info("search People total="+this.totalResults);
|
||||||
this.results = data[1];
|
this.results = data[1];
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status = errorCodes.DONE;
|
this.searchUtils.status = errorCodes.DONE;
|
||||||
if(this.totalResults == 0 ){
|
if(this.totalResults == 0 ){
|
||||||
this.status = errorCodes.NONE;
|
this.searchUtils.status = errorCodes.NONE;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
|
@ -137,10 +136,10 @@ export class SearchPeopleComponent {
|
||||||
console.info("error");
|
console.info("error");
|
||||||
//TODO check erros (service not available, bad request)
|
//TODO check erros (service not available, bad request)
|
||||||
// if( ){
|
// if( ){
|
||||||
// this.status = ErrorCodes.ERROR;
|
// this.searchUtils.status = ErrorCodes.ERROR;
|
||||||
// }
|
// }
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
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){
|
if(keyword.length > 0){
|
||||||
parameters = "q=" + keyword + "&op=and";
|
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){
|
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.filters = this.searchPage.checkSelectedFilters(data[2]);
|
||||||
this.searchPage.updateBaseUrlWithParameters(this.filters);
|
this.searchPage.updateBaseUrlWithParameters(this.filters);
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status = errorCodes.DONE;
|
this.searchUtils.status = errorCodes.DONE;
|
||||||
if(this.totalResults == 0 ){
|
if(this.totalResults == 0 ){
|
||||||
this.status = errorCodes.NONE;
|
this.searchUtils.status = errorCodes.NONE;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
//TODO check erros (service not available, bad request)
|
//TODO check erros (service not available, bad request)
|
||||||
// if( ){
|
// if( ){
|
||||||
// this.status = ErrorCodes.ERROR;
|
// this.searchUtils.status = ErrorCodes.ERROR;
|
||||||
// }
|
// }
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
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) {
|
private queryChanged($event) {
|
||||||
var parameters = $event.value;
|
var parameters = $event.value;
|
||||||
console.info("queryChanged: Execute search query "+parameters);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,13 +7,16 @@ import {SearchResult} from '../utils/entities/searchResult';
|
||||||
import {OpenaireProperties, ErrorCodes} from '../utils/properties/openaireProperties';
|
import {OpenaireProperties, ErrorCodes} from '../utils/properties/openaireProperties';
|
||||||
import {SearchFields} from '../utils/properties/searchFields';
|
import {SearchFields} from '../utils/properties/searchFields';
|
||||||
import {SearchPageComponent } from './searchUtils/searchPage.component';
|
import {SearchPageComponent } from './searchUtils/searchPage.component';
|
||||||
|
import {SearchUtilsClass } from './searchUtils/searchUtils.class';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'search-projects',
|
selector: 'search-projects',
|
||||||
template: `
|
template: `
|
||||||
|
|
||||||
<search-page pageTitle="Search Projects" type="project" [(filters)] = "filters"
|
<search-page pageTitle="Search Projects" type="project" [(filters)] = "filters"
|
||||||
[(results)] = "results" [(totalResults)] = "totalResults" [(keyword)] = "keyword"
|
[(results)] = "results" [(totalResults)] = "totalResults"
|
||||||
[(page)] = "page" [(size)] = "size" [(status)] = "status" [baseUrl] = "baseUrl" (queryChange)="queryChanged($event)" >
|
[(searchUtils)] = "searchUtils"
|
||||||
|
[baseUrl] = "baseUrl" (queryChange)="queryChanged($event)" >
|
||||||
</search-page>
|
</search-page>
|
||||||
`
|
`
|
||||||
|
|
||||||
|
@ -22,11 +25,8 @@ export class SearchProjectsComponent {
|
||||||
public results =[];
|
public results =[];
|
||||||
private filters: Filter[] =[];
|
private filters: Filter[] =[];
|
||||||
public totalResults:number = 0 ;
|
public totalResults:number = 0 ;
|
||||||
public status:number;
|
|
||||||
private baseUrl:string;
|
private baseUrl:string;
|
||||||
private keyword = '';
|
private searchUtils:SearchUtilsClass = new SearchUtilsClass();
|
||||||
private page :number = 1;
|
|
||||||
private size :number = 10;
|
|
||||||
private sub: any;
|
private sub: any;
|
||||||
private subResults: any;
|
private subResults: any;
|
||||||
private searchFields:SearchFields = new SearchFields();
|
private searchFields:SearchFields = new SearchFields();
|
||||||
|
@ -42,7 +42,7 @@ export class SearchProjectsComponent {
|
||||||
console.info(" constructor SearchProjectsComponent "+this.refineFields.length);
|
console.info(" constructor SearchProjectsComponent "+this.refineFields.length);
|
||||||
|
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status =errorCodes.LOADING;
|
this.searchUtils.status =errorCodes.LOADING;
|
||||||
this.baseUrl = OpenaireProperties.getLinkToSearchProjects();
|
this.baseUrl = OpenaireProperties.getLinkToSearchProjects();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -57,13 +57,13 @@ export class SearchProjectsComponent {
|
||||||
this.sub = this.route.queryParams.subscribe(params => {
|
this.sub = this.route.queryParams.subscribe(params => {
|
||||||
|
|
||||||
//get keyword from url parameters
|
//get keyword from url parameters
|
||||||
this.keyword = (params['keyword']?params['keyword']:'');
|
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
|
||||||
|
|
||||||
//get page from url parameters
|
//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);
|
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){
|
if(keyword.length > 0){
|
||||||
parameters = "q=" + keyword + "&op=and";
|
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){
|
private _getResults(parameters:string,refine:boolean, page: number, size: number){
|
||||||
if(!refine && !this.searchPage){
|
if(!refine && !this.searchPage){
|
||||||
|
@ -97,19 +97,19 @@ export class SearchProjectsComponent {
|
||||||
// this.filters = this.searchPage.checkSelectedFilters(data[2]);
|
// this.filters = this.searchPage.checkSelectedFilters(data[2]);
|
||||||
this.searchPage.updateBaseUrlWithParameters(this.filters);
|
this.searchPage.updateBaseUrlWithParameters(this.filters);
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status = errorCodes.DONE;
|
this.searchUtils.status = errorCodes.DONE;
|
||||||
if(this.totalResults == 0 ){
|
if(this.totalResults == 0 ){
|
||||||
this.status = errorCodes.NONE;
|
this.searchUtils.status = errorCodes.NONE;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
//TODO check erros (service not available, bad request)
|
//TODO check erros (service not available, bad request)
|
||||||
// if( ){
|
// if( ){
|
||||||
// this.status = ErrorCodes.ERROR;
|
// this.searchUtils.status = ErrorCodes.ERROR;
|
||||||
// }
|
// }
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status = errorCodes.ERROR;
|
this.searchUtils.status = errorCodes.ERROR;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,7 @@ export class SearchProjectsComponent {
|
||||||
private queryChanged($event) {
|
private queryChanged($event) {
|
||||||
this.urlParams = undefined;
|
this.urlParams = undefined;
|
||||||
var parameters = $event.value;
|
var parameters = $event.value;
|
||||||
this._getResults(parameters, true, this.page, this.size);
|
this._getResults(parameters, true, this.searchUtils.page, this.searchUtils.size);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,14 +9,15 @@ import {SearchResult} from '../utils/entities/searchResult';
|
||||||
import {OpenaireProperties, ErrorCodes} from '../utils/properties/openaireProperties';
|
import {OpenaireProperties, ErrorCodes} from '../utils/properties/openaireProperties';
|
||||||
import {SearchFields} from '../utils/properties/searchFields';
|
import {SearchFields} from '../utils/properties/searchFields';
|
||||||
import {SearchPageComponent } from './searchUtils/searchPage.component';
|
import {SearchPageComponent } from './searchUtils/searchPage.component';
|
||||||
|
import {SearchUtilsClass} from './searchUtils/searchUtils.class';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'search-publications',
|
selector: 'search-publications',
|
||||||
template: `
|
template: `
|
||||||
|
|
||||||
<search-page pageTitle="Search Publications" type="publication" [(filters)] = "filters"
|
<search-page pageTitle="Search Publications" type="publication" [(filters)] = "filters"
|
||||||
[(results)] = "results" [(totalResults)] = "totalResults" [(keyword)] = "keyword"
|
[(results)] = "results" [(totalResults)] = "totalResults"
|
||||||
[(page)] = "page" [(size)] = "size" [(status)] = "status" [baseUrl] = "baseUrl" (queryChange)="queryChanged($event)" >
|
[(searchUtils)] = "searchUtils" [baseUrl] = "baseUrl" (queryChange)="queryChanged($event)" >
|
||||||
</search-page>
|
</search-page>
|
||||||
|
|
||||||
`
|
`
|
||||||
|
@ -26,11 +27,9 @@ export class SearchPublicationsComponent {
|
||||||
public results =[];
|
public results =[];
|
||||||
private filters =[];
|
private filters =[];
|
||||||
public totalResults:number = 0 ;
|
public totalResults:number = 0 ;
|
||||||
public status:number;
|
|
||||||
private baseUrl:string;
|
private baseUrl:string;
|
||||||
private keyword = '';
|
private searchUtils:SearchUtilsClass = new SearchUtilsClass();
|
||||||
private page :number = 1;
|
|
||||||
private size :number = 10;
|
|
||||||
private sub: any;
|
private sub: any;
|
||||||
private subResults: any;
|
private subResults: any;
|
||||||
private searchFields:SearchFields = new SearchFields();
|
private searchFields:SearchFields = new SearchFields();
|
||||||
|
@ -43,7 +42,7 @@ export class SearchPublicationsComponent {
|
||||||
|
|
||||||
constructor (private route: ActivatedRoute, private _searchPublicationsService: SearchPublicationsService ) {
|
constructor (private route: ActivatedRoute, private _searchPublicationsService: SearchPublicationsService ) {
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status =errorCodes.LOADING;
|
this.searchUtils.status =errorCodes.LOADING;
|
||||||
this.baseUrl = OpenaireProperties.getLinkToSearchPublications();
|
this.baseUrl = OpenaireProperties.getLinkToSearchPublications();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -54,10 +53,10 @@ export class SearchPublicationsComponent {
|
||||||
this.searchPage.fieldIdsMap = this.fieldIdsMap;
|
this.searchPage.fieldIdsMap = this.fieldIdsMap;
|
||||||
|
|
||||||
this.sub = this.route.queryParams.subscribe(params => {
|
this.sub = this.route.queryParams.subscribe(params => {
|
||||||
this.keyword = (params['keyword']?params['keyword']:'');
|
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
|
||||||
this.page = (params['page']=== undefined)?1:+params['page'];
|
this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
|
||||||
var queryParameters = this.searchPage.getQueryParametersFromUrl(params);
|
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];
|
this.results = data[1];
|
||||||
|
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status = errorCodes.DONE;
|
this.searchUtils.status = errorCodes.DONE;
|
||||||
if(this.totalResults == 0 ){
|
if(this.totalResults == 0 ){
|
||||||
this.status = errorCodes.NONE;
|
this.searchUtils.status = errorCodes.NONE;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
//TODO check erros (service not available, bad request)
|
//TODO check erros (service not available, bad request)
|
||||||
// if( ){
|
// if( ){
|
||||||
// this.status = ErrorCodes.ERROR;
|
// this.searchUtils.status = ErrorCodes.ERROR;
|
||||||
// }
|
// }
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
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];
|
this.results = data[1];
|
||||||
|
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status = errorCodes.DONE;
|
this.searchUtils.status = errorCodes.DONE;
|
||||||
if(this.totalResults == 0 ){
|
if(this.totalResults == 0 ){
|
||||||
this.status = errorCodes.NONE;
|
this.searchUtils.status = errorCodes.NONE;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
//TODO check erros (service not available, bad request)
|
//TODO check erros (service not available, bad request)
|
||||||
// if( ){
|
// if( ){
|
||||||
// this.status = ErrorCodes.ERROR;
|
// this.searchUtils.status = ErrorCodes.ERROR;
|
||||||
// }
|
// }
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
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.checkSelectedFilters(this.filters);
|
||||||
this.searchPage.updateBaseUrlWithParameters(this.filters);
|
this.searchPage.updateBaseUrlWithParameters(this.filters);
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status = errorCodes.DONE;
|
this.searchUtils.status = errorCodes.DONE;
|
||||||
if(this.totalResults == 0 ){
|
if(this.totalResults == 0 ){
|
||||||
this.status = errorCodes.NONE;
|
this.searchUtils.status = errorCodes.NONE;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
//TODO check erros (service not available, bad request)
|
//TODO check erros (service not available, bad request)
|
||||||
// if( ){
|
// if( ){
|
||||||
// this.status = ErrorCodes.ERROR;
|
// this.searchUtils.status = ErrorCodes.ERROR;
|
||||||
// }
|
// }
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
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) {
|
private queryChanged($event) {
|
||||||
var parameters = $event.value;
|
var parameters = $event.value;
|
||||||
console.info("queryChanged: Execute search query "+parameters);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import {Location} from '@angular/common';
|
||||||
import {Filter, Value,AdvancedField} from '../searchUtils/searchHelperClasses.class';
|
import {Filter, Value,AdvancedField} from '../searchUtils/searchHelperClasses.class';
|
||||||
import {SearchResult} from '../../utils/entities/searchResult';
|
import {SearchResult} from '../../utils/entities/searchResult';
|
||||||
import {SearchFields} from '../../utils/properties/searchFields';
|
import {SearchFields} from '../../utils/properties/searchFields';
|
||||||
|
import {SearchUtilsClass} from './searchUtils.class';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'advanced-search-page',
|
selector: 'advanced-search-page',
|
||||||
|
@ -34,12 +35,12 @@ import {SearchFields} from '../../utils/properties/searchFields';
|
||||||
[(selectedFields)]="selectedFields"
|
[(selectedFields)]="selectedFields"
|
||||||
(queryChange)="queryChanged($event)">
|
(queryChange)="queryChanged($event)">
|
||||||
</advanced-search-form>
|
</advanced-search-form>
|
||||||
<div class="text-right" *ngIf="results && results.length>= size">
|
<!--div class="text-right" *ngIf="results && results.length>= size"-->
|
||||||
<search-paging [(page)] = "page" [(size)] = "size" [(results)] = "results" [(baseUrl)] = "baseURLWithParameters" [(totalResults)] = "totalResults" ></search-paging>
|
<search-paging [(page)] = "searchUtils.page" [(size)] = "searchUtils.size" [(results)] = "results" [(baseUrl)] = "baseURLWithParameters" [(totalResults)] = "totalResults" ></search-paging>
|
||||||
|
|
||||||
</div>
|
<!--/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>
|
<!--/div>
|
||||||
</div-->
|
</div-->
|
||||||
|
@ -52,14 +53,12 @@ export class AdvancedSearchPageComponent {
|
||||||
@Input() pageTitle = "";
|
@Input() pageTitle = "";
|
||||||
@Input() results = [];
|
@Input() results = [];
|
||||||
@Input() entityType;
|
@Input() entityType;
|
||||||
@Input() page:number = 1;
|
@Input() searchUtils:SearchUtilsClass = new SearchUtilsClass();
|
||||||
@Input() size: number = 10;
|
|
||||||
@Input() totalResults: number = 0;
|
@Input() totalResults: number = 0;
|
||||||
@Input() fieldIds: string[];
|
@Input() fieldIds: string[];
|
||||||
@Input() fieldIdsMap:{ [key:string]:{ name:string, operator:string, type:string, indexField:string }} ;
|
@Input() fieldIdsMap:{ [key:string]:{ name:string, operator:string, type:string, indexField:string }} ;
|
||||||
@Input() selectedFields:AdvancedField[];
|
@Input() selectedFields:AdvancedField[];
|
||||||
@Input() baseUrl:string = '';
|
@Input() baseUrl:string = '';
|
||||||
@Input() status: number;
|
|
||||||
@Input() simpleSearchUrl: string;
|
@Input() simpleSearchUrl: string;
|
||||||
|
|
||||||
private baseURLWithParameters:string = '';
|
private baseURLWithParameters:string = '';
|
||||||
|
@ -119,10 +118,10 @@ export class AdvancedSearchPageComponent {
|
||||||
"&"+this.fieldIdsMap[this.fieldIds[i]].operator+"="+fields[this.fieldIds[i]].operators.join()
|
"&"+this.fieldIdsMap[this.fieldIds[i]].operator+"="+fields[this.fieldIds[i]].operators.join()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(includePage && this.page != 1){
|
if(includePage && this.searchUtils.page != 1){
|
||||||
params += "&page="+this.page;
|
params += "&page="+this.searchUtils.page;
|
||||||
}
|
}
|
||||||
return params;
|
return '?'+params;
|
||||||
}
|
}
|
||||||
public createQueryParameters(){
|
public createQueryParameters(){
|
||||||
var params="";
|
var params="";
|
||||||
|
@ -145,7 +144,7 @@ export class AdvancedSearchPageComponent {
|
||||||
goTo(page:number = 1){
|
goTo(page:number = 1){
|
||||||
console.info("goto");
|
console.info("goto");
|
||||||
//console.info("keyword: "+this.keyword);
|
//console.info("keyword: "+this.keyword);
|
||||||
this.page = page;
|
this.searchUtils.page = page;
|
||||||
var urlParameters = this.createUrlParameters(true);
|
var urlParameters = this.createUrlParameters(true);
|
||||||
var queryParameters = this.createQueryParameters();
|
var queryParameters = this.createQueryParameters();
|
||||||
this.location.go(location.pathname,urlParameters);
|
this.location.go(location.pathname,urlParameters);
|
||||||
|
@ -160,8 +159,8 @@ export class AdvancedSearchPageComponent {
|
||||||
this.goTo(1);
|
this.goTo(1);
|
||||||
}
|
}
|
||||||
pageChanged($event) {
|
pageChanged($event) {
|
||||||
this.page = +$event.value;
|
this.searchUtils.page = +$event.value;
|
||||||
this.goTo(this.page);
|
this.goTo(this.searchUtils.page);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Update the url with proper parameters. This is used as base url in Paging Component
|
* Update the url with proper parameters. This is used as base url in Paging Component
|
||||||
|
|
|
@ -4,13 +4,14 @@ import {Location} from '@angular/common';
|
||||||
import { Filter, Value} from './searchHelperClasses.class';
|
import { Filter, Value} from './searchHelperClasses.class';
|
||||||
import {SearchResult} from '../../utils/entities/searchResult';
|
import {SearchResult} from '../../utils/entities/searchResult';
|
||||||
import {SearchFields} from '../../utils/properties/searchFields';
|
import {SearchFields} from '../../utils/properties/searchFields';
|
||||||
|
import {SearchUtilsClass} from './searchUtils.class';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'search-page',
|
selector: 'search-page',
|
||||||
template: `
|
template: `
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="page-header">
|
<div class="searchUtils.page-header">
|
||||||
<h1>{{pageTitle}}</h1>
|
<h1>{{pageTitle}}</h1>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
@ -18,7 +19,7 @@ import {SearchFields} from '../../utils/properties/searchFields';
|
||||||
<div class="row row-offcanvas row-offcanvas-right">
|
<div class="row row-offcanvas row-offcanvas-right">
|
||||||
<div class="col-xs-12 col-sm-10 text-center col-md-offset-1 ">
|
<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>
|
<div>
|
||||||
<span *ngFor="let filter of filters " >
|
<span *ngFor="let filter of filters " >
|
||||||
<span *ngIf = "filter.countSelectedValues > 0"> {{filter.title}}: </span>
|
<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 " >
|
<div class="col-xs-12 col-sm-9 " >
|
||||||
<search-download [totalResults]="totalResults" (downloadClick)="downloadClicked($event)"></search-download>
|
<search-download [totalResults]="totalResults" (downloadClick)="downloadClicked($event)"></search-download>
|
||||||
<search-paging [(page)] = "page" [(size)] = "size" [(results)] = "results" [(baseUrl)] = "baseURLWithParameters" [(totalResults)] = "totalResults" ></search-paging>
|
<search-paging [(page)] = "searchUtils.page" [(size)] = "searchUtils.size" [(results)] = "results" [(baseUrl)] = "baseURLWithParameters" [(totalResults)] = "totalResults" ></search-paging>
|
||||||
<search-result [results]="results" [totalResults]="totalResults" [status]=status [page]="page"></search-result>
|
<search-result [results]="results" [totalResults]="totalResults" [status]=searchUtils.status [page]="searchUtils.page"></search-result>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="!showRefine" >
|
<div *ngIf="!showRefine" >
|
||||||
|
|
||||||
<search-form [(keyword)]="keyword" (keywordChange)="keywordChanged($event)"></search-form>
|
<search-form [(keyword)]="searchUtils.keyword" (keywordChange)="keywordChanged($event)"></search-form>
|
||||||
<search-paging [(page)] = "page" [(size)] = "size" [(results)] = "results" [(baseUrl)] = "baseURLWithParameters" [(totalResults)] = "totalResults" ></search-paging>
|
<search-paging [(page)] = "searchUtils.page" [(size)] = "searchUtils.size" [(results)] = "results" [(baseUrl)] = "baseURLWithParameters" [(totalResults)] = "totalResults" ></search-paging>
|
||||||
<search-result [results]="results" [totalResults]="totalResults" [status]=status [page]="page"></search-result>
|
<search-result [results]="results" [totalResults]="totalResults" [status]=searchUtils.status [page]="searchUtils.page"></search-result>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -62,11 +63,8 @@ export class SearchPageComponent {
|
||||||
@Input() results = [];
|
@Input() results = [];
|
||||||
@Input() filters = [];
|
@Input() filters = [];
|
||||||
@Input() type;
|
@Input() type;
|
||||||
@Input() page:number = 1;
|
@Input() searchUtils:SearchUtilsClass = new SearchUtilsClass();
|
||||||
@Input() size: number = 10;
|
|
||||||
@Input() status: number;
|
|
||||||
@Input() totalResults: number = 0;
|
@Input() totalResults: number = 0;
|
||||||
@Input() keyword: string = '';
|
|
||||||
@Output() queryChange = new EventEmitter();
|
@Output() queryChange = new EventEmitter();
|
||||||
@Output() downloadClick = new EventEmitter();
|
@Output() downloadClick = new EventEmitter();
|
||||||
@Input() baseUrl:string = '';
|
@Input() baseUrl:string = '';
|
||||||
|
@ -183,11 +181,11 @@ export class SearchPageComponent {
|
||||||
allLimits+=((filterLimits.length == 0 )?'':"&" +filter.filterId + '='+ filterLimits) ;
|
allLimits+=((filterLimits.length == 0 )?'':"&" +filter.filterId + '='+ filterLimits) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(this.keyword.length > 0 ){
|
if(this.searchUtils.keyword.length > 0 ){
|
||||||
allLimits+='&keyword=' + this.keyword;
|
allLimits+='&keyword=' + this.searchUtils.keyword;
|
||||||
}
|
}
|
||||||
if(this.page != 1 && includePage){
|
if(this.searchUtils.page != 1 && includePage){
|
||||||
allLimits+=((allLimits.length == 0)?'':'&') + 'page=' + this.page;
|
allLimits+=((allLimits.length == 0)?'':'&') + 'page=' + this.searchUtils.page;
|
||||||
}
|
}
|
||||||
return allLimits;
|
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[]){
|
private createIndexQueryParameters(filters:Filter[]){
|
||||||
var allLimits="";
|
var allLimits="";
|
||||||
|
@ -232,7 +230,7 @@ export class SearchPageComponent {
|
||||||
allLimits += filterLimits;
|
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;
|
return allLimits;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
@ -244,7 +242,7 @@ export class SearchPageComponent {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(this.keyword.length > 0 ){
|
if(this.searchUtils.keyword.length > 0 ){
|
||||||
filtered = true;
|
filtered = true;
|
||||||
}
|
}
|
||||||
return filtered;
|
return filtered;
|
||||||
|
@ -260,8 +258,8 @@ export class SearchPageComponent {
|
||||||
filter.countSelectedValues = 0;
|
filter.countSelectedValues = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(this.keyword.length > 0 ){
|
if(this.searchUtils.keyword.length > 0 ){
|
||||||
this.keyword ='';
|
this.searchUtils.keyword ='';
|
||||||
}
|
}
|
||||||
this.location.go(location.pathname);
|
this.location.go(location.pathname);
|
||||||
this.goTo(1);
|
this.goTo(1);
|
||||||
|
@ -271,8 +269,8 @@ export class SearchPageComponent {
|
||||||
value.selected = false;
|
value.selected = false;
|
||||||
}
|
}
|
||||||
goTo(page:number = 1){
|
goTo(page:number = 1){
|
||||||
this.page = page;
|
this.searchUtils.page = page;
|
||||||
console.info("PAGE goto = "+this.page);
|
console.info("searchUtils.page goto = "+this.searchUtils.page);
|
||||||
this.queryParameters = new Map<string,string>();
|
this.queryParameters = new Map<string,string>();
|
||||||
var urlParameters = this.createUrlParameters(this.filters,true);
|
var urlParameters = this.createUrlParameters(this.filters,true);
|
||||||
console.info("urlParams : "+urlParameters);
|
console.info("urlParams : "+urlParameters);
|
||||||
|
@ -282,6 +280,7 @@ export class SearchPageComponent {
|
||||||
var indexQuery = this.createIndexQueryParameters(this.filters);
|
var indexQuery = this.createIndexQueryParameters(this.filters);
|
||||||
|
|
||||||
this.location.go(location.pathname,urlParameters);
|
this.location.go(location.pathname,urlParameters);
|
||||||
|
console.info("SearchPAGE::page "+this.searchUtils.page);
|
||||||
|
|
||||||
this.queryChange.emit({
|
this.queryChange.emit({
|
||||||
value: queryParameters,
|
value: queryParameters,
|
||||||
|
@ -294,7 +293,7 @@ export class SearchPageComponent {
|
||||||
this.goTo(1);
|
this.goTo(1);
|
||||||
}
|
}
|
||||||
keywordChanged($event) {
|
keywordChanged($event) {
|
||||||
this.keyword = $event.value;
|
this.searchUtils.keyword = $event.value;
|
||||||
this.goTo(1);
|
this.goTo(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
export class SearchUtilsClass{
|
||||||
|
page:number = 1;
|
||||||
|
size:number = 10;
|
||||||
|
status:number = 1;
|
||||||
|
keyword:string = "";
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue