diff --git a/portal-2/src/app/app.routing.ts b/portal-2/src/app/app.routing.ts index bb7bf57f..db7c6efd 100644 --- a/portal-2/src/app/app.routing.ts +++ b/portal-2/src/app/app.routing.ts @@ -22,6 +22,10 @@ import { SearchPeopleComponent } from './searchPages/searchPeople.component'; import { AdvancedSearchPublicationsComponent } from './searchPages/advanced/advancedSearchPublications.component'; import { AdvancedSearchDataProvidersComponent } from './searchPages/advanced/advancedSearchDataProviders.component'; import { AdvancedSearchProjectsComponent } from './searchPages/advanced/advancedSearchProjects.component'; +import { AdvancedSearchDatasetsComponent } from './searchPages/advanced/advancedSearchDatasets.component'; +import { AdvancedSearchPeopleComponent } from './searchPages/advanced/advancedSearchPeople.component'; +import { AdvancedSearchOrganizationsComponent } from './searchPages/advanced/advancedSearchOrganizations.component'; + import { DepositComponent } from './deposit/deposit.component'; import { DepositResultComponent } from './deposit/depositResult.component'; @@ -58,6 +62,9 @@ const appRoutes: Routes = [ { path: 'search/advanced/publications', component: AdvancedSearchPublicationsComponent }, { path: 'search/advanced/dataproviders', component: AdvancedSearchDataProvidersComponent }, { path: 'search/advanced/projects', component: AdvancedSearchProjectsComponent }, + { path: 'search/advanced/datasets', component: AdvancedSearchDatasetsComponent }, + { path: 'search/advanced/people', component: AdvancedSearchPeopleComponent }, + { path: 'search/advanced/organizations', component: AdvancedSearchOrganizationsComponent }, { path: 'deposit', component: DepositComponent}, { path: 'deposit-results', component: DepositResultComponent}, { path: 'test', component: TestComponent}, diff --git a/portal-2/src/app/searchPages/advanced/advancedSearchDatasets.component.ts b/portal-2/src/app/searchPages/advanced/advancedSearchDatasets.component.ts new file mode 100644 index 00000000..77a17f4e --- /dev/null +++ b/portal-2/src/app/searchPages/advanced/advancedSearchDatasets.component.ts @@ -0,0 +1,112 @@ +import {Component, Input, ViewChild} from '@angular/core'; +import {Observable} from 'rxjs/Observable'; +import { Router, ActivatedRoute} from '@angular/router'; +import {Filter, Value,AdvancedField} from '../searchUtils/searchHelperClasses.class'; +import {SearchDatasetsService} from '../../services/searchDatasets.service'; +import {SearchResult} from '../../utils/entities/searchResult'; +import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties'; +import {AdvancedSearchPageComponent} from '../searchUtils/advancedSearchPage.component'; +import {SearchFields} from '../../utils/properties/searchFields'; + + + +@Component({ + selector: 'advanced-search-datasets', + template: ` + + + + ` + }) + +export class AdvancedSearchDatasetsComponent { + private results =[]; + private filters =[]; + private totalResults:number = 0 ; + private page :number = 1; + private size :number = 10; + public status:number; + private baseUrl: string; + private searchFields:SearchFields = new SearchFields(); + + private fieldIds: string[] = this.searchFields.ADVANCED_SEARCH_DATASET_PARAM; + private fieldIdsMap: { [key:string]:{ name:string, operator:string, type:string, indexField:string }} = this.searchFields.DATASET_FIELDS_MAP; + private selectedFields:AdvancedField[] = []; + + @ViewChild (AdvancedSearchPageComponent) searchPage : AdvancedSearchPageComponent ; + + + constructor (private route: ActivatedRoute, private _searchDatasetsService: SearchDatasetsService ) { + + this.results =[]; + var errorCodes:ErrorCodes = new ErrorCodes(); + this.status =errorCodes.LOADING; + this.baseUrl = OpenaireProperties.getLinkToSearchAdvancedPublications(); + + + + } + ngOnInit() { + var errorCodes:ErrorCodes = new ErrorCodes(); + this.status =errorCodes.LOADING; + this.sub = this.route.queryParams.subscribe(params => { + let page = (params['page']=== undefined)?1:+params['page']; + this.page = ( page <= 0 ) ? 1 : page; + this.searchPage.fieldIds = this.fieldIds; + this.searchPage.selectedFields = this.selectedFields; + this.searchPage.fieldIdsMap = this.fieldIdsMap; + this.searchPage.getSelectedFiltersFromUrl(params); + this.getResults(this.searchPage.createQueryParameters(), this.page, this.size); + + }); + } + ngOnDestroy() { + this.sub.unsubscribe(); + } + sub: any; + public getResults(parameters:string, page: number, size: number){ + var errorCodes:ErrorCodes = new ErrorCodes(); + this.status = errorCodes.LOADING; + console.info("Advanced Search Datasets: Execute search query "+parameters); + this._searchDatasetsService.searchDatasets(parameters, null, page, size, []).subscribe( + data => { + this.totalResults = data[0]; + console.info("search Datasets total="+this.totalResults); + this.results = data[1]; + this.searchPage.updateBaseUrlWithParameters(); + var errorCodes:ErrorCodes = new ErrorCodes(); + this.status = errorCodes.DONE; + if(this.totalResults == 0 ){ + this.status = errorCodes.NONE; + } + }, + err => { + console.error(err); + console.info("error"); + //TODO check erros (service not available, bad request) + // if( ){ + // this.status = ErrorCodes.ERROR; + // } + var errorCodes:ErrorCodes = new ErrorCodes(); + this.status = errorCodes.NOT_AVAILABLE; + } + ); + } + private setFilters(){ + //TODO set filters from + } + + private queryChanged($event) { + var parameters = $event.value; + this.getResults(parameters, this.page,this.size); + console.info("queryChanged: Execute search query "+parameters); + + } + + +} diff --git a/portal-2/src/app/searchPages/advanced/advancedSearchOrganizations.component.ts b/portal-2/src/app/searchPages/advanced/advancedSearchOrganizations.component.ts new file mode 100644 index 00000000..49646a55 --- /dev/null +++ b/portal-2/src/app/searchPages/advanced/advancedSearchOrganizations.component.ts @@ -0,0 +1,112 @@ +import {Component, Input, ViewChild} from '@angular/core'; +import {Observable} from 'rxjs/Observable'; +import { Router, ActivatedRoute} from '@angular/router'; +import {Filter, Value,AdvancedField} from '../searchUtils/searchHelperClasses.class'; +import {SearchOrganizationsService} from '../../services/searchOrganizations.service'; +import {SearchResult} from '../../utils/entities/searchResult'; +import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties'; +import {AdvancedSearchPageComponent} from '../searchUtils/advancedSearchPage.component'; +import {SearchFields} from '../../utils/properties/searchFields'; + + + +@Component({ + selector: 'advanced-search-organizations', + template: ` + + + + ` + }) + +export class AdvancedSearchOrganizationsComponent { + private results =[]; + private filters =[]; + private totalResults:number = 0 ; + private page :number = 1; + private size :number = 10; + public status:number; + private baseUrl: string; + private searchFields:SearchFields = new SearchFields(); + + private fieldIds: string[] = this.searchFields.ADVANCED_SEARCH_ORGANIZATION_PARAM; + private fieldIdsMap: { [key:string]:{ name:string, operator:string, type:string, indexField:string }} = this.searchFields.ORGANIZATION_FIELDS_MAP; + private selectedFields:AdvancedField[] = []; + + @ViewChild (AdvancedSearchPageComponent) searchPage : AdvancedSearchPageComponent ; + + + constructor (private route: ActivatedRoute, private _searchOrganizationsService: SearchOrganizationsService ) { + + this.results =[]; + var errorCodes:ErrorCodes = new ErrorCodes(); + this.status =errorCodes.LOADING; + this.baseUrl = OpenaireProperties.getLinkToSearchAdvancedPublications(); + + + + } + ngOnInit() { + var errorCodes:ErrorCodes = new ErrorCodes(); + this.status =errorCodes.LOADING; + this.sub = this.route.queryParams.subscribe(params => { + let page = (params['page']=== undefined)?1:+params['page']; + this.page = ( page <= 0 ) ? 1 : page; + this.searchPage.fieldIds = this.fieldIds; + this.searchPage.selectedFields = this.selectedFields; + this.searchPage.fieldIdsMap = this.fieldIdsMap; + this.searchPage.getSelectedFiltersFromUrl(params); + this.getResults(this.searchPage.createQueryParameters(), this.page, this.size); + + }); + } + ngOnDestroy() { + this.sub.unsubscribe(); + } + sub: any; + public getResults(parameters:string, page: number, size: number){ + var errorCodes:ErrorCodes = new ErrorCodes(); + this.status = errorCodes.LOADING; + console.info("Advanced Search Organizations: Execute search query "+parameters); + this._searchOrganizationsService.searchOrganizations(parameters, null, page, size, []).subscribe( + data => { + this.totalResults = data[0]; + console.info("search Organizations total="+this.totalResults); + this.results = data[1]; + this.searchPage.updateBaseUrlWithParameters(); + var errorCodes:ErrorCodes = new ErrorCodes(); + this.status = errorCodes.DONE; + if(this.totalResults == 0 ){ + this.status = errorCodes.NONE; + } + }, + err => { + console.error(err); + console.info("error"); + //TODO check erros (service not available, bad request) + // if( ){ + // this.status = ErrorCodes.ERROR; + // } + var errorCodes:ErrorCodes = new ErrorCodes(); + this.status = errorCodes.NOT_AVAILABLE; + } + ); + } + private setFilters(){ + //TODO set filters from + } + + private queryChanged($event) { + var parameters = $event.value; + this.getResults(parameters, this.page,this.size); + console.info("queryChanged: Execute search query "+parameters); + + } + + +} diff --git a/portal-2/src/app/searchPages/advanced/advancedSearchPeople.component.ts b/portal-2/src/app/searchPages/advanced/advancedSearchPeople.component.ts new file mode 100644 index 00000000..6aa8acaa --- /dev/null +++ b/portal-2/src/app/searchPages/advanced/advancedSearchPeople.component.ts @@ -0,0 +1,112 @@ +import {Component, Input, ViewChild} from '@angular/core'; +import {Observable} from 'rxjs/Observable'; +import { Router, ActivatedRoute} from '@angular/router'; +import {Filter, Value,AdvancedField} from '../searchUtils/searchHelperClasses.class'; +import {SearchPeopleService} from '../../services/searchPeople.service'; +import {SearchResult} from '../../utils/entities/searchResult'; +import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties'; +import {AdvancedSearchPageComponent} from '../searchUtils/advancedSearchPage.component'; +import {SearchFields} from '../../utils/properties/searchFields'; + + + +@Component({ + selector: 'advanced-search-organizations', + template: ` + + + + ` + }) + +export class AdvancedSearchPeopleComponent { + private results =[]; + private filters =[]; + private totalResults:number = 0 ; + private page :number = 1; + private size :number = 10; + public status:number; + private baseUrl: string; + private searchFields:SearchFields = new SearchFields(); + + private fieldIds: string[] = this.searchFields.ADVANCED_SEARCH_PERSON_PARAM; + private fieldIdsMap: { [key:string]:{ name:string, operator:string, type:string, indexField:string }} = this.searchFields.PERSON_FIELDS_MAP; + private selectedFields:AdvancedField[] = []; + + @ViewChild (AdvancedSearchPageComponent) searchPage : AdvancedSearchPageComponent ; + + + constructor (private route: ActivatedRoute, private _searchPeopleService: SearchPeopleService ) { + + this.results =[]; + var errorCodes:ErrorCodes = new ErrorCodes(); + this.status =errorCodes.LOADING; + this.baseUrl = OpenaireProperties.getLinkToSearchAdvancedPublications(); + + + + } + ngOnInit() { + var errorCodes:ErrorCodes = new ErrorCodes(); + this.status =errorCodes.LOADING; + this.sub = this.route.queryParams.subscribe(params => { + let page = (params['page']=== undefined)?1:+params['page']; + this.page = ( page <= 0 ) ? 1 : page; + this.searchPage.fieldIds = this.fieldIds; + this.searchPage.selectedFields = this.selectedFields; + this.searchPage.fieldIdsMap = this.fieldIdsMap; + this.searchPage.getSelectedFiltersFromUrl(params); + this.getResults(this.searchPage.createQueryParameters(), this.page, this.size); + + }); + } + ngOnDestroy() { + this.sub.unsubscribe(); + } + sub: any; + public getResults(parameters:string, page: number, size: number){ + var errorCodes:ErrorCodes = new ErrorCodes(); + this.status = errorCodes.LOADING; + console.info("Advanced Search People: Execute search query "+parameters); + this._searchPeopleService.searchPeople(parameters, null, page, size, []).subscribe( + data => { + this.totalResults = data[0]; + console.info("search People total="+this.totalResults); + this.results = data[1]; + this.searchPage.updateBaseUrlWithParameters(); + var errorCodes:ErrorCodes = new ErrorCodes(); + this.status = errorCodes.DONE; + if(this.totalResults == 0 ){ + this.status = errorCodes.NONE; + } + }, + err => { + console.error(err); + console.info("error"); + //TODO check erros (service not available, bad request) + // if( ){ + // this.status = ErrorCodes.ERROR; + // } + var errorCodes:ErrorCodes = new ErrorCodes(); + this.status = errorCodes.NOT_AVAILABLE; + } + ); + } + private setFilters(){ + //TODO set filters from + } + + private queryChanged($event) { + var parameters = $event.value; + this.getResults(parameters, this.page,this.size); + console.info("queryChanged: Execute search query "+parameters); + + } + + +} diff --git a/portal-2/src/app/searchPages/advanced/advancedSearchProjects.component.ts b/portal-2/src/app/searchPages/advanced/advancedSearchProjects.component.ts index 6e8f8df4..67d5a179 100644 --- a/portal-2/src/app/searchPages/advanced/advancedSearchProjects.component.ts +++ b/portal-2/src/app/searchPages/advanced/advancedSearchProjects.component.ts @@ -13,7 +13,7 @@ import {SearchFields} from '../../utils/properties/searchFields'; @Component({ selector: 'advanced-search-projects', template: ` - res.json()) + .map(res => res['terms']) + .map(res => this.parse(res)); + + } + + getDatasetTypesJsonFile ():any { + var lang = JSON.parse(JSON.stringify(require('../utils/vocabularies/dnet:dataCite_resource.json'))); + return this.parse(lang["terms"]); + } + getAccessMode ():any { console.info("Get AccessMode from IS"); let url = this.api+"dnet:access_modes.json"; @@ -104,7 +124,20 @@ export class ISVocabulariesService { } - private handleError (error: Response) { +getCountryCompatibility ():any { + let url = this.api+"dnet:countries.json"; + return this.http.get(url) + .map(res => res.json()) + .map(res => res['terms']) + .map(res => this.parse(res)); + +} + +getCountryJsonFile ():any { + var lang = JSON.parse(JSON.stringify(require('../utils/vocabularies/countries.json'))); + return this.parse(lang["terms"]); +} +private handleError (error: Response) { // in a real world app, we may send the error to some remote logging infrastructure // instead of just logging it to the console console.error(error); diff --git a/portal-2/src/app/sharedComponents/navigationBar.component.ts b/portal-2/src/app/sharedComponents/navigationBar.component.ts index 90442c42..6dca164f 100644 --- a/portal-2/src/app/sharedComponents/navigationBar.component.ts +++ b/portal-2/src/app/sharedComponents/navigationBar.component.ts @@ -35,7 +35,11 @@ import 'rxjs/Rx';
  • Entity Registries
  • Advanced Search Publications
  • +
  • Advanced Search Research Data
  • +
  • Advanced Search Projects
  • Advanced Search Data Providers
  • +
  • Advanced Search Organizations
  • +
  • Advanced Search People