1
|
import {ChangeDetectorRef, Component, Input} from '@angular/core';
|
2
|
import {ChangeDetectionStrategy} from '@angular/core';
|
3
|
import {ViewEncapsulation} from '@angular/core';
|
4
|
import {ActivatedRoute, Router} from '@angular/router';
|
5
|
import {Location} from '@angular/common';
|
6
|
import {Title, Meta} from '@angular/platform-browser';
|
7
|
|
8
|
import {FetchResearchResults} from '../../utils/fetchEntitiesClasses/fetchResearchResults.class';
|
9
|
import {FetchDataproviders} from '../../utils/fetchEntitiesClasses/fetchDataproviders.class';
|
10
|
import {FetchProjects} from '../../utils/fetchEntitiesClasses/fetchProjects.class';
|
11
|
import {FetchOrganizations} from '../../utils/fetchEntitiesClasses/fetchOrganizations.class';
|
12
|
|
13
|
import {SearchResearchResultsService} from '../../services/searchResearchResults.service';
|
14
|
import {SearchDataprovidersService} from '../../services/searchDataproviders.service';
|
15
|
import {SearchProjectsService} from '../../services/searchProjects.service';
|
16
|
import {SearchOrganizationsService} from '../../services/searchOrganizations.service';
|
17
|
|
18
|
import {SearchFields} from '../../utils/properties/searchFields';
|
19
|
import {ErrorCodes} from '../../utils/properties/errorCodes';
|
20
|
import {RouterHelper} from '../../utils/routerHelper.class';
|
21
|
import {RefineFieldResultsService} from '../../services/refineFieldResults.service';
|
22
|
import {PiwikService} from '../../utils/piwik/piwik.service';
|
23
|
import {ConfigurationService} from '../../utils/configuration/configuration.service';
|
24
|
import {EnvProperties} from '../../utils/properties/env-properties';
|
25
|
import {SEOService} from '../../sharedComponents/SEO/SEO.service';
|
26
|
import {StringUtils} from '../../utils/string-utils.class';
|
27
|
import {SearchCustomFilter} from "../searchUtils/searchUtils.class";
|
28
|
import {Observable} from "rxjs";
|
29
|
import {AdvancedField, Filter} from "../searchUtils/searchHelperClasses.class";
|
30
|
|
31
|
@Component({
|
32
|
changeDetection: ChangeDetectionStrategy.Default,
|
33
|
encapsulation: ViewEncapsulation.Emulated,
|
34
|
selector: 'search-all',
|
35
|
templateUrl: 'searchAll.component.html'
|
36
|
})
|
37
|
export class SearchAllComponent {
|
38
|
public sub: any;
|
39
|
piwiksub: any;
|
40
|
// public reloadResults: boolean;
|
41
|
// public reloadPublications: boolean;
|
42
|
// public reloadDatasets: boolean;
|
43
|
// public reloadSoftware: boolean;
|
44
|
// public reloadOrps: boolean;
|
45
|
// public reloadProjects: boolean;
|
46
|
// public reloadDataproviders: boolean;
|
47
|
// public reloadOrganizations: boolean;
|
48
|
reload:{result:boolean, projects:boolean, datasources: boolean, organizations:boolean} = {result:true, projects:true, datasources: true, organizations:true};
|
49
|
|
50
|
public pageTitle = "Search in OpenAIRE"
|
51
|
public keyword: string = "";
|
52
|
public publications: string[];
|
53
|
public datasets: string[];
|
54
|
public software: string[];
|
55
|
public orps: string[];
|
56
|
public projectsTab: string[];
|
57
|
public dataproviders: string[];
|
58
|
public organizations: string[];
|
59
|
|
60
|
public activeEntity = null;
|
61
|
public linkToSearchPublications = "";
|
62
|
public linkToSearchProjects = "";
|
63
|
public linkToSearchDataproviders = "";
|
64
|
public linkToSearchDatasets = "";
|
65
|
public linkToSearchSoftware = "";
|
66
|
public linkToSearchOrps = "";
|
67
|
public linkToSearchOrganizations = "";
|
68
|
|
69
|
public fetchPublications: FetchResearchResults;
|
70
|
public fetchDataproviders: FetchDataproviders;
|
71
|
public fetchProjects: FetchProjects;
|
72
|
public fetchDatasets: FetchResearchResults;
|
73
|
public fetchSoftware: FetchResearchResults;
|
74
|
public fetchOrps: FetchResearchResults;
|
75
|
public fetchOrganizations: FetchOrganizations;
|
76
|
|
77
|
public searchFields: SearchFields = new SearchFields();
|
78
|
public errorCodes: ErrorCodes = new ErrorCodes();
|
79
|
public routerHelper: RouterHelper = new RouterHelper();
|
80
|
|
81
|
showPublications: boolean = false;
|
82
|
showDatasets: boolean = false;
|
83
|
showSoftware: boolean = false;
|
84
|
showOrps: boolean = false;
|
85
|
showProjects: boolean = false;
|
86
|
showDataProviders: boolean = false;
|
87
|
showOrganizations: boolean = false;
|
88
|
advancedSearchLink: string = "/search/advanced/publications";
|
89
|
properties: EnvProperties;
|
90
|
@Input() logoURL;
|
91
|
@Input() name;
|
92
|
@Input() customFilter: SearchCustomFilter = null;
|
93
|
@Input() piwikSiteId = null;
|
94
|
@Input() formPlaceholderText = "Search for research results, projects, content providers & organizations in OpenAIRE";
|
95
|
|
96
|
|
97
|
public subPub;
|
98
|
public subData;
|
99
|
public subSoftware;
|
100
|
public subOrps;
|
101
|
public subProjects;
|
102
|
public subOrg;
|
103
|
public subDataPr;
|
104
|
|
105
|
|
106
|
quickFilter: { filter: Filter, selected: boolean, filterId: string, value: string } = {
|
107
|
filter: null,
|
108
|
selected: true,
|
109
|
filterId: "resultbestaccessright",
|
110
|
value: "Open Access"
|
111
|
};
|
112
|
|
113
|
resultTypes = {publication: true, dataset: true, software: true, other: true};
|
114
|
|
115
|
//adv Search Form
|
116
|
public fieldIds: string[] = this.searchFields.RESULT_ADVANCED_FIELDS;
|
117
|
public fieldIdsMap = this.searchFields.RESULT_FIELDS;
|
118
|
public selectedFields: AdvancedField[] = [];
|
119
|
|
120
|
//new
|
121
|
parameters = {};
|
122
|
disableForms: boolean = true;
|
123
|
|
124
|
constructor(private route: ActivatedRoute,
|
125
|
private _router: Router,
|
126
|
private _searchResearchResultsService: SearchResearchResultsService,
|
127
|
private _searchDataprovidersService: SearchDataprovidersService,
|
128
|
private _searchProjectsService: SearchProjectsService,
|
129
|
private _searchOrganizationsService: SearchOrganizationsService,
|
130
|
private _refineFieldResultsService: RefineFieldResultsService,
|
131
|
private location: Location,
|
132
|
private _meta: Meta,
|
133
|
private _title: Title,
|
134
|
private _piwikService: PiwikService,
|
135
|
private config: ConfigurationService,
|
136
|
private seoService: SEOService, private router: Router, private cdr:ChangeDetectorRef) {
|
137
|
this.fetchPublications = new FetchResearchResults(this._searchResearchResultsService);
|
138
|
this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService);
|
139
|
this.fetchProjects = new FetchProjects(this._searchProjectsService);
|
140
|
this.fetchDatasets = new FetchResearchResults(this._searchResearchResultsService);
|
141
|
this.fetchSoftware = new FetchResearchResults(this._searchResearchResultsService);
|
142
|
this.fetchOrps = new FetchResearchResults(this._searchResearchResultsService);
|
143
|
this.fetchOrganizations = new FetchOrganizations(this._searchOrganizationsService);
|
144
|
this.selectedFields.push(new AdvancedField(this.fieldIds[0], this.fieldIdsMap[this.fieldIds[0]].param, this.fieldIdsMap[this.fieldIds[0]].name, this.fieldIdsMap[this.fieldIds[0]].type, '', "and"));
|
145
|
|
146
|
}
|
147
|
|
148
|
public ngOnInit() {
|
149
|
this.route.data
|
150
|
.subscribe((data: { envSpecific: EnvProperties }) => {
|
151
|
|
152
|
var description = "open access, research, scientific publication, European Commission, EC, FP7, ERC, Horizon 2020, H2020, search, projects ";
|
153
|
var title = "OpenAIRE | Search publications, research data, projects... | OpenAIRE";
|
154
|
this.properties = data.envSpecific;
|
155
|
var url = data.envSpecific.baseLink + this._router.url;
|
156
|
this._title.setTitle(title);
|
157
|
this._meta.updateTag({content: description}, "name='description'");
|
158
|
this._meta.updateTag({content: description}, "property='og:description'");
|
159
|
this._meta.updateTag({content: title}, "property='og:title'");
|
160
|
this._meta.updateTag({content: url}, "property='og:url'");
|
161
|
this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this._router.url, false);
|
162
|
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
|
163
|
this.piwiksub = this._piwikService.trackView(this.properties, "OpenAIRE |Search publications, research data, projects...", this.piwikSiteId).subscribe();
|
164
|
|
165
|
}
|
166
|
|
167
|
|
168
|
if ((this.customFilter && this.customFilter.queryFieldName == "communitId") || this.properties.adminToolsCommunity) {
|
169
|
this.config.getCommunityInformation(this.properties, (this.customFilter && this.customFilter.queryFieldName == "communitId") ? this.customFilter.valueId : this.properties.adminToolsCommunity).subscribe(data => {
|
170
|
var showEntity = {};
|
171
|
for (var i = 0; i < data['entities'].length; i++) {
|
172
|
|
173
|
showEntity["" + data['entities'][i]["pid"] + ""] = data['entities'][i]["isEnabled"];
|
174
|
}
|
175
|
this.showPublications = showEntity["publication"];
|
176
|
this.showDatasets = showEntity["dataset"];
|
177
|
this.showProjects = showEntity["project"];
|
178
|
this.showOrganizations = showEntity["organization"];
|
179
|
this.showDataProviders = showEntity["datasource"];
|
180
|
this.showSoftware = showEntity["software"];
|
181
|
this.showOrps = showEntity["orp"];
|
182
|
if (this.customFilter && this.customFilter.queryFieldName == "communityId") {
|
183
|
this.showProjects = false;
|
184
|
this.showOrganizations = false;
|
185
|
this.showDataProviders = false;
|
186
|
}
|
187
|
this.loadAll();
|
188
|
|
189
|
});
|
190
|
} else {
|
191
|
if ((this.customFilter && this.customFilter.queryFieldName == "country")) {
|
192
|
this.showPublications = true;
|
193
|
this.showDatasets = true;
|
194
|
this.showDataProviders = true;
|
195
|
this.showSoftware = true;
|
196
|
this.showOrps = true;
|
197
|
this.showProjects = true;
|
198
|
this.showOrganizations = true;
|
199
|
this.showDataProviders = true;
|
200
|
}
|
201
|
}
|
202
|
this.loadAll();
|
203
|
});
|
204
|
}
|
205
|
|
206
|
loadAll() {
|
207
|
this.reloadTabs();
|
208
|
this.sub = this.route.queryParams.subscribe(params => {
|
209
|
this.parameters = Object.assign({}, params);
|
210
|
this.keyword = (params['keyword']) ? params['keyword'] : (params["q"] ? params["q"] : (params["f0"] && params["f0"] == "q" && params["fv0"]?params["fv0"]:""));
|
211
|
this.selectedFields[0].value = this.keyword;
|
212
|
this.quickFilter.selected = ((params['qf']== undefined || params["qf"] == "true") == true);
|
213
|
if (params["type"] && params["type"].length > 0) {
|
214
|
this.resultTypes['publication'] = (params["type"].split(",").indexOf("publications") != -1);
|
215
|
this.resultTypes['dataset'] = (params["type"].split(",").indexOf("datasets") != -1);
|
216
|
this.resultTypes['software'] = (params["type"].split(",").indexOf("software") != -1);
|
217
|
this.resultTypes['other'] = (params["type"].split(",").indexOf("other") != -1);
|
218
|
}
|
219
|
if(this.activeEntity == null && (!params["active"] || params["active"].length ==0)){
|
220
|
this.activeEntity = this.getDefaultEntityToShow();
|
221
|
}else if(params["active"] && params["active"].length >0 ){
|
222
|
this.activeEntity = ((["result","projects","organizations","datasources"]).indexOf(params["active"])!= -1)?params["active"]:this.getDefaultEntityToShow();
|
223
|
}else if (this.activeEntity !=null && (!params["active"] || params["active"].length ==0)){
|
224
|
this.parameters["active"]=this.activeEntity;
|
225
|
if(location.search && location.search.indexOf("active=") == -1){
|
226
|
this.location.go(location.pathname, ((location.search)?(location.search+"&"):("?")) +"active=" + this.activeEntity);
|
227
|
}
|
228
|
}
|
229
|
if (this.activeEntity == "result") {
|
230
|
this.searchResults();
|
231
|
} else if (this.activeEntity == "projects") {
|
232
|
this.searchProjects();
|
233
|
} else if (this.activeEntity == "datasources") {
|
234
|
this.searchDataProviders();
|
235
|
} else if (this.activeEntity == "organizations") {
|
236
|
this.searchOrganizations();
|
237
|
}
|
238
|
this.count();
|
239
|
});
|
240
|
}
|
241
|
|
242
|
getDefaultEntityToShow(){
|
243
|
if (this.showPublications || this.showDatasets || this.showSoftware || this.showOrps) {
|
244
|
return "result";
|
245
|
} else if (this.showProjects) {
|
246
|
return "projects";
|
247
|
} else if (this.showDataProviders) {
|
248
|
return "content providers";
|
249
|
} else if (this.showOrganizations) {
|
250
|
return "organizations";
|
251
|
}
|
252
|
}
|
253
|
|
254
|
public ngOnDestroy() {
|
255
|
if (this.sub) {
|
256
|
this.sub.unsubscribe();
|
257
|
}
|
258
|
if (this.piwiksub) {
|
259
|
this.piwiksub.unsubscribe();
|
260
|
}
|
261
|
if (this.keyword != null && this.keyword.length > 0) {
|
262
|
if (this.subPub) {
|
263
|
this.subPub.unsubscribe();
|
264
|
}
|
265
|
if (this.subData) {
|
266
|
this.subData.unsubscribe();
|
267
|
}
|
268
|
if (this.subSoftware) {
|
269
|
this.subSoftware.unsubscribe();
|
270
|
}
|
271
|
if (this.subOrps) {
|
272
|
this.subOrps.unsubscribe();
|
273
|
}
|
274
|
if (this.subProjects) {
|
275
|
this.subProjects.unsubscribe();
|
276
|
}
|
277
|
if (this.subOrg) {
|
278
|
this.subOrg.unsubscribe();
|
279
|
}
|
280
|
if (this.subDataPr) {
|
281
|
this.subDataPr.unsubscribe();
|
282
|
}
|
283
|
|
284
|
}
|
285
|
}
|
286
|
|
287
|
public searchResults() {
|
288
|
this.advancedSearchLink = this.properties.searchLinkToAdvancedPublications;//"/search/advanced/publications";
|
289
|
if (this.reload[this.activeEntity] &&
|
290
|
this.fetchPublications.searchUtils.status != this.errorCodes.NONE) {
|
291
|
this.reload[this.activeEntity] = false;
|
292
|
this.linkToSearchPublications = this.properties.searchLinkToPublications;// + "?keyword=" + this.keyword;
|
293
|
}
|
294
|
}
|
295
|
|
296
|
|
297
|
public searchProjects() {
|
298
|
this.advancedSearchLink = this.properties.searchLinkToAdvancedProjects;//"/search/advanced/projects";
|
299
|
if (this.reload[this.activeEntity] &&
|
300
|
this.fetchProjects.searchUtils.status != this.errorCodes.NONE ) {
|
301
|
this.reload[this.activeEntity] = false;
|
302
|
this.linkToSearchProjects = this.properties.searchLinkToProjects;// + "?keyword=" + this.keyword;
|
303
|
}
|
304
|
}
|
305
|
|
306
|
public searchDataProviders() {
|
307
|
this.advancedSearchLink = this.properties.searchLinkToAdvancedDataProviders;//"/search/advanced/dataproviders";
|
308
|
if ( this.reload[this.activeEntity] &&
|
309
|
this.fetchDataproviders.searchUtils.status != this.errorCodes.NONE) {
|
310
|
this.reload[this.activeEntity] = false;
|
311
|
this.linkToSearchDataproviders = this.properties.searchLinkToDataProviders;// + "?keyword=" + this.keyword;
|
312
|
}
|
313
|
}
|
314
|
|
315
|
public searchOrganizations() {
|
316
|
this.advancedSearchLink = this.properties.searchLinkToAdvancedOrganizations;//"/search/advanced/organizations";
|
317
|
if (this.reload[this.activeEntity] &&
|
318
|
this.fetchOrganizations.searchUtils.status != this.errorCodes.NONE) {
|
319
|
this.reload[this.activeEntity] = false;
|
320
|
this.linkToSearchOrganizations = this.properties.searchLinkToOrganizations;// + "?keyword=" + this.keyword;
|
321
|
}
|
322
|
}
|
323
|
private prepareKeywordParam(keyword){
|
324
|
if (this.parameters["q"] && keyword.length == 0) {
|
325
|
delete this.parameters['q'];
|
326
|
delete this.parameters['op'];
|
327
|
} else {
|
328
|
this.parameters["fv0"] = keyword;
|
329
|
this.parameters["f0"] = "q";
|
330
|
}
|
331
|
}
|
332
|
private prepareResultParameters() {
|
333
|
//quickSelections
|
334
|
if (this.resultTypes && this.activeEntity == "result") {
|
335
|
let values = [];
|
336
|
if (this.resultTypes.publication) {
|
337
|
values.push("publications");
|
338
|
}
|
339
|
if (this.resultTypes.dataset) {
|
340
|
values.push("datasets");
|
341
|
}
|
342
|
if (this.resultTypes.software) {
|
343
|
values.push("software");
|
344
|
}
|
345
|
if (this.resultTypes.other) {
|
346
|
values.push("other");
|
347
|
}
|
348
|
if (values.length > 0) {
|
349
|
this.parameters["type"] = values.join(",");
|
350
|
}
|
351
|
}
|
352
|
if (this.quickFilter && this.activeEntity == "result") {
|
353
|
this.parameters["qf"] = this.quickFilter.selected;
|
354
|
}
|
355
|
}
|
356
|
|
357
|
public quickSelectionsChanged() {
|
358
|
this.prepareResultParameters();
|
359
|
this.reload[this.activeEntity] = true;
|
360
|
this.router.navigate([location.pathname], {queryParams: this.parameters});
|
361
|
}
|
362
|
|
363
|
|
364
|
public keywordChanged($event) {
|
365
|
this.prepareKeywordParam(this.selectedFields[0].value);
|
366
|
this.reloadTabs();
|
367
|
this.router.navigate([location.pathname], {queryParams: this.parameters});
|
368
|
}
|
369
|
|
370
|
private count() {
|
371
|
var refineParams = null;
|
372
|
if (this.customFilter) {
|
373
|
refineParams = (refineParams ? (refineParams + '&') : '') + "&fq=" + StringUtils.URIEncode(this.customFilter.queryFieldName + " exact " + StringUtils.quote((this.customFilter.valueId)));
|
374
|
}
|
375
|
if (this.activeEntity != "result" && this.reload["result"] && (this.showPublications || this.showSoftware || this.datasets || this.showOrps)) {
|
376
|
this.fetchPublications.searchUtils.status = this.errorCodes.LOADING;
|
377
|
this.reload["result"] = false;
|
378
|
this.fetchPublications.results = [];
|
379
|
this.subPub = this.numOfSearchResults(this.fetchPublications, refineParams);
|
380
|
}
|
381
|
|
382
|
if (this.activeEntity != "projects" && this.reload["projects"] && this.showProjects) {
|
383
|
this.fetchProjects.searchUtils.status = this.errorCodes.LOADING;
|
384
|
this.fetchProjects.results = [];
|
385
|
this.reload["projects"] = false;
|
386
|
this.subProjects = this._searchProjectsService.numOfSearchProjects(this.keyword, this.properties, refineParams).subscribe(
|
387
|
data => {
|
388
|
this.fetchProjects.searchUtils.totalResults = data;
|
389
|
this.fetchProjects.searchUtils.status = this.errorCodes.DONE;
|
390
|
if (this.fetchProjects.searchUtils.totalResults == 0) {
|
391
|
this.fetchProjects.searchUtils.status = this.errorCodes.NONE;
|
392
|
}
|
393
|
},
|
394
|
err => {
|
395
|
//console.log(err);
|
396
|
this.handleError("Error getting number of Projects", err);
|
397
|
this.fetchProjects.searchUtils.status = this.errorCodes.ERROR;
|
398
|
}
|
399
|
);
|
400
|
}
|
401
|
if (this.activeEntity != "datasources" && this.reload["datasources"] && this.showDataProviders) {
|
402
|
this.fetchDataproviders.results = [];
|
403
|
this.reload["datasources"] = false;
|
404
|
this.fetchDataproviders.getNumForSearch(this.keyword, this.properties, refineParams);
|
405
|
}
|
406
|
if (this.activeEntity != "organizations" && this.reload["organizations"] && this.showOrganizations) {
|
407
|
this.fetchOrganizations.searchUtils.status = this.errorCodes.LOADING;
|
408
|
this.fetchOrganizations.results = [];
|
409
|
this.reload["organizations"] = false;
|
410
|
this.subOrg = this._searchOrganizationsService.numOfSearchOrganizations(this.keyword, this.properties, refineParams).subscribe(
|
411
|
data => {
|
412
|
this.fetchOrganizations.searchUtils.totalResults = data;
|
413
|
this.fetchOrganizations.searchUtils.status = this.errorCodes.DONE;
|
414
|
if (this.fetchOrganizations.searchUtils.totalResults == 0) {
|
415
|
this.fetchOrganizations.searchUtils.status = this.errorCodes.NONE;
|
416
|
}
|
417
|
},
|
418
|
err => {
|
419
|
//console.log(err);
|
420
|
this.handleError("Error getting number of Organizations", err);
|
421
|
this.fetchOrganizations.searchUtils.status = this.errorCodes.ERROR;
|
422
|
|
423
|
}
|
424
|
);
|
425
|
}
|
426
|
|
427
|
|
428
|
}
|
429
|
|
430
|
private numOfSearchResults(fetchClass: FetchResearchResults, refineParams): Observable<any> {
|
431
|
return this._searchResearchResultsService.numOfResearchOutcomes(this.keyword, this.properties, refineParams).subscribe(
|
432
|
data => {
|
433
|
fetchClass.searchUtils.totalResults = data;
|
434
|
fetchClass.searchUtils.status = this.errorCodes.DONE;
|
435
|
if (fetchClass.searchUtils.totalResults == 0) {
|
436
|
fetchClass.searchUtils.status = this.errorCodes.NONE;
|
437
|
}
|
438
|
},
|
439
|
err => {
|
440
|
this.handleError("Error getting number of research results", err);
|
441
|
fetchClass.searchUtils.status = this.errorCodes.ERROR;
|
442
|
}
|
443
|
);
|
444
|
}
|
445
|
|
446
|
private reloadTabs() {
|
447
|
this.reload = {result:true, projects:true, datasources: true, organizations:true};
|
448
|
this.fetchOrganizations.searchUtils.status = this.errorCodes.LOADING;
|
449
|
this.fetchDataproviders.searchUtils.status = this.errorCodes.LOADING;
|
450
|
this.fetchProjects.searchUtils.status = this.errorCodes.LOADING;
|
451
|
this.fetchPublications.searchUtils.status = this.errorCodes.LOADING;
|
452
|
this.fetchDatasets.searchUtils.status = this.errorCodes.LOADING;
|
453
|
this.fetchSoftware.searchUtils.status = this.errorCodes.LOADING;
|
454
|
this.fetchOrps.searchUtils.status = this.errorCodes.LOADING;
|
455
|
}
|
456
|
|
457
|
private handleError(message: string, error) {
|
458
|
console.error("General Search Page: " + message, error);
|
459
|
}
|
460
|
|
461
|
private getEntityName(entityType: string, plural: boolean, full: boolean): string {
|
462
|
if (entityType == "publication") {
|
463
|
return "publication" + (plural ? "s" : "");
|
464
|
} else if (entityType == "dataset") {
|
465
|
return (full ? "research data" : ("dataset" + (plural ? "s" : "")));
|
466
|
} else if (entityType == "software") {
|
467
|
return "software";
|
468
|
} else if (entityType == "other") {
|
469
|
return (full ? ("other research product" + (plural ? "s" : "")) : "other");
|
470
|
}
|
471
|
}
|
472
|
|
473
|
activeEntityUpdate($event) {
|
474
|
this.disableForms = $event.disableForms;
|
475
|
let updated = true;
|
476
|
if (this.activeEntity == "result") {
|
477
|
if($event.searchUtils.status!=this.errorCodes.LOADING) {
|
478
|
this.fetchPublications.searchUtils.totalResults = $event.searchUtils.totalResults;
|
479
|
}
|
480
|
this.fetchPublications.searchUtils.status = $event.searchUtils.status;
|
481
|
}else if (this.activeEntity == "projects"){
|
482
|
if($event.searchUtils.status!=this.errorCodes.LOADING) {
|
483
|
this.fetchProjects.searchUtils.totalResults = $event.searchUtils.totalResults;
|
484
|
}
|
485
|
this.fetchProjects.searchUtils.status = $event.searchUtils.status;
|
486
|
}else if (this.activeEntity == "datasources"){
|
487
|
if($event.searchUtils.status!=this.errorCodes.LOADING) {
|
488
|
this.fetchDataproviders.searchUtils.totalResults = $event.searchUtils.totalResults;
|
489
|
}
|
490
|
this.fetchDataproviders.searchUtils.status = $event.searchUtils.status;
|
491
|
}else if (this.activeEntity == "organizations") {
|
492
|
if($event.searchUtils.status!=this.errorCodes.LOADING) {
|
493
|
this.fetchOrganizations.searchUtils.totalResults = $event.searchUtils.totalResults;
|
494
|
}
|
495
|
this.fetchOrganizations.searchUtils.status = $event.searchUtils.status;
|
496
|
}else{
|
497
|
updated = false;
|
498
|
}
|
499
|
if(updated) {
|
500
|
this.cdr.detectChanges();
|
501
|
}
|
502
|
}
|
503
|
|
504
|
entityChanged(entity){
|
505
|
this.activeEntity = entity;
|
506
|
this.parameters = {};
|
507
|
this.reload[entity]= true;
|
508
|
this.parameters["active"] = entity;
|
509
|
if ( this.keyword.length > 0) {
|
510
|
this.parameters["q"] = this.keyword;
|
511
|
this.parameters["op"] = "and";
|
512
|
}
|
513
|
this.router.navigate(["/search/find"], {queryParams: this.parameters});
|
514
|
}
|
515
|
|
516
|
}
|