Project

General

Profile

1
import {ChangeDetectorRef, Component, Input, ViewChild} 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, Subscription} from "rxjs";
29
import {AdvancedField, Filter} from "../searchUtils/searchHelperClasses.class";
30
import {SearchResearchResultsComponent} from "../searchResearchResults.component";
31
import {SearchProjectsComponent} from "../searchProjects.component";
32
import {SearchOrganizationsComponent} from "../searchOrganizations.component";
33
import {SearchDataProvidersComponent} from "../searchDataProviders.component";
34
import {NewSearchPageComponent} from "../searchUtils/newSearchPage.component";
35

    
36
@Component({
37
  changeDetection: ChangeDetectionStrategy.Default,
38
  encapsulation: ViewEncapsulation.Emulated,
39
  selector: 'search-all',
40
  templateUrl: 'searchAll.component.html'
41
})
42
export class SearchAllComponent {
43
  // public reloadResults: boolean;
44
  // public reloadPublications: boolean;
45
  // public reloadDatasets: boolean;
46
  // public reloadSoftware: boolean;
47
  // public reloadOrps: boolean;
48
  // public reloadProjects: boolean;
49
  // public reloadDataproviders: boolean;
50
  // public reloadOrganizations: boolean;
51
  reload:{result:boolean, projects:boolean, datasources: boolean, organizations:boolean} = {result:true, projects:true, datasources: true, organizations:true};
52

    
53
  public pageTitle = "Search in OpenAIRE"
54
  public keyword: string = "";
55
  public publications: string[];
56
  public datasets: string[];
57
  public software: string[];
58
  public orps: string[];
59
  public projectsTab: string[];
60
  public dataproviders: string[];
61
  public organizations: string[];
62

    
63
  public activeEntity = null;
64
  public linkToSearchPublications = "";
65
  public linkToSearchProjects = "";
66
  public linkToSearchDataproviders = "";
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 outcomes, projects, content providers & organizations in OpenAIRE";
95

    
96
  subs: Subscription[] = [];
97

    
98
  quickFilter: { filter: Filter, selected: boolean, filterId: string, value: string } = {
99
    filter: null,
100
    selected: true,
101
    filterId: "resultbestaccessright",
102
    value: "Open Access"
103
  };
104

    
105
  resultTypes = {publication: true, dataset: true, software: true, other: true};
106

    
107
  //adv Search Form
108
  public fieldIds: string[] = this.searchFields.RESULT_ADVANCED_FIELDS;
109
  public fieldIdsMap = this.searchFields.RESULT_FIELDS;
110
  public selectedFields: AdvancedField[] = [];
111

    
112
  //new
113
  parameters = {};
114
  disableForms: boolean = true;
115
  @ViewChild (SearchResearchResultsComponent) searchResearchResultsComponent : SearchResearchResultsComponent ;
116
  @ViewChild (SearchProjectsComponent) searchProjectsComponent : SearchProjectsComponent ;
117
  @ViewChild (SearchDataProvidersComponent) searchDataprovidersComponent : SearchDataProvidersComponent ;
118
  @ViewChild (SearchOrganizationsComponent) searchOrganizationsComponent : SearchOrganizationsComponent ;
119
  constructor(private route: ActivatedRoute,
120
              private _router: Router,
121
              private _searchResearchResultsService: SearchResearchResultsService,
122
              private _searchDataprovidersService: SearchDataprovidersService,
123
              private _searchProjectsService: SearchProjectsService,
124
              private _searchOrganizationsService: SearchOrganizationsService,
125
              private _refineFieldResultsService: RefineFieldResultsService,
126
              private location: Location,
127
              private _meta: Meta,
128
              private _title: Title,
129
              private _piwikService: PiwikService,
130
              private config: ConfigurationService,
131
              private seoService: SEOService, private router: Router, private cdr:ChangeDetectorRef) {
132
    this.fetchPublications = new FetchResearchResults(this._searchResearchResultsService);
133
    this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService);
134
    this.fetchProjects = new FetchProjects(this._searchProjectsService);
135
    this.fetchDatasets = new FetchResearchResults(this._searchResearchResultsService);
136
    this.fetchSoftware = new FetchResearchResults(this._searchResearchResultsService);
137
    this.fetchOrps = new FetchResearchResults(this._searchResearchResultsService);
138
    this.fetchOrganizations = new FetchOrganizations(this._searchOrganizationsService);
139
    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"));
140

    
141
  }
142

    
143
  public ngOnInit() {
144
    this.subs.push(this.route.data
145
      .subscribe((data: { envSpecific: EnvProperties }) => {
146

    
147
        var description = "open access, research, scientific publication, European Commission, EC, FP7, ERC, Horizon 2020, H2020, search, projects ";
148
        var title = "OpenAIRE | Search publications, research data, projects... | OpenAIRE";
149
        this.properties = data.envSpecific;
150
        var url = data.envSpecific.baseLink + this._router.url;
151
        this._title.setTitle(title);
152
        this._meta.updateTag({content: description}, "name='description'");
153
        this._meta.updateTag({content: description}, "property='og:description'");
154
        this._meta.updateTag({content: title}, "property='og:title'");
155
        this._meta.updateTag({content: url}, "property='og:url'");
156
        this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this._router.url, false);
157
        if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
158
          this.subs.push(this._piwikService.trackView(this.properties, "OpenAIRE |Search publications, research data, projects...", this.piwikSiteId).subscribe());
159

    
160
        }
161

    
162

    
163
        if ((this.customFilter && this.customFilter.queryFieldName == "communityId") || this.properties.adminToolsCommunity) {
164
          //this.config.getCommunityInformation(this.properties, (this.customFilter && this.customFilter.queryFieldName == "communityId") ? this.customFilter.valueId : this.properties.adminToolsCommunity).subscribe(data => {
165
          this.subs.push(this.config.communityInformationState.subscribe(data => {
166
            if(data) {
167
              var showEntity = {};
168
              for (var i = 0; i < data['entities'].length; i++) {
169

    
170
                showEntity["" + data['entities'][i]["pid"] + ""] = data['entities'][i]["isEnabled"];
171
              }
172
              this.showPublications = showEntity["publication"];
173
              this.showDatasets = showEntity["dataset"];
174
              this.showProjects = showEntity["project"];
175
              this.showOrganizations = showEntity["organization"];
176
              this.showDataProviders = showEntity["datasource"];
177
              this.showSoftware = showEntity["software"];
178
              this.showOrps = showEntity["orp"];
179
              if (this.customFilter && this.customFilter.queryFieldName == "communityId") {
180
                this.showProjects = false;
181
                this.showOrganizations = false;
182
                this.showDataProviders = false;
183
              }
184
              this.loadAll();
185
            }
186
          }));
187
        } else {
188
          if ((this.customFilter && this.customFilter.queryFieldName == "country")) {
189
            this.showPublications = true;
190
            this.showDatasets = true;
191
            this.showDataProviders = true;
192
            this.showSoftware = true;
193
            this.showOrps = true;
194
            this.showProjects = true;
195
            this.showOrganizations = true;
196
            this.showDataProviders = true;
197
          }
198
        }
199
        this.loadAll();
200
      }));
201
  }
202

    
203
  loadAll() {
204
    this.reloadTabs();
205
    this.subs.push(this.route.queryParams.subscribe(params => {
206
      this.parameters = Object.assign({}, params);
207
      this.keyword = (params['keyword']) ? params['keyword'] : (params["q"] ? params["q"] : (params["f0"] && params["f0"] == "q" && params["fv0"]?params["fv0"]:""));
208
      this.selectedFields[0].value = StringUtils.URIDecode(this.keyword);
209
      this.quickFilter.selected = ((params['qf']== undefined || params["qf"] == "true") == true);
210
      if (params["type"] && params["type"].length > 0) {
211
        this.resultTypes['publication'] = (params["type"].split(",").indexOf("publications") != -1);
212
        this.resultTypes['dataset'] = (params["type"].split(",").indexOf("datasets") != -1);
213
        this.resultTypes['software'] = (params["type"].split(",").indexOf("software") != -1);
214
        this.resultTypes['other'] = (params["type"].split(",").indexOf("other") != -1);
215
      }
216
      if(this.activeEntity == null && (!params["active"] || params["active"].length ==0)){
217
        this.activeEntity = this.getDefaultEntityToShow();
218
      }else if(params["active"] && params["active"].length >0 ){
219
        this.activeEntity = ((["result","projects","organizations","datasources"]).indexOf(params["active"])!= -1)?params["active"]:this.getDefaultEntityToShow();
220
      }else if (this.activeEntity !=null  && (!params["active"] || params["active"].length ==0)){
221
        this.parameters["active"]=this.activeEntity;
222
        if(location.search && location.search.indexOf("active=") == -1){
223
          this.location.go(location.pathname, ((location.search)?(location.search+"&"):("?")) +"active=" + this.activeEntity);
224
        }
225
      }
226
      if (this.activeEntity == "result") {
227
        this.searchResults();
228
      } else if (this.activeEntity == "projects") {
229
        this.searchProjects();
230
      } else if (this.activeEntity == "datasources") {
231
        this.searchDataProviders();
232
      } else if (this.activeEntity == "organizations") {
233
        this.searchOrganizations();
234
      }
235
      this.count();
236
    }));
237
  }
238

    
239
  getDefaultEntityToShow(){
240
    if (this.showPublications || this.showDatasets || this.showSoftware || this.showOrps) {
241
      return "result";
242
    } else if (this.showProjects) {
243
      return "projects";
244
    } else if (this.showDataProviders) {
245
      return "content providers";
246
    } else if (this.showOrganizations) {
247
      return "organizations";
248
    }
249
  }
250

    
251
  public ngOnDestroy() {
252
    for (let sub of this.subs) {
253
      sub.unsubscribe();
254
    }
255
  }
256

    
257
  public searchResults() {
258
    this.advancedSearchLink = this.properties.searchLinkToAdvancedPublications;//"/search/advanced/publications";
259
    if (this.reload[this.activeEntity] &&
260
      this.fetchPublications.searchUtils.status != this.errorCodes.NONE) {
261
      this.reload[this.activeEntity] = false;
262
      this.linkToSearchPublications = this.properties.searchLinkToPublications;// + "?keyword="  + this.keyword;
263
    }
264
  }
265

    
266

    
267
  public searchProjects() {
268
    this.advancedSearchLink = this.properties.searchLinkToAdvancedProjects;//"/search/advanced/projects";
269
    if (this.reload[this.activeEntity] &&
270
      this.fetchProjects.searchUtils.status != this.errorCodes.NONE ) {
271
      this.reload[this.activeEntity]  = false;
272
      this.linkToSearchProjects = this.properties.searchLinkToProjects;// + "?keyword="  + this.keyword;
273
    }
274
  }
275

    
276
  public searchDataProviders() {
277
    this.advancedSearchLink = this.properties.searchLinkToAdvancedDataProviders;//"/search/advanced/dataproviders";
278
    if ( this.reload[this.activeEntity] &&
279
      this.fetchDataproviders.searchUtils.status != this.errorCodes.NONE) {
280
      this.reload[this.activeEntity] = false;
281
      this.linkToSearchDataproviders = this.properties.searchLinkToDataProviders;// + "?keyword="  + this.keyword;
282
    }
283
  }
284

    
285
  public searchOrganizations() {
286
    this.advancedSearchLink = this.properties.searchLinkToAdvancedOrganizations;//"/search/advanced/organizations";
287
    if (this.reload[this.activeEntity] &&
288
      this.fetchOrganizations.searchUtils.status != this.errorCodes.NONE) {
289
      this.reload[this.activeEntity] = false;
290
      this.linkToSearchOrganizations = this.properties.searchLinkToOrganizations;// + "?keyword="  + this.keyword;
291
    }
292
  }
293
  private prepareKeywordParam(keyword){
294
    if (this.parameters["q"]) {
295
      delete this.parameters['q'];
296
      delete this.parameters['op'];
297
    }
298
     if(keyword.length > 0){
299
      this.parameters["fv0"] = keyword;
300
      this.parameters["f0"] = "q";
301
    }else if(keyword.length ==0 && this.parameters["f0"]=="q"){
302
       delete this.parameters['f0'];
303
       delete this.parameters['fv0'];
304
     }
305
  }
306
  /*
307
  //quickSelection moved inside the searchpage
308
  private prepareResultParameters() {
309
    //quickSelections
310
    if (this.resultTypes && this.activeEntity == "result") {
311
      let values = [];
312
      if (this.resultTypes.publication) {
313
        values.push("publications");
314
      }
315
      if (this.resultTypes.dataset) {
316
        values.push("datasets");
317
      }
318
      if (this.resultTypes.software) {
319
        values.push("software");
320
      }
321
      if (this.resultTypes.other) {
322
        values.push("other");
323
      }
324
      if (values.length > 0) {
325
        this.parameters["type"] = values.join(",");
326
      }
327
    }
328
    if (this.quickFilter && this.activeEntity == "result") {
329
      this.parameters["qf"] = this.quickFilter.selected;
330
    }
331
  }
332

    
333
  public quickSelectionsChanged() {
334
    this.prepareResultParameters();
335
    this.parameters["page"] = 1;
336
    this.reload[this.activeEntity] = true;
337
    this.router.navigate([location.pathname], {queryParams: this.parameters});
338
  }*/
339

    
340

    
341
  public keywordChanged($event) {
342
    this.prepareKeywordParam(this.selectedFields[0].value);
343
    this.parameters["page"] = 1;
344
    this.reloadTabs();
345
    this.router.navigate([location.pathname], {queryParams: this.parameters});
346
  }
347

    
348
  private count() {
349
    var refineParams = null;
350
    if (this.customFilter) {
351
      refineParams = (refineParams ? (refineParams + '&') : '') + "&fq=" + StringUtils.URIEncode(this.customFilter.queryFieldName + " exact " + StringUtils.quote((this.customFilter.valueId)));
352
    }
353
    if (this.activeEntity != "result" && this.reload["result"] &&  (this.showPublications || this.showSoftware || this.datasets || this.showOrps)) {
354
      this.fetchPublications.searchUtils.status = this.errorCodes.LOADING;
355
      this.reload["result"] = false;
356
      this.fetchPublications.results = [];
357
      //Add Open Access Filter
358
      this.subs.push(this.numOfSearchResults(this.fetchPublications, (refineParams ? (refineParams + '&') : '') + "&fq=resultbestaccessright%20exact%20%22Open%20Access%22"));
359
    }
360

    
361
    if (this.activeEntity != "projects" && this.reload["projects"] && this.showProjects) {
362
      this.fetchProjects.searchUtils.status = this.errorCodes.LOADING;
363
      this.fetchProjects.results = [];
364
      this.reload["projects"] = false;
365
      this.subs.push(this._searchProjectsService.numOfSearchProjects2(this.keyword.length>0?NewSearchPageComponent.createKeywordQuery("project",this.keyword,"q","="):"", this.properties, refineParams).subscribe(
366
        data => {
367
          this.fetchProjects.searchUtils.totalResults = data;
368
          this.fetchProjects.searchUtils.status = this.errorCodes.DONE;
369
          if (this.fetchProjects.searchUtils.totalResults == 0) {
370
            this.fetchProjects.searchUtils.status = this.errorCodes.NONE;
371
          }
372
        },
373
        err => {
374
          //console.log(err);
375
          this.handleError("Error getting number of Projects", err);
376
          this.fetchProjects.searchUtils.status = this.errorCodes.ERROR;
377
          this.fetchProjects.searchUtils.totalResults = null;
378
        }
379
      ));
380
    }
381
    if (this.activeEntity != "datasources"  && this.reload["datasources"] && this.showDataProviders) {
382
      this.fetchDataproviders.results = [];
383
      this.reload["datasources"] = false;
384
      // this.fetchDataproviders.getNumForSearch(this.keyword, this.properties, refineParams);
385
      this.subs.push(this._searchDataprovidersService.numOfSearchDataproviders2(this.keyword.length>0?NewSearchPageComponent.createKeywordQuery("datasources",this.keyword,"q","="):"", this.properties, refineParams).subscribe(
386
        data => {
387
          this.fetchDataproviders.searchUtils.totalResults = data;
388
          this.fetchDataproviders.searchUtils.status = this.errorCodes.DONE;
389
          if (this.fetchDataproviders.searchUtils.totalResults == 0) {
390
            this.fetchDataproviders.searchUtils.status = this.errorCodes.NONE;
391
          }
392
        },
393
        err => {
394
          //console.log(err);
395
          this.handleError("Error getting number of Projects", err);
396
          this.fetchDataproviders.searchUtils.status = this.errorCodes.ERROR;
397
          this.fetchDataproviders.searchUtils.totalResults = null;
398
        }
399
      ));
400
    }
401
    if (this.activeEntity != "organizations" && this.reload["organizations"] && this.showOrganizations) {
402
      this.fetchOrganizations.searchUtils.status = this.errorCodes.LOADING;
403
      this.fetchOrganizations.results = [];
404
      this.reload["organizations"] = false;
405
      this.subs.push(this._searchOrganizationsService.numOfSearchOrganizations2(this.keyword.length>0?NewSearchPageComponent.createKeywordQuery("organizations",this.keyword,"q","="):"", this.properties, refineParams).subscribe(
406
        data => {
407
          this.fetchOrganizations.searchUtils.totalResults = data;
408
          this.fetchOrganizations.searchUtils.status = this.errorCodes.DONE;
409
          if (this.fetchOrganizations.searchUtils.totalResults == 0) {
410
            this.fetchOrganizations.searchUtils.status = this.errorCodes.NONE;
411
          }
412
        },
413
        err => {
414
          //console.log(err);
415
          this.handleError("Error getting number of Organizations", err);
416
          this.fetchOrganizations.searchUtils.status = this.errorCodes.ERROR;
417
          this.fetchOrganizations.searchUtils.totalResults = null;
418

    
419
        }
420
      ));
421
    }
422

    
423

    
424
  }
425

    
426
  private numOfSearchResults(fetchClass: FetchResearchResults, refineParams): Subscription {
427
    return this._searchResearchResultsService.numOfResearchOutcomes(this.keyword.length>0?NewSearchPageComponent.createKeywordQuery("result",this.keyword,"q","="):"", this.properties, refineParams).subscribe(
428
      data => {
429
        fetchClass.searchUtils.totalResults = data;
430
        fetchClass.searchUtils.status = this.errorCodes.DONE;
431
        if (fetchClass.searchUtils.totalResults == 0) {
432
          fetchClass.searchUtils.status = this.errorCodes.NONE;
433
        }
434
      },
435
      err => {
436
        this.handleError("Error getting number of research results", err);
437
        fetchClass.searchUtils.status = this.errorCodes.ERROR;
438
        fetchClass.searchUtils.totalResults = null;
439
      }
440
    );
441
  }
442

    
443
  private reloadTabs() {
444
    this.reload = {result:true, projects:true, datasources: true, organizations:true};
445
    this.fetchOrganizations.searchUtils.status = this.errorCodes.LOADING;
446
    this.fetchDataproviders.searchUtils.status =  this.errorCodes.LOADING;
447
    this.fetchProjects.searchUtils.status =  this.errorCodes.LOADING;
448
    this.fetchPublications.searchUtils.status =  this.errorCodes.LOADING;
449
    this.fetchDatasets.searchUtils.status =  this.errorCodes.LOADING;
450
    this.fetchSoftware.searchUtils.status =  this.errorCodes.LOADING;
451
    this.fetchOrps.searchUtils.status =  this.errorCodes.LOADING;
452
  }
453

    
454
  private handleError(message: string, error) {
455
    console.error("General Search Page: " + message, error);
456
  }
457

    
458
  activeEntityUpdate($event) {
459
    this.disableForms = $event.disableForms;
460
    let updated = true
461
    console.debug($event)
462
    if (this.activeEntity == "result") {
463
      if($event.searchUtils.status!=this.errorCodes.LOADING) {
464
        this.fetchPublications.searchUtils.totalResults = $event.searchUtils.totalResults;
465
      }
466
      this.fetchPublications.searchUtils.status = $event.searchUtils.status;
467
    }else if (this.activeEntity == "projects"){
468
      if($event.searchUtils.status!=this.errorCodes.LOADING) {
469
        this.fetchProjects.searchUtils.totalResults = $event.searchUtils.totalResults;
470
      }
471
      this.fetchProjects.searchUtils.status = $event.searchUtils.status;
472
    }else if (this.activeEntity == "datasources"){
473
      if($event.searchUtils.status!=this.errorCodes.LOADING) {
474
        this.fetchDataproviders.searchUtils.totalResults = $event.searchUtils.totalResults;
475
      }
476
      this.fetchDataproviders.searchUtils.status = $event.searchUtils.status;
477
    }else if (this.activeEntity == "organizations") {
478
      if($event.searchUtils.status!=this.errorCodes.LOADING) {
479
        this.fetchOrganizations.searchUtils.totalResults = $event.searchUtils.totalResults;
480
      }
481
      this.fetchOrganizations.searchUtils.status = $event.searchUtils.status;
482
    }else{
483
      updated = false;
484
    }
485
    if(updated) {
486
      this.cdr.detectChanges();
487
    }
488
  }
489

    
490
  entityChanged(entity){
491
    if(this.activeEntity == "result") {
492
      this.resultTypes = {publication: true, dataset: true, software: true, other: true};
493
    }
494
    if(this.activeEntity == "result" && this.searchResearchResultsComponent){
495
      this.searchResearchResultsComponent.ngOnDestroy();
496
    }else  if(this.activeEntity == "projects" && this.searchProjectsComponent){
497
      this.searchProjectsComponent.ngOnDestroy();
498
    }else  if(this.activeEntity == "datasources" && this.searchDataprovidersComponent){
499
      this.searchDataprovidersComponent.ngOnDestroy();
500
    }else if(this.activeEntity == "organizations" && this.searchOrganizationsComponent){
501
      this.searchOrganizationsComponent.ngOnDestroy();
502
    }
503
    this.activeEntity = entity;
504
      this.parameters = {};
505
      this.reload[entity]= true;
506
      this.parameters["active"] = entity;
507
    if ( this.keyword.length > 0) {
508
      this.parameters["fv0"] = this.keyword;
509
      this.parameters["f0"] = "q";
510
    }
511
      this.router.navigate(["/search/find"], {queryParams: this.parameters});
512
    }
513

    
514
}
(5-5/6)