Revision 44262
Added by Argiro Kokogiannaki over 7 years ago
searchPublications.component.ts | ||
---|---|---|
1 | 1 |
import {Component, Input, ViewChild} from '@angular/core'; |
2 | 2 |
import { ActivatedRoute} from '@angular/router'; |
3 |
import {Location} from '@angular/common'; |
|
3 | 4 |
|
4 | 5 |
import { Filter, Value} from './searchUtils/searchHelperClasses.class'; |
5 | 6 |
|
6 | 7 |
import {SearchPublicationsService} from '../services/searchPublications.service'; |
7 | 8 |
import {SearchResult} from '../utils/entities/searchResult'; |
8 | 9 |
import {OpenaireProperties, ErrorCodes} from '../utils/properties/openaireProperties'; |
10 |
import {SearchFields} from '../utils/properties/searchFields'; |
|
11 |
import {SearchPageComponent } from './searchUtils/searchPage.component'; |
|
9 | 12 |
|
10 | 13 |
@Component({ |
11 | 14 |
selector: 'search-publications', |
... | ... | |
29 | 32 |
private page :number = 1; |
30 | 33 |
private size :number = 10; |
31 | 34 |
private sub: any; |
35 |
private refineFields = []; |
|
36 |
private searchFields:SearchFields = new SearchFields(); |
|
37 |
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ; |
|
38 |
private _location:Location; |
|
32 | 39 |
|
33 | 40 |
constructor (private route: ActivatedRoute, private _searchPublicationsService: SearchPublicationsService ) { |
34 | 41 |
//this.results =[]; |
... | ... | |
36 | 43 |
var errorCodes:ErrorCodes = new ErrorCodes(); |
37 | 44 |
this.status =errorCodes.LOADING; |
38 | 45 |
this.baseUrl = OpenaireProperties.getLinkToSearchPublications(); |
46 |
this.refineFields = this.searchFields.getPROJECT_FIELDS(); |
|
47 |
//get refine field filters from url parameters |
|
48 |
if(!this.searchPage){ |
|
49 |
this.searchPage = new SearchPageComponent(this._location); |
|
50 |
} |
|
39 | 51 |
} |
40 | 52 |
|
41 | 53 |
private ngOnInit() { |
54 |
this.searchPage.refineFields = this.refineFields; |
|
42 | 55 |
this.sub = this.route.queryParams.subscribe(params => { |
43 | 56 |
this.keyword = (params['keyword']?params['keyword']:''); |
44 | 57 |
this.page = (params['page']=== undefined)?1:+params['page']; |
Also available in: Unified diff
In Projects search component and search PAge: create the proper query using url parameters, mark as checked the proper filters after getting the results from search, apply changes in other components so they can work too.