Revision 44421
Added by Argiro Kokogiannaki over 7 years ago
search.component.ts | ||
---|---|---|
138 | 138 |
private searchOrganizationsComponent: SearchOrganizationsComponent; |
139 | 139 |
private searchPeopleComponent: SearchPeopleComponent; |
140 | 140 |
|
141 |
//TODO add more viewchild for other entities |
|
142 |
|
|
141 |
private subPub;private subData;private subProjects;private subOrg;private subPeople; private subDataPr; |
|
143 | 142 |
constructor ( private route: ActivatedRoute, |
144 | 143 |
private _searchPublicationsService: SearchPublicationsService, |
145 | 144 |
private _searchDataprovidersService: SearchDataprovidersService, |
... | ... | |
169 | 168 |
private ngOnDestroy() { |
170 | 169 |
this.sub.unsubscribe(); |
171 | 170 |
if(this.keyword !=null && this.keyword.length > 0){ |
171 |
if(this.subPub){ |
|
172 |
this.subPub.unsubscribe(); |
|
173 |
} |
|
174 |
if(this.subData){ |
|
175 |
this.subData.unsubscribe(); |
|
176 |
} |
|
177 |
if(this.subProjects){ |
|
178 |
this.subProjects.unsubscribe(); |
|
179 |
} |
|
180 |
if(this.subOrg){ |
|
181 |
this.subOrg.unsubscribe(); |
|
182 |
} |
|
183 |
if(this.subPeople){ |
|
184 |
this.subPeople.unsubscribe(); |
|
185 |
} |
|
186 |
if(this.subDataPr){ |
|
187 |
this.subDataPr.unsubscribe(); |
|
188 |
} |
|
172 | 189 |
this.subPublicationsCount.unsubscribe(); |
173 | 190 |
this.subDatasetsCount.unsubscribe(); |
174 | 191 |
this.subProjectsCount.unsubscribe(); |
... | ... | |
229 | 246 |
private keywordChanged($event){ |
230 | 247 |
this.keyword = $event.value; |
231 | 248 |
console.info("Search Find: search with keyword \"" + this.keyword + "\"" ); |
249 |
if(location.pathname.indexOf("search/find") ==-1){ |
|
250 |
this.location.go(location.pathname+"search/find","?keyword=" + this.keyword); |
|
251 |
}else{ |
|
252 |
this.location.go(location.pathname,"?keyword=" + this.keyword); |
|
253 |
} |
|
232 | 254 |
|
233 | 255 |
//unsubscribeSearch(); |
234 | 256 |
|
... | ... | |
256 | 278 |
|
257 | 279 |
private count() { |
258 | 280 |
this.subPublicationsCount = this.route.queryParams.subscribe(params => { |
259 |
this._searchPublicationsService.numOfSearchPublications(this.keyword).subscribe( |
|
281 |
this.subPub = this._searchPublicationsService.numOfSearchPublications(this.keyword).subscribe(
|
|
260 | 282 |
data => { |
261 | 283 |
this.searchPublicationsComponent.totalResults = data; |
262 | 284 |
}, |
... | ... | |
267 | 289 |
}) |
268 | 290 |
|
269 | 291 |
this.subDatasetsCount = this.route.queryParams.subscribe(params => { |
270 |
this._searchDatasetsService.numOfSearchDatasets(this.keyword).subscribe( |
|
292 |
this.subData = this._searchDatasetsService.numOfSearchDatasets(this.keyword).subscribe(
|
|
271 | 293 |
data => { |
272 | 294 |
this.searchDatasetsComponent.totalResults = data; |
273 | 295 |
}, |
... | ... | |
278 | 300 |
}) |
279 | 301 |
|
280 | 302 |
this.subProjectsCount = this.route.queryParams.subscribe(params => { |
281 |
this._searchProjectsService.numOfSearchProjects(this.keyword).subscribe( |
|
303 |
this.subProjects = this._searchProjectsService.numOfSearchProjects(this.keyword).subscribe(
|
|
282 | 304 |
data => { |
283 | 305 |
this.searchProjectsComponent.totalResults = data; |
284 | 306 |
}, |
... | ... | |
291 | 313 |
this.searchDataProvidersComponent.getNumForSearch(this.keyword); |
292 | 314 |
|
293 | 315 |
this.subOrganizationsCount = this.route.queryParams.subscribe(params => { |
294 |
this._searchOrganizationsService.numOfSearchOrganizations(this.keyword).subscribe( |
|
316 |
this.subOrg = this._searchOrganizationsService.numOfSearchOrganizations(this.keyword).subscribe(
|
|
295 | 317 |
data => { |
296 | 318 |
this.searchOrganizationsComponent.totalResults = data; |
297 | 319 |
}, |
... | ... | |
302 | 324 |
}) |
303 | 325 |
|
304 | 326 |
this.subPeopleCount = this.route.queryParams.subscribe(params => { |
305 |
this._searchPeopleService.numOfSearchPeople(this.keyword).subscribe( |
|
327 |
this.subPeople = this._searchPeopleService.numOfSearchPeople(this.keyword).subscribe(
|
|
306 | 328 |
data => { |
307 | 329 |
this.searchPeopleComponent.totalResults = data; |
308 | 330 |
}, |
Also available in: Unified diff
Publication page & project PAge: add claim result inline, fix claim context - use autocomplete component, in home page add keyword to the url when user searches for a term