diff --git a/portal-2/src/app/app.routing.ts b/portal-2/src/app/app.routing.ts index a3a2be16..859ece8f 100644 --- a/portal-2/src/app/app.routing.ts +++ b/portal-2/src/app/app.routing.ts @@ -23,6 +23,7 @@ import { ErrorPageComponent } from './error/errorPage.component'; import { TestComponent } from './test/test.component'; import { SearchAllComponent } from './searchAll/searchAll.component'; +import { SearchCompatibleDataprovidersComponent } from './searchPages/dataProviders/compatibleDataProviders.component'; const appRoutes: Routes = [ { path: '', component: SearchComponent, pathMatch: 'full' }, @@ -36,6 +37,7 @@ const appRoutes: Routes = [ { path: 'search/dataset', component: DatasetComponent }, { path: 'search/publication', component: PublicationComponent }, { path: 'search/dataprovider', component: DataProviderComponent}, + { path: 'search/data-providers', component: SearchCompatibleDataprovidersComponent}, { path: 'search/find', component: SearchComponent }, { path: 'linking', component: LinkingComponent }, { path: 'bulk-linking', component: BulkLinkingComponent}, diff --git a/portal-2/src/app/searchPages/dataProviders/compatibleDataProviders.component.ts b/portal-2/src/app/searchPages/dataProviders/compatibleDataProviders.component.ts new file mode 100644 index 00000000..36eb0296 --- /dev/null +++ b/portal-2/src/app/searchPages/dataProviders/compatibleDataProviders.component.ts @@ -0,0 +1,132 @@ +import {Component, Input, ViewChild} from '@angular/core'; +import { ActivatedRoute} from '@angular/router'; + +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'; + +@Component({ + selector: 'search-dataproviders', + template: ` + + + + + ` + +}) +export class SearchCompatibleDataprovidersComponent { + public results =[]; + private filters =[]; + public totalResults:number = 0 ; + private baseUrl:string; + public status:number; + private keyword = ''; + private page :number = 1; + private size :number = 10; + private sub: any; + + constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) { + var errorCodes:ErrorCodes = new ErrorCodes(); + this.status =errorCodes.LOADING; + this.baseUrl = OpenaireProperties.getLinkToSearchDataProviders(); + } + + private ngOnInit() { + this.sub = this.route.queryParams.subscribe(params => { + this.keyword = (params['keyword']?params['keyword']:''); + this.page = (params['page']=== undefined)?1:+params['page']; + this.filters = this.createFilters(); + for(var i=0; i< this.filters.length ; i++){ + var filter = this.filters[i]; + 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.getResults(this.keyword, this.page, this.size); + }); + } + + private ngOnDestroy() { + this.sub.unsubscribe(); + } + + public getResults(parameters:string, page: number, size: number){ + console.info("getResults: Execute search query "+parameters); +//q=(not datasourcecompatibilityid exact 'UNKNOWN' )and (not datasourcecompatibilityid exact 'hostedBy' ) and (not datasourcecompatibilityid exact 'notCompatible' ) +// (datasourcecompatibilityid <> "UNKNOWN") and (datasourcecompatibilityid <> "hostedBy") and (datasourcecompatibilityid <> "notCompatible") + this._searchDataprovidersService.searchDataproviders(parameters, page, size).subscribe( + data => { + this.totalResults = data[0]; + console.info("searchPubl total="+this.totalResults); + this.results = data[1]; + var errorCodes:ErrorCodes = new ErrorCodes(); + this.status = errorCodes.DONE; + if(this.totalResults == 0 ){ + this.status = errorCodes.NONE; + } + }, + err => { + console.error(err); + console.info("error"); + this.totalResults = 0; + this.results = []; + var errorCodes:ErrorCodes = new ErrorCodes(); + this.status = errorCodes.ERROR; + } + ); + } + + private setFilters(){ + //TODO set filters from + } + + private queryChanged($event) { + var parameters = $event.value; + console.info("queryChanged: Execute search query "+parameters); + this.getResults(parameters, this.page, this.size); + } + private createFilters():Filter[] { + var filter_names=["Type","Compatibility Level"]; + var filter_ids=["type","compatibility"]; + var filter_original_ids=["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; + } + +} diff --git a/portal-2/src/app/searchPages/dataProviders/entityRegistries.component.ts b/portal-2/src/app/searchPages/dataProviders/entityRegistries.component.ts new file mode 100644 index 00000000..e69de29b diff --git a/portal-2/src/app/searchPages/search.module.ts b/portal-2/src/app/searchPages/search.module.ts index 636c698d..5c2910e9 100644 --- a/portal-2/src/app/searchPages/search.module.ts +++ b/portal-2/src/app/searchPages/search.module.ts @@ -25,6 +25,7 @@ import { SearchDataprovidersComponent } from './searchDataproviders.component'; import { SearchProjectsComponent } from './searchProjects.component'; import {SearchComponent} from './find/search.component'; +import {SearchCompatibleDataprovidersComponent} from './dataProviders/compatibleDataProviders.component'; @NgModule({ @@ -48,7 +49,8 @@ import {SearchComponent} from './find/search.component'; AdvancedSearchPublicationsComponent, SearchDataprovidersComponent, SearchComponent, - SearchProjectsComponent + SearchProjectsComponent, + SearchCompatibleDataprovidersComponent ], providers:[ @@ -60,7 +62,8 @@ import {SearchComponent} from './find/search.component'; SearchPublicationsComponent, SearchProjectsComponent, SearchDataprovidersComponent, - SearchComponent + SearchComponent, + SearchCompatibleDataprovidersComponent ] }) export class SearchModule { } diff --git a/portal-2/src/app/searchPages/searchUtils/searchFilter.component.ts b/portal-2/src/app/searchPages/searchUtils/searchFilter.component.ts index 5b53fc81..4c6398b9 100644 --- a/portal-2/src/app/searchPages/searchUtils/searchFilter.component.ts +++ b/portal-2/src/app/searchPages/searchUtils/searchFilter.component.ts @@ -6,17 +6,17 @@ import { Filter, Value} from './searchHelperClasses.class'; @Component({ selector: 'search-filter', template: ` -

{{filter.title}}

+

{{filter.title}}

- {{value.name}} ({{value.number}}) + {{value.name}} ({{value.number}})

More

- {{value.name}} ({{value.number}}) + {{value.name}} ({{value.number}})

Less
@@ -32,6 +32,7 @@ export class SearchFilterComponent { //@Output() change = new EventEmitter(); @Input() test:{value:number} ; @Input() filter:Filter; + @Input() showResultCount:boolean = true; private showAll:boolean = false; constructor () { @@ -39,6 +40,7 @@ export class SearchFilterComponent { } ngOnInit() { + console.info(" showResultCount "+this.showResultCount + " (this.showResultCount == true): " + (this.showResultCount == true)+ " (this.showResultCount == false): "+(this.showResultCount == false)); } diff --git a/portal-2/src/app/searchPages/searchUtils/searchPage.component.ts b/portal-2/src/app/searchPages/searchUtils/searchPage.component.ts index 26c9b3c3..02f26f5f 100644 --- a/portal-2/src/app/searchPages/searchUtils/searchPage.component.ts +++ b/portal-2/src/app/searchPages/searchUtils/searchPage.component.ts @@ -18,7 +18,7 @@ import {SearchResult} from '../../utils/entities/searchResult';
Clear Filters

- +

@@ -45,13 +45,13 @@ export class SearchPageComponent { @Input() keyword: string = ''; @Output() queryChange = new EventEmitter(); @Input() baseUrl:string = ''; + @Input() showResultCount:boolean = true; constructor (private location: Location) { } ngOnInit() { - console.info(" page - value: "+this.page); console.info("searchPage total="+this.totalResults); console.info("searchPage: results.length = "+this.results.length); } @@ -131,6 +131,8 @@ export class SearchPageComponent { if(this.keyword.length > 0 ){ this.keyword =''; } + this.location.go(location.pathname); + this.goTo(1); } goTo(page:number = 1){ diff --git a/portal-2/src/server.ts b/portal-2/src/server.ts index d7d33a69..c0b55e1b 100644 --- a/portal-2/src/server.ts +++ b/portal-2/src/server.ts @@ -64,6 +64,7 @@ app.get('/search/project', ngApp); app.get('/search/organization', ngApp); app.get('/search/dataset', ngApp); app.get('/search/dataprovider', ngApp); +app.get('search/data-providers', ngApp); app.get('/search/publication', ngApp); app.get('/search', ngApp); app.get('/search/find/publications', ngApp);