Commiting a first draft with refine fields - using a dummy results from project refine results
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@44048 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
14af748130
commit
e926893ea4
|
@ -6,6 +6,7 @@ import { Filter, Value} from '../searchUtils/searchHelperClasses.class';
|
|||
import {SearchDataprovidersService} from '../../services/searchDataproviders.service';
|
||||
import {SearchResult} from '../../utils/entities/searchResult';
|
||||
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties';
|
||||
import {SearchFields} from '../../utils/properties/searchFields';
|
||||
|
||||
@Component({
|
||||
selector: 'search-dataproviders',
|
||||
|
@ -102,20 +103,19 @@ export class SearchCompatibleDataprovidersComponent {
|
|||
private createFilters():Filter[] {
|
||||
var filter_names=["Type","Compatibility Level"];
|
||||
var filter_ids=["type","compatibility"];
|
||||
var filter_original_ids=["datasourcetypeid","openairecompatibilityid"];
|
||||
|
||||
var searchFields = new SearchFields();
|
||||
var filter_original_ids = searchFields.COMPATIBLE_DATAPROVIDER_FIELDS; //["datasourcetypeid","openairecompatibilityid"];
|
||||
var value_names=[
|
||||
["Institutional Publication Repository","Thematic Publication Repository", "Other Publication Repository", "Publication Repositories Aggregators",
|
||||
"Data Repositories", "Data Repositories Aggregators", "Journals", "Journals Aggregators", "CRIS Systems", "Publication Catalogues"],
|
||||
["OpenAIRE Basic (DRIVER OA)","OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)","OpenAIRE Data (funded, referenced datasets)"]];
|
||||
var value_ids=[
|
||||
["instRepo","thematicRepo", "otherRepo", "pubRepoAggr",
|
||||
"dataRepo", "dataRepoAggr", "jRepo", "jRepoAggr", "cris", "pubCat"],
|
||||
["compBasic","comp2", "comp2plus", "comp3","comp2data"]];
|
||||
var value_original_ids=[
|
||||
["pubsrepository::institutional","pubsrepository::thematic", "pubsrepository::unknown", "aggregator::pubsrepository::thematic or aggregator::pubsrepository::institutional or aggregator::pubsrepository::unknown",
|
||||
"datarepository::unknown", "aggregator::datarepository", "pubsrepository::journal", "aggregator::pubsrepository::journals", "cris", "pubscatalogue::unknown"],
|
||||
["driver","openaire2.0", "driver-openaire2.0", "openaire3.0","openaire2.0_data"]];
|
||||
var value_ids=[
|
||||
["instRepo","thematicRepo", "otherRepo", "pubRepoAggr", "dataRepo", "dataRepoAggr", "jRepo", "jRepoAggr", "cris", "pubCat"],
|
||||
["compBasic","comp2", "comp2plus", "comp3","comp2data"]];
|
||||
var value_original_ids=[
|
||||
["pubsrepository::institutional","pubsrepository::thematic", "pubsrepository::unknown", "aggregator::pubsrepository::thematic or aggregator::pubsrepository::institutional or aggregator::pubsrepository::unknown",
|
||||
"datarepository::unknown", "aggregator::datarepository", "pubsrepository::journal", "aggregator::pubsrepository::journals", "cris", "pubscatalogue::unknown"],
|
||||
["driver","openaire2.0", "driver-openaire2.0", "openaire3.0","openaire2.0_data"]];
|
||||
var filters: Filter[] =[];
|
||||
for(var i =0 ; i < filter_names.length;i++){
|
||||
var values:Value[] = [];
|
||||
|
|
|
@ -6,6 +6,7 @@ import { Filter, Value} from './searchUtils/searchHelperClasses.class';
|
|||
import {SearchDataprovidersService} from '../services/searchDataproviders.service';
|
||||
import {SearchResult} from '../utils/entities/searchResult';
|
||||
import {OpenaireProperties, ErrorCodes} from '../utils/properties/openaireProperties';
|
||||
import {SearchFields} from '../utils/properties/searchFields';
|
||||
|
||||
@Component({
|
||||
selector: 'search-dataproviders',
|
||||
|
@ -42,63 +43,9 @@ export class SearchDataprovidersComponent {
|
|||
this.sub = this.route.queryParams.subscribe(params => {
|
||||
this.keyword = (params['keyword']?params['keyword']:'');
|
||||
this.page = (params['page']=== undefined)?1:+params['page'];
|
||||
for(var i=0; i<5 ; i++){
|
||||
var values = [];
|
||||
for(var j=0; j<10 ; j++){
|
||||
var value:Value = {name: "name"+j, id: "filter_"+i+ "_id_"+j, number:j, selected:false}
|
||||
values.push(value);
|
||||
}
|
||||
values.sort((n2,n1) => {
|
||||
if (n1.number > n2.number) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (n1.number < n2.number) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
});
|
||||
var filter:Filter = {title: "title"+i, filterId: "filter_"+i, originalFilterId: "filter_"+i, values : values, countSelectedValues:0, "filterOperator": 'and'}
|
||||
if(i==0) {
|
||||
var values = [];
|
||||
for(var j=0; j<10 ; j++){
|
||||
var value:Value = {name: "MYname"+j, id: "MYfilter_"+i+ "_id_"+j, number:j, selected:false}
|
||||
values.push(value);
|
||||
}
|
||||
values.sort((n2,n1) => {
|
||||
if (n1.number > n2.number) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (n1.number < n2.number) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
});
|
||||
var filter1:Filter = {title: "MYtitle"+i, filterId: "MYfilter_"+i, originalFilterId: "MYfilter_"+i, values : values, countSelectedValues:0, "filterOperator": 'or'}
|
||||
this.filters.push(filter1);
|
||||
this.getResults(this.keyword, this.page, this.size);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
console.info(params);
|
||||
if(params[filter.filterId] != undefined) {
|
||||
let values = params[filter.filterId].split(",");
|
||||
for(let value of values) {
|
||||
for(let filterValue of filter.values) {
|
||||
if(filterValue.id == value) {
|
||||
filterValue.selected = true;
|
||||
filter.countSelectedValues++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.filters = this.createFilters();
|
||||
this.getResults(this.keyword, this.page, this.size);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -143,5 +90,32 @@ export class SearchDataprovidersComponent {
|
|||
this.getResults(parameters, this.page, this.size);
|
||||
}
|
||||
|
||||
|
||||
private createFilters():Filter[] {
|
||||
var filter_names=["Type","Compatibility Level"];
|
||||
var filter_ids=["type","compatibility"];
|
||||
var searchFields = new SearchFields();
|
||||
var filter_original_ids = searchFields.COMPATIBLE_DATAPROVIDER_FIELDS; //["datasourcetypeid","openairecompatibilityid"];
|
||||
var value_names=[
|
||||
["Institutional Publication Repository","Thematic Publication Repository", "Other Publication Repository", "Publication Repositories Aggregators",
|
||||
"Data Repositories", "Data Repositories Aggregators", "Journals", "Journals Aggregators", "CRIS Systems", "Publication Catalogues"],
|
||||
["OpenAIRE Basic (DRIVER OA)","OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)","OpenAIRE Data (funded, referenced datasets)"]];
|
||||
var value_ids=[
|
||||
["instRepo","thematicRepo", "otherRepo", "pubRepoAggr", "dataRepo", "dataRepoAggr", "jRepo", "jRepoAggr", "cris", "pubCat"],
|
||||
["compBasic","comp2", "comp2plus", "comp3","comp2data"]];
|
||||
var value_original_ids=[
|
||||
["pubsrepository::institutional","pubsrepository::thematic", "pubsrepository::unknown", "aggregator::pubsrepository::thematic or aggregator::pubsrepository::institutional or aggregator::pubsrepository::unknown",
|
||||
"datarepository::unknown", "aggregator::datarepository", "pubsrepository::journal", "aggregator::pubsrepository::journals", "cris", "pubscatalogue::unknown"],
|
||||
["driver","openaire2.0", "driver-openaire2.0", "openaire3.0","openaire2.0_data"]];
|
||||
var filters: Filter[] =[];
|
||||
for(var i =0 ; i < filter_names.length;i++){
|
||||
var values:Value[] = [];
|
||||
for(var j =0 ; j < value_names[i].length;j++){
|
||||
var value:Value = {name: value_names[i][j], id: value_ids[i][j], number:j, selected:false}
|
||||
values.push(value);
|
||||
}
|
||||
var filter:Filter = {title: filter_names[i], filterId: filter_ids[i], originalFilterId: filter_original_ids[i], values : values, countSelectedValues:0, "filterOperator": 'or'}
|
||||
filters.push(filter);
|
||||
}
|
||||
return filters;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,10 +3,12 @@ import { ActivatedRoute} from '@angular/router';
|
|||
|
||||
import { Filter, Value} from './searchUtils/searchHelperClasses.class';
|
||||
|
||||
import {RefineResultsService} from '../services/servicesUtils/refineResuts.service';
|
||||
import {SearchDatasetsService} from '../services/searchDatasets.service';
|
||||
import {SearchResult} from '../utils/entities/searchResult';
|
||||
import {OpenaireProperties, ErrorCodes} from '../utils/properties/openaireProperties';
|
||||
|
||||
import {SearchFields} from '../utils/properties/searchFields';
|
||||
import {SearchPageComponent } from './searchUtils/searchPage.component';
|
||||
@Component({
|
||||
selector: 'search-datasets',
|
||||
template: `
|
||||
|
@ -21,7 +23,7 @@ import {OpenaireProperties, ErrorCodes} from '../utils/properties/openaireProper
|
|||
})
|
||||
export class SearchDatasetsComponent {
|
||||
public results =[];
|
||||
private filters =[];
|
||||
private filters: Filter[] =[];
|
||||
public totalResults:number = 0 ;
|
||||
private baseUrl:string;
|
||||
public status:number;
|
||||
|
@ -30,74 +32,26 @@ export class SearchDatasetsComponent {
|
|||
private size :number = 10;
|
||||
private sub: any;
|
||||
|
||||
constructor (private route: ActivatedRoute, private _searchDatasetsService: SearchDatasetsService ) {
|
||||
//this.results =[];
|
||||
//this.filters =[];
|
||||
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ;
|
||||
constructor (private route: ActivatedRoute, private _searchDatasetsService: SearchDatasetsService, private _refineResultsService:RefineResultsService ) {
|
||||
|
||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.status =errorCodes.LOADING;
|
||||
this.baseUrl = OpenaireProperties.getLinkToSearchDatasets();
|
||||
}
|
||||
|
||||
private ngOnInit() {
|
||||
|
||||
this.sub = this.route.queryParams.subscribe(params => {
|
||||
this.keyword = (params['keyword']?params['keyword']:'');
|
||||
this.page = (params['page']=== undefined)?1:+params['page'];
|
||||
for(var i=0; i<5 ; i++){
|
||||
var values = [];
|
||||
for(var j=0; j<10 ; j++){
|
||||
var value:Value = {name: "name"+j, id: "filter_"+i+ "_id_"+j, number:j, selected:false}
|
||||
values.push(value);
|
||||
}
|
||||
values.sort((n2,n1) => {
|
||||
if (n1.number > n2.number) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (n1.number < n2.number) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
});
|
||||
var filter:Filter = {title: "title"+i, filterId: "filter_"+i, originalFilterId: "filter_"+i, values : values, countSelectedValues:0, "filterOperator": 'and'}
|
||||
if(i==0) {
|
||||
var values = [];
|
||||
for(var j=0; j<10 ; j++){
|
||||
var value:Value = {name: "MYname"+j, id: "MYfilter_"+i+ "_id_"+j, number:j, selected:false}
|
||||
values.push(value);
|
||||
}
|
||||
values.sort((n2,n1) => {
|
||||
if (n1.number > n2.number) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (n1.number < n2.number) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
});
|
||||
var filter1:Filter = {title: "MYtitle"+i, filterId: "MYfilter_"+i, originalFilterId: "MYfilter_"+i, values : values, countSelectedValues:0, "filterOperator": 'or'}
|
||||
this.filters.push(filter1);
|
||||
this.getResults(this.keyword, this.page, this.size);
|
||||
|
||||
}
|
||||
this.getRefineResults();
|
||||
this.getResults(this.keyword, this.page, this.size);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
console.info(params);
|
||||
if(params[filter.filterId] != undefined) {
|
||||
let values = params[filter.filterId].split(",");
|
||||
for(let value of values) {
|
||||
for(let filterValue of filter.values) {
|
||||
if(filterValue.id == value) {
|
||||
filterValue.selected = true;
|
||||
filter.countSelectedValues++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
@ -105,14 +59,32 @@ export class SearchDatasetsComponent {
|
|||
private ngOnDestroy() {
|
||||
this.sub.unsubscribe();
|
||||
}
|
||||
public getRefineResults (){
|
||||
// this._refineResultsService.getRefineResults(this.searchPage.getFields()).subscribe(
|
||||
this._refineResultsService.getRefineResults(["projectendyear","projectstartyear","funderid","projectecsc39"]).subscribe(
|
||||
|
||||
data => {
|
||||
|
||||
this.filters = data;
|
||||
|
||||
},
|
||||
err => {
|
||||
console.error(err);
|
||||
//TODO check erros (service not available, bad request)
|
||||
// if( ){
|
||||
// this.status = ErrorCodes.ERROR;
|
||||
// }
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
public getResults(parameters:string, page: number, size: number){
|
||||
console.info("getResults: Execute search query "+parameters);
|
||||
|
||||
this._searchDatasetsService.searchDatasets(parameters, page, size).subscribe(
|
||||
data => {
|
||||
this.totalResults = data[0];
|
||||
console.info("searchPubl total="+this.totalResults);
|
||||
console.info("searchDataset total="+this.totalResults);
|
||||
this.results = data[1];
|
||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.status = errorCodes.DONE;
|
||||
|
|
|
@ -3,9 +3,11 @@ import { ActivatedRoute} from '@angular/router';
|
|||
|
||||
import { Filter, Value} from './searchUtils/searchHelperClasses.class';
|
||||
|
||||
import {RefineResultsService} from '../services/servicesUtils/refineResuts.service';
|
||||
import {SearchOrganizationsService} from '../services/searchOrganizations.service';
|
||||
import {SearchResult} from '../utils/entities/searchResult';
|
||||
import {OpenaireProperties, ErrorCodes} from '../utils/properties/openaireProperties';
|
||||
import {SearchPageComponent } from './searchUtils/searchPage.component';
|
||||
|
||||
@Component({
|
||||
selector: 'search-organizations',
|
||||
|
@ -30,7 +32,7 @@ export class SearchOrganizationsComponent {
|
|||
private size :number = 10;
|
||||
private sub: any;
|
||||
|
||||
constructor (private route: ActivatedRoute, private _searchOrganizationsService: SearchOrganizationsService ) {
|
||||
constructor (private route: ActivatedRoute, private _searchOrganizationsService: SearchOrganizationsService, private _refineResultsService:RefineResultsService ) {
|
||||
//this.results =[];
|
||||
//this.filters =[];
|
||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
|
@ -42,70 +44,34 @@ export class SearchOrganizationsComponent {
|
|||
this.sub = this.route.queryParams.subscribe(params => {
|
||||
this.keyword = (params['keyword']?params['keyword']:'');
|
||||
this.page = (params['page']=== undefined)?1:+params['page'];
|
||||
for(var i=0; i<5 ; i++){
|
||||
var values = [];
|
||||
for(var j=0; j<10 ; j++){
|
||||
var value:Value = {name: "name"+j, id: "filter_"+i+ "_id_"+j, number:j, selected:false}
|
||||
values.push(value);
|
||||
}
|
||||
values.sort((n2,n1) => {
|
||||
if (n1.number > n2.number) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (n1.number < n2.number) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
});
|
||||
var filter:Filter = {title: "title"+i, filterId: "filter_"+i, originalFilterId: "filter_"+i, values : values, countSelectedValues:0, "filterOperator": 'and'}
|
||||
if(i==0) {
|
||||
var values = [];
|
||||
for(var j=0; j<10 ; j++){
|
||||
var value:Value = {name: "MYname"+j, id: "MYfilter_"+i+ "_id_"+j, number:j, selected:false}
|
||||
values.push(value);
|
||||
}
|
||||
values.sort((n2,n1) => {
|
||||
if (n1.number > n2.number) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (n1.number < n2.number) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
});
|
||||
var filter1:Filter = {title: "MYtitle"+i, filterId: "MYfilter_"+i, originalFilterId: "MYfilter_"+i, values : values, countSelectedValues:0, "filterOperator": 'or'}
|
||||
this.filters.push(filter1);
|
||||
this.getResults(this.keyword, this.page, this.size);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
console.info(params);
|
||||
if(params[filter.filterId] != undefined) {
|
||||
let values = params[filter.filterId].split(",");
|
||||
for(let value of values) {
|
||||
for(let filterValue of filter.values) {
|
||||
if(filterValue.id == value) {
|
||||
filterValue.selected = true;
|
||||
filter.countSelectedValues++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.getRefineResults();
|
||||
this.getResults(this.keyword, this.page, this.size);
|
||||
});
|
||||
}
|
||||
|
||||
private ngOnDestroy() {
|
||||
this.sub.unsubscribe();
|
||||
}
|
||||
public getRefineResults (){
|
||||
// this._refineResultsService.getRefineResults(this.searchPage.getFields()).subscribe(
|
||||
this._refineResultsService.getRefineResults(["projectendyear","projectstartyear","funderid","projectecsc39"]).subscribe(
|
||||
|
||||
data => {
|
||||
|
||||
this.filters = data;
|
||||
|
||||
},
|
||||
err => {
|
||||
console.error(err);
|
||||
//TODO check erros (service not available, bad request)
|
||||
// if( ){
|
||||
// this.status = ErrorCodes.ERROR;
|
||||
// }
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
public getResults(parameters:string, page: number, size: number){
|
||||
console.info("getResults: Execute search query "+parameters);
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ import {OpenaireProperties, ErrorCodes} from '../utils/properties/openaireProper
|
|||
|
||||
<search-page pageTitle="Search People" type="people" [(filters)] = "filters"
|
||||
[(results)] = "results" [(totalResults)] = "totalResults" [(keyword)] = "keyword"
|
||||
[(page)] = "page" [(size)] = "size" [(status)] = "status" [baseUrl] = "baseUrl" (queryChange)="queryChanged($event)" >
|
||||
[(page)] = "page" [(size)] = "size" [(status)] = "status" [baseUrl] = "baseUrl" (queryChange)="queryChanged($event)" [showRefine]=false >
|
||||
</search-page>
|
||||
|
||||
`
|
||||
|
|
|
@ -2,11 +2,13 @@ import {Component, Input, ViewChild} from '@angular/core';
|
|||
import { ActivatedRoute} from '@angular/router';
|
||||
|
||||
import { Filter, Value} from './searchUtils/searchHelperClasses.class';
|
||||
import {RefineResultsService} from '../services/servicesUtils/refineResuts.service';
|
||||
|
||||
import {SearchProjectsService} from '../services/searchProjects.service';
|
||||
import {SearchResult} from '../utils/entities/searchResult';
|
||||
import {OpenaireProperties, ErrorCodes} from '../utils/properties/openaireProperties';
|
||||
|
||||
import {SearchFields} from '../utils/properties/searchFields';
|
||||
import {SearchPageComponent } from './searchUtils/searchPage.component';
|
||||
@Component({
|
||||
selector: 'search-projects',
|
||||
template: `
|
||||
|
@ -15,13 +17,13 @@ import {OpenaireProperties, ErrorCodes} from '../utils/properties/openaireProper
|
|||
[(results)] = "results" [(totalResults)] = "totalResults" [(keyword)] = "keyword"
|
||||
[(page)] = "page" [(size)] = "size" [(status)] = "status" [baseUrl] = "baseUrl" (queryChange)="queryChanged($event)" >
|
||||
</search-page>
|
||||
|
||||
<!--[refineParameters]="refineParameters"-->
|
||||
`
|
||||
|
||||
})
|
||||
export class SearchProjectsComponent {
|
||||
public results =[];
|
||||
private filters =[];
|
||||
private filters: Filter[] =[];
|
||||
public totalResults:number = 0 ;
|
||||
public status:number;
|
||||
private baseUrl:string;
|
||||
|
@ -29,75 +31,53 @@ export class SearchProjectsComponent {
|
|||
private page :number = 1;
|
||||
private size :number = 10;
|
||||
private sub: any;
|
||||
private refineParameters = [];
|
||||
private searchFields:SearchFields = new SearchFields();
|
||||
|
||||
constructor (private route: ActivatedRoute, private _searchProjectsService: SearchProjectsService ) {
|
||||
//this.results =[];
|
||||
//this.filters =[];
|
||||
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ;
|
||||
|
||||
constructor (private route: ActivatedRoute, private _searchProjectsService: SearchProjectsService, private _refineResultsService:RefineResultsService ) {
|
||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.status =errorCodes.LOADING;
|
||||
this.baseUrl = OpenaireProperties.getLinkToSearchProjects();
|
||||
}
|
||||
|
||||
private ngOnInit() {
|
||||
this.refineParameters = this.searchFields.getPROJECT_FIELDS();
|
||||
this.searchPage.refineParameters = this.refineParameters; //TODO make it work as a directive
|
||||
|
||||
this.sub = this.route.queryParams.subscribe(params => {
|
||||
this.keyword = (params['keyword']?params['keyword']:'');
|
||||
this.page = (params['page']=== undefined)?1:+params['page'];
|
||||
for(var i=0; i<5 ; i++){
|
||||
var values = [];
|
||||
for(var j=0; j<10 ; j++){
|
||||
var value:Value = {name: "name"+j, id: "filter_"+i+ "_id_"+j, number:j, selected:false}
|
||||
values.push(value);
|
||||
}
|
||||
values.sort((n2,n1) => {
|
||||
if (n1.number > n2.number) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (n1.number < n2.number) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
});
|
||||
var filter:Filter = {title: "title"+i, filterId: "filter_"+i, originalFilterId: "filter_"+i, values : values, countSelectedValues:0, "filterOperator": 'and'}
|
||||
if(i==0) {
|
||||
var values = [];
|
||||
for(var j=0; j<10 ; j++){
|
||||
var value:Value = {name: "MYname"+j, id: "MYfilter_"+i+ "_id_"+j, number:j, selected:false}
|
||||
values.push(value);
|
||||
}
|
||||
values.sort((n2,n1) => {
|
||||
if (n1.number > n2.number) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (n1.number < n2.number) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
});
|
||||
var filter1:Filter = {title: "MYtitle"+i, filterId: "MYfilter_"+i, originalFilterId: "MYfilter_"+i, values : values, countSelectedValues:0, "filterOperator": 'or'}
|
||||
this.filters.push(filter1);
|
||||
this.getResults(this.keyword, this.page, this.size);
|
||||
|
||||
var selected_filters = [];
|
||||
var searchFields:SearchFields = new SearchFields();
|
||||
for(var i=0; i< searchFields.PROJECT_FIELDS.length ; i++){
|
||||
var filterId = searchFields.PROJECT_FIELDS[i];
|
||||
var filterParam = searchFields.PROJECT_PARAM_FIELDS[i];
|
||||
if(params[filterParam] != undefined) {
|
||||
selected_filters.push(filterId);
|
||||
}
|
||||
}
|
||||
this.getResults(this.keyword, this.page, this.size);
|
||||
this.getRefineResults();
|
||||
// var filters = this.createFilters(selected_filters);
|
||||
|
||||
|
||||
|
||||
console.info(params);
|
||||
if(params[filter.filterId] != undefined) {
|
||||
let values = params[filter.filterId].split(",");
|
||||
for(let value of values) {
|
||||
for(let filterValue of filter.values) {
|
||||
if(filterValue.id == value) {
|
||||
filterValue.selected = true;
|
||||
filter.countSelectedValues++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// for(var i=0; i< filters.length ; i++){
|
||||
// var filter:Filter = filters[i];
|
||||
// if(params[filter.filterId] != undefined) {
|
||||
// let values = params[filter.filterId].split(",");
|
||||
// for(let value of values) {
|
||||
// for(let filterValue of filter.values) {
|
||||
// if(filterValue.id == value) {
|
||||
// filterValue.selected = true;
|
||||
// filter.countSelectedValues++;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// this.filters = filters;
|
||||
|
||||
});
|
||||
}
|
||||
|
@ -105,14 +85,32 @@ export class SearchProjectsComponent {
|
|||
private ngOnDestroy() {
|
||||
this.sub.unsubscribe();
|
||||
}
|
||||
public getRefineResults (){
|
||||
// this._refineResultsService.getRefineResults(this.searchPage.getFields()).subscribe(
|
||||
this._refineResultsService.getRefineResults(["projectendyear","projectstartyear","funderid","projectecsc39"]).subscribe(
|
||||
|
||||
data => {
|
||||
|
||||
this.filters = data;
|
||||
|
||||
},
|
||||
err => {
|
||||
console.error(err);
|
||||
//TODO check erros (service not available, bad request)
|
||||
// if( ){
|
||||
// this.status = ErrorCodes.ERROR;
|
||||
// }
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
public getResults(parameters:string, page: number, size: number){
|
||||
console.info("getResults: Execute search query "+parameters);
|
||||
|
||||
// var refine = "&refine=true"+this.searchPage.getRefineFieldsQuery(this.searchPage.getSelectedFilters());
|
||||
this._searchProjectsService.searchProjects(parameters, page, size).subscribe(
|
||||
data => {
|
||||
this.totalResults = data[0];
|
||||
console.info("search Projects total="+this.totalResults);
|
||||
console.info("search Projects: [Parameters:"+parameters+" ] [total results:"+this.totalResults+"]");
|
||||
this.results = data[1];
|
||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.status = errorCodes.DONE;
|
||||
|
@ -122,13 +120,12 @@ export class SearchProjectsComponent {
|
|||
},
|
||||
err => {
|
||||
console.error(err);
|
||||
console.info("error");
|
||||
//TODO check erros (service not available, bad request)
|
||||
//TODO check erros (service not available, bad request)
|
||||
// if( ){
|
||||
// this.status = ErrorCodes.ERROR;
|
||||
// }
|
||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.status = errorCodes.NOT_AVAILABLE;
|
||||
this.status = errorCodes.ERROR;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@ -139,9 +136,53 @@ export class SearchProjectsComponent {
|
|||
|
||||
private queryChanged($event) {
|
||||
var parameters = $event.value;
|
||||
console.info("queryChanged: Execute search query "+parameters);
|
||||
// this.filters = this.createFilters(this.searchPage.getSelectedFilters());
|
||||
// this.getRefineResults();
|
||||
this.getResults(parameters, this.page, this.size);
|
||||
}
|
||||
|
||||
private createFilters(selected_filters:string[]):Filter[] {
|
||||
|
||||
var filter_original_ids = this.searchFields.PROJECT_FIELDS; // ["funderid","fundinglevel0_id","fundinglevel1_id","fundinglevel2_id","projectstartyear","projectendyear","projectecsc39"];
|
||||
var filter_names = ["Funder","Funding level 0", "Funding level 1","Funding level 2", "Start Year","End Year","Special Clause 39"];
|
||||
var filter_ids = this.searchFields.PROJECT_PARAM_FIELDS;
|
||||
|
||||
var dependent: { [key:string]:string } = this.searchFields.DEPENDENT_FIELDS;
|
||||
|
||||
var hidden_filter_original_ids = this.searchFields.HIDDEN_FIELDS;
|
||||
|
||||
var value_names=[["EC","FP7"],["1-fl0","2-fl0"],["1-fl1","2-fl1"],["1-fl2","2-fl2"],["2001","2005"],["2011","2015"],["yes","no"] ];
|
||||
var value_ids=[["EC","FP7"],["1-fl0","2-fl0"],["1-fl1","2-fl1"],["1-fl2","2-fl2"],["2001","2005"],["2011","2015"],["yes","no"] ];
|
||||
var value_original_ids=[["EC","FP7"],["1-fl0","2-fl0"],["1-fl1","2-fl1"],["1-fl2","2-fl2"],["2001","2005"],["2011","2015"],["yes","no"] ];
|
||||
var filters: Filter[] =[];
|
||||
for(var i =0 ; i < filter_original_ids.length;i++){
|
||||
var dependentTo = dependent[filter_original_ids[i]];
|
||||
// var old_filter =
|
||||
|
||||
//if filter is not marked as hidden OR it is hidden but it is dependent to a field that it IS selected
|
||||
//dependentTo != undefined &&
|
||||
if(hidden_filter_original_ids.indexOf(filter_original_ids[i]) == -1 || (selected_filters.indexOf(dependentTo) != -1) ){
|
||||
var filter:Filter ;
|
||||
if(selected_filters.indexOf(filter_original_ids[i]) && this.filters.length > 0){
|
||||
for(var j =0 ; j < this.filters.length;j++){
|
||||
if(filter_original_ids[i] == this.filters[j].filterId){
|
||||
filter = this.filters[j];
|
||||
}
|
||||
}
|
||||
}else{
|
||||
var values:Value[] = [];
|
||||
for(var j =0 ; j < value_names[i].length;j++){
|
||||
var value:Value = {name: value_names[i][j], id: value_ids[i][j], number:j, selected:false}
|
||||
values.push(value);
|
||||
}
|
||||
filter = {title: filter_names[i], filterId: filter_ids[i], originalFilterId: filter_original_ids[i], values : values, countSelectedValues:0, "filterOperator": 'or'}
|
||||
|
||||
}
|
||||
filters.push(filter);
|
||||
}
|
||||
|
||||
}
|
||||
return filters;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import { Filter, Value} from './searchHelperClasses.class';
|
|||
@Component({
|
||||
selector: 'search-filter',
|
||||
template: `
|
||||
<h4>{{filter.title}} </h4>
|
||||
<h4>{{filter.title}} </h4>
|
||||
<p *ngFor = "let value of filter.values.slice(0,5)" >
|
||||
<input [(ngModel)]="value.selected" type="checkbox" (ngModelChange)="filterChange(value.selected)" />
|
||||
<span> {{value.name}}</span><span *ngIf = "showResultCount === true" > ({{value.number}}) </span>
|
||||
|
@ -25,10 +25,10 @@ import { Filter, Value} from './searchHelperClasses.class';
|
|||
})
|
||||
|
||||
export class SearchFilterComponent {
|
||||
@Input() title;
|
||||
@Input() filterId;
|
||||
@Input() values; //array[] " name, id, number, selected"
|
||||
@Input() countSelectedValues:number = 0; //array[] " name, id, number, selected"
|
||||
// @Input() title;
|
||||
// @Input() filterId;
|
||||
// @Input() values; //array[] " name, id, number, selected"
|
||||
// @Input() countSelectedValues:number = 0; //array[] " name, id, number, selected"
|
||||
//@Output() change = new EventEmitter();
|
||||
@Input() test:{value:number} ;
|
||||
@Input() filter:Filter;
|
||||
|
@ -40,7 +40,6 @@ export class SearchFilterComponent {
|
|||
}
|
||||
|
||||
ngOnInit() {
|
||||
console.info(" showResultCount "+this.showResultCount + " (this.showResultCount == true): " + (this.showResultCount == true)+ " (this.showResultCount == false): "+(this.showResultCount == false));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -2,14 +2,14 @@ export class Filter{
|
|||
public title: string; // eg Type
|
||||
public filterId: string; // type (name in url parameter)
|
||||
public originalFilterId: string; // (in index)
|
||||
public countSelectedValues: number;
|
||||
public values: Value[];
|
||||
public filterOperator: string;
|
||||
public countSelectedValues: number = 0;
|
||||
public values: Value[] = [];
|
||||
public filterOperator: string ='or';
|
||||
}
|
||||
export class Value{
|
||||
public name: string; //eg Article, Journal
|
||||
public id: string; //0001
|
||||
public selected: boolean;
|
||||
public number: number;
|
||||
public selected: boolean = false;
|
||||
public number: number = 0;
|
||||
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import {Location} from '@angular/common';
|
|||
|
||||
import { Filter, Value} from './searchHelperClasses.class';
|
||||
import {SearchResult} from '../../utils/entities/searchResult';
|
||||
import {SearchFields} from '../../utils/properties/searchFields';
|
||||
|
||||
@Component({
|
||||
selector: 'search-page',
|
||||
|
@ -14,7 +15,7 @@ import {SearchResult} from '../../utils/entities/searchResult';
|
|||
<h1>{{pageTitle}}</h1>
|
||||
</div>
|
||||
<div>
|
||||
<div class="row row-offcanvas row-offcanvas-right">
|
||||
<div *ngIf="showRefine" class="row row-offcanvas row-offcanvas-right">
|
||||
<div class="col-xs-12 col-sm-3">
|
||||
<a *ngIf="isFiltered()" (click)="clearFilters()" > Clear Filters</a>
|
||||
<p *ngFor="let filter of filters " >
|
||||
|
@ -28,6 +29,13 @@ import {SearchResult} from '../../utils/entities/searchResult';
|
|||
<search-result [results]="results" [totalResults]="totalResults" [status]=status [page]="page"></search-result>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="!showRefine" >
|
||||
|
||||
<search-form [(keyword)]="keyword" (keywordChange)="keywordChanged($event)"></search-form>
|
||||
<search-paging [(page)] = "page" [(size)] = "size" [(results)] = "results" [baseUrl] = "baseUrl+createQueryParameters()" [(totalResults)] = "totalResults" ></search-paging>
|
||||
<search-result [results]="results" [totalResults]="totalResults" [status]=status [page]="page"></search-result>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -46,14 +54,18 @@ export class SearchPageComponent {
|
|||
@Output() queryChange = new EventEmitter();
|
||||
@Input() baseUrl:string = '';
|
||||
@Input() showResultCount:boolean = true;
|
||||
@Input() showRefine:boolean = true;
|
||||
// @Input()
|
||||
refineParameters = [];
|
||||
private searchFields:SearchFields = new SearchFields();
|
||||
|
||||
constructor (private location: Location) {
|
||||
console.log("Search page constr"+ this.refineParameters.length);
|
||||
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
console.info("searchPage total="+this.totalResults);
|
||||
console.info("searchPage: results.length = "+this.results.length);
|
||||
|
||||
}
|
||||
|
||||
changekeyword(){
|
||||
|
@ -99,9 +111,8 @@ export class SearchPageComponent {
|
|||
}
|
||||
}
|
||||
if(this.keyword.length > 0 ){
|
||||
allLimits+=((allLimits.length == 0)?'':' and ') /*+ ' keyword=' */+ this.keyword;
|
||||
allLimits+= this.keyword + ((allLimits.length == 0)?'':'&') /*+ ' keyword=' */;
|
||||
}
|
||||
console.info("QueryParams: "+allLimits);
|
||||
return allLimits;
|
||||
}
|
||||
private isFiltered(){
|
||||
|
@ -136,31 +147,59 @@ export class SearchPageComponent {
|
|||
}
|
||||
|
||||
goTo(page:number = 1){
|
||||
console.info("goto");
|
||||
console.info("keyword: "+this.keyword);
|
||||
this.page = page;
|
||||
var urlParameters = this.createUrlParameters();
|
||||
var queryParameters = this.createQueryParameters();
|
||||
console.info(location.pathname);
|
||||
this.location.go(location.pathname,urlParameters);
|
||||
this.location.go(location.pathname,urlParameters);
|
||||
this.queryChange.emit({
|
||||
value: queryParameters
|
||||
});
|
||||
|
||||
}
|
||||
filterChanged($event){
|
||||
console.info("filterChanged");
|
||||
this.goTo(1);
|
||||
this.goTo(1);
|
||||
}
|
||||
keywordChanged($event) {
|
||||
console.info("keywordChanged");
|
||||
this.keyword = $event.value;
|
||||
console.info("searchPage: keyword= "+this.keyword);
|
||||
this.goTo(1);
|
||||
this.keyword = $event.value;
|
||||
this.goTo(1);
|
||||
}
|
||||
// pageChanged($event) {
|
||||
// this.page = +$event.value;
|
||||
// this.goTo(this.page);
|
||||
// }
|
||||
public getSelectedFilters():string[] {
|
||||
var selected:string[] = [];
|
||||
for(var i=0; i < this.filters.length; i++){
|
||||
var filter:Filter = this.filters[i];
|
||||
if(filter.countSelectedValues > 0){
|
||||
selected.push(filter.filterId);
|
||||
|
||||
}
|
||||
}
|
||||
return selected;
|
||||
}
|
||||
public getFields():string[] {
|
||||
var selected_filters:string[] = this.getSelectedFilters();
|
||||
var fields:string[] = [];
|
||||
for(var i =0 ; i < this.refineParameters.length;i++){
|
||||
var dependentTo = this.searchFields.DEPENDENT_FIELDS[this.refineParameters[i]];
|
||||
|
||||
//if filter is not marked as hidden OR it is hidden but it is dependent to a field that it IS selected
|
||||
if(this.searchFields.HIDDEN_FIELDS.indexOf(this.refineParameters[i]) == -1 || (selected_filters.indexOf(dependentTo) != -1) ){
|
||||
|
||||
fields.push(this.refineParameters[i]);
|
||||
}
|
||||
|
||||
}
|
||||
return fields;
|
||||
}
|
||||
public getRefineFieldsQuery():string{
|
||||
|
||||
console.log("Refine parames::"+this.refineParameters.length+this.searchFields.HIDDEN_FIELDS.length);
|
||||
var fields:string[] = this.getFields();
|
||||
|
||||
var fieldsStr = ""
|
||||
for(var i =0 ; i < fields.length ;i++){
|
||||
fieldsStr+="&fields="+fields[i];
|
||||
}
|
||||
return fieldsStr;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -5,10 +5,10 @@ import {Observable} from 'rxjs/Observable';
|
|||
selector: 'search-paging',
|
||||
template: `
|
||||
<div class= "searchPaging">
|
||||
<div class="text-right" *ngIf="results && results.length>= size">
|
||||
<div class="text-right" *ngIf="results && totalResults > size">
|
||||
<paging [currentPage]="page" [totalResults]="totalResults" [baseUrl]="baseUrl" [size]="size"> </paging>
|
||||
</div>
|
||||
<div class="text-left" *ngIf="results && results.length> 0">
|
||||
<div class="text-left" *ngIf="results && totalResults > 0">
|
||||
{{totalResults}} documents, page {{page}} of {{(currentPage())}}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -37,7 +37,8 @@ export class SearchOrganizationsService {
|
|||
let length = Array.isArray(data) ? data.length : 1;
|
||||
|
||||
for(let i=0; i<length; i++) {
|
||||
let resData = length > 1 ? data[i]['result']['metadata']['oaf:entity']['oaf:organization'] : data['result']['metadata']['oaf:entity']['oaf:organization'];
|
||||
console.log("Organizations size::: "+length+ " is array::"+Array.isArray(data) );
|
||||
let resData = Array.isArray(data) ? data[i]['result']['metadata']['oaf:entity']['oaf:organization'] : data['result']['metadata']['oaf:entity']['oaf:organization'];
|
||||
|
||||
var result: SearchResult = new SearchResult();
|
||||
|
||||
|
@ -49,7 +50,7 @@ export class SearchOrganizationsService {
|
|||
}
|
||||
|
||||
result['title'].url = OpenaireProperties.getsearchLinkToOrganization();
|
||||
result['title'].url += length > 1 ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
|
||||
result['title'].url += Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
|
||||
|
||||
if(resData['rels'].hasOwnProperty("rel")) {
|
||||
let relLength = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'].length : 1;
|
||||
|
|
|
@ -3,6 +3,7 @@ import {Http, Response} from '@angular/http';
|
|||
import {Observable} from 'rxjs/Observable';
|
||||
import {OpenaireProperties} from '../utils/properties/openaireProperties';
|
||||
import {SearchResult} from '../utils/entities/searchResult';
|
||||
// import {RefineParsingUtils} from './services-utils/refineResults.class';
|
||||
|
||||
@Injectable()
|
||||
export class SearchProjectsService {
|
||||
|
|
|
@ -20,8 +20,9 @@ import {SearchDataprovidersService} from './searchDataproviders.service';
|
|||
import {SearchDatasetsService} from './searchDatasets.service';
|
||||
import {SearchOrganizationsService} from './searchOrganizations.service';
|
||||
import {SearchPeopleService} from './searchPeople.service';
|
||||
|
||||
import {SearchProjectsService} from './searchProjects.service';
|
||||
import {RefineResultsService} from './servicesUtils/refineResuts.service';
|
||||
|
||||
|
||||
|
||||
@NgModule({
|
||||
|
@ -36,7 +37,7 @@ import {SearchProjectsService} from './searchProjects.service';
|
|||
SearchCrossrefService, SearchDataciteService, SearchOrcidService,
|
||||
SearchPublicationsService, SearchDataprovidersService, DataProviderService,
|
||||
SearchProjectsService, SearchDatasetsService, SearchOrganizationsService,
|
||||
SearchPeopleService
|
||||
SearchPeopleService,RefineResultsService
|
||||
],
|
||||
exports: [
|
||||
]
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
|
||||
|
||||
|
||||
class RefineParsingUtils {
|
||||
|
||||
|
||||
public static parse (data) {
|
||||
// let results: SearchResult[] = [];
|
||||
//
|
||||
// let length = Array.isArray(data) ? data.length : 1;
|
||||
//
|
||||
// for(let i=0; i<length; i++) {
|
||||
// let resData = length > 1 ? data[i]['result']['metadata']['oaf:entity']['oaf:project'] : data['result']['metadata']['oaf:entity']['oaf:project'];
|
||||
//
|
||||
// var result: SearchResult = new SearchResult();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
import {Injectable} from '@angular/core';
|
||||
import {Http, Response} from '@angular/http';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
// import {RefineParsingUtils} from './services-utils/refineResults.class';
|
||||
import { Filter, Value} from '../../searchPages/searchUtils/searchHelperClasses.class';
|
||||
|
||||
@Injectable()
|
||||
export class RefineResultsService {
|
||||
|
||||
constructor(private http: Http) {}
|
||||
|
||||
getRefineResults(fields:string[]):any {
|
||||
|
||||
console.info("In get RefineResults:");
|
||||
|
||||
|
||||
return this.http.get('./refineResults.json')
|
||||
.map(res => <any> res.json())
|
||||
.do(res => console.log(res))
|
||||
.map(res => this.parseRefineResults(res['refineResults'],fields))
|
||||
;
|
||||
}
|
||||
public parseRefineResults (data, fields:string[]):Filter[] {
|
||||
// var data = this.json.refineReuslts;
|
||||
var filters:Filter[] = [];
|
||||
for(let j=0; j<data.length; j++) {
|
||||
|
||||
var filter:Filter = new Filter();
|
||||
console.log("Parsing field :" + fields[j] );
|
||||
|
||||
filter.title = fields[j];
|
||||
filter.filterId = fields[j];
|
||||
filter.originalFilterId = fields[j];
|
||||
let field = data[j][fields[j]];
|
||||
for(let i=0; i<field.length; i++) {
|
||||
var value:Value = new Value();
|
||||
value.name = field[i].name;
|
||||
value.number = field[i].count;
|
||||
value.id = field[i].id;
|
||||
filter.values.push(value);
|
||||
|
||||
}
|
||||
filters.push(filter);
|
||||
}
|
||||
return filters;
|
||||
}
|
||||
|
||||
}
|
|
@ -41,7 +41,7 @@ export class PagingFormatter {
|
|||
}
|
||||
|
||||
ngOnInit() {
|
||||
console.info("In paging -- CurrentPage:"+this.currentPage+" "+"total Pages = "+this.getTotalPages() +" Results num:"+this.totalResults);
|
||||
|
||||
}
|
||||
getTotalPages(){
|
||||
var i:number =parseInt(''+(this.totalResults/this.size));
|
||||
|
|
|
@ -20,8 +20,10 @@ export class OpenaireProperties {
|
|||
// public claimsAPIURL = "http://rudie.di.uoa.gr:8080/dnet-openaire-connector-service-1.0.0-SNAPSHOT/rest/claimsService/"
|
||||
private static claimsAPIURL = "http://scoobydoo.di.uoa.gr:8181/dnet-openaire-connector-service-1.0.0-SNAPSHOT/rest/claimsService/";
|
||||
|
||||
//private static searchAPIURL = "http://astero.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/";
|
||||
//private static searchAPIURL = "http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/";
|
||||
|
||||
// private static searchAPIURL = "http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/";
|
||||
//"http://astero.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/";
|
||||
// private searchAPIURL = "http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2.0/api/";
|
||||
private static searchAPIURL = "http://scoobydoo.di.uoa.gr:8181/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/";
|
||||
|
||||
//private static searchServiveURL = "http://astero.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/";
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
export class SearchFields {
|
||||
//main Entities
|
||||
public PUBLICATION_FIELDS:string[] = ["instancetypenameid", "resultlanguageid", "communityid", "relfunderid",
|
||||
"relfundinglevel0_id","relfundinglevel1_id,relfundinglevel2_id",
|
||||
"resultacceptanceyear","resultbestlicense","resulthostingdatasourceid","collectedfromdatasourceid"];
|
||||
public DATASET_FIELDS:string[] = ["instancetypenameid", "resultlanguageid", "relfunderid",
|
||||
"relfundinglevel0_id","relfundinglevel1_id,relfundinglevel2_id",
|
||||
"resultacceptanceyear","resultbestlicense","resulthostingdatasourceid","collectedfromdatasourceid"];
|
||||
public DATAPROVIDER_FIELDS:string[] = ["datasourcetypeuiid", "datasourceodlanguages", "datasourceodcontenttypes", "datasourcecompatibilityid"];
|
||||
public ORGANIZATION_FIELDS:string[] = ["organizationcountryid","organizationeclegalbody"];
|
||||
public PROJECT_FIELDS:string[] = ["funderid","fundinglevel0_id","fundinglevel1_id","fundinglevel2_id","projectstartyear","projectendyear","projectecsc39"];
|
||||
public PEOPLE_FIELDS:string[] = [];
|
||||
//extra pages
|
||||
public COMPATIBLE_DATAPROVIDER_FIELDS:string[] = ["datasourcetypeid","openairecompatibilityid"];
|
||||
public ENTITYREGISTRIES_DATAPROVIDER_FIELDS:string[] = [];
|
||||
|
||||
|
||||
public HIDDEN_FIELDS:string[] = ["fundinglevel0_id","fundinglevel1_id","fundinglevel2_id",
|
||||
"relfundinglevel0_id","relfundinglevel1_id,relfundinglevel2_id"];
|
||||
|
||||
public DEPENDENT_FIELDS: { [key:string]:string } = {["fundinglevel0_id"]:"funderid",
|
||||
["fundinglevel1_id"]:"fundinglevel0_id", ["fundinglevel2_id"]:"fundinglevel1_id", ["relfundinglevel0_id"]:"relfunderid",
|
||||
["relfundinglevel1_id"]:"relfundinglevel0_id", ["relfundinglevel2_id"]:"relfundinglevel1_id"};
|
||||
|
||||
public PROJECT_PARAM_FIELDS:string[] = ["funder","fl0","fl1", "fl2", "start","end","sc39"];
|
||||
|
||||
public getPROJECT_FIELDS(){
|
||||
return this.PROJECT_FIELDS;
|
||||
}
|
||||
constructor (){
|
||||
}
|
||||
|
||||
}
|
|
@ -77,17 +77,681 @@ app.get('/search/find/people', ngApp);
|
|||
app.get('/deposit', ngApp);
|
||||
app.get('/deposit-result', ngApp);
|
||||
app.get('/error', ngApp);
|
||||
app.get('*', ngApp);
|
||||
app.get('/test', ngApp);
|
||||
app.get('/refineResults.json', function(req, res) {
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
var pojo = {
|
||||
"refineResults":[
|
||||
{
|
||||
"projectendyear":[
|
||||
{
|
||||
"name":"2016",
|
||||
"id":"2016",
|
||||
"count":"103"
|
||||
},
|
||||
{
|
||||
"name":"2015",
|
||||
"id":"2015",
|
||||
"count":"91"
|
||||
},
|
||||
{
|
||||
"name":"2013",
|
||||
"id":"2013",
|
||||
"count":"69"
|
||||
},
|
||||
{
|
||||
"name":"2010",
|
||||
"id":"2010",
|
||||
"count":"60"
|
||||
},
|
||||
{
|
||||
"name":"2011",
|
||||
"id":"2011",
|
||||
"count":"59"
|
||||
},
|
||||
{
|
||||
"name":"2014",
|
||||
"id":"2014",
|
||||
"count":"59"
|
||||
},
|
||||
{
|
||||
"name":"2012",
|
||||
"id":"2012",
|
||||
"count":"58"
|
||||
},
|
||||
{
|
||||
"name":"2005",
|
||||
"id":"2005",
|
||||
"count":"54"
|
||||
},
|
||||
{
|
||||
"name":"2000",
|
||||
"id":"2000",
|
||||
"count":"52"
|
||||
},
|
||||
{
|
||||
"name":"2006",
|
||||
"id":"2006",
|
||||
"count":"51"
|
||||
},
|
||||
{
|
||||
"name":"2007",
|
||||
"id":"2007",
|
||||
"count":"51"
|
||||
},
|
||||
{
|
||||
"name":"2017",
|
||||
"id":"2017",
|
||||
"count":"49"
|
||||
},
|
||||
{
|
||||
"name":"2009",
|
||||
"id":"2009",
|
||||
"count":"48"
|
||||
},
|
||||
{
|
||||
"name":"2002",
|
||||
"id":"2002",
|
||||
"count":"43"
|
||||
},
|
||||
{
|
||||
"name":"2004",
|
||||
"id":"2004",
|
||||
"count":"43"
|
||||
},
|
||||
{
|
||||
"name":"2001",
|
||||
"id":"2001",
|
||||
"count":"41"
|
||||
},
|
||||
{
|
||||
"name":"1999",
|
||||
"id":"1999",
|
||||
"count":"40"
|
||||
},
|
||||
{
|
||||
"name":"2008",
|
||||
"id":"2008",
|
||||
"count":"37"
|
||||
},
|
||||
{
|
||||
"name":"1997",
|
||||
"id":"1997",
|
||||
"count":"35"
|
||||
},
|
||||
{
|
||||
"name":"2003",
|
||||
"id":"2003",
|
||||
"count":"35"
|
||||
},
|
||||
{
|
||||
"name":"1998",
|
||||
"id":"1998",
|
||||
"count":"33"
|
||||
},
|
||||
{
|
||||
"name":"1993",
|
||||
"id":"1993",
|
||||
"count":"28"
|
||||
},
|
||||
{
|
||||
"name":"1995",
|
||||
"id":"1995",
|
||||
"count":"28"
|
||||
},
|
||||
{
|
||||
"name":"1990",
|
||||
"id":"1990",
|
||||
"count":"27"
|
||||
},
|
||||
{
|
||||
"name":"1994",
|
||||
"id":"1994",
|
||||
"count":"24"
|
||||
},
|
||||
{
|
||||
"name":"1996",
|
||||
"id":"1996",
|
||||
"count":"23"
|
||||
},
|
||||
{
|
||||
"name":"1992",
|
||||
"id":"1992",
|
||||
"count":"22"
|
||||
},
|
||||
{
|
||||
"name":"1979",
|
||||
"id":"1979",
|
||||
"count":"19"
|
||||
},
|
||||
{
|
||||
"name":"1988",
|
||||
"id":"1988",
|
||||
"count":"19"
|
||||
},
|
||||
{
|
||||
"name":"1989",
|
||||
"id":"1989",
|
||||
"count":"18"
|
||||
},
|
||||
{
|
||||
"name":"1991",
|
||||
"id":"1991",
|
||||
"count":"18"
|
||||
},
|
||||
{
|
||||
"name":"1974",
|
||||
"id":"1974",
|
||||
"count":"17"
|
||||
},
|
||||
{
|
||||
"name":"2018",
|
||||
"id":"2018",
|
||||
"count":"17"
|
||||
},
|
||||
{
|
||||
"name":"1975",
|
||||
"id":"1975",
|
||||
"count":"14"
|
||||
},
|
||||
{
|
||||
"name":"1986",
|
||||
"id":"1986",
|
||||
"count":"14"
|
||||
},
|
||||
{
|
||||
"name":"1982",
|
||||
"id":"1982",
|
||||
"count":"13"
|
||||
},
|
||||
{
|
||||
"name":"1987",
|
||||
"id":"1987",
|
||||
"count":"13"
|
||||
},
|
||||
{
|
||||
"name":"1981",
|
||||
"id":"1981",
|
||||
"count":"12"
|
||||
},
|
||||
{
|
||||
"name":"1985",
|
||||
"id":"1985",
|
||||
"count":"12"
|
||||
},
|
||||
{
|
||||
"name":"1976",
|
||||
"id":"1976",
|
||||
"count":"11"
|
||||
},
|
||||
{
|
||||
"name":"1983",
|
||||
"id":"1983",
|
||||
"count":"9"
|
||||
},
|
||||
{
|
||||
"name":"2019",
|
||||
"id":"2019",
|
||||
"count":"9"
|
||||
},
|
||||
{
|
||||
"name":"1973",
|
||||
"id":"1973",
|
||||
"count":"8"
|
||||
},
|
||||
{
|
||||
"name":"1980",
|
||||
"id":"1980",
|
||||
"count":"8"
|
||||
},
|
||||
{
|
||||
"name":"1968",
|
||||
"id":"1968",
|
||||
"count":"7"
|
||||
},
|
||||
{
|
||||
"name":"1984",
|
||||
"id":"1984",
|
||||
"count":"7"
|
||||
},
|
||||
{
|
||||
"name":"1970",
|
||||
"id":"1970",
|
||||
"count":"6"
|
||||
},
|
||||
{
|
||||
"name":"1969",
|
||||
"id":"1969",
|
||||
"count":"5"
|
||||
},
|
||||
{
|
||||
"name":"1978",
|
||||
"id":"1978",
|
||||
"count":"5"
|
||||
},
|
||||
{
|
||||
"name":"2020",
|
||||
"id":"2020",
|
||||
"count":"5"
|
||||
},
|
||||
{
|
||||
"name":"1966",
|
||||
"id":"1966",
|
||||
"count":"3"
|
||||
},
|
||||
{
|
||||
"name":"1972",
|
||||
"id":"1972",
|
||||
"count":"3"
|
||||
},
|
||||
{
|
||||
"name":"1977",
|
||||
"id":"1977",
|
||||
"count":"3"
|
||||
},
|
||||
{
|
||||
"name":"1962",
|
||||
"id":"1962",
|
||||
"count":"2"
|
||||
},
|
||||
{
|
||||
"name":"1963",
|
||||
"id":"1963",
|
||||
"count":"2"
|
||||
},
|
||||
{
|
||||
"name":"1971",
|
||||
"id":"1971",
|
||||
"count":"2"
|
||||
},
|
||||
{
|
||||
"name":"1960",
|
||||
"id":"1960",
|
||||
"count":"1"
|
||||
},
|
||||
{
|
||||
"name":"1961",
|
||||
"id":"1961",
|
||||
"count":"1"
|
||||
},
|
||||
{
|
||||
"name":"1964",
|
||||
"id":"1964",
|
||||
"count":"1"
|
||||
},
|
||||
{
|
||||
"name":"1967",
|
||||
"id":"1967",
|
||||
"count":"1"
|
||||
},
|
||||
{
|
||||
"name":"2021",
|
||||
"id":"2021",
|
||||
"count":"1"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"projectstartyear":[
|
||||
{
|
||||
"name":"2015",
|
||||
"id":"2015",
|
||||
"count":"75"
|
||||
},
|
||||
{
|
||||
"name":"2008",
|
||||
"id":"2008",
|
||||
"count":"71"
|
||||
},
|
||||
{
|
||||
"name":"2011",
|
||||
"id":"2011",
|
||||
"count":"66"
|
||||
},
|
||||
{
|
||||
"name":"2009",
|
||||
"id":"2009",
|
||||
"count":"65"
|
||||
},
|
||||
{
|
||||
"name":"2010",
|
||||
"id":"2010",
|
||||
"count":"65"
|
||||
},
|
||||
{
|
||||
"name":"2003",
|
||||
"id":"2003",
|
||||
"count":"63"
|
||||
},
|
||||
{
|
||||
"name":"2013",
|
||||
"id":"2013",
|
||||
"count":"62"
|
||||
},
|
||||
{
|
||||
"name":"2012",
|
||||
"id":"2012",
|
||||
"count":"61"
|
||||
},
|
||||
{
|
||||
"name":"2014",
|
||||
"id":"2014",
|
||||
"count":"61"
|
||||
},
|
||||
{
|
||||
"name":"2005",
|
||||
"id":"2005",
|
||||
"count":"59"
|
||||
},
|
||||
{
|
||||
"name":"2002",
|
||||
"id":"2002",
|
||||
"count":"54"
|
||||
},
|
||||
{
|
||||
"name":"2004",
|
||||
"id":"2004",
|
||||
"count":"50"
|
||||
},
|
||||
{
|
||||
"name":"2007",
|
||||
"id":"2007",
|
||||
"count":"49"
|
||||
},
|
||||
{
|
||||
"name":"2006",
|
||||
"id":"2006",
|
||||
"count":"47"
|
||||
},
|
||||
{
|
||||
"name":"1996",
|
||||
"id":"1996",
|
||||
"count":"45"
|
||||
},
|
||||
{
|
||||
"name":"1997",
|
||||
"id":"1997",
|
||||
"count":"44"
|
||||
},
|
||||
{
|
||||
"name":"1998",
|
||||
"id":"1998",
|
||||
"count":"44"
|
||||
},
|
||||
{
|
||||
"name":"2001",
|
||||
"id":"2001",
|
||||
"count":"40"
|
||||
},
|
||||
{
|
||||
"name":"2000",
|
||||
"id":"2000",
|
||||
"count":"38"
|
||||
},
|
||||
{
|
||||
"name":"1999",
|
||||
"id":"1999",
|
||||
"count":"36"
|
||||
},
|
||||
{
|
||||
"name":"1992",
|
||||
"id":"1992",
|
||||
"count":"34"
|
||||
},
|
||||
{
|
||||
"name":"1991",
|
||||
"id":"1991",
|
||||
"count":"32"
|
||||
},
|
||||
{
|
||||
"name":"1974",
|
||||
"id":"1974",
|
||||
"count":"31"
|
||||
},
|
||||
{
|
||||
"name":"1994",
|
||||
"id":"1994",
|
||||
"count":"31"
|
||||
},
|
||||
{
|
||||
"name":"1993",
|
||||
"id":"1993",
|
||||
"count":"30"
|
||||
},
|
||||
{
|
||||
"name":"1990",
|
||||
"id":"1990",
|
||||
"count":"27"
|
||||
},
|
||||
{
|
||||
"name":"1995",
|
||||
"id":"1995",
|
||||
"count":"27"
|
||||
},
|
||||
{
|
||||
"name":"1987",
|
||||
"id":"1987",
|
||||
"count":"24"
|
||||
},
|
||||
{
|
||||
"name":"1985",
|
||||
"id":"1985",
|
||||
"count":"23"
|
||||
},
|
||||
{
|
||||
"name":"1988",
|
||||
"id":"1988",
|
||||
"count":"18"
|
||||
},
|
||||
{
|
||||
"name":"2016",
|
||||
"id":"2016",
|
||||
"count":"18"
|
||||
},
|
||||
{
|
||||
"name":"1989",
|
||||
"id":"1989",
|
||||
"count":"17"
|
||||
},
|
||||
{
|
||||
"name":"1976",
|
||||
"id":"1976",
|
||||
"count":"16"
|
||||
},
|
||||
{
|
||||
"name":"1986",
|
||||
"id":"1986",
|
||||
"count":"16"
|
||||
},
|
||||
{
|
||||
"name":"1977",
|
||||
"id":"1977",
|
||||
"count":"14"
|
||||
},
|
||||
{
|
||||
"name":"1980",
|
||||
"id":"1980",
|
||||
"count":"13"
|
||||
},
|
||||
{
|
||||
"name":"1981",
|
||||
"id":"1981",
|
||||
"count":"12"
|
||||
},
|
||||
{
|
||||
"name":"1983",
|
||||
"id":"1983",
|
||||
"count":"12"
|
||||
},
|
||||
{
|
||||
"name":"1973",
|
||||
"id":"1973",
|
||||
"count":"10"
|
||||
},
|
||||
{
|
||||
"name":"1968",
|
||||
"id":"1968",
|
||||
"count":"9"
|
||||
},
|
||||
{
|
||||
"name":"1978",
|
||||
"id":"1978",
|
||||
"count":"8"
|
||||
},
|
||||
{
|
||||
"name":"1979",
|
||||
"id":"1979",
|
||||
"count":"8"
|
||||
},
|
||||
{
|
||||
"name":"1984",
|
||||
"id":"1984",
|
||||
"count":"8"
|
||||
},
|
||||
{
|
||||
"name":"1972",
|
||||
"id":"1972",
|
||||
"count":"6"
|
||||
},
|
||||
{
|
||||
"name":"1982",
|
||||
"id":"1982",
|
||||
"count":"6"
|
||||
},
|
||||
{
|
||||
"name":"1967",
|
||||
"id":"1967",
|
||||
"count":"4"
|
||||
},
|
||||
{
|
||||
"name":"1969",
|
||||
"id":"1969",
|
||||
"count":"4"
|
||||
},
|
||||
{
|
||||
"name":"1961",
|
||||
"id":"1961",
|
||||
"count":"3"
|
||||
},
|
||||
{
|
||||
"name":"1965",
|
||||
"id":"1965",
|
||||
"count":"3"
|
||||
},
|
||||
{
|
||||
"name":"1970",
|
||||
"id":"1970",
|
||||
"count":"3"
|
||||
},
|
||||
{
|
||||
"name":"1971",
|
||||
"id":"1971",
|
||||
"count":"3"
|
||||
},
|
||||
{
|
||||
"name":"1975",
|
||||
"id":"1975",
|
||||
"count":"3"
|
||||
},
|
||||
{
|
||||
"name":"1962",
|
||||
"id":"1962",
|
||||
"count":"2"
|
||||
},
|
||||
{
|
||||
"name":"1917",
|
||||
"id":"1917",
|
||||
"count":"1"
|
||||
},
|
||||
{
|
||||
"name":"1959",
|
||||
"id":"1959",
|
||||
"count":"1"
|
||||
},
|
||||
{
|
||||
"name":"1960",
|
||||
"id":"1960",
|
||||
"count":"1"
|
||||
},
|
||||
{
|
||||
"name":"1963",
|
||||
"id":"1963",
|
||||
"count":"1"
|
||||
},
|
||||
{
|
||||
"name":"1966",
|
||||
"id":"1966",
|
||||
"count":"1"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"funderid":[
|
||||
{
|
||||
"name":"nsf_________::NSF",
|
||||
"id":"nsf_________::NSF",
|
||||
"count":"1060"
|
||||
},
|
||||
{
|
||||
"name":"ec__________::EC",
|
||||
"id":"ec__________::EC",
|
||||
"count":"150"
|
||||
},
|
||||
{
|
||||
"name":"nhmrc_______::NHMRC",
|
||||
"id":"nhmrc_______::NHMRC",
|
||||
"count":"90"
|
||||
},
|
||||
{
|
||||
"name":"arc_________::ARC",
|
||||
"id":"arc_________::ARC",
|
||||
"count":"62"
|
||||
},
|
||||
{
|
||||
"name":"fct_________::FCT",
|
||||
"id":"fct_________::FCT",
|
||||
"count":"50"
|
||||
},
|
||||
{
|
||||
"name":"wt__________::WT",
|
||||
"id":"wt__________::WT",
|
||||
"count":"21"
|
||||
},
|
||||
{
|
||||
"name":"sfi_________::SFI",
|
||||
"id":"sfi_________::SFI",
|
||||
"count":"17"
|
||||
},
|
||||
{
|
||||
"name":"irb_hr______::MSES",
|
||||
"id":"irb_hr______::MSES",
|
||||
"count":"1"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"projectecsc39":[
|
||||
{
|
||||
"name":"false",
|
||||
"id":"false",
|
||||
"count":"96"
|
||||
},
|
||||
{
|
||||
"name":"true",
|
||||
"id":"true",
|
||||
"count":"4"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
var json = JSON.stringify(pojo, null, 2);
|
||||
res.status(200).send(json);
|
||||
});
|
||||
|
||||
app.get('*', ngApp);
|
||||
|
||||
|
||||
//
|
||||
// app.get('*', function(req, res) {
|
||||
// res.setHeader('Content-Type', 'application/json');
|
||||
// var pojo = { status: 404, message: 'No Content' };
|
||||
// var json = JSON.stringify(pojo, null, 2);
|
||||
// res.status(404).send(json);
|
||||
// });
|
||||
|
||||
// Server
|
||||
let server = app.listen(process.env.PORT || 3000, () => {
|
||||
|
|
Loading…
Reference in New Issue